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

@@ -1,4 +1,6 @@
<script lang="ts">
import FolderPicker from '$lib/components/FolderPicker.svelte';
let {
onClose,
onAdded
@@ -97,19 +99,23 @@
</div>
<div class="space-y-4">
<label class="block">
<div class="block">
<span class="text-sm font-medium text-gray-700">
{source === 'github' ? 'GitHub URL' : 'Absolute Path'}
{source === 'github' ? 'GitHub URL' : 'Local Path'}
</span>
<input
type="text"
bind:value={sourceUrl}
placeholder={source === 'github'
? 'https://github.com/facebook/react'
: '/home/user/projects/my-sdk'}
class="mt-1 w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none"
/>
</label>
{#if source === 'github'}
<input
type="text"
bind:value={sourceUrl}
placeholder="https://github.com/facebook/react"
class="mt-1 w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none"
/>
{:else}
<div class="mt-1">
<FolderPicker bind:value={sourceUrl} onselect={(p) => { if (!title) title = p.split('/').at(-1) ?? ''; }} />
</div>
{/if}
</div>
<label class="block">
<span class="text-sm font-medium text-gray-700">Display Title (optional)</span>