summaryrefslogtreecommitdiffhomepage
path: root/src/features
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-15 10:05:08 +0900
committerAdam Malczewski <[email protected]>2026-10-15 10:05:08 +0900
commite49d98f692bb0c0bf6563c57ab3187e74635dbb5 (patch)
tree0ad84484331817ddda488dffebfd9c9eacc45a53 /src/features
parentdfd279fbe1c50743dc8105715fef7e74402f4564 (diff)
downloaddispatch-web-e49d98f692bb0c0bf6563c57ab3187e74635dbb5.tar.gz
dispatch-web-e49d98f692bb0c0bf6563c57ab3187e74635dbb5.zip
feat(home): navbar header actions — raised primary 'New workspace' button, secondary actions as text links, Phosphor icons when compact
Diffstat (limited to 'src/features')
-rw-r--r--src/features/workspaces/ui/HomeHeader.svelte69
-rw-r--r--src/features/workspaces/ui/HomeHeader.test.ts5
2 files changed, 39 insertions, 35 deletions
diff --git a/src/features/workspaces/ui/HomeHeader.svelte b/src/features/workspaces/ui/HomeHeader.svelte
index 8090489..5329b2d 100644
--- a/src/features/workspaces/ui/HomeHeader.svelte
+++ b/src/features/workspaces/ui/HomeHeader.svelte
@@ -1,4 +1,8 @@
<script lang="ts">
+ import ArchiveIcon from "phosphor-svelte/lib/ArchiveIcon";
+ import DotsThreeIcon from "phosphor-svelte/lib/DotsThreeIcon";
+ import PlusIcon from "phosphor-svelte/lib/PlusIcon";
+ import PuzzlePieceIcon from "phosphor-svelte/lib/PuzzlePieceIcon";
import { isValidSlug } from "../logic/route";
/** The create outcome the page reports back to the popover. */
@@ -78,68 +82,65 @@
</span>
</div>
- <div class="flex items-center gap-2" class:gap-1={compact}>
+ <!-- Navbar actions (app.css): "New workspace" is the one raised button
+ (`.navbar-btn`, primary-tinted); the secondary actions are plain text
+ links (`.navbar-link`) — the light-blue colour + spacing say clickable
+ without button chrome. Compact: labels collapse to Phosphor icons. -->
+ <div class="flex items-center gap-1" class:gap-3={!compact}>
<!-- New workspace -->
<button
type="button"
- class="btn btn-primary btn-sm"
- class:btn-circle={compact}
+ class="navbar-btn navbar-btn-primary"
+ class:navbar-btn-icon={compact}
aria-label="New workspace"
title="New workspace"
onclick={() => (popoverOpen ? closePopover() : openPopover())}
>
- {#if compact}
- <span aria-hidden="true" class="text-lg leading-none">+</span>
- {:else}
- New workspace
- {/if}
+ <PlusIcon size={16} weight="bold" aria-hidden="true" />
+ {#if !compact}<span>New workspace</span>{/if}
</button>
{#if withPlugins}
<button
type="button"
- class="btn btn-outline btn-sm"
- class:btn-circle={compact}
+ class="navbar-link"
aria-label="Plugins"
title="Open the plugin manager (load/unload plugins globally)"
onclick={onOpenPlugins}
>
- {#if compact}
- <span aria-hidden="true">⚡</span>
- {:else}
- Plugins
- {/if}
+ {#if compact}<PuzzlePieceIcon size={18} aria-hidden="true" />{:else}<span>Plugins</span>{/if}
</button>
{/if}
+ <!-- Archived workspaces -->
+ <button
+ type="button"
+ class="navbar-link"
+ aria-label="Archived workspaces"
+ title="View archived workspaces"
+ onclick={onOpenArchived}
+ >
+ {#if compact}<ArchiveIcon size={18} aria-hidden="true" />{:else}<span>Archived</span>{/if}
+ </button>
+
{#if withSort}
+ <!-- Overflow last, like a navbar's trailing menu. -->
<div class="dropdown dropdown-end">
- <button type="button" class="btn btn-ghost btn-sm" aria-label="More actions" title="More">
- ⋯
+ <button
+ type="button"
+ class="navbar-link"
+ aria-label="More actions"
+ title="More"
+ >
+ <DotsThreeIcon size={20} weight="bold" aria-hidden="true" />
</button>
- <ul class="dropdown-content menu z-50 w-52 rounded-box border border-base-content/15 bg-base-100 p-2 shadow-xl">
+ <ul class="dropdown-content menu z-50 mt-1 w-52 rounded-box border border-base-content/15 bg-base-100 p-2 shadow-xl">
<li>
<button type="button" onclick={onSort}>Reset arrangement by recent activity</button>
</li>
</ul>
</div>
{/if}
-
- <!-- Archived workspaces -->
- <button
- type="button"
- class="btn btn-ghost btn-sm"
- class:btn-circle={compact}
- aria-label="Archived workspaces"
- title="View archived workspaces"
- onclick={onOpenArchived}
- >
- {#if compact}
- <span aria-hidden="true">🗄</span>
- {:else}
- Archived
- {/if}
- </button>
</div>
</header>
diff --git a/src/features/workspaces/ui/HomeHeader.test.ts b/src/features/workspaces/ui/HomeHeader.test.ts
index 40b060f..4db8b04 100644
--- a/src/features/workspaces/ui/HomeHeader.test.ts
+++ b/src/features/workspaces/ui/HomeHeader.test.ts
@@ -86,6 +86,9 @@ describe("HomeHeader", () => {
it("compact mode collapses the primary button to an icon", () => {
const p = props();
render(HomeHeader, { props: { ...p, compact: true } });
- expect(screen.getByRole("button", { name: "New workspace" })).toHaveTextContent("+");
+ const button = screen.getByRole("button", { name: "New workspace" });
+ expect(button).toHaveClass("navbar-btn-icon");
+ expect(button).toHaveTextContent(""); // icon only — the label collapses
+ expect(button.querySelector("svg")).not.toBeNull();
});
});