style(project): format Go with gofmt, set up Prettier for the frontend
Run gofmt -w across the backend, normalising the manually-aligned := blocks to the gofmt standard. No code behaviour changes. Add Prettier (+ prettier-plugin-svelte) to the frontend with the SvelteKit default config (tabs, single quotes) so formatting is reproducible, then run it over the whole tree. Add format / format:check npm scripts and a .prettierignore (build output, generated schema.ts, static assets). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -76,7 +76,7 @@
|
||||
{ value: 'created', label: 'Created' },
|
||||
{ value: 'content_datetime', label: 'Date taken' },
|
||||
{ value: 'original_name', label: 'Name' },
|
||||
{ value: 'mime', label: 'Type' },
|
||||
{ value: 'mime', label: 'Type' }
|
||||
];
|
||||
|
||||
let files = $state<File[]>([]);
|
||||
@@ -181,7 +181,7 @@
|
||||
const p = new URLSearchParams({
|
||||
limit: String(LIMIT),
|
||||
sort: sortState.sort,
|
||||
order: sortState.order,
|
||||
order: sortState.order
|
||||
});
|
||||
if (filterParam) p.set('filter', filterParam);
|
||||
return p;
|
||||
@@ -335,7 +335,7 @@
|
||||
let activeIdx = $derived(activeFileId ? files.findIndex((f) => f.id === activeFileId) : -1);
|
||||
let viewerPrevId = $derived(activeIdx > 0 ? (files[activeIdx - 1]?.id ?? null) : null);
|
||||
let viewerNextId = $derived(
|
||||
activeIdx >= 0 && activeIdx < files.length - 1 ? (files[activeIdx + 1]?.id ?? null) : null,
|
||||
activeIdx >= 0 && activeIdx < files.length - 1 ? (files[activeIdx + 1]?.id ?? null) : null
|
||||
);
|
||||
|
||||
// Paging near the end of the loaded grid: pull the next page by cursor so the
|
||||
@@ -469,11 +469,7 @@
|
||||
/>
|
||||
|
||||
{#if filterOpen}
|
||||
<FilterBar
|
||||
value={filterParam}
|
||||
onApply={applyFilter}
|
||||
onClose={() => (filterOpen = false)}
|
||||
/>
|
||||
<FilterBar value={filterParam} onApply={applyFilter} onClose={() => (filterOpen = false)} />
|
||||
{/if}
|
||||
|
||||
<FileUpload bind:this={uploader} onUploaded={handleUploaded}>
|
||||
@@ -535,10 +531,19 @@
|
||||
<div class="picker-backdrop" role="presentation" onclick={() => (tagEditorOpen = false)}></div>
|
||||
<div class="picker-sheet tag-sheet" role="dialog" aria-label="Edit tags">
|
||||
<div class="picker-header">
|
||||
<span class="picker-title">Edit tags — {$selectionStore.ids.size} file{$selectionStore.ids.size !== 1 ? 's' : ''}</span>
|
||||
<span class="picker-title"
|
||||
>Edit tags — {$selectionStore.ids.size} file{$selectionStore.ids.size !== 1
|
||||
? 's'
|
||||
: ''}</span
|
||||
>
|
||||
<button class="picker-close" onclick={() => (tagEditorOpen = false)} aria-label="Close">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
||||
<path
|
||||
d="M3 3l10 10M13 3L3 13"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -553,10 +558,17 @@
|
||||
<div class="picker-backdrop" role="presentation" onclick={() => (poolPickerOpen = false)}></div>
|
||||
<div class="picker-sheet" role="dialog" aria-label="Add to pool">
|
||||
<div class="picker-header">
|
||||
<span class="picker-title">Add {$selectionStore.ids.size} file{$selectionStore.ids.size !== 1 ? 's' : ''} to pool</span>
|
||||
<span class="picker-title"
|
||||
>Add {$selectionStore.ids.size} file{$selectionStore.ids.size !== 1 ? 's' : ''} to pool</span
|
||||
>
|
||||
<button class="picker-close" onclick={() => (poolPickerOpen = false)} aria-label="Close">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
||||
<path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
||||
<path
|
||||
d="M3 3l10 10M13 3L3 13"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -697,8 +709,14 @@
|
||||
}
|
||||
|
||||
@keyframes slide-up {
|
||||
from { transform: translateY(20px); opacity: 0; }
|
||||
to { transform: translateY(0); opacity: 1; }
|
||||
from {
|
||||
transform: translateY(20px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.picker-header {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
anchor: id,
|
||||
limit: '3',
|
||||
sort: sort.sort,
|
||||
order: sort.order,
|
||||
order: sort.order
|
||||
});
|
||||
try {
|
||||
const result = await api.get<FileCursorPage>(`/files?${params}`);
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
// In trash, tap always selects (no detail page)
|
||||
if (e.shiftKey && lastSelectedIdx !== null) {
|
||||
const from = Math.min(lastSelectedIdx, idx);
|
||||
const to = Math.max(lastSelectedIdx, idx);
|
||||
const to = Math.max(lastSelectedIdx, idx);
|
||||
for (let i = from; i <= to; i++) {
|
||||
if (files[i]?.id) selectionStore.select(files[i].id!);
|
||||
}
|
||||
@@ -93,7 +93,9 @@
|
||||
else selectionStore.deselect(files[idx].id!);
|
||||
lastSelectedIdx = idx;
|
||||
}
|
||||
function onTouchEnd() { dragSelecting = false; }
|
||||
function onTouchEnd() {
|
||||
dragSelecting = false;
|
||||
}
|
||||
document.addEventListener('touchmove', onTouchMove, { passive: false });
|
||||
document.addEventListener('touchend', onTouchEnd);
|
||||
document.addEventListener('touchcancel', onTouchEnd);
|
||||
@@ -145,7 +147,13 @@
|
||||
|
||||
<div class="page">
|
||||
<header>
|
||||
<button class="back-btn" onclick={() => { selectionStore.exit(); goto('/files'); }}>
|
||||
<button
|
||||
class="back-btn"
|
||||
onclick={() => {
|
||||
selectionStore.exit();
|
||||
goto('/files');
|
||||
}}
|
||||
>
|
||||
← Files
|
||||
</button>
|
||||
<span class="title">Trash</span>
|
||||
@@ -190,14 +198,27 @@
|
||||
<span class="sel-num">{$selectionCount}</span>
|
||||
<span class="sel-label">selected</span>
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
|
||||
<path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
||||
<path
|
||||
d="M2 2l10 10M12 2L2 12"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.8"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="sel-spacer"></div>
|
||||
<button class="sel-action restore" onclick={() => (confirmRestore = true)} disabled={actionBusy}>
|
||||
<button
|
||||
class="sel-action restore"
|
||||
onclick={() => (confirmRestore = true)}
|
||||
disabled={actionBusy}
|
||||
>
|
||||
Restore
|
||||
</button>
|
||||
<button class="sel-action perm-delete" onclick={() => (confirmPermDelete = true)} disabled={actionBusy}>
|
||||
<button
|
||||
class="sel-action perm-delete"
|
||||
onclick={() => (confirmPermDelete = true)}
|
||||
disabled={actionBusy}
|
||||
>
|
||||
Delete permanently
|
||||
</button>
|
||||
</div>
|
||||
@@ -254,7 +275,9 @@
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.back-btn:hover { color: var(--color-accent); }
|
||||
.back-btn:hover {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 0.9rem;
|
||||
@@ -275,7 +298,10 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select-btn:hover { color: var(--color-text-primary); border-color: var(--color-accent); }
|
||||
.select-btn:hover {
|
||||
color: var(--color-text-primary);
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
|
||||
.select-btn.active {
|
||||
background-color: color-mix(in srgb, var(--color-accent) 25%, var(--color-bg-elevated));
|
||||
@@ -335,8 +361,14 @@
|
||||
}
|
||||
|
||||
@keyframes slide-up {
|
||||
from { transform: translateY(12px); opacity: 0; }
|
||||
to { transform: translateY(0); opacity: 1; }
|
||||
from {
|
||||
transform: translateY(12px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.sel-count {
|
||||
@@ -363,9 +395,13 @@
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.sel-label { font-size: 0.85rem; }
|
||||
.sel-label {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.sel-spacer { flex: 1; }
|
||||
.sel-spacer {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sel-action {
|
||||
background: none;
|
||||
@@ -378,14 +414,17 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sel-action:disabled { opacity: 0.5; cursor: default; }
|
||||
.sel-action:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.sel-action.restore {
|
||||
color: #7ECBA1;
|
||||
color: #7ecba1;
|
||||
}
|
||||
|
||||
.sel-action.restore:hover:not(:disabled) {
|
||||
background-color: color-mix(in srgb, #7ECBA1 15%, transparent);
|
||||
background-color: color-mix(in srgb, #7ecba1 15%, transparent);
|
||||
}
|
||||
|
||||
.sel-action.perm-delete {
|
||||
@@ -395,4 +434,4 @@
|
||||
.sel-action.perm-delete:hover:not(:disabled) {
|
||||
background-color: color-mix(in srgb, var(--color-danger) 15%, transparent);
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user