refactor: clean up opal-web duplication, dead code, and comment noise

- Deduplicate API_BASE (was defined in both client.js and endpoints.js)
- Extract EMPTY_STATE and persist() helper in auth store (DRY)
- Extract updateByUuid() in tasks store, normalize to .map() pattern
- Remove unused getQueueSize(), Select.svelte, and lib/index.js
- Modernize uuid.js to prefer crypto.randomUUID()
- Strip ~60 redundant comments that restated self-evident code

No behavior changes. Build passes, pre-existing type errors unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 01:03:08 +01:00
parent 41a12fe7a9
commit 8693681660
22 changed files with 110 additions and 470 deletions
+2 -17
View File
@@ -28,7 +28,6 @@
/** @type {() => void} */
export let onClose;
// Editing state — only one field at a time
/** @type {string|null} */
let editingField = null;
@@ -37,7 +36,6 @@
let editProject = '';
let editTagInput = '';
// Recurring instance: remember user choice for this sheet session
/** @type {'instance'|'template'|null} */
let recurringChoice = null;
@@ -67,17 +65,12 @@
0: 3
});
/**
* Format a unix timestamp as yyyy-MM-dd for date input
* @param {number} ts
* @returns {string}
*/
/** @param {number} ts @returns {string} */
function tsToDateValue(ts) {
return format(fromUnix(ts), 'yyyy-MM-dd');
}
/**
* Check if a field edit on a recurring instance needs the instance/template prompt
* @param {string} field
* @returns {boolean}
*/
@@ -124,14 +117,10 @@
function saveCurrentEdit() {
if (!editingField) return;
// Each field handles its own save via its input events
editingField = null;
}
/**
* Get the UUID to update based on recurring choice
* @returns {string}
*/
/** @returns {string} */
function getTargetUuid() {
if (recurringChoice === 'template' && task.parent_uuid) {
return task.parent_uuid;
@@ -194,7 +183,6 @@
async function removeTag(tag) {
try {
await tagsAPI.remove(getTargetUuid(), tag);
// Optimistic: update local
task = { ...task, tags: task.tags.filter(t => t !== tag) };
} catch (error) {
console.error('Failed to remove tag:', error);
@@ -207,7 +195,6 @@
editTagInput = '';
try {
await tagsAPI.add(getTargetUuid(), tag);
// Optimistic: update local
task = { ...task, tags: [...task.tags, tag] };
} catch (error) {
console.error('Failed to add tag:', error);
@@ -259,12 +246,10 @@
}
}
// After recurring choice is made, proceed with the pending edit
$: if (recurringChoice && pendingEditField) {
const field = pendingEditField;
pendingEditField = null;
if (field === 'priority-cycle') {
// Direct cycle
const next = priorityCycle[task.priority] ?? 1;
onUpdate(getTargetUuid(), { priority: /** @type {import('$lib/api/types.js').TaskPriority} */ (next) });
} else {