feat(fase-10): sidebar "+ New collective" entry + modal (10.6)
Adds a new "+ New collective" entry at the bottom of the sidebar collective-switcher dropdown (and the mobile drawer for parity). Clicking it opens a CreateCollectiveModal that reuses the same onboarding form — name + emoji grid — and calls the existing create_collective() RPC (migration 012). On success, the new collective is appended to $userCollectives, set active in $currentCollective, persisted to localStorage, and the user is sent to /lists. Side effects: - Switcher now opens even with a single collective (previously gated on >1) so the entry is always reachable; the chevron is always shown. - DesktopSidebar gets a data-testid on the switcher button so the Playwright suite can target it without text matching. O-04 (rescued from Fase 7): Eva creates her first collective via onboarding, then opens the switcher and creates a second one without leaving /lists; both collectives end up in the switcher and the DB. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
import { currentCollective, userCollectives } from '$lib/stores/collective';
|
||||
import { displayName } from '$lib/stores/auth';
|
||||
import Avatar from '$lib/components/Avatar.svelte';
|
||||
import CreateCollectiveModal from '$lib/components/CreateCollectiveModal.svelte';
|
||||
import { logout } from '$lib/auth';
|
||||
import * as m from '$lib/paraglide/messages';
|
||||
import { Settings, Users, LogOut, X } from 'lucide-svelte';
|
||||
import { Settings, Users, LogOut, X, Plus } from 'lucide-svelte';
|
||||
|
||||
let showCreate = $state(false);
|
||||
|
||||
let { open = $bindable(false) }: { open?: boolean } = $props();
|
||||
|
||||
@@ -65,10 +68,21 @@
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
close();
|
||||
showCreate = true;
|
||||
}}
|
||||
class="mt-2 flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm text-text-secondary hover:bg-black/5 dark:hover:bg-white/5"
|
||||
>
|
||||
<Plus size={14} strokeWidth={1.5} />
|
||||
{m.sidebar_create_collective()}
|
||||
</button>
|
||||
<a
|
||||
href="/collective/manage"
|
||||
onclick={close}
|
||||
class="mt-2 flex items-center gap-2 rounded-md px-2 py-2 text-sm text-text-secondary hover:bg-black/5 dark:hover:bg-white/5"
|
||||
class="mt-1 flex items-center gap-2 rounded-md px-2 py-2 text-sm text-text-secondary hover:bg-black/5 dark:hover:bg-white/5"
|
||||
>
|
||||
<Users size={14} strokeWidth={1.5} />
|
||||
{m.manage_title()}
|
||||
@@ -106,3 +120,7 @@
|
||||
</div>
|
||||
</aside>
|
||||
{/if}
|
||||
|
||||
{#if showCreate}
|
||||
<CreateCollectiveModal onClose={() => (showCreate = false)} />
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user