fix(ui): resolve state_referenced_locally warnings and add folder picker

- Fix Svelte state_referenced_locally warning in +page.svelte and repos/[id]/+page.svelte
  by initializing $state with empty defaults and syncing via $effect
- Add FolderPicker component with server-side filesystem browser
  (single-click to navigate, double-click or "Select This Folder" to confirm)
- Git repos highlighted with orange folder icon and "git" badge
- Add GET /api/v1/fs/browse endpoint listing subdirectories
- Wire FolderPicker into AddRepositoryModal for local source type
- Auto-fills title from the selected folder name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Giancarmine Salucci
2026-03-23 09:17:44 +01:00
parent f91bdbc2bf
commit 391eb7f411
5 changed files with 275 additions and 17 deletions

View File

@@ -8,9 +8,11 @@
let { data }: { data: PageData } = $props();
// Local mutable copy; refreshRepositories() keeps it up to date after mutations.
// Intentionally captures initial value from server load — mutations happen via fetch.
let repositories = $state<Repository[]>(data.repositories ?? []); // svelte-disable state_referenced_locally
// Initialized empty; $effect syncs from data prop on every navigation/reload.
let repositories = $state<Repository[]>([]);
$effect(() => {
repositories = data.repositories ?? [];
});
let showAddModal = $state(false);
let confirmDeleteId = $state<string | null>(null);
let activeJobIds = $state<Record<string, string>>({});