mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-25 08:03:45 +00:00
Each of these kept a header of its own above the page. They register with the band instead: the breadcrumb names what the page is on, and the page's buttons sit at the far end of the one row. They answer the band's width rather than the window's, since the buttons share that row with the breadcrumb. The script editor folds Diff and Settings into the menu it already shows when compact, the app editor drops the panel buttons, Awareness and Export and goes icon-only on Deploy and the mode switch, the flow editor menus its diff, and runs hides its counters. Runs also declares `actionsFlexible`: its search is the one control here that can give width back, and a box that refused to shrink would make it take its maximum instead. The run detail page loses its ActionRow, and the audit log its big title — the breadcrumb says where you are, and the page keeps its tooltip. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
57 lines
2.5 KiB
Svelte
57 lines
2.5 KiB
Svelte
<script lang="ts">
|
|
import { workspaceStore, userWorkspaces } from '$lib/stores'
|
|
import { workspaceIsFork } from '$lib/utils/workspaceHierarchy'
|
|
import { Badge, Button } from './common'
|
|
import { goto } from '$app/navigation'
|
|
import { useWorkspaceDrafts } from '$lib/workspaceDrafts.svelte'
|
|
import PageHeaderContent from '$lib/components/PageHeaderContent.svelte'
|
|
import { pageHeader, PHONE_BAR } from '$lib/components/pageHeaderRegistry.svelte'
|
|
|
|
// Surfaces pending drafts (scripts/flows/apps) for the current workspace and
|
|
// links to the compare page in draft mode. Mutually exclusive with
|
|
// ForkWorkspaceBanner: that one self-gates on `isFork`, this one on `!isFork`,
|
|
// so a fork workspace never shows both. In a fork, drafts are discovered via
|
|
// the on-page "Deployed ↔ draft (N)" toggle badge instead.
|
|
let isFork = $derived(workspaceIsFork($workspaceStore, $userWorkspaces))
|
|
|
|
// Count comes from the shared Workspace Drafts resource (count ≡ the draft
|
|
// list; refreshes itself on deploy/discard). Pass undefined in a fork or with
|
|
// no workspace so it doesn't fetch and the banner stays hidden.
|
|
const drafts = useWorkspaceDrafts(() => (!isFork ? ($workspaceStore ?? undefined) : undefined))
|
|
const draftCount = $derived(drafts.count)
|
|
|
|
function openDraftCompare() {
|
|
if ($workspaceStore) {
|
|
goto('/forks/compare?workspace_id=' + encodeURIComponent($workspaceStore) + '&mode=draft', {
|
|
replaceState: true
|
|
})
|
|
}
|
|
}
|
|
const phone = $derived(pageHeader.barWidth > 0 && pageHeader.barWidth < PHONE_BAR)
|
|
</script>
|
|
|
|
{#if !isFork && draftCount > 0}
|
|
<!-- In the band rather than a banner over the page: it is a standing fact about the workspace,
|
|
not an interruption, and one button says it and acts on it. -->
|
|
<PageHeaderContent actions={draftsAction} actionsOrder={-100} />
|
|
{/if}
|
|
|
|
{#snippet draftsAction()}
|
|
<!-- A count on its own leaves the reader to work out what it counts; the sentence says it.
|
|
On a phone the sentence goes and the badge becomes the button: the count is the part that
|
|
has to be seen, and the bar has room for one thing. -->
|
|
{#if phone}
|
|
<Button variant="subtle" unifiedSize="sm" onclick={openDraftCompare} title="Review & deploy drafts">
|
|
<Badge color="blue" small>{draftCount}</Badge>
|
|
</Button>
|
|
{:else}
|
|
<span class="shrink-0 text-2xs text-tertiary">This workspace has</span>
|
|
<Badge color="blue" small>
|
|
{draftCount} draft{draftCount !== 1 ? 's' : ''}
|
|
</Badge>
|
|
<Button variant="subtle" unifiedSize="sm" onclick={openDraftCompare}>
|
|
Review & deploy drafts
|
|
</Button>
|
|
{/if}
|
|
{/snippet}
|