Files
FabledCurator/frontend/src/components/TopNav.vue
T
bvandeusen 2d1cddd9b7
CI / lint (push) Successful in 3s
CI / frontend-build (push) Successful in 19s
CI / backend-lint-and-test (push) Successful in 30s
CI / integration (push) Successful in 3m18s
feat(explore): 3-pane tagging workspace — gallery | viewer | tag rail
Reworks Explore from "anchor + neighbour grid + cluster tag-gap rail" into a
persistent 3-pane workspace that unfolds the image modal so you can tag while
rabbit-holing (operator concept 2026-06-26):

- LEFT  neighbour grid (larger thumbs), click = walk; breadcrumb retained.
- CENTER light viewer — reuses ImageCanvas + ImageMetaBar(:image) for the
  focused image; "Open full viewer" still launches the overlay modal.
- RIGHT  the modal's TagPanel, hosted on the anchor for modal-parity tagging
  (chips, autocomplete, suggestions + Accept, fandom-on-chip, T/"/" focus).

Reuse without destabilising the audited modal store: TagPanel and
SuggestionsPanel gain an optional `host` prop (default = modal store, so the
image modal is unchanged); the explore store implements the same small
tag-CRUD surface (current/currentImageId + reloadTags/addExistingTag/
removeTag/createAndAdd) over the anchor. ImageMetaBar gains an optional
`image` prop for the same reason.

Drops the mass/cluster tagger (TagGapPanel deleted; clusterIds/thumbById
removed) — per-image tagging feeds the per-tag reference-embedding centroid
better than bulk ops.

Nav: keep the Explore tab but bare /explore now SEEDS a random image
(GET /api/showcase?limit=1 → /explore/:id) so the tab kick-starts a rabbit
hole; explicit meta.navOrder pins nav order (Explore after Gallery) since
router.getRoutes() doesn't preserve declaration order.

Note: the backend cluster tag-gaps route/service (#94a) is now frontend-orphaned
— left in place; flag for a separate cleanup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 01:15:11 -04:00

225 lines
6.8 KiB
Vue

<template>
<header class="fc-topnav">
<div class="fc-nav-left">
<RouterLink :to="FRONT_DOOR" class="fc-brand" aria-label="FabledCurator home">
<img src="/favicon.svg" alt="" class="fc-brand__glyph" width="22" height="22" />
<span class="fc-brand__text">FabledCurator</span>
</RouterLink>
<span class="fc-health" :title="health.label">
<v-icon size="x-small" :color="health.color">{{ health.icon }}</v-icon>
</span>
<PipelineStatusChip />
</div>
<!-- Desktop: inline links, centered. Hidden on mobile (see media query),
where they fold into the hamburger menu on the right. -->
<nav class="fc-links">
<RouterLink
v-for="r in contentRoutes"
:key="r.name"
:to="{ name: r.name }"
class="fc-link"
>{{ r.meta.title }}</RouterLink>
</nav>
<div class="fc-nav-right">
<!-- Per-view contextual actions teleport here (Showcase: Shuffle,
Gallery: Select). TopNav owns the slot, not its contents. -->
<div id="fc-nav-actions" class="fc-nav-actions" />
<!-- Settings is config, not content pinned to the right edge,
separated from the content nav (desktop). On mobile it lives in
the hamburger menu below like every other route. -->
<RouterLink
v-if="settingsRoute"
:to="{ name: settingsRoute.name }"
class="fc-link fc-link--settings"
:aria-label="settingsRoute.meta.title"
>
<v-icon size="small">mdi-cog-outline</v-icon>
<span class="fc-link--settings__label">{{ settingsRoute.meta.title }}</span>
</RouterLink>
<!-- Mobile nav: the link row collides with brand + actions below ~768px
(7+ links in one flex row), so collapse it into a menu. -->
<v-menu location="bottom end">
<template #activator="{ props: menuProps }">
<v-btn
v-bind="menuProps"
icon="mdi-menu" variant="text" size="small"
class="fc-nav-burger" aria-label="Menu"
/>
</template>
<v-list density="compact" min-width="180">
<v-list-item
v-for="r in navRoutes"
:key="r.name"
:to="{ name: r.name }"
:title="r.meta.title"
/>
</v-list>
</v-menu>
</div>
</header>
</template>
<script setup>
import { computed, onMounted } from 'vue'
import router, { FRONT_DOOR } from '../router.js'
import { useSystemStore } from '../stores/system.js'
import PipelineStatusChip from './PipelineStatusChip.vue'
const system = useSystemStore()
onMounted(() => system.refreshHealth())
// Every route with a meta.title is a nav entry. Order by meta.navOrder —
// router.getRoutes() does NOT guarantee declaration order, so explicit numbers
// pin the sequence (e.g. Explore after Gallery). Routes without one fall to the
// end. Auto-tracks future routes.
const navRoutes = computed(() =>
router.getRoutes()
.filter(r => r.meta?.title)
.sort((a, b) => (a.meta.navOrder ?? 999) - (b.meta.navOrder ?? 999))
)
// Content links for the centered desktop row — everything EXCEPT Settings,
// which is config and gets pinned to the right edge instead.
const contentRoutes = computed(() =>
navRoutes.value.filter(r => r.name !== 'settings')
)
const settingsRoute = computed(() =>
navRoutes.value.find(r => r.name === 'settings') || null
)
const health = computed(() => {
if (system.healthy === null) {
return { icon: 'mdi-circle-outline', color: 'on-surface', label: 'checking…' }
}
if (system.healthy === true) {
return { icon: 'mdi-circle', color: 'success', label: 'healthy' }
}
return { icon: 'mdi-alert-circle', color: 'error', label: 'unreachable' }
})
</script>
<style scoped>
.fc-topnav {
position: sticky;
top: 0;
z-index: 1000;
/* Both side cells use `flex: 1 1 0` — equal flex weight, basis 0 —
so they grow/shrink at the same rate regardless of which one has
content (brand vs. teleport-slot action button). The middle cell
is `flex: 0 0 auto` (content width), and because the side cells
are symmetric, the middle stays geometrically centered. Earlier
attempts: `flex: 1` defaults to basis 0%, which made the centered
links shift when actions appeared; `grid-template-columns: 1fr
auto 1fr` actually means `minmax(auto, 1fr)` so a wide brand
pushed the link block off-center on narrow viewports. */
display: flex;
align-items: center;
gap: 1rem;
padding: 0.75rem 1rem;
/* Obsidian (#14171A = 20,23,26) gradient fade — content scrolls under it. */
background: linear-gradient(
to bottom,
rgba(20, 23, 26, 0.92) 0%,
rgba(20, 23, 26, 0.65) 60%,
rgba(20, 23, 26, 0) 100%
);
backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px);
}
.fc-brand {
display: flex;
align-items: center;
gap: 8px;
text-decoration: none;
flex-shrink: 0;
}
.fc-brand__glyph { display: block; }
.fc-brand__text {
font-family: 'Fraunces', Georgia, serif;
font-size: 20px;
font-weight: 500;
color: rgb(var(--v-theme-accent));
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.fc-links {
flex: 0 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.25rem;
}
.fc-link {
padding: 0.5rem 1rem;
border-radius: 6px;
color: rgb(var(--v-theme-on-surface));
text-decoration: none;
font-weight: 500;
font-size: 1rem;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
transition: background 0.2s ease, transform 0.1s ease;
}
.fc-link:hover {
background: rgba(232, 228, 216, 0.12);
transform: translateY(-1px);
}
/* Active route: accent text only (FabledDesignSystem: accent for
nav-active, never on action buttons). No underline. */
.fc-link.router-link-exact-active {
color: rgb(var(--v-theme-accent));
}
/* Settings: gear + label, pinned right of the content nav. */
.fc-link--settings {
display: inline-flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
}
.fc-nav-left {
flex: 1 1 0;
min-width: 0;
display: flex;
align-items: center;
justify-content: flex-start;
gap: 8px;
}
.fc-health {
display: flex;
align-items: center;
flex-shrink: 0;
}
.fc-nav-right {
flex: 1 1 0;
min-width: 0;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.5rem;
}
.fc-nav-actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
/* The hamburger only exists on mobile; the inline links carry desktop. */
.fc-nav-burger { display: none; }
@media (max-width: 768px) {
.fc-topnav { gap: 0.5rem; padding: 0.6rem 0.75rem; }
/* Fold the link row into the hamburger menu. */
.fc-links { display: none; }
/* Settings is in the hamburger menu on mobile (navRoutes includes it). */
.fc-link--settings { display: none; }
.fc-nav-burger { display: inline-flex; }
}
@media (max-width: 480px) {
/* Reclaim width on the smallest phones — the glyph alone still brands. */
.fc-brand__text { display: none; }
}
</style>