diff --git a/src/features/series/panels/TrackingPanel.svelte b/src/features/series/panels/TrackingPanel.svelte index abfe602..2575cb5 100644 --- a/src/features/series/panels/TrackingPanel.svelte +++ b/src/features/series/panels/TrackingPanel.svelte @@ -1,5 +1,5 @@ - e.key === "Escape" && onClose()} /> + { if (e.key === "Escape") { if (confirmUnbindId !== null) { confirmUnbindId = null; } else if (editingId !== null) { editingId = null; } else { onClose(); } } }} /> { if (e.target === e.currentTarget) onClose(); }}> @@ -249,13 +254,12 @@ Tracking {mangaTitle} - + {#if loading} - - Loading… + {:else if loggedInTrackers.length === 0} @@ -284,119 +288,140 @@ {#if records.length === 0} - Not tracking this manga yet. - Click a tracker tab above to search and add it. + Not tracking yet. + Click a tracker tab above to search and link it. {:else} {#each records as record (record.id)} {@const tracker = trackerFor(record.trackerId)} {@const isBusy = updatingRecord === record.id} + {@const isEdit = editingId === record.id} + {@const pct = record.totalChapters > 0 ? Math.min(100, (record.lastChapterRead / record.totalChapters) * 100) : null} + {@const canUnlink = !tracker || tracker.supportsTrackDeletion !== false} + - {#if tracker}{/if} + {#if tracker}{/if} {tracker?.name ?? "Tracker"} + {#if record.remoteUrl} + + + + {/if} - + {#if tracker?.supportsPrivateTracking} togglePrivate(record)} > - {#if record.private}{:else}{/if} + {#if record.private}{:else}{/if} + {record.private ? "Private" : "Public"} {/if} - syncRecord(record)}> - + syncRecord(record)}> + {#if store.settings.trackerSyncBack} - applyToLibrary(record)}> - + applyToLibrary(record)}> + {/if} - unbind(record)}> - + {#if canUnlink} + confirmUnbindId = record.id}> + + + {/if} + + + + + + updateStatus(record, parseInt((e.target as HTMLSelectElement).value))}> + {#each (tracker?.statuses ?? []) as s} + {s.name} + {/each} + + {#if (tracker?.scores ?? []).length > 0} + updateScore(record, (e.target as HTMLSelectElement).value)}> + {#each (tracker?.scores ?? []) as s} + ★ {s} + {/each} + + {/if} + + + {#if isEdit} + + + Chapter read + + 0 ? record.totalChapters : undefined} + step="0.5" bind:value={chapterDraft} + onkeydown={(e) => { if (e.key === "Enter") submitChapter(record); if (e.key === "Escape") cancelEditor(); }} + use:autoFocus + /> + {#if record.totalChapters > 0} + / {record.totalChapters} + {/if} + + + {#if record.totalChapters > 0} + + {/if} + {#if tracker?.supportsReadingDates} + + + + Started + + + + + Finished + + + + {/if} + + Cancel + submitChapter(record)}>Save + + + {:else} + openChapterEditor(record)} disabled={isBusy}> + + + {#if record.totalChapters > 0}Ch. {record.lastChapterRead} / {record.totalChapters} + {:else if record.lastChapterRead > 0}Ch. {record.lastChapterRead} read + {:else}Set progress…{/if} + + {#if record.startDate || record.finishDate} + + {#if record.startDate}{record.startDate}{/if} + {#if record.startDate && record.finishDate} → {/if} + {#if record.finishDate}{record.finishDate}{/if} + + {/if} + + Edit - - - - {#if record.remoteUrl} - - {record.title} - - {:else} - {record.title} - {/if} - - - updateStatus(record, parseInt((e.target as HTMLSelectElement).value))}> - {#each (tracker?.statuses ?? []) as s} - {s.name} - {/each} - - updateScore(record, (e.target as HTMLSelectElement).value)}> - {#each (tracker?.scores ?? []) as s} - ★ {s} - {/each} - - - - {#if editingChapter === record.id} - - - Chapter read - - 0 ? record.totalChapters : undefined} - step="0.5" bind:value={chapterDraft} - onkeydown={(e) => { if (e.key === "Enter") submitChapter(record); if (e.key === "Escape") cancelChapterEditor(); }} - use:autoFocus - /> - {#if record.totalChapters > 0} - / {record.totalChapters} - {/if} - - - {#if record.totalChapters > 0} - - {/if} - - Cancel - submitChapter(record)}>Save - - - {:else} - openChapterEditor(record)} - onkeydown={(e) => e.key === "Enter" && openChapterEditor(record)} - title="Click to edit" - > - - - {#if record.totalChapters > 0} - Ch. {record.lastChapterRead} / {record.totalChapters} - {:else if record.lastChapterRead > 0} - Ch. {record.lastChapterRead} read - {:else} - Set chapter… - {/if} - - Edit - - {#if record.totalChapters > 0} - - + {#if pct !== null} + + {/if} - - {/if} + {/if} + {/each} @@ -416,7 +441,7 @@ onkeydown={(e) => e.key === "Enter" && doSearch(activeTab as number, searchQuery)} use:autoFocus /> - {#if searching}{/if} + {#if searching}{/if} @@ -453,7 +478,7 @@ {/if} - {isBound ? "✓ Tracking" : "Track"} + {isBound ? "✓ Linked" : "Link"} {/each} @@ -465,41 +490,59 @@ +{#if confirmUnbindId !== null} + {@const rec = records.find(r => r.id === confirmUnbindId)} + {@const trk = rec ? trackerFor(rec.trackerId) : null} + confirmUnbindId = null}> + e.stopPropagation()}> + Unlink from {trk?.name ?? "tracker"}? + Your progress on {trk?.name} is unaffected. + + confirmUnbindId = null}>Cancel + rec && unbind(rec)}>Unlink + + + +{/if} + \ No newline at end of file
Not tracking this manga yet.
Click a tracker tab above to search and add it.
Not tracking yet.
Click a tracker tab above to search and link it.
Unlink from {trk?.name ?? "tracker"}?
Your progress on {trk?.name} is unaffected.