mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
feat(frontend): add the perfect-design theme, shell and helpers
Install @perfect-design/ui 0.3.10 with the workbench style pack, IBM Plex faces and the inline theme boot script. The app shell uses AppHeader, AppShell and SidebarNav. Shared formatters, severity tones and icon data replace the per-view copies. A test checks that main.css scans only the library directories the app imports.
This commit is contained in:
+46
-58
@@ -1,61 +1,49 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-background">
|
||||
<nav class="sticky top-0 z-50 bg-card/95 backdrop-blur-lg shadow-sm border-b">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex justify-between h-16">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="flex items-center justify-center w-10 h-10 rounded-lg bg-primary text-primary-foreground">
|
||||
<i class="fas fa-box-open text-lg"></i>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<h1 class="text-lg font-semibold tracking-tight text-foreground">GoHoarder</h1>
|
||||
<p class="text-xs text-muted-foreground">Package Cache Manager</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-1">
|
||||
<router-link
|
||||
to="/"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-foreground/70 hover:text-foreground hover:bg-accent transition-colors"
|
||||
active-class="text-foreground bg-accent"
|
||||
>
|
||||
<i class="fas fa-chart-pie text-sm"></i>
|
||||
<span>Dashboard</span>
|
||||
</router-link>
|
||||
<router-link
|
||||
to="/packages"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-foreground/70 hover:text-foreground hover:bg-accent transition-colors"
|
||||
active-class="text-foreground bg-accent"
|
||||
>
|
||||
<i class="fas fa-boxes text-sm"></i>
|
||||
<span>Packages</span>
|
||||
</router-link>
|
||||
<router-link
|
||||
to="/stats"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-foreground/70 hover:text-foreground hover:bg-accent transition-colors"
|
||||
active-class="text-foreground bg-accent"
|
||||
>
|
||||
<i class="fas fa-chart-bar text-sm"></i>
|
||||
<span>Statistics</span>
|
||||
</router-link>
|
||||
<router-link
|
||||
to="/admin/bypasses"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium text-foreground/70 hover:text-foreground hover:bg-accent transition-colors"
|
||||
active-class="text-foreground bg-accent"
|
||||
>
|
||||
<i class="fas fa-shield-alt text-sm"></i>
|
||||
<span>Admin</span>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { RouterView } from 'vue-router'
|
||||
import { AppHeader, AppShell, Icon, ThemeToggle, Toaster, useThemeStore } from '@perfect-design/ui'
|
||||
import AppNav from '@/components/shell/AppNav.vue'
|
||||
import { faBoxOpen } from '@/lib/icons'
|
||||
|
||||
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10">
|
||||
<router-view />
|
||||
</main>
|
||||
// init() installs the watcher that applies and persists the choice; the style is set after it so a stored value cannot override the pack.
|
||||
onMounted(() => {
|
||||
const theme = useThemeStore()
|
||||
theme.init()
|
||||
theme.setStyle('workbench')
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex min-h-dvh flex-col">
|
||||
<!-- Rendered here, not by AppShell: the header sits above the shell, and the skip link must be the first tab stop. -->
|
||||
<a
|
||||
href="#main-content"
|
||||
class="sr-only focus:not-sr-only focus:absolute focus:start-2 focus:top-2 focus:z-(--z-toast) focus:rounded-md focus:bg-primary focus:px-3 focus:py-2 focus:text-sm focus:text-primary-foreground"
|
||||
>Skip to main content</a
|
||||
>
|
||||
<!-- AppShell wraps its #header slot in its own <header> and AppHeader renders one too; outside the shell there is one banner. -->
|
||||
<AppHeader sticky mobile-variant="sheet" class="[&>div]:h-(--header-h)">
|
||||
<template #brand>
|
||||
<Icon :icon="faBoxOpen" size="lg" class="text-primary" />
|
||||
<p class="m-0 text-lg font-semibold">GoHoarder</p>
|
||||
<p class="m-0 hidden text-sm text-muted-foreground sm:block">Package cache manager</p>
|
||||
</template>
|
||||
<template #actions><ThemeToggle /></template>
|
||||
<template #mobile><AppNav sheet /></template>
|
||||
</AppHeader>
|
||||
|
||||
<!-- The aside scrolls itself, so only the aside can stick; both offsets come from --header-h. -->
|
||||
<AppShell
|
||||
:skip-link="false"
|
||||
drawer-breakpoint="md"
|
||||
sidebar-label="Sections"
|
||||
content-max-width="7xl"
|
||||
class="flex-1 md:[&_[data-slot=app-shell-sidebar]]:sticky md:[&_[data-slot=app-shell-sidebar]]:top-(--header-h) md:[&_[data-slot=app-shell-sidebar]]:h-[calc(100dvh-var(--header-h))] md:[&_[data-slot=app-shell-sidebar]]:self-start"
|
||||
>
|
||||
<template #sidebar><AppNav /></template>
|
||||
<div class="py-6"><RouterView /></div>
|
||||
</AppShell>
|
||||
|
||||
<Toaster />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// App component
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user