<script lang="ts">
  import ProjectDashboard from '../features/projects/ProjectDashboard.svelte';
  import ServerLogin from '../features/auth/ServerLogin.svelte';

  let apiBase = localStorage.getItem('apiBase') ?? 'http://localhost:8080';

  function handleServerChange(event: CustomEvent<{ apiBase: string }>) {
    apiBase = event.detail.apiBase;
    localStorage.setItem('apiBase', apiBase);
  }
</script>

<main class="shell">
  <aside class="sidebar">
    <h1>项目工作台</h1>
    <ServerLogin {apiBase} on:serverChange={handleServerChange} />
  </aside>

  <section class="workspace">
    <ProjectDashboard
      summary={{
        project_id: 1,
        pending_inbox_count: 0,
        open_task_count: 0,
        recent_note_count: 0,
        recent_session_count: 0,
      }}
    />
  </section>
</main>
