refactor(reader): Fix reader-context imports and remove dead code
Problem: - Many format modules imported from '../core/reader-context' - reader-context.ts was a local interface file, not a true context module - Confusion between canonical reader-shell.ts and local reader-context.ts - PDF page-cache.ts was 100% dead code (unused, unregistered, no exports) - Several unused variables and imports across reader modules Root Cause: - reader-context.ts created as temporary file during refactoring - Modules imported from it instead of canonical reader-shell.ts - page-cache.ts copied from comic version but never integrated - Incomplete refactoring left behind unused code Solution: - Update all imports to use reader-shell (canonical source) - Remove unused page-cache.ts (dead code) - Clean up unused variables and imports - Consolidate type definitions Changes: Import Path Updates: - comic/*: '../core/reader-context' → '../../reader-shell' - manga/*: '../core/reader-context' → '../../reader-shell' - pdf/*: '../core/reader-context' → '../../reader-shell' - reflowable/ebook/*: '../core/reader-context' → '../../reader-shell' - All now import UniversalReader from single source Dead Code Removal: - pdf/page-cache.ts: Deleted entirely - No init() function exported - Not registered in reader-shell.ts - All functions unused (createPDFPageCache, getCachedPage, etc.) - Only 2 lines of executable code (console.log, DOM cleanup) - 148 lines of dead code Clean Up: - navigator-panel.ts: Remove unused containerRect variable - api-explorer-docs.ts, api.ts, queue.ts: Fix unused imports - unlinked_books.ts: Remove unused variables - panel-dock-system.ts: Remove unused context variables Impact: - ✅ All modules use canonical type definitions - ✅ No more duplicate/conflicting interfaces - ✅ Dead code removed (148 lines) - ✅ Cleaner imports, easier maintenance - ✅ TypeScript compiler warnings resolved Files changed: 26 Lines changed: +450, -520 (net -70 lines)
This commit is contained in:
@@ -204,11 +204,7 @@ function searchBooksForLink(): void {
|
||||
});
|
||||
}
|
||||
|
||||
function selectBookForLink(
|
||||
mediaItemId: string,
|
||||
title: string,
|
||||
_coverPath: string,
|
||||
): void {
|
||||
function selectBookForLink(mediaItemId: string, _coverPath: string): void {
|
||||
selectedMediaItem = mediaItemId;
|
||||
const resultsContainer = document.getElementById("link-search-results");
|
||||
if (!resultsContainer) return;
|
||||
@@ -243,7 +239,6 @@ function confirmManualLink(): void {
|
||||
|
||||
if (!progressIdInput) return;
|
||||
|
||||
const progressId = progressIdInput.value;
|
||||
const confidence = parseFloat(confidenceInput?.value || "0");
|
||||
const bookTitle = bookTitleInput?.value || "";
|
||||
const sha256 = sha256Input?.value || "";
|
||||
@@ -456,7 +451,6 @@ function setupEventDelegation(): void {
|
||||
} else if (action === "select-book") {
|
||||
selectBookForLink(
|
||||
card.dataset.mediaItemId || "",
|
||||
card.dataset.title || "",
|
||||
card.dataset.cover || "",
|
||||
);
|
||||
} else if (action === "select-match") {
|
||||
|
||||
Reference in New Issue
Block a user