Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/console/app/assets/css/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-signal: var(--signal);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
Expand Down Expand Up @@ -96,7 +97,9 @@
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
/* What needs attention or is switched on: unread, checked, the active step. */
--signal: oklch(0.585 0.233 277);
--chart-1: oklch(0.585 0.233 277);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
Expand Down Expand Up @@ -133,6 +136,7 @@
--border: oklch(0.25 0 0);
--input: oklch(0.2 0 0);
--ring: oklch(0.439 0 0);
--signal: oklch(0.673 0.182 276.935);
--chart-1: oklch(0.6 0.22 275);
--chart-2: oklch(0.75 0.15 160);
--chart-3: oklch(0.8 0.18 70);
Expand Down Expand Up @@ -163,9 +167,9 @@
}
}

/* The shared studio section-label: a small, tracked, uppercase muted heading.
/* The shared studio section-label: a small muted heading in sentence case.
One definition so the Detect / Audit / Review tabs label their sections
identically. */
@utility section-label {
@apply text-[11px] font-semibold uppercase tracking-wider text-muted-foreground;
@apply text-xs font-medium text-muted-foreground;
}
90 changes: 40 additions & 50 deletions packages/console/app/components/avatar/AvatarUploadCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { Upload, Loader2, Trash2 } from "@lucide/vue";
import { Label } from "#console/components/ui/label";
import { Button } from "#console/components/ui/button";
import { Card, CardContent, CardFooter } from "#console/components/ui/card";
import EntityAvatar from "./EntityAvatar.vue";

defineProps<{
Expand All @@ -28,55 +27,46 @@ const emit = defineEmits<{
</script>

<template>
<Card class="rounded-xl border-border/50 py-0 pt-6">
<CardContent>
<div class="flex items-start justify-between">
<div class="space-y-1">
<Label class="text-sm font-medium">{{ label }}</Label>
<p class="text-sm text-muted-foreground">{{ description }}</p>
</div>
<div class="flex items-center gap-2">
<!-- Remove: trash icon left of the avatar -->
<Button
v-if="src"
variant="ghost"
size="icon"
class="size-8 rounded-full text-muted-foreground hover:text-destructive"
:aria-label="removeLabel"
:disabled="isDeleting || isUploading"
@click="emit('remove')"
>
<Loader2 v-if="isDeleting" :size="15" class="animate-spin" />
<Trash2 v-else :size="15" />
</Button>
<button
type="button"
:disabled="isUploading || isDeleting"
class="group relative flex size-12 cursor-pointer transition-opacity hover:opacity-80 disabled:cursor-default disabled:opacity-60"
@click="emit('pick')"
<!-- An avatar setting, as a settings row in its own box: what it's for on
the left; remove, then the avatar (click to upload) on the right. -->
<div>
<div
class="flex items-center gap-4 rounded-lg border border-border/60 px-4 py-3.5 text-[13px]"
>
<div class="min-w-0 flex-1">
<Label>{{ label }}</Label>
<p class="mt-0.5 text-muted-foreground">{{ description }}</p>
</div>
<div class="flex shrink-0 items-center gap-2">
<Button
v-if="src"
variant="ghost"
size="icon"
class="size-8 rounded-full text-muted-foreground hover:text-destructive"
:aria-label="removeLabel"
:disabled="isDeleting || isUploading"
@click="emit('remove')"
>
<Loader2 v-if="isDeleting" :size="15" class="animate-spin" />
<Trash2 v-else :size="15" />
</Button>
<button
type="button"
:disabled="isUploading || isDeleting"
class="group relative flex size-8 cursor-pointer rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-default disabled:opacity-60"
@click="emit('pick')"
>
<EntityAvatar :name="name" :src="src" size="md" />
<div
class="absolute inset-0 flex items-center justify-center rounded-full bg-black/50"
:class="isUploading ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'"
>
<EntityAvatar :name="name" :src="src" size="lg" />
<div
class="absolute inset-0 flex items-center justify-center rounded-full bg-black/50 transition-opacity"
:class="
isUploading
? 'opacity-100'
: 'opacity-0 group-hover:opacity-100'
"
>
<Loader2
v-if="isUploading"
:size="18"
class="animate-spin text-white"
/>
<Upload v-else :size="18" class="text-white" />
</div>
</button>
</div>
<Loader2 v-if="isUploading" :size="14" class="animate-spin text-white" />
<Upload v-else :size="14" class="text-white" />
</div>
</button>
</div>
</CardContent>
<CardFooter class="rounded-b-xl border-t border-border/50 bg-muted/30 pb-6">
<p class="text-xs text-muted-foreground">{{ footer }}</p>
</CardFooter>
</Card>
</div>
<p class="mt-2 text-xs text-muted-foreground">{{ footer }}</p>
</div>
</template>
23 changes: 17 additions & 6 deletions packages/console/app/components/avatar/EntityAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ import {
AvatarImage,
} from "#console/components/ui/avatar";
import { getInitials, gradientForName } from "#console/utils/naming";
import { cn } from "#console/utils/shadcn";

// Attributes from the caller (a class, a title) land on the avatar itself, not
// the link or box around it.
defineOptions({ inheritAttrs: false });
const attrs = useAttrs();

interface Props {
href?: string;
size?: "sm" | "md" | "lg";
size?: "xs" | "sm" | "md" | "lg";
name?: string;
src?: string;
alt?: string;
Expand All @@ -20,12 +26,14 @@ const props = withDefaults(defineProps<Props>(), {

const sizeClasses = computed(() => {
switch (props.size) {
case "xs":
return "size-5 text-[9px]";
case "sm":
return "h-6 w-6 text-xs";
return "size-6 text-xs";
case "lg":
return "h-12 w-12 text-lg";
return "size-12 text-lg";
default:
return "h-8 w-8 text-sm";
return "size-8 text-sm";
}
});

Expand All @@ -43,10 +51,13 @@ const gradientStyle = computed(() => {

<template>
<component :is="href ? 'NuxtLink' : 'div'" :to="href" class="inline-block">
<Avatar :class="['rounded-full', sizeClasses]">
<Avatar
v-bind="attrs"
:class="cn('rounded-full', sizeClasses, attrs.class as string)"
>
<AvatarImage v-if="src" :src="src" :alt="alt || name || 'Avatar'" />
<AvatarFallback
class="rounded-full text-white font-medium"
class="rounded-[inherit] text-white font-medium"
:style="gradientStyle"
>
{{ initials }}
Expand Down
2 changes: 1 addition & 1 deletion packages/console/app/components/label/LabelOptionList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defineProps<{
</ComboboxEmpty>
<ComboboxGroup v-for="section in sections" :key="section.key">
<ComboboxLabel
class="px-2 pt-2 pb-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground"
class="px-2 pt-2 pb-1 text-xs font-medium text-muted-foreground"
>
{{ section.label || t("common.labelPicker.uncategorized") }}
</ComboboxLabel>
Expand Down
18 changes: 5 additions & 13 deletions packages/console/app/components/layout/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
BreadcrumbList,
BreadcrumbPage,
} from "#console/components/ui/breadcrumb";
import { NotificationsDropdown } from "#console/components/layout/header";

const route = useRoute();

Expand All @@ -27,11 +26,9 @@ const pageCategory = computed(() =>
</script>

<template>
<!-- One flex row of three in-flow zones: the persistent sidebar trigger
(left) and app chrome (right) reserve their own space, and the swappable
page content (breadcrumb / tabs / page controls) takes the middle. Because
every zone is in normal flow, the middle shrinks to fit between the others
and can never overlap the chrome at any width or sidebar state. -->
<!-- One flex row: the persistent sidebar trigger, then the page's own
content (its title, tabs, and controls), which takes the rest and
shrinks to fit. -->
<header
class="sticky top-0 z-10 flex h-11 shrink-0 items-center gap-2 border-b border-border/50 bg-background/80 px-3 backdrop-blur-sm rounded-t-xl"
>
Expand All @@ -46,11 +43,11 @@ const pageCategory = computed(() =>
category OR its own header row (tabs/controls) teleported into the
socket — pages with a socket header set `hideCategory`. -->
<div class="flex min-w-0 flex-1 items-center gap-2">
<Breadcrumb v-if="pageCategory" class="shrink-0">
<Breadcrumb v-if="pageCategory" class="mr-2 shrink-0">
<BreadcrumbList class="flex items-center">
<BreadcrumbItem class="flex items-center">
<BreadcrumbPage
class="text-sm font-medium text-muted-foreground leading-none"
class="text-sm font-medium text-foreground leading-none"
>
{{ pageCategory }}
</BreadcrumbPage>
Expand All @@ -62,10 +59,5 @@ const pageCategory = computed(() =>
child carries its own `flex-1`. -->
<div id="header-socket" class="contents" />
</div>

<!-- Right: persistent app chrome. -->
<div class="flex shrink-0 items-center gap-2">
<NotificationsDropdown />
</div>
</header>
</template>
2 changes: 1 addition & 1 deletion packages/console/app/components/layout/CommandMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defineShortcuts(shortcutConfig);
</p>
</CommandEmpty>

<!-- Quiet uppercase group headings do the visual separating, so no hard
<!-- Quiet group headings do the visual separating, so no hard
rules between groups. -->
<CommandGroup
v-for="section in sections"
Expand Down
65 changes: 65 additions & 0 deletions packages/console/app/components/layout/header/HeaderBreadcrumb.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script setup lang="ts">
import { ChevronRight } from "@lucide/vue";

/**
* A page's place in the app header: each step a muted link (or text), the
* last in the foreground. A `#last` slot replaces the last step, for one
* that's a control (the studio's document menu).
*/
export interface BreadcrumbStep {
label: string;
to?: string;
/** Set in mono, for a reference such as a certificate number. */
mono?: boolean;
}

const props = defineProps<{
label: string;
steps: BreadcrumbStep[];
}>();
const slots = useSlots();

/** The step for the current page: the last, unless a `#last` slot follows. */
const isCurrent = (index: number) =>
index === props.steps.length - 1 && !slots.last;
</script>

<template>
<nav :aria-label="label" class="flex min-w-0 items-center gap-1.5 text-sm">
<template v-for="(step, index) in steps" :key="index">
<ChevronRight
v-if="index > 0"
:size="12"
class="shrink-0 text-muted-foreground/60"
aria-hidden="true"
/>
<NuxtLink
v-if="step.to"
:to="step.to"
class="shrink-0 text-muted-foreground hover:text-foreground"
>
{{ step.label }}
</NuxtLink>
<span
v-else
class="truncate"
:class="[
isCurrent(index) ? 'text-foreground' : 'text-muted-foreground',
step.mono && 'shrink-0 font-mono text-xs',
]"
:aria-current="isCurrent(index) ? 'page' : undefined"
>
{{ step.label }}
</span>
</template>
<template v-if="$slots.last">
<ChevronRight
v-if="steps.length"
:size="12"
class="shrink-0 text-muted-foreground/60"
aria-hidden="true"
/>
<slot name="last" />
</template>
</nav>
</template>
10 changes: 8 additions & 2 deletions packages/console/app/components/layout/header/HeaderSocket.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
* `<HeaderSocket>…</HeaderSocket>` teleports into `#header-socket` (rendered by
* AppHeader). `defer` waits for the target to exist on the client; the socket is
* client-only chrome, so nothing renders during SSR — which is fine (both apps
* run SPA). The teleported node fills the zone as a flex row.
* run SPA). The teleported node fills the zone as a flex row. `end` places it
* after the page's own header content whatever order they mount in, for a
* table's controls beside the page's title and tabs.
*/
defineProps<{ end?: boolean }>();
</script>

<template>
<Teleport to="#header-socket" defer>
<div class="flex min-w-0 flex-1 items-center gap-2">
<div
class="flex min-w-0 flex-1 items-center gap-2"
:class="end && 'order-last justify-end'"
>
<slot />
</div>
</Teleport>
Expand Down
33 changes: 33 additions & 0 deletions packages/console/app/components/layout/header/HeaderTabs.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script setup lang="ts" generic="T extends string">
import { pillTabClass } from "./pillTab";
/**
* Pill tabs for the app header, bound to a value rather than a route: the
* views of one page (a list's filters, a page's two lists). Section tabs that
* navigate between pages are `SectionTabs`, drawn the same.
*/
defineProps<{
tabs: { value: T; label: string; count?: number }[];
label: string;
}>();

const model = defineModel<T>({ required: true });
</script>

<template>
<div role="tablist" :aria-label="label" class="flex min-w-0 gap-0.5 overflow-x-auto">
<button
v-for="tab in tabs"
:key="tab.value"
type="button"
role="tab"
:aria-selected="model === tab.value"
:class="pillTabClass(model === tab.value)"
@click="model = tab.value"
>
{{ tab.label }}
<span v-if="tab.count !== undefined" class="tabular-nums text-muted-foreground">
{{ tab.count }}
</span>
</button>
</div>
</template>
Loading