feat(ui): migrate to @recloudstudio/ui, add theme toggle and polish console UX

This commit is contained in:
RhenCloud committed 2026-10-03 22:54:32 +08:00
1 parent a899e16604
commit fbbff669a3
45 files changed
+1489 -1343

No files matched your search

+118 -115
View File
@@ -1,10 +1,6 @@
@import "tailwindcss";
/* ---------------------------------------------------------------------------
* Theme tokens — RGB triplets so Tailwind opacity modifiers (bg-accent/10)
* work against them; values switch automatically with prefers-color-scheme
* (unless an explicit data-theme="light" is set on <html>).
* ------------------------------------------------------------------------- */
/* ReCloud UI-compatible RGB aliases for app-specific Tailwind utilities. */
@theme inline {
--font-ui: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
@@ -12,35 +8,34 @@
--radius: 12px;
--shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
--shadow-card-hover: 0 8px 24px -12px rgba(15, 23, 42, 0.25);
--shadow-accent-lg: 0 12px 28px -10px rgb(var(--accent));
--shadow-drawer: -16px 0 48px rgba(15, 23, 42, 0.12);
--shadow-accent-lg: 0 12px 28px -10px rgb(var(--wh-accent));
--shadow-modal: 0 12px 40px rgba(15, 23, 42, 0.25);
--animate-rise: rise 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both;
--color-bg: rgb(var(--bg));
--color-surface: rgb(var(--surface));
--color-surface-2: rgb(var(--surface-2));
--color-surface-3: rgb(var(--surface-3));
--color-border: rgb(var(--border));
--color-border-strong: rgb(var(--border-strong));
--color-text: rgb(var(--text));
--color-muted: rgb(var(--muted));
--color-faint: rgb(var(--faint));
--color-accent: rgb(var(--accent));
--color-accent-strong: rgb(var(--accent-strong));
--color-accent-dim: rgb(var(--accent-dim));
--color-accent-text: rgb(var(--accent-text));
--color-accent-border: rgb(var(--accent-border));
--color-ok: rgb(var(--ok));
--color-ok-dim: rgb(var(--ok-dim));
--color-warn: rgb(var(--warn));
--color-warn-dim: rgb(var(--warn-dim));
--color-bad: rgb(var(--bad));
--color-bad-dim: rgb(var(--bad-dim));
--color-info: rgb(var(--info));
--color-info-dim: rgb(var(--info-dim));
--color-body-text: rgb(var(--body-text));
--color-code-bg: rgb(var(--code-bg));
--color-bg: rgb(var(--wh-bg));
--color-surface: rgb(var(--wh-surface));
--color-surface-2: rgb(var(--wh-surface-2));
--color-surface-3: rgb(var(--wh-surface-3));
--color-border: rgb(var(--wh-border));
--color-border-strong: rgb(var(--wh-border-strong));
--color-text: rgb(var(--wh-text));
--color-muted: rgb(var(--wh-muted));
--color-faint: rgb(var(--wh-faint));
--color-accent: rgb(var(--wh-accent));
--color-accent-strong: rgb(var(--wh-accent-strong));
--color-accent-dim: rgb(var(--wh-accent-dim));
--color-accent-text: rgb(var(--wh-accent-text));
--color-accent-border: rgb(var(--wh-accent-border));
--color-ok: rgb(var(--wh-ok));
--color-ok-dim: rgb(var(--wh-ok-dim));
--color-warn: rgb(var(--wh-warn));
--color-warn-dim: rgb(var(--wh-warn-dim));
--color-bad: rgb(var(--wh-bad));
--color-bad-dim: rgb(var(--wh-bad-dim));
--color-info: rgb(var(--wh-info));
--color-info-dim: rgb(var(--wh-info-dim));
--color-body-text: rgb(var(--wh-body-text));
--color-code-bg: rgb(var(--wh-code-bg));
}
@keyframes rise {
@@ -56,72 +51,71 @@
:root {
color-scheme: light;
--header-bg: rgba(255, 255, 255, 0.82);
--scrim: rgba(15, 23, 42, 0.4);
--knob: #ffffff;
--dot: rgba(15, 23, 42, 0.05);
--shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
--wh-header-bg: rgba(255, 255, 255, 0.82);
--wh-scrim: rgba(15, 23, 42, 0.4);
--wh-knob: #ffffff;
--wh-dot: rgba(15, 23, 42, 0.05);
--wh-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
--bg: 246 247 249;
--surface: 255 255 255;
--surface-2: 243 244 246;
--surface-3: 236 238 242;
--border: 230 232 236;
--border-strong: 212 216 222;
--text: 15 23 42;
--muted: 91 100 114;
--faint: 154 163 178;
--accent: 79 70 229;
--accent-strong: 67 56 202;
--accent-dim: 238 242 255;
--accent-text: 55 48 163;
--accent-border: 224 231 255;
--ok: 22 163 74;
--ok-dim: 236 253 243;
--warn: 180 83 9;
--warn-dim: 254 243 199;
--bad: 220 38 38;
--bad-dim: 254 242 242;
--info: 37 99 235;
--info-dim: 239 246 255;
--body-text: 48 54 61;
--code-bg: 240 241 243;
--wh-bg: 248 250 252;
--wh-surface: 255 255 255;
--wh-surface-2: 248 250 252;
--wh-surface-3: 241 245 249;
--wh-border: 226 232 240;
--wh-border-strong: 203 213 225;
--wh-text: 15 23 42;
--wh-muted: 71 85 105;
--wh-faint: 100 116 139;
--wh-accent: 37 99 235;
--wh-accent-strong: 29 78 216;
--wh-accent-dim: 239 246 255;
--wh-accent-text: 30 64 175;
--wh-accent-border: 191 219 254;
--wh-ok: 22 163 74;
--wh-ok-dim: 240 253 244;
--wh-warn: 217 119 6;
--wh-warn-dim: 255 251 235;
--wh-bad: 220 38 38;
--wh-bad-dim: 254 242 242;
--wh-info: 37 99 235;
--wh-info-dim: 239 246 255;
--wh-body-text: 48 54 61;
--wh-code-bg: 240 241 243;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
color-scheme: dark;
--header-bg: rgba(15, 20, 28, 0.82);
--scrim: rgba(2, 6, 12, 0.6);
--knob: #dfe4ee;
--dot: rgba(148, 163, 184, 0.08);
--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
:root.dark,
:root[data-theme="dark"] {
color-scheme: dark;
--wh-header-bg: rgba(15, 20, 28, 0.82);
--wh-scrim: rgba(2, 6, 12, 0.6);
--wh-knob: #dfe4ee;
--wh-dot: rgba(148, 163, 184, 0.08);
--wh-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.5);
--bg: 11 15 23;
--surface: 19 26 36;
--surface-2: 26 34 48;
--surface-3: 35 45 61;
--border: 39 49 67;
--border-strong: 56 70 96;
--text: 230 233 239;
--muted: 154 166 184;
--faint: 107 119 137;
--accent: 99 102 241;
--accent-strong: 129 140 248;
--accent-dim: 28 33 64;
--accent-text: 199 210 254;
--accent-border: 47 55 102;
--ok: 34 197 94;
--ok-dim: 16 36 26;
--warn: 251 191 36;
--warn-dim: 42 36 16;
--bad: 240 82 82;
--bad-dim: 42 22 24;
--info: 59 130 246;
--info-dim: 23 37 84;
--body-text: 195 202 214;
--code-bg: 26 34 48;
}
--wh-bg: 2 6 23;
--wh-surface: 15 23 42;
--wh-surface-2: 30 41 59;
--wh-surface-3: 51 65 85;
--wh-border: 51 65 85;
--wh-border-strong: 71 85 105;
--wh-text: 241 245 249;
--wh-muted: 148 163 184;
--wh-faint: 100 116 139;
--wh-accent: 96 165 250;
--wh-accent-strong: 147 197 253;
--wh-accent-dim: 30 58 138;
--wh-accent-text: 191 219 254;
--wh-accent-border: 30 64 175;
--wh-ok: 34 197 94;
--wh-ok-dim: 16 36 26;
--wh-warn: 251 191 36;
--wh-warn-dim: 42 36 16;
--wh-bad: 240 82 82;
--wh-bad-dim: 42 22 24;
--wh-info: 59 130 246;
--wh-info-dim: 23 37 84;
--wh-body-text: 195 202 214;
--wh-code-bg: 26 34 48;
}
@layer base {
@@ -140,7 +134,7 @@
inset: 0;
z-index: 0;
pointer-events: none;
background-image: radial-gradient(var(--dot) 1px, transparent 1px);
background-image: radial-gradient(var(--wh-dot) 1px, transparent 1px);
background-size: 22px 22px;
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 40%);
}
@@ -154,7 +148,7 @@
.header {
@apply sticky top-0 z-20 flex items-center justify-between gap-4 px-8 py-3.5 border-b border-border;
background: var(--header-bg);
background: var(--wh-header-bg);
backdrop-filter: blur(12px);
}
@@ -426,7 +420,7 @@
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--knob);
background: var(--wh-knob);
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
transition: transform 0.18s;
}
@@ -506,19 +500,38 @@
@apply rounded-[5px] bg-accent-dim px-1.5 py-px font-mono text-accent;
}
/* ---- Drawer / overlay ---- */
.overlay {
@apply fixed inset-0 z-40 backdrop-blur-[2px];
background: var(--scrim);
/* ---- Modal editors (RcDialog wrapper) ---- */
.editor-dialog {
display: flex !important;
flex-direction: column !important;
gap: 0 !important;
max-height: calc(100dvh - 2rem) !important;
overflow: hidden !important;
padding: 0 !important;
}
.editor {
@apply fixed bottom-0 right-0 top-0 z-50 flex w-[min(520px,100vw)] flex-col border-l border-border bg-surface shadow-drawer;
.editor-dialog > div:first-child {
margin-bottom: 0 !important;
flex-shrink: 0 !important;
}
.editor-dialog > div:nth-child(2) {
flex: 1 1 0% !important;
min-height: 0 !important;
display: flex !important;
flex-direction: column !important;
padding: 0 !important;
}
.editor-dialog > div:nth-child(3) {
margin-top: 0 !important;
flex-shrink: 0 !important;
padding: 0 !important;
}
.editor-head {
@apply flex items-center justify-between gap-3 border-b border-border px-6 py-4;
background: var(--header-bg);
background: var(--wh-header-bg);
backdrop-filter: blur(12px);
}
@@ -541,7 +554,7 @@
.editor-body {
@apply flex-1 overflow-y-auto px-6 py-5;
scrollbar-width: thin;
scrollbar-color: var(--scrim) transparent;
scrollbar-color: var(--wh-scrim) transparent;
}
.editor-section {
@@ -972,7 +985,7 @@
.modal-overlay {
@apply fixed inset-0 z-[60] flex items-center justify-center p-6 backdrop-blur-[2px];
background: var(--scrim);
background: var(--wh-scrim);
}
.detail-head {
@@ -1264,13 +1277,3 @@
.fade-leave-to {
opacity: 0;
}
.slide-enter-active,
.slide-leave-active {
transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.slide-enter-from,
.slide-leave-to {
transform: translateX(100%);
}
+40 -168
View File
@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { DeliveryMetrics, Group, Route, SendRecord } from "~/types";
import { collectEvents } from "~/composables/useFilterNode";
import type { DeliveryMetrics, Group, SendRecord } from "~/types";
const props = defineProps<{
groups: Group[];
@@ -14,39 +13,6 @@ const props = defineProps<{
const { t } = useI18n();
const router = useRouter();
const routesByGroup = ref<Record<string, Route[]>>({});
const routesLoading = ref(false);
const allRoutes = computed(() => {
const out: Array<Route & { group?: Group }> = [];
for (const g of props.groups) {
for (const r of routesByGroup.value[g.id] ?? []) out.push({ ...r, group: g });
}
return out;
});
async function loadRoutes() {
if (!props.groups.length) return;
routesLoading.value = true;
const entries = await Promise.all(
props.groups.map(async (g) => {
try {
const data = await apiFetch<{ routes?: Route[] }>(
`/admin/api/groups/${encodeURIComponent(g.id)}/routes`,
);
return [g.id, data.routes ?? []] as const;
} catch {
return [g.id, []] as const;
}
}),
);
routesByGroup.value = Object.fromEntries(entries);
routesLoading.value = false;
}
onMounted(loadRoutes);
watch(() => props.groups, loadRoutes);
const kpis = computed(() => {
const m = props.metrics;
const total = m?.total ?? 0;
@@ -102,24 +68,13 @@ function fmtTime(ts: number): string {
if (d < 86_400_000) return `${Math.round(d / 3_600_000)}h`;
return `${Math.round(d / 86_400_000)}d`;
}
function platformLabel(p?: string): string {
if (p === "telegram") return "TG";
if (p === "feishu") return "FS";
if (p === "discord") return "DC";
return "—";
}
function routeEvents(r: Route): string[] {
return collectEvents(r.ast ?? { all: r.filters });
}
</script>
<template>
<div class="space-y-6">
<!-- KPI cards -->
<section class="grid grid-cols-2 gap-4 xl:grid-cols-4">
<div v-for="k in kpis" :key="k.label" class="rounded border border-border bg-surface p-5">
<RcCard v-for="k in kpis" :key="k.label" variant="outline" padding="md" class="p-5">
<div class="text-[11px] font-bold uppercase tracking-[1.5px] text-faint">{{ k.label }}</div>
<div
class="mt-2 text-2xl font-extrabold tracking-tight [font-variant-numeric:tabular-nums]"
@@ -127,132 +82,49 @@ function routeEvents(r: Route): string[] {
>
{{ metricsLoading ? "—" : k.value }}
</div>
</div>
</RcCard>
</section>
<div class="grid grid-cols-1 gap-6 xl:grid-cols-3">
<!-- Routes overview -->
<section class="rounded border border-border bg-surface xl:col-span-2">
<div class="flex items-center justify-between border-b border-border px-5 py-4">
<h2 class="text-sm font-bold tracking-tight">{{ t("overview.routes") }}</h2>
<span class="text-xs text-faint [font-variant-numeric:tabular-nums]">{{
allRoutes.length
}}</span>
</div>
<!-- Recent send logs -->
<RcCard variant="outline" padding="none">
<div class="flex items-center justify-between border-b border-border px-5 py-4">
<h2 class="text-sm font-bold tracking-tight">{{ t("overview.recent") }}</h2>
<RcButton variant="link" size="xs" @click="router.replace('/admin/logs')">
{{ t("overview.viewAll") }}
</RcButton>
</div>
<div v-if="routesLoading" class="px-5 py-12 text-center text-faint">
{{ t("status.loading") }}
</div>
<div v-else-if="!allRoutes.length" class="px-5 py-12 text-center text-muted">
<p class="mb-3">{{ t("routes.emptyGroup") }}</p>
<button class="btn btn-accent btn-sm" @click="router.replace('/admin/groups')">
{{ t("routes.createFirst") }}
</button>
</div>
<div v-if="logsLoading" class="flex justify-center px-5 py-12 text-faint">
<RcSpinner size="sm" />
</div>
<RcEmptyState v-else-if="!logs.length" :title="t('metrics.empty')" class="px-5 py-12" />
<div v-else class="overflow-x-auto">
<table class="w-full min-w-[560px] text-left text-[13px]">
<thead>
<tr
class="border-b border-border text-[10px] font-bold uppercase tracking-[1.2px] text-faint"
<ul v-else class="divide-y divide-border">
<li
v-for="log in logs.slice(0, 10)"
:key="log.id ?? `${log.ts}-${log.target}`"
class="flex items-center gap-3 px-5 py-3"
>
<span class="dot" :class="log.ok ? 'ok' : 'bad'" />
<div class="min-w-0 flex-1">
<div class="flex items-center gap-2">
<RcBadge
variant="soft"
size="xs"
class="uppercase tracking-wide"
:class="eventBadge(log.event)"
>
<th class="px-5 py-2.5">Route</th>
<th class="px-3 py-2.5">Group</th>
<th class="px-3 py-2.5">Events</th>
<th class="px-3 py-2.5">Targets</th>
<th class="px-5 py-2.5 text-right">State</th>
</tr>
</thead>
<tbody>
<tr
v-for="r in allRoutes.slice(0, 8)"
:key="r.id"
class="cursor-pointer border-b border-border transition-colors last:border-0 hover:bg-surface-2"
@click="router.replace('/admin/groups')"
>
<td class="px-5 py-3">
<div class="font-semibold text-text">{{ r.name || r.id }}</div>
<div class="font-mono text-[11px] text-faint">{{ r.id }}</div>
</td>
<td class="px-3 py-3 text-muted">{{ r.group?.name || "—" }}</td>
<td class="px-3 py-3">
<div class="flex flex-wrap gap-1">
<span
v-for="ev in routeEvents(r).slice(0, 2)"
:key="ev"
class="rounded-full bg-accent-dim px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide text-accent"
>
{{ ev }}
</span>
<span v-if="routeEvents(r).length > 2" class="text-[10px] text-faint">
+{{ routeEvents(r).length - 2 }}
</span>
</div>
</td>
<td class="px-3 py-3">
<div class="flex items-center gap-1">
<span
v-for="tg in r.targets.slice(0, 3)"
:key="tg.channelId ?? tg.chatId ?? platformLabel(tg.platform)"
class="rounded border border-border bg-surface-2 px-1.5 py-0.5 font-mono text-[10px] text-muted"
>
{{ platformLabel(tg.platform) }}
</span>
<span v-if="r.targets.length > 3" class="text-[10px] text-faint">
+{{ r.targets.length - 3 }}
</span>
</div>
</td>
<td class="px-5 py-3 text-right">
<span class="dot" :class="r.enabled ? 'ok' : 'bad'" />
</td>
</tr>
</tbody>
</table>
</div>
</section>
<!-- Recent send logs -->
<section class="rounded border border-border bg-surface">
<div class="flex items-center justify-between border-b border-border px-5 py-4">
<h2 class="text-sm font-bold tracking-tight">{{ t("overview.recent") }}</h2>
<button class="text-xs font-semibold text-accent" @click="router.replace('/admin/logs')">
{{ t("overview.viewAll") }}
</button>
</div>
<div v-if="logsLoading" class="px-5 py-12 text-center text-faint">
{{ t("status.loading") }}
</div>
<div v-else-if="!logs.length" class="px-5 py-12 text-center text-faint">
{{ t("metrics.empty") }}
</div>
<ul v-else class="divide-y divide-border">
<li
v-for="log in logs.slice(0, 10)"
:key="log.id ?? `${log.ts}-${log.target}`"
class="flex items-center gap-3 px-5 py-3"
>
<span class="dot" :class="log.ok ? 'ok' : 'bad'" />
<div class="min-w-0 flex-1">
<div class="flex items-center gap-2">
<span
class="rounded-full px-2 py-0.5 text-[10px] font-bold uppercase tracking-wide"
:class="eventBadge(log.event)"
>
{{ log.event }}
</span>
<span class="truncate text-[12px] text-muted">{{ log.repo || log.target }}</span>
</div>
<div class="mt-0.5 truncate font-mono text-[11px] text-faint">{{ log.target }}</div>
{{ log.event }}
</RcBadge>
<span class="truncate text-[12px] text-muted">{{ log.repo || log.target }}</span>
</div>
<span class="text-[11px] font-medium text-faint [font-variant-numeric:tabular-nums]">
{{ fmtTime(log.ts) }}
</span>
</li>
</ul>
</section>
</div>
<div class="mt-0.5 truncate font-mono text-[11px] text-faint">{{ log.target }}</div>
</div>
<span class="text-[11px] font-medium text-faint [font-variant-numeric:tabular-nums]">
{{ fmtTime(log.ts) }}
</span>
</li>
</ul>
</RcCard>
</div>
</template>
+30
View File
@@ -0,0 +1,30 @@
<template>
<img
src="/logo.svg"
:width="size"
:height="size"
alt="WebHooker"
class="app-logo"
:style="{ width: `${size}px`, height: `${size}px` }"
/>
</template>
<script setup lang="ts">
withDefaults(
defineProps<{
size?: number;
}>(),
{
size: 32,
},
);
</script>
<style scoped>
.app-logo {
display: inline-block;
flex-shrink: 0;
vertical-align: middle;
border-radius: 22%;
}
</style>
+23 -4
View File
@@ -1,13 +1,32 @@
<template>
<div class="toasts">
<div class="recloud-toasts" aria-live="polite" aria-atomic="true">
<TransitionGroup name="toast">
<div v-for="t in toasts" :key="t.id" class="toast" :class="t.kind" @click="dismiss(t.id)">
{{ t.msg }}
</div>
<RcCard
v-for="t in toasts"
:key="t.id"
:variant="t.kind === 'bad' ? 'soft' : 'outline'"
padding="sm"
class="recloud-toast"
:class="t.kind"
role="status"
@click="dismiss(t.id)"
>
<component :is="t.kind === 'bad' ? CircleAlert : CircleCheck" :size="18" />
<span>{{ t.msg }}</span>
<X :size="15" class="toast-close" />
</RcCard>
</TransitionGroup>
</div>
</template>
<script setup lang="ts">
import { CircleAlert, CircleCheck, X } from "lucide-vue-next";
const { toasts, dismiss } = useToasts();
</script>
<style scoped>
.recloud-toasts { position: fixed; z-index: 70; right: 1rem; bottom: 1rem; display: grid; width: min(calc(100vw - 2rem), 390px); gap: .65rem; }
.recloud-toast { display: flex; align-items: center; gap: .7rem; cursor: pointer; box-shadow: 0 16px 38px rgb(var(--wh-text) / .14); } .recloud-toast :deep(.rc-card-body) { display: flex; width: 100%; align-items: center; gap: .7rem; padding: .1rem; } .recloud-toast :deep(svg) { flex: none; color: rgb(var(--wh-ok)); } .recloud-toast.bad :deep(svg) { color: rgb(var(--wh-bad)); } .recloud-toast span { flex: 1; font-size: .8rem; font-weight: 700; } .recloud-toast .toast-close { color: rgb(var(--wh-faint)); }
.toast-enter-active, .toast-leave-active { transition: opacity 180ms ease, transform 180ms ease; } .toast-enter-from, .toast-leave-to { opacity: 0; transform: translateX(16px); }
</style>
+20 -15
View File
@@ -4,25 +4,25 @@
<span class="kpi-label">{{ t("audit.title") }}</span>
<div class="log-filters">
<label class="filter-label">{{ t("audit.filterGroup") }}</label>
<select
<RcSelect
class="filter-select"
:value="selectedGroupId"
:model-value="selectedGroupId || 'all'"
:options="groupOptions"
:disabled="loading"
@change="onGroupFilter"
>
<option value="">{{ t("audit.allGroups") }}</option>
<option v-for="g in groups" :key="g.id" :value="g.id">
{{ g.name || g.id }}
</option>
</select>
@update:model-value="onGroupFilter"
/>
</div>
<button class="btn btn-ghost btn-sm" :disabled="loading" @click="refresh">
<RcButton variant="ghost" size="sm" :disabled="loading" @click="refresh">
{{ t("audit.refresh") }}
</button>
</RcButton>
</div>
<p v-if="error" class="err">{{ error }}</p>
<p v-else-if="!loading && !entries.length" class="empty-log">{{ t("audit.empty") }}</p>
<RcEmptyState
v-else-if="!loading && !entries.length"
:title="t('audit.empty')"
class="empty-log"
/>
<div class="log-list">
<article v-for="e in entries" :key="e.id ?? e.ts" class="log-entry">
@@ -57,7 +57,7 @@ import type { AuditEntry, Group } from "~/types";
const { t } = useI18n();
defineProps<{
const props = defineProps<{
entries: AuditEntry[];
loading: boolean;
error: string;
@@ -74,8 +74,13 @@ function refresh(): void {
emit("refresh");
}
function onGroupFilter(e: Event): void {
emit("update:selectedGroupId", (e.target as HTMLSelectElement).value);
const groupOptions = computed(() => [
{ label: t("audit.allGroups"), value: "all" },
...props.groups.map((g) => ({ label: g.name || g.id, value: g.id })),
]);
function onGroupFilter(value: string): void {
emit("update:selectedGroupId", value === "all" ? "" : value);
emit("filter");
}
</script>
+108 -155
View File
@@ -1,122 +1,65 @@
<template>
<div class="flex min-h-screen bg-bg text-text">
<!-- Sidebar -->
<aside
class="sticky top-0 z-30 flex h-screen w-[240px] flex-shrink-0 flex-col border-r border-border bg-surface max-lg:hidden"
>
<div class="flex items-center gap-3 px-5 py-5">
<div class="brand-mark" aria-hidden="true">
<svg
viewBox="0 0 64 64"
class="h-[22px] w-[22px]"
fill="none"
stroke="currentColor"
stroke-width="6"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M41 23 V35.5 A10.5 10.5 0 0 1 20 35.5 L28 25.5" />
<circle cx="41" cy="18" r="4.5" fill="currentColor" stroke="none" />
</svg>
</div>
<div>
<div class="text-sm font-extrabold tracking-tight">WebHooker</div>
<div class="text-[10px] font-semibold uppercase tracking-[2px] text-faint">
{{ t("app.tagline") }}
</div>
</div>
</div>
<nav class="flex-1 space-y-0.5 px-3">
<div class="console-shell">
<aside class="console-sidebar">
<NuxtLink class="console-brand" to="/">
<AppLogo :size="32" />
<span><strong>WebHooker</strong><small>{{ t("app.tagline") }}</small></span>
</NuxtLink>
<p class="console-nav-label">{{ t("app.tagline") }}</p>
<nav class="console-nav">
<button
v-for="n in nav"
:key="n.id"
class="flex w-full items-center gap-3 rounded-[8px] px-3 py-2 text-[13px] font-semibold transition-colors"
:class="
n.id === activeNav
? 'bg-accent-dim text-accent'
: 'text-muted hover:bg-surface-2 hover:text-text'
"
class="console-nav-item"
:class="{ active: n.id === activeNav }"
@click="switchView(n.id)"
>
<span
class="h-1.5 w-1.5 rounded-full"
:class="n.id === activeNav ? 'bg-accent' : 'bg-border-strong'"
/>
<component :is="navIcon(n.id)" :size="17" :stroke-width="1.8" />
{{ n.label }}
</button>
</nav>
<div class="border-t border-border px-3 py-4">
<a
class="block rounded-[8px] px-3 py-2 text-[13px] font-semibold text-muted transition-colors hover:bg-surface-2"
href="/admin/logout"
>
{{ t("app.signOut") }}
</a>
<div class="console-sidebar-footer">
<a href="/admin/logout"><LogOut :size="16" />{{ t("app.signOut") }}</a>
</div>
</aside>
<!-- Main column -->
<div class="flex min-w-0 flex-1 flex-col">
<header
class="sticky top-0 z-20 flex items-center justify-between gap-4 border-b border-border px-6 py-3"
style="background: var(--header-bg); backdrop-filter: blur(12px)"
>
<div class="console-main">
<header class="console-topbar">
<div>
<h1 class="text-[15px] font-extrabold tracking-tight">{{ pageTitle }}</h1>
<p v-if="needLogin" class="text-[11px] text-faint">{{ t("login.title") }}</p>
<p v-else class="text-[11px] text-faint">
{{ loadingAny ? t("status.loading") : t("status.connected") }}
</p>
<p class="console-kicker">WebHooker / {{ activeNav }}</p>
<h1>{{ pageTitle }}</h1>
</div>
<div class="flex items-center gap-2">
<button v-if="view === 'overview'" class="btn btn-ghost btn-sm" @click="refreshOverview">
{{ t("metrics.refresh") }}
</button>
<button class="btn btn-ghost btn-sm" @click="toggle">{{ t("app.langToggle") }}</button>
<button
<div class="console-actions">
<RcBadge v-if="!needLogin && loadingAny" variant="soft" size="sm" dot class="console-status">
{{ t("status.loading") }}
</RcBadge>
<RcButton v-if="view === 'overview'" variant="ghost" size="sm" @click="refreshOverview"><RefreshCw :size="15" />{{ t("metrics.refresh") }}</RcButton>
<ThemeToggle />
<RcButton variant="ghost" size="sm" @click="toggle"><Languages :size="15" />{{ t("app.langToggle") }}</RcButton>
<RcButton
v-if="!needLogin && selectedGroup && canEditRoutes(selectedGroup.id)"
class="btn btn-accent btn-sm"
@click="openNew"
>
{{ t("app.newRoute") }}
</button>
<button
><Plus :size="16" />{{ t("app.newRoute") }}</RcButton>
<RcButton
v-if="!needLogin && !selectedGroup && view === 'groups' && isSuper"
class="btn btn-accent btn-sm"
@click="openNewGroup"
>
{{ t("app.newGroup") }}
</button>
><Plus :size="16" />{{ t("app.newGroup") }}</RcButton>
</div>
</header>
<!-- Mobile nav -->
<nav class="flex gap-1 overflow-x-auto border-b border-border px-4 py-2 lg:hidden">
<button
v-for="n in nav"
:key="n.id"
class="whitespace-nowrap rounded-[7px] px-3 py-1.5 text-[13px] font-semibold transition-colors"
:class="n.id === activeNav ? 'bg-accent-dim text-accent' : 'text-muted'"
@click="switchView(n.id)"
>
{{ n.label }}
</button>
</nav>
<div class="console-mobile-nav"><RcTabs :model-value="activeNav" :items="mobileNav" @update:model-value="switchView($event as View)" /></div>
<main class="mx-auto w-full max-w-[1180px] px-6 pb-24 pt-6 max-sm:px-4">
<div v-if="needLogin" class="login">
<div class="login-card">
<main class="console-content">
<div v-if="needLogin" class="console-login">
<RcCard variant="outline" padding="lg" class="console-login-card">
<template #header><LockKeyhole :size="24" /></template>
<h2>{{ t("login.title") }}</h2>
<p v-if="forbidden">{{ t("login.forbidden") }}</p>
<p v-else>{{ t("login.prompt") }}</p>
<a class="btn btn-accent btn-lg" href="/admin/login">{{ t("login.button") }}</a>
</div>
<p>{{ forbidden ? t("login.forbidden") : t("login.prompt") }}</p>
<a href="/admin/login"><RcButton size="lg"><LogIn :size="17" />{{ t("login.button") }}</RcButton></a>
</RcCard>
</div>
<template v-else>
<!-- Overview dashboard -->
<AdminHome
v-if="view === 'overview'"
:key="refreshKey"
@@ -128,22 +71,13 @@
:metrics-loading="metricsLoading"
/>
<!-- Group detail view -->
<template v-else-if="selectedGroup">
<section class="toolbar">
<div class="crumbs">
<button class="btn btn-ghost btn-sm" @click="exitGroup">
{{ t("group.back") }}
</button>
<span class="kpi-label">{{
t("group.routesIn", { name: selectedGroup.name })
}}</span>
<span class="kpi">{{ groupRoutes.length }}</span>
</div>
<div class="status">
<span class="dot" :class="groupRoutesLoading ? '' : 'ok'"></span>
<span>{{ groupRoutesLoading ? t("status.loading") : t("status.connected") }}</span>
<section class="console-context-bar">
<div>
<RcButton variant="ghost" size="sm" @click="exitGroup"><ArrowLeft :size="15" />{{ t("group.back") }}</RcButton>
<p>{{ t("group.routesIn", { name: selectedGroup.name }) }}</p>
</div>
<RcBadge :variant="groupRoutesLoading ? 'soft' : 'success'" size="sm" dot>{{ groupRoutes.length }}</RcBadge>
</section>
<p v-if="groupRoutesError" class="err">{{ groupRoutesError }}</p>
@@ -164,15 +98,10 @@
/>
</section>
<section v-if="!groupRoutesLoading && !groupRoutes.length" class="empty">
<p>{{ t("routes.emptyGroup") }}</p>
<button
v-if="canEditRoutes(selectedGroup.id)"
class="btn btn-accent"
@click="openNew"
>
{{ t("routes.createFirst") }}
</button>
<section v-if="!groupRoutesLoading && !groupRoutes.length" class="console-empty">
<RcEmptyState :title="t('routes.emptyGroup')">
<RcButton v-if="canEditRoutes(selectedGroup.id)" @click="openNew"><Plus :size="16" />{{ t("routes.createFirst") }}</RcButton>
</RcEmptyState>
</section>
<MembersPanel
@@ -189,48 +118,39 @@
/>
</template>
<!-- Top-level views -->
<template v-else-if="view === 'groups'">
<section class="toolbar">
<div>
<span class="kpi-label">{{ t("kpi.groups") }}</span>
<span class="kpi">{{ groups.length }}</span>
</div>
<div class="status">
<span class="dot" :class="groupsLoading ? '' : 'ok'"></span>
<span>{{ groupsLoading ? t("status.loading") : t("status.connected") }}</span>
</div>
<section class="console-context-bar">
<div><p>{{ t("kpi.groups") }}</p><strong>{{ groups.length }}</strong></div>
<RcBadge v-if="groupsLoading" variant="soft" size="sm" dot>{{ t("status.loading") }}</RcBadge>
</section>
<p v-if="groupsError" class="err">{{ groupsError }}</p>
<section class="routes">
<article
<RcCard
v-for="(g, i) in groups"
:key="g.id"
class="card cursor-pointer"
variant="outline"
:hoverable="true"
padding="md"
class="console-group-card"
:style="{ animationDelay: i * 45 + 'ms' }"
@click="enterGroup(g)"
>
<div class="card-head">
<div class="card-title">
<template #header><div class="card-head"><div class="card-title">
<span class="route-name">{{ g.name || t("route.untitled") }}</span>
<span class="route-id">{{ g.id }}</span>
<span v-if="roleOf(g.id)" class="badge lang">{{
t("role.badge", { role: t("roles." + roleOf(g.id)) })
}}</span>
<RcBadge v-if="roleOf(g.id)" variant="brand" size="xs">{{ t("role.badge", { role: t("roles." + roleOf(g.id)) }) }}</RcBadge>
</div>
<div v-if="canEditGroup(g.id)" class="card-actions" @click.stop>
<button
class="icon-btn"
<RcButton
variant="ghost" size="icon"
:title="t('groupEditor.editTitle')"
@click="openEditGroup(g)"
>
✎
</button>
<button class="icon-btn danger" @click="onDeleteGroup(g)">✕</button>
><Pencil :size="15" /></RcButton>
<RcButton variant="ghost" color="error" size="icon" @click="onDeleteGroup(g)"><Trash2 :size="15" /></RcButton>
</div>
</div>
</div></template>
<div class="target">
<span
><b>{{ t("groups.members") }}</b
@@ -245,27 +165,17 @@
}}</code></span
>
</div>
<div class="group-open mt-2.5 text-right text-xs font-medium text-accent">
{{ t("groups.open") }}
</div>
</article>
<template #footer><span class="console-open"><ArrowRight :size="15" />{{ t("groups.open") }}</span></template>
</RcCard>
</section>
<section v-if="!groupsLoading && !groups.length" class="empty">
<p>{{ t("groups.empty") }}</p>
<button v-if="isSuper" class="btn btn-accent" @click="openNewGroup">
{{ t("groups.createFirst") }}
</button>
<section v-if="!groupsLoading && !groups.length" class="console-empty">
<RcEmptyState :title="t('groups.empty')"><RcButton v-if="isSuper" @click="openNewGroup"><Plus :size="16" />{{ t("groups.createFirst") }}</RcButton></RcEmptyState>
</section>
</template>
<template v-else-if="view === 'logs'">
<section class="toolbar">
<div class="status">
<span class="dot" :class="logsLoading ? '' : 'ok'"></span>
<span>{{ logsLoading ? t("status.loading") : t("status.connected") }}</span>
</div>
</section>
<section v-if="logsLoading" class="console-context-bar"><RcBadge variant="soft" size="sm" dot>{{ t("status.loading") }}</RcBadge></section>
<SendLogs
:logs="logs"
:loading="logsLoading"
@@ -328,6 +238,23 @@
</template>
<script setup lang="ts">
import {
Activity,
ArrowLeft,
ArrowRight,
ClipboardList,
Gauge,
Languages,
Layers3,
LockKeyhole,
LogIn,
LogOut,
Pencil,
Plus,
RefreshCw,
ShieldCheck,
Trash2,
} from "lucide-vue-next";
import type { Group, Route } from "~/types";
import { useAuditApi } from "~/composables/useAudit";
import WebhookPanel from "~/components/WebhookPanel.vue";
@@ -370,6 +297,19 @@ const nav = computed(() => [
{ id: "metrics" as View, label: t("tab.metrics"), path: "/admin/metrics" },
]);
const mobileNav = computed(() => nav.value.map(({ id, label }) => ({ value: id, label, icon: navIcon(id) })));
function navIcon(id: View) {
const icons = {
overview: Gauge,
groups: Layers3,
logs: Activity,
audit: ClipboardList,
metrics: ShieldCheck,
} satisfies Record<View, typeof Gauge>;
return icons[id];
}
const activeNav = computed<View>(() => view.value ?? "overview");
const pageTitle = computed(() => {
@@ -652,3 +592,16 @@ async function onDeleteGroup(group: Group): Promise<void> {
}
}
</script>
<style scoped>
.console-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; background: rgb(var(--wh-bg)); color: rgb(var(--wh-text)); }
.console-sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; border-right: 1px solid rgb(var(--wh-border)); background: linear-gradient(165deg, rgb(var(--wh-surface)), rgb(var(--wh-surface-2))); padding: 1.25rem .85rem; }
.console-brand { display: flex; align-items: center; gap: .7rem; padding: .45rem .55rem 1.75rem; color: rgb(var(--wh-text)); text-decoration: none; } .console-brand :deep(svg) { color: rgb(var(--wh-accent)); } .console-brand span { display: grid; gap: .1rem; } .console-brand strong { font-size: 1rem; letter-spacing: -.04em; } .console-brand small, .console-nav-label, .console-kicker { color: rgb(var(--wh-faint)); font-size: .62rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.console-nav-label { margin: 0 .65rem .45rem; } .console-nav { display: grid; gap: .2rem; } .console-nav-item { display: flex; align-items: center; gap: .7rem; width: 100%; border: 0; border-radius: .65rem; background: transparent; padding: .7rem; color: rgb(var(--wh-muted)); font: inherit; font-size: .82rem; font-weight: 700; text-align: left; transition: background-color 150ms ease, color 150ms ease; cursor: pointer; } .console-nav-item:hover { background: rgb(var(--wh-surface-2)); color: rgb(var(--wh-text)); } .console-nav-item.active { background: rgb(var(--wh-accent)); color: white; box-shadow: 0 8px 18px rgb(var(--wh-accent) / .2); }
.console-sidebar-footer { display: grid; gap: .9rem; margin-top: auto; padding: .9rem .55rem .25rem; border-top: 1px solid rgb(var(--wh-border)); } .console-sidebar-footer a { display: inline-flex; align-items: center; gap: .55rem; color: rgb(var(--wh-muted)); font-size: .8rem; font-weight: 700; text-decoration: none; } .console-sidebar-footer a:hover { color: rgb(var(--wh-bad)); }
.console-main { min-width: 0; } .console-topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid rgb(var(--wh-border)); background: color-mix(in srgb, rgb(var(--wh-bg)) 87%, transparent); padding: .8rem clamp(1rem, 3vw, 2.5rem); backdrop-filter: blur(18px); } .console-topbar h1 { margin: .1rem 0 0; font-size: 1.15rem; letter-spacing: -.035em; } .console-kicker { margin: 0; } .console-actions { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; } .console-status { white-space: nowrap; }
.console-mobile-nav { display: none; } .console-content { width: min(100% - 2rem, 1240px); margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.5rem) 0 5rem; } .console-login { display: grid; min-height: 62vh; place-items: center; } .console-login-card { width: min(100%, 430px); text-align: center; } .console-login-card :deep(.rc-card-header) { justify-content: center; color: rgb(var(--wh-accent)); } .console-login-card h2 { margin: .35rem 0 .65rem; font-size: 1.35rem; letter-spacing: -.035em; } .console-login-card p { margin: 0 0 1.4rem; color: rgb(var(--wh-muted)); }
.console-context-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: .8rem 1rem; border: 1px solid rgb(var(--wh-border)); border-radius: .85rem; background: rgb(var(--wh-surface) / .6); } .console-context-bar > div { display: flex; align-items: center; gap: .8rem; } .console-context-bar p { margin: 0; color: rgb(var(--wh-muted)); font-size: .8rem; font-weight: 700; } .console-context-bar strong { font-size: 1.25rem; letter-spacing: -.04em; } .console-empty { padding: 4rem 1rem; } .console-group-card { cursor: pointer; } .console-open { display: inline-flex; align-items: center; gap: .35rem; color: rgb(var(--wh-accent)); font-size: .75rem; font-weight: 800; }
@media (max-width: 900px) { .console-shell { display: block; } .console-sidebar { display: none; } .console-mobile-nav { display: block; border-bottom: 1px solid rgb(var(--wh-border)); padding: .5rem 1rem; overflow-x: auto; } .console-mobile-nav :deep(.rc-tabs) { min-width: max-content; } }
@media (max-width: 620px) { .console-topbar { align-items: flex-start; flex-direction: column; } .console-actions { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: .05rem; } .console-status { display: none; } .console-content { width: min(100% - 1.25rem, 1240px); } }
</style>
+30 -29
View File
@@ -15,6 +15,9 @@ const emit = defineEmits<{ (e: "remove"): void }>();
const { t } = useI18n();
const NODE_KINDS = ["all", "any"] as const;
const filterTypeOptions = computed(() => FILTER_TYPES.map((value) => ({ label: t("filter." + value), value })));
const filterOpOptions = computed(() => FILTER_OPS.map((value) => ({ label: t("filterOp." + value), value })));
const nodeKindOptions = computed(() => NODE_KINDS.map((value) => ({ label: t("filterNode." + value), value })));
function addChild(kind: "leaf" | "all" | "any" | "not"): void {
props.node.children.push(blankNode(kind));
@@ -33,25 +36,22 @@ function unwrapNot(): void {
<template>
<div class="node-editor" :class="{ 'node-nested': depth > 0 }">
<div v-if="node.kind === 'leaf'" class="leaf-row">
<select v-model="node.leaf.type" class="node-select">
<option v-for="ft in FILTER_TYPES" :key="ft" :value="ft">{{ t("filter." + ft) }}</option>
</select>
<RcSelect v-model="node.leaf.type" class="node-select" :options="filterTypeOptions" />
<input
<RcInput
v-if="node.leaf.type === 'field'"
v-model="node.leaf.path"
class="input node-path"
:placeholder="t('routeEditor.pathPlaceholder')"
/>
<select
<RcSelect
v-if="node.leaf.type !== 'keyword'"
v-model="node.leaf.op"
class="node-select"
:options="filterOpOptions"
:title="t('routeEditor.op')"
>
<option v-for="op in FILTER_OPS" :key="op" :value="op">{{ t("filterOp." + op) }}</option>
</select>
/>
<TagInput
v-if="node.leaf.type === 'keyword' || node.leaf.op !== 'exists'"
@@ -60,46 +60,45 @@ function unwrapNot(): void {
:placeholder="t('routeEditor.valuesPlaceholder')"
/>
<label class="inline node-exclude" :title="t('routeEditor.not')">
<input v-model="node.leaf.exclude" type="checkbox" />
<span>{{ t("routeEditor.not") }}</span>
</label>
<RcCheckbox v-model="node.leaf.exclude" class="node-exclude" :label="t('routeEditor.not')" :title="t('routeEditor.not')" />
<button
<RcButton
v-if="deletable"
type="button"
variant="destructive"
size="icon"
class="icon-btn danger"
:title="t('routeEditor.remove')"
@click="emit('remove')"
>
✕
</button>
</RcButton>
</div>
<div v-else-if="node.kind === 'all' || node.kind === 'any'" class="node-group">
<div class="node-group-head">
<select v-model="node.kind" class="node-combo">
<option v-for="k in NODE_KINDS" :key="k" :value="k">{{ t("filterNode." + k) }}</option>
</select>
<RcSelect v-model="node.kind" class="node-combo" :options="nodeKindOptions" />
<div class="node-actions">
<button type="button" class="btn btn-ghost node-add" @click="addChild('leaf')">
<RcButton type="button" variant="ghost" size="xs" class="node-add" @click="addChild('leaf')">
+ {{ t("routeEditor.addLeaf") }}
</button>
<button type="button" class="btn btn-ghost node-add" @click="addChild('all')">
</RcButton>
<RcButton type="button" variant="ghost" size="xs" class="node-add" @click="addChild('all')">
+ {{ t("routeEditor.addGroup") }}
</button>
<button type="button" class="btn btn-ghost node-add" @click="addChild('not')">
</RcButton>
<RcButton type="button" variant="ghost" size="xs" class="node-add" @click="addChild('not')">
+ {{ t("routeEditor.addNot") }}
</button>
<button
</RcButton>
<RcButton
v-if="deletable"
type="button"
variant="destructive"
size="icon"
class="icon-btn danger"
:title="t('routeEditor.remove')"
@click="emit('remove')"
>
✕
</button>
</RcButton>
</div>
</div>
<div class="node-children">
@@ -119,18 +118,20 @@ function unwrapNot(): void {
<div class="node-group-head">
<span class="node-combo node-combo-label">{{ t("filterNode.not") }}</span>
<div class="node-actions">
<button type="button" class="btn btn-ghost node-add" @click="unwrapNot">
<RcButton type="button" variant="ghost" size="xs" class="node-add" @click="unwrapNot">
{{ t("filterNode.unwrap") }}
</button>
<button
</RcButton>
<RcButton
v-if="deletable"
type="button"
variant="destructive"
size="icon"
class="icon-btn danger"
:title="t('routeEditor.remove')"
@click="emit('remove')"
>
✕
</button>
</RcButton>
</div>
</div>
<div class="node-children">
+256 -235
View File
@@ -1,240 +1,235 @@
<template>
<Teleport to="body">
<Transition name="fade">
<div v-if="open" class="overlay" @click.self="close"></div>
</Transition>
<Transition name="slide">
<aside v-if="open" class="editor" role="dialog" aria-modal="true">
<div class="editor-head">
<div class="editor-heading">
<span class="editor-eyebrow">{{ t("groupEditor.eyebrow") }}</span>
<h2>{{ isEdit ? t("groupEditor.editTitle") : t("groupEditor.newTitle") }}</h2>
<RcDialog
:open="open"
:title="isEdit ? t('groupEditor.editTitle') : t('groupEditor.newTitle')"
class="editor-dialog flex flex-col gap-0 max-h-[calc(100dvh-2rem)] overflow-hidden p-0 max-w-2xl"
@update:open="onOpenChange"
>
<template #header>
<div class="editor-head">
<div class="editor-heading">
<span class="editor-eyebrow">{{ t("groupEditor.eyebrow") }}</span>
<h2>{{ isEdit ? t("groupEditor.editTitle") : t("groupEditor.newTitle") }}</h2>
</div>
</div>
</template>
<form class="editor-body" @submit.prevent="save">
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionBasic") }}</h3>
<div class="row2">
<div class="field">
<label>{{ t("groupEditor.name") }}</label>
<RcInput
v-model="form.name"
type="text"
:placeholder="t('groupEditor.namePlaceholder')"
required
/>
</div>
<div class="field">
<label>{{ t("groupEditor.id") }}</label>
<RcInput
v-model="form.id"
type="text"
:placeholder="t('groupEditor.idPlaceholder')"
required
/>
<div class="hint">
{{ isEdit ? t("groupEditor.renameHint") : t("groupEditor.idHint") }}
</div>
</div>
<button class="icon-btn" :title="t('groupEditor.close')" @click="close">✕</button>
</div>
<form class="editor-body" @submit.prevent="save">
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionBasic") }}</h3>
<div class="row2">
<div class="field">
<label>{{ t("groupEditor.name") }}</label>
<input
v-model="form.name"
type="text"
class="input"
:placeholder="t('groupEditor.namePlaceholder')"
required
/>
</div>
<div class="field">
<label>{{ t("groupEditor.id") }}</label>
<input
v-model="form.id"
type="text"
class="input"
:placeholder="t('groupEditor.idPlaceholder')"
required
/>
<div class="hint">
{{ isEdit ? t("groupEditor.renameHint") : t("groupEditor.idHint") }}
</div>
</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionPreferences") }}</h3>
<div class="row2">
<div class="field">
<label>{{ t("groupEditor.language") }}</label>
<input
v-model="form.lang"
type="text"
class="input"
:placeholder="t('groupEditor.langPlaceholder')"
/>
<div class="hint">{{ t("groupEditor.langHint") }}</div>
</div>
<div class="field">
<label
>{{ t("groupEditor.emoji") }}
<span class="lbl-note">{{ t("groupEditor.emojiNote") }}</span></label
>
<label class="inline">
<input v-model="form.emoji" type="checkbox" />
<span>{{ t("groupEditor.emojiLabel") }}</span>
</label>
</div>
</div>
<div class="field">
<label
>{{ t("groupEditor.forgeSources") }}
<span class="lbl-note">{{ t("groupEditor.forgeSourcesNote") }}</span></label
>
<div v-for="(s, i) in form.forgeSources" :key="i" class="forge-source-row">
<input
v-model="s.host"
type="text"
class="input f-host"
:placeholder="t('groupEditor.forgeSourcesHost')"
/>
<select v-model="s.type" class="select forge-type">
<option value="github">GitHub</option>
<option value="gitea">Gitea</option>
</select>
<button
type="button"
class="icon-btn danger"
@click="form.forgeSources.splice(i, 1)"
>
✕
</button>
<input
v-model="s.name"
type="text"
class="input f-name"
:placeholder="t('groupEditor.forgeSourcesName')"
/>
</div>
<button type="button" class="btn btn-ghost add-filter" @click="addForgeSource">
{{ t("groupEditor.forgeSourcesAdd") }}
</button>
<div class="hint">{{ t("groupEditor.forgeSourcesHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionAccess") }}</h3>
<div class="field">
<label
>{{ t("groupEditor.membersNote") }}
<span class="lbl-note">{{ t("groupEditor.membersHint") }}</span></label
>
<p class="hint">
{{ t("groupEditor.membersGoPanel") }}
</p>
</div>
<div v-if="superAdmin" class="field">
<label
>{{ t("groupEditor.owners") }}
<span class="lbl-note">{{ t("groupEditor.ownersNote") }}</span></label
>
<input
v-model="form.owners"
type="text"
class="input"
:placeholder="t('groupEditor.ownersPlaceholder')"
/>
<div class="hint">{{ t("groupEditor.ownersHint") }}</div>
</div>
<div v-else class="field">
<label
>{{ t("groupEditor.owners") }}
<span class="lbl-note">{{ t("groupEditor.ownersSuperOnly") }}</span></label
>
<input v-model="ownersReadonly" type="text" class="input opacity-60" disabled />
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionProviders") }}</h3>
<div class="field">
<label
>{{ t("groupEditor.providers") }}
<span class="lbl-note">{{ t("groupEditor.providersNote") }}</span></label
>
<div class="flex flex-wrap gap-4">
<label class="inline">
<input
type="checkbox"
:checked="form.providers.includes('github')"
@change="toggleProvider('github', $event)"
/>
<span>GitHub</span>
</label>
<label class="inline">
<input
type="checkbox"
:checked="form.providers.includes('gitea')"
@change="toggleProvider('gitea', $event)"
/>
<span>Gitea</span>
</label>
</div>
<div class="hint">{{ t("groupEditor.providersHint") }}</div>
</div>
<div class="field">
<label
>{{ t("groupEditor.installationId") }}
<span class="lbl-note">{{ t("groupEditor.installationIdNote") }}</span></label
>
<input
v-model="form.installationId"
type="text"
class="input"
inputmode="numeric"
:placeholder="t('groupEditor.installationIdPlaceholder')"
/>
<div class="hint">{{ t("groupEditor.installationIdHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionLog") }}</h3>
<div class="field">
<label
>{{ t("groupEditor.logTarget") }}
<span class="lbl-note">{{ t("groupEditor.logTargetNote") }}</span></label
>
<select v-model="form.logPlatform" class="select">
<option value="">{{ t("groupEditor.logDisabled") }}</option>
<option value="discord">Discord</option>
<option value="telegram">Telegram</option>
<option value="feishu">{{ t("groupEditor.logFeishu") }}</option>
</select>
<template v-if="form.logPlatform === 'discord'">
<input
v-model="form.logChannelId"
type="text"
class="input mt-2"
:placeholder="t('routeEditor.channelPlaceholder')"
/>
<input
v-model="form.logThreadId"
type="text"
class="input mt-2"
:placeholder="t('routeEditor.threadPlaceholder')"
/>
</template>
<template
v-else-if="form.logPlatform === 'telegram' || form.logPlatform === 'feishu'"
>
<input
v-model="form.logChatId"
type="text"
class="input mt-2"
:placeholder="t('routeEditor.chatPlaceholder')"
/>
<input
v-if="form.logPlatform === 'telegram'"
v-model="form.logTopicId"
type="text"
class="input mt-2"
:placeholder="t('routeEditor.topicPlaceholder')"
/>
</template>
<div class="hint">{{ t("groupEditor.logTargetHint") }}</div>
</div>
</section>
<div class="err">{{ formError }}</div>
</form>
<div class="editor-foot">
<button class="btn btn-ghost" type="button" @click="close">
{{ t("groupEditor.cancel") }}
</button>
<button class="btn btn-accent" type="button" :disabled="saving" @click="save">
{{ t("groupEditor.save") }}
</button>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionPreferences") }}</h3>
<div class="row2">
<div class="field">
<label>{{ t("groupEditor.language") }}</label>
<RcInput
v-model="form.lang"
type="text"
:placeholder="t('groupEditor.langPlaceholder')"
/>
<div class="hint">{{ t("groupEditor.langHint") }}</div>
</div>
<div class="field">
<label
>{{ t("groupEditor.emoji") }}
<span class="lbl-note">{{ t("groupEditor.emojiNote") }}</span></label
>
<RcSwitch v-model="form.emoji" :label="t('groupEditor.emojiLabel')" />
</div>
</div>
</aside>
</Transition>
</Teleport>
<div class="field">
<label
>{{ t("groupEditor.forgeSources") }}
<span class="lbl-note">{{ t("groupEditor.forgeSourcesNote") }}</span></label
>
<div v-for="(s, i) in form.forgeSources" :key="i" class="forge-source-row">
<RcInput
v-model="s.host"
type="text"
class="[grid-area:host]"
:placeholder="t('groupEditor.forgeSourcesHost')"
/>
<RcSelect
v-model="s.type"
class="w-[110px] [grid-area:type]"
:options="[
{ label: 'GitHub', value: 'github' },
{ label: 'Gitea', value: 'gitea' },
]"
/>
<RcButton
type="button"
variant="destructive"
size="icon"
class="[grid-area:del] justify-self-end"
@click="form.forgeSources.splice(i, 1)"
>
✕
</RcButton>
<RcInput
v-model="s.name"
type="text"
class="[grid-area:name]"
:placeholder="t('groupEditor.forgeSourcesName')"
/>
</div>
<RcButton type="button" variant="ghost" class="add-filter" @click="addForgeSource">
{{ t("groupEditor.forgeSourcesAdd") }}
</RcButton>
<div class="hint">{{ t("groupEditor.forgeSourcesHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionAccess") }}</h3>
<div class="field">
<label
>{{ t("groupEditor.membersNote") }}
<span class="lbl-note">{{ t("groupEditor.membersHint") }}</span></label
>
<p class="hint">
{{ t("groupEditor.membersGoPanel") }}
</p>
</div>
<div v-if="superAdmin" class="field">
<label
>{{ t("groupEditor.owners") }}
<span class="lbl-note">{{ t("groupEditor.ownersNote") }}</span></label
>
<RcTagInput
v-model="owners"
separator=","
:placeholder="t('groupEditor.ownersPlaceholder')"
/>
<div class="hint">{{ t("groupEditor.ownersHint") }}</div>
</div>
<div v-else class="field">
<label
>{{ t("groupEditor.owners") }}
<span class="lbl-note">{{ t("groupEditor.ownersSuperOnly") }}</span></label
>
<RcInput v-model="ownersReadonly" type="text" class="opacity-60" disabled />
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionProviders") }}</h3>
<div class="field">
<label
>{{ t("groupEditor.providers") }}
<span class="lbl-note">{{ t("groupEditor.providersNote") }}</span></label
>
<div class="flex flex-wrap gap-4">
<RcCheckbox
:model-value="form.providers.includes('github')"
label="GitHub"
@update:model-value="toggleProvider('github', $event)"
/>
<RcCheckbox
:model-value="form.providers.includes('gitea')"
label="Gitea"
@update:model-value="toggleProvider('gitea', $event)"
/>
</div>
<div class="hint">{{ t("groupEditor.providersHint") }}</div>
</div>
<div class="field">
<label
>{{ t("groupEditor.installationId") }}
<span class="lbl-note">{{ t("groupEditor.installationIdNote") }}</span></label
>
<RcInput
v-model="form.installationId"
type="text"
inputmode="numeric"
:placeholder="t('groupEditor.installationIdPlaceholder')"
/>
<div class="hint">{{ t("groupEditor.installationIdHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("groupEditor.sectionLog") }}</h3>
<div class="field">
<label
>{{ t("groupEditor.logTarget") }}
<span class="lbl-note">{{ t("groupEditor.logTargetNote") }}</span></label
>
<RcSelect
:model-value="form.logPlatform || 'none'"
:options="[
{ label: t('groupEditor.logDisabled'), value: 'none' },
{ label: 'Discord', value: 'discord' },
{ label: 'Telegram', value: 'telegram' },
{ label: t('groupEditor.logFeishu'), value: 'feishu' },
]"
@update:model-value="form.logPlatform = ($event === 'none' ? '' : $event) as '' | 'discord' | 'telegram' | 'feishu'"
/>
<template v-if="form.logPlatform === 'discord'">
<RcInput
v-model="form.logChannelId"
type="text"
class="mt-2"
:placeholder="t('routeEditor.channelPlaceholder')"
/>
<RcInput
v-model="form.logThreadId"
type="text"
class="mt-2"
:placeholder="t('routeEditor.threadPlaceholder')"
/>
</template>
<template v-else-if="form.logPlatform === 'telegram' || form.logPlatform === 'feishu'">
<RcInput
v-model="form.logChatId"
type="text"
class="mt-2"
:placeholder="t('routeEditor.chatPlaceholder')"
/>
<RcInput
v-if="form.logPlatform === 'telegram'"
v-model="form.logTopicId"
type="text"
class="mt-2"
:placeholder="t('routeEditor.topicPlaceholder')"
/>
</template>
<div class="hint">{{ t("groupEditor.logTargetHint") }}</div>
</div>
</section>
<div class="err">{{ formError }}</div>
</form>
<template #footer>
<div class="editor-foot">
<RcButton variant="ghost" type="button" @click="close">
{{ t("groupEditor.cancel") }}
</RcButton>
<RcButton variant="primary" type="button" :loading="saving" @click="save">
{{ t("groupEditor.save") }}
</RcButton>
</div>
</template>
</RcDialog>
</template>
<script setup lang="ts">
@@ -273,12 +268,21 @@ const form = reactive({
logChatId: "",
logTopicId: "",
});
const owners = computed({
get: () =>
form.owners
.split(",")
.map((owner) => owner.trim())
.filter(Boolean),
set: (values: string[]) => {
form.owners = values.join(", ");
},
});
function addForgeSource(): void {
form.forgeSources.push({ host: "", type: "github" });
}
function toggleProvider(p: "github" | "gitea", e: Event): void {
const checked = (e.target as HTMLInputElement).checked;
function toggleProvider(p: "github" | "gitea", checked: boolean): void {
form.providers = checked
? [...new Set([...form.providers, p])]
: form.providers.filter((x) => x !== p);
@@ -313,6 +317,10 @@ function close(): void {
emit("close");
}
function onOpenChange(open: boolean): void {
if (!open) close();
}
function save(): void {
formError.value = "";
const id = form.id.trim();
@@ -394,3 +402,16 @@ function save(): void {
});
}
</script>
<style scoped>
:deep(.editor-foot) {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
border-top: 1px solid rgb(var(--wh-border));
background: rgb(var(--wh-surface));
padding: 1rem 1.5rem;
box-shadow: 0 -8px 24px -16px rgba(15, 23, 42, 0.18);
}
</style>
+34 -49
View File
@@ -1,44 +1,27 @@
<template>
<div class="mx-auto max-w-[760px] px-5 pb-20 pt-12">
<header class="mb-7 flex flex-wrap items-center justify-between gap-4">
<NuxtLink
class="text-base font-extrabold tracking-[-0.01em] text-text no-underline"
:to="q('/terms')"
>Web<span class="text-accent">Hooker</span></NuxtLink
>
<nav class="flex gap-2">
<NuxtLink
class="rounded-full border border-transparent px-3.5 py-1.5 text-[13px] text-muted no-underline transition-colors hover:text-text"
:class="active === 'terms' ? 'border-accent-border bg-accent-dim text-accent' : ''"
:to="q('/terms')"
>
{{ t("服务条款", "Terms") }}
</NuxtLink>
<NuxtLink
class="rounded-full border border-transparent px-3.5 py-1.5 text-[13px] text-muted no-underline transition-colors hover:text-text"
:class="active === 'privacy' ? 'border-accent-border bg-accent-dim text-accent' : ''"
:to="q('/privacy')"
>
{{ t("隐私政策", "Privacy") }}
<main class="legal-shell">
<header class="legal-header">
<NuxtLink class="legal-brand" :to="q('/')"><AppLogo :size="28" /><span>WebHooker</span></NuxtLink>
<nav aria-label="Legal navigation">
<NuxtLink v-for="item in links" :key="item.key" :to="q(item.path)">
<RcBadge :variant="active === item.key ? 'brand' : 'subtle'" size="sm">{{ item.label }}</RcBadge>
</NuxtLink>
</nav>
</header>
<article
class="rounded-xl border border-border bg-surface px-10 py-9 shadow-[0_1px_3px_var(--shadow)]"
>
<h1 class="mb-1.5 text-[26px] font-extrabold tracking-[-0.02em]">{{ title }}</h1>
<p class="mb-6 text-[13px] text-muted">{{ t("最后更新", "Last updated") }}: {{ updated }}</p>
<div class="legal-body" v-html="body" />
</article>
<footer class="mt-6 flex flex-wrap items-center justify-between gap-3">
<span class="text-[13px] text-muted">WebHooker · GitHub → Discord</span>
<NuxtLink
class="rounded-full border border-border bg-surface px-3.5 py-1.5 text-[13px] text-muted no-underline transition-colors hover:text-text"
:to="altLink"
>{{ lang === "zh" ? "English" : "中文" }}</NuxtLink
>
<section class="legal-heading">
<p>{{ t("WebHooker 服务规范", "WebHooker service policy") }}</p>
<h1>{{ title }}</h1>
<span>{{ t("最后更新", "Last updated") }} · {{ updated }}</span>
</section>
<RcCard variant="outline" padding="lg" class="legal-card"><article class="legal-body" v-html="body" /></RcCard>
<footer class="legal-footer">
<NuxtLink :to="q('/')">{{ t("返回首页", "Back to home") }}</NuxtLink>
<div class="legal-footer-actions">
<ThemeToggle show-label />
<NuxtLink :to="altLink">{{ lang === "zh" ? "English" : "中文" }}</NuxtLink>
</div>
</footer>
</div>
</main>
</template>
<script setup lang="ts">
@@ -46,23 +29,25 @@ import { computed } from "vue";
import { pickLang, type Lang } from "~/utils/legal";
const props = defineProps<{ active: "terms" | "privacy"; title: string; body: string }>();
const route = useRoute();
const config = useRuntimeConfig();
const lang = computed<Lang>(() => pickLang(String(route.query.lang ?? "")));
const altLang = computed(() => (lang.value === "zh" ? "en" : "zh"));
const updated = computed(() => "2026-08-01");
const updated = "2026-08-01";
const t = (zh: string, en: string): string => (lang.value === "zh" ? zh : en);
const q = (p: string): string => `${p}?lang=${lang.value}`;
const altLink = computed(() =>
q(props.active === "terms" ? "/terms" : "/privacy").replace(
`lang=${lang.value}`,
`lang=${altLang.value}`,
),
);
const q = (path: string): string => `${path}?lang=${lang.value}`;
const links = computed(() => [
{ key: "terms" as const, path: "/terms", label: t("服务条款", "Terms") },
{ key: "privacy" as const, path: "/privacy", label: t("隐私政策", "Privacy") },
]);
const altLink = computed(() => `${props.active === "terms" ? "/terms" : "/privacy"}?lang=${altLang.value}`);
useHead({ title: `${props.title} · WebHooker` });
void config;
</script>
<style scoped>
.legal-shell { position: relative; z-index: 1; width: min(100% - 2rem, 860px); margin: 0 auto; padding: 2rem 0 4rem; } .legal-header, .legal-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; } .legal-brand { display: inline-flex; align-items: center; gap: .6rem; color: rgb(var(--wh-text)); font-size: 1rem; font-weight: 800; text-decoration: none; letter-spacing: -.035em; } .legal-brand :deep(svg) { color: rgb(var(--wh-accent)); } nav { display: flex; gap: .35rem; } nav a { text-decoration: none; }
.legal-heading { max-width: 640px; padding: clamp(4rem, 11vw, 7rem) 0 clamp(2rem, 6vw, 3.5rem); } .legal-heading p { margin: 0 0 .75rem; color: rgb(var(--wh-accent)); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; } .legal-heading h1 { margin: 0; font-size: clamp(2.4rem, 7vw, 4rem); letter-spacing: -.06em; line-height: 1; } .legal-heading span { display: block; margin-top: 1rem; color: rgb(var(--wh-faint)); font-size: .78rem; }
.legal-card { box-shadow: 0 24px 60px rgb(var(--wh-text) / .06); } .legal-body :deep(h2) { margin: 2.25rem 0 .75rem; font-size: 1.1rem; letter-spacing: -.02em; } .legal-body :deep(h2:first-child) { margin-top: 0; } .legal-body :deep(p), .legal-body :deep(li) { color: rgb(var(--wh-body-text)); line-height: 1.8; } .legal-body :deep(a) { color: rgb(var(--wh-accent)); } .legal-body :deep(ul) { padding-left: 1.25rem; }
.legal-footer { margin-top: 1.5rem; color: rgb(var(--wh-muted)); font-size: .78rem; } .legal-footer-actions { display: flex; align-items: center; gap: .75rem; } .legal-footer a { color: inherit; text-decoration: none; } .legal-footer a:hover { color: rgb(var(--wh-accent)); }
@media (max-width: 520px) { .legal-shell { width: min(100% - 1.5rem, 860px); } .legal-header { align-items: flex-start; flex-direction: column; } }
</style>
+34 -35
View File
@@ -1,5 +1,5 @@
<template>
<section class="members-panel">
<RcCard variant="outline" padding="md" class="members-panel">
<div class="panel-head">
<h3>{{ t("members.title") }}</h3>
<span class="lbl-note">{{ t("members.note") }}</span>
@@ -10,46 +10,42 @@
<ul class="member-list">
<li v-for="m in members" :key="m.login.toLowerCase()" class="member-row">
<span class="member-login">{{ m.login }}</span>
<select
<RcSelect
v-if="canEdit"
class="filter-select"
:value="m.role"
:model-value="m.role"
:options="roleOptions"
:disabled="saving"
@change="onRoleChange(m, $event)"
>
<option value="owner">{{ t("roles.owner") }}</option>
<option value="admin">{{ t("roles.admin") }}</option>
<option value="viewer">{{ t("roles.viewer") }}</option>
</select>
<span v-else class="role-pill" :class="m.role">{{ t("roles." + m.role) }}</span>
<button
@update:model-value="onRoleChange(m, $event)"
/>
<RcBadge v-else size="xs" class="role-pill" :class="m.role">{{ t("roles." + m.role) }}</RcBadge>
<RcButton
v-if="canEdit"
type="button"
variant="destructive"
size="icon"
class="icon-btn danger"
:disabled="saving"
:title="t('members.remove')"
@click="removeMember(m)"
>
✕
</button>
</RcButton>
</li>
</ul>
<div v-if="canEdit" class="member-add">
<input
<RcInput
v-model="newLogin"
type="text"
:placeholder="t('members.addPlaceholder')"
class="text-input"
@keydown.enter.prevent="addMember"
/>
<select v-model="newRole" class="filter-select">
<option value="owner">{{ t("roles.owner") }}</option>
<option value="admin">{{ t("roles.admin") }}</option>
<option value="viewer">{{ t("roles.viewer") }}</option>
</select>
<button class="btn btn-accent btn-sm" :disabled="saving" @click="addMember">
<RcSelect v-model="newRole" class="filter-select" :options="roleOptions" />
<RcButton type="button" size="sm" :disabled="saving" @click="addMember">
{{ t("members.addBtn") }}
</button>
</RcButton>
</div>
<div v-if="canEdit" class="invite-box">
@@ -58,30 +54,27 @@
<span class="lbl-note">{{ t("members.inviteNote") }}</span>
</h4>
<div class="invite-create">
<select v-model="inviteRole" class="filter-select">
<option value="admin">{{ t("roles.admin") }}</option>
<option value="viewer">{{ t("roles.viewer") }}</option>
</select>
<button class="btn btn-accent btn-sm" :disabled="saving || inviting" @click="createInvite">
<RcSelect v-model="inviteRole" class="filter-select" :options="inviteRoleOptions" />
<RcButton type="button" size="sm" :disabled="saving || inviting" @click="createInvite">
{{ t("members.createInvite") }}
</button>
</RcButton>
</div>
<ul v-if="invites.length" class="invite-list">
<li v-for="inv in invites" :key="inv.token" class="invite-row">
<code class="invite-token">{{ shortToken(inv.token) }}</code>
<span class="role-pill" :class="inv.role">{{ t("roles." + inv.role) }}</span>
<RcBadge size="xs" class="role-pill" :class="inv.role">{{ t("roles." + inv.role) }}</RcBadge>
<span class="invite-exp">{{ fmtExp(inv.expiresAt) }}</span>
<button class="btn btn-ghost btn-sm" @click="copyInvite(inv)">
<RcButton type="button" variant="ghost" size="sm" @click="copyInvite(inv)">
{{ copied === inv.token ? t("members.copied") : t("members.copyLink") }}
</button>
<button class="icon-btn danger" @click="revoke(inv)">{{ t("members.revoke") }}</button>
</RcButton>
<RcButton type="button" variant="destructive" size="sm" class="icon-btn danger" @click="revoke(inv)">{{ t("members.revoke") }}</RcButton>
</li>
</ul>
<p v-else class="empty-log">{{ t("members.noInvites") }}</p>
</div>
<div class="err">{{ formError }}</div>
</section>
</RcCard>
</template>
<script setup lang="ts">
@@ -103,6 +96,12 @@ const inviteRole = ref<"admin" | "viewer">("admin");
const inviting = ref(false);
const formError = ref("");
const { copied, copy } = useCopy(2000);
const roleOptions = computed(() => [
{ label: t("roles.owner"), value: "owner" },
{ label: t("roles.admin"), value: "admin" },
{ label: t("roles.viewer"), value: "viewer" },
]);
const inviteRoleOptions = computed(() => roleOptions.value.filter((option) => option.value !== "owner"));
watch(
() => props.group,
@@ -122,13 +121,13 @@ function ownerCount(): number {
return members.value.filter((m) => m.role === "owner").length;
}
function onRoleChange(m: GroupMember, e: Event): void {
const role = (e.target as HTMLSelectElement).value as GroupRole;
if (role === "viewer" && m.role === "owner" && ownerCount() === 1) {
function onRoleChange(m: GroupMember, role: string): void {
const nextRole = role as GroupRole;
if (nextRole === "viewer" && m.role === "owner" && ownerCount() === 1) {
formError.value = t("members.errLastOwner");
return;
}
m.role = role;
m.role = nextRole;
emitSave();
}
+36 -26
View File
@@ -3,7 +3,7 @@ import type { DeliveryMetrics, Group, MetricsBreakdown } from "~/types";
const { t } = useI18n();
defineProps<{
const props = defineProps<{
metrics: DeliveryMetrics | null;
loading: boolean;
error: string;
@@ -19,6 +19,11 @@ const emit = defineEmits<{
const sortBy = ref<"total" | "failed" | "rate">("total");
const groupOptions = computed(() => [
{ label: t("metrics.allGroups"), value: "all" },
...props.groups.map((g) => ({ label: g.name || g.id, value: g.id })),
]);
function pct(value: number): string {
return `${(value * 100).toFixed(1)}%`;
}
@@ -28,8 +33,8 @@ function pctOf(count: number, total: number): string {
return `${((count / total) * 100).toFixed(0)}%`;
}
function onGroupFilter(e: Event): void {
emit("update:selectedGroupId", (e.target as HTMLSelectElement).value);
function onGroupFilter(value: string): void {
emit("update:selectedGroupId", value === "all" ? "" : value);
emit("filter");
}
@@ -113,40 +118,38 @@ function cycleSort(): void {
<span class="kpi-label">{{ t("metrics.title") }}</span>
<div class="log-filters">
<label class="filter-label">{{ t("metrics.filterGroup") }}</label>
<select
<RcSelect
class="filter-select"
:value="selectedGroupId"
:model-value="selectedGroupId || 'all'"
:options="groupOptions"
:disabled="loading"
@change="onGroupFilter"
>
<option value="">{{ t("metrics.allGroups") }}</option>
<option v-for="g in groups" :key="g.id" :value="g.id">
{{ g.name || g.id }}
</option>
</select>
@update:model-value="onGroupFilter"
/>
</div>
<button class="btn btn-ghost btn-sm" :disabled="loading" @click="emit('refresh')">
<RcButton variant="ghost" size="sm" :disabled="loading" @click="emit('refresh')">
{{ t("metrics.refresh") }}
</button>
</RcButton>
</div>
<p v-if="error" class="err">{{ error }}</p>
<p v-else-if="!loading && !metrics" class="empty-log">{{ t("metrics.empty") }}</p>
<RcEmptyState v-else-if="!loading && !metrics" :title="t('metrics.empty')" class="empty-log" />
<template v-else-if="metrics">
<div class="metric-kpis">
<div
<RcCard
v-for="k in summary(metrics)"
:key="k.label"
variant="outline"
padding="md"
class="metric-kpi"
:class="TONE[k.tone] ?? ''"
>
<span class="metric-kpi-value">{{ k.value }}</span>
<span class="metric-kpi-label">{{ k.label }}</span>
</div>
</RcCard>
</div>
<article v-if="metrics.byPlatform.length" class="metric-block">
<RcCard v-if="metrics.byPlatform.length" variant="outline" padding="md" class="metric-block">
<h3 class="metric-block-title">{{ t("metrics.byPlatform") }}</h3>
<div
v-for="r in rows(metrics.byPlatform, (r) => r.platform ?? 'unknown')"
@@ -170,12 +173,14 @@ function cycleSort(): void {
</div>
<span class="metric-total">{{ r.total }}</span>
</div>
</article>
</RcCard>
<article v-if="metrics.byEvent.length" class="metric-block">
<RcCard v-if="metrics.byEvent.length" variant="outline" padding="md" class="metric-block">
<div class="metric-block-head">
<h3 class="metric-block-title">{{ t("metrics.byEvent") }}</h3>
<button class="metric-sort-toggle" @click="cycleSort">{{ sortLabel() }}</button>
<RcButton variant="ghost" size="xs" class="metric-sort-toggle" @click="cycleSort">{{
sortLabel()
}}</RcButton>
</div>
<div
v-for="r in rows(metrics.byEvent, (r) => r.event ?? 'unknown')"
@@ -199,9 +204,9 @@ function cycleSort(): void {
</div>
<span class="metric-total">{{ r.total }}</span>
</div>
</article>
</RcCard>
<article v-if="metrics.byStatus.length" class="metric-block">
<RcCard v-if="metrics.byStatus.length" variant="outline" padding="md" class="metric-block">
<h3 class="metric-block-title">{{ t("metrics.byStatus") }}</h3>
<div class="metric-status-row">
<span
@@ -216,9 +221,14 @@ function cycleSort(): void {
{{ s.status }} · {{ s.count }}
</span>
</div>
</article>
</RcCard>
<article v-if="metrics.recentFailures.length" class="metric-block">
<RcCard
v-if="metrics.recentFailures.length"
variant="outline"
padding="md"
class="metric-block"
>
<h3 class="metric-block-title">{{ t("metrics.recentFailures") }}</h3>
<div
v-for="f in metrics.recentFailures"
@@ -232,7 +242,7 @@ function cycleSort(): void {
<span class="log-time">{{ f.target }}</span>
</div>
</div>
</article>
</RcCard>
</template>
</div>
</template>
+32 -25
View File
@@ -1,20 +1,18 @@
<template>
<article class="route-card" :class="{ disabled: !route.enabled }">
<RcCard variant="outline" padding="none" :class="cardClass">
<div class="route-card-main">
<div class="route-card-header">
<label v-if="!readonly" class="switch">
<input type="checkbox" :checked="route.enabled" @change="onToggle" />
<span class="track"></span>
</label>
<RcSwitch v-if="!readonly" :model-value="route.enabled" size="sm" @update:model-value="onToggle" />
<span v-if="readonly" class="dot" :class="route.enabled ? 'ok' : 'bad'"></span>
<div class="route-card-title">
<span class="route-name">{{ route.name || t("route.untitled") }}</span>
<span class="route-id">{{ route.id }}</span>
</div>
<div class="route-card-badges">
<span
<RcBadge
v-for="(tg, i) in route.targets"
:key="i"
size="xs"
class="route-badge"
:class="
tg.platform === 'telegram'
@@ -41,14 +39,10 @@
? t("route.feishu")
: "Discord"
}}
</span>
<span v-if="route.fallback" class="route-badge route-badge-fallback">{{
t("route.fallback")
}}</span>
<span v-if="route.stop" class="route-badge route-badge-stop">{{ t("route.stop") }}</span>
<span v-if="route.discordRoleIds?.length" class="route-badge route-badge-role"
>@roles</span
>
</RcBadge>
<RcBadge v-if="route.fallback" variant="warning" size="xs" class="route-badge route-badge-fallback">{{ t("route.fallback") }}</RcBadge>
<RcBadge v-if="route.stop" variant="destructive" size="xs" class="route-badge route-badge-stop">{{ t("route.stop") }}</RcBadge>
<RcBadge v-if="route.discordRoleIds?.length" size="xs" class="route-badge route-badge-role">@roles</RcBadge>
</div>
</div>
@@ -84,7 +78,10 @@
</div>
<div v-if="!readonly" class="route-card-actions">
<button
<RcButton
type="button"
variant="ghost"
size="icon"
class="route-action-btn"
:disabled="atFirst"
:title="t('route.moveUp')"
@@ -102,8 +99,11 @@
>
<path d="m18 15-6-6-6 6" />
</svg>
</button>
<button
</RcButton>
<RcButton
type="button"
variant="ghost"
size="icon"
class="route-action-btn"
:disabled="atLast"
:title="t('route.moveDown')"
@@ -121,8 +121,11 @@
>
<path d="m6 9 6 6 6-6" />
</svg>
</button>
<button
</RcButton>
<RcButton
type="button"
variant="ghost"
size="icon"
class="route-action-btn"
:title="t('routeEditor.editTitle')"
@click="$emit('edit', route)"
@@ -140,8 +143,11 @@
<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" />
<path d="m15 5 4 4" />
</svg>
</button>
<button
</RcButton>
<RcButton
type="button"
variant="destructive"
size="icon"
class="route-action-btn route-action-btn-danger"
:title="t('routeEditor.close')"
@click="$emit('delete', route)"
@@ -159,9 +165,9 @@
<path d="M18 6 6 18" />
<path d="m6 6 12 12" />
</svg>
</button>
</RcButton>
</div>
</article>
</RcCard>
</template>
<script setup lang="ts">
@@ -181,6 +187,7 @@ const summary = computed(() => {
const node: FilterNode = props.route.ast ?? { all: props.route.filters };
return describeNode(node, t);
});
const cardClass = computed(() => `route-card${props.route.enabled ? "" : " disabled"}`);
const emit = defineEmits<{
(e: "toggle", route: Route): void;
(e: "edit", route: Route): void;
@@ -188,8 +195,8 @@ const emit = defineEmits<{
(e: "move", route: Route, dir: -1 | 1): void;
}>();
function onToggle(event: Event): void {
const next = { ...props.route, enabled: (event.target as HTMLInputElement).checked };
function onToggle(enabled: boolean): void {
const next = { ...props.route, enabled };
emit("toggle", next);
}
</script>
+254 -230
View File
@@ -29,6 +29,16 @@ const emit = defineEmits<{ (e: "close"): void; (e: "save", route: Route): void }
const { t } = useI18n();
const isEdit = computed(() => props.route != null);
const discordRoles = computed({
get: () =>
form.discordRolesText
.split(",")
.map((role) => role.trim())
.filter(Boolean),
set: (roles: string[]) => {
form.discordRolesText = roles.join(", ");
},
});
const filterError = ref("");
const targetError = ref("");
const formError = ref("");
@@ -188,6 +198,10 @@ function close(): void {
emit("close");
}
function onOpenChange(open: boolean): void {
if (!open) close();
}
async function runTest(): Promise<void> {
testError.value = "";
testResult.value = null;
@@ -315,237 +329,247 @@ watch(
</script>
<template>
<Teleport to="body">
<Transition name="fade">
<div v-if="open" class="overlay" @click.self="close" />
</Transition>
<Transition name="slide">
<aside v-if="open" class="editor" role="dialog" aria-modal="true">
<div class="editor-head">
<div class="editor-heading">
<span class="editor-eyebrow">{{ t("routeEditor.eyebrow") }}</span>
<h2>{{ isEdit ? t("routeEditor.editTitle") : t("routeEditor.newTitle") }}</h2>
<RcDialog
:open="open"
:title="isEdit ? t('routeEditor.editTitle') : t('routeEditor.newTitle')"
class="editor-dialog flex flex-col gap-0 max-h-[calc(100dvh-2rem)] overflow-hidden p-0 max-w-3xl"
@update:open="onOpenChange"
>
<template #header>
<div class="editor-head">
<div class="editor-heading">
<span class="editor-eyebrow">{{ t("routeEditor.eyebrow") }}</span>
<h2>{{ isEdit ? t("routeEditor.editTitle") : t("routeEditor.newTitle") }}</h2>
</div>
</div>
</template>
<form class="editor-body" @submit.prevent="save">
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionBasic") }}</h3>
<div v-if="!isEdit" class="templates">
<RcButton
v-for="tmpl in ROUTE_TEMPLATES"
:key="tmpl.id"
type="button"
variant="ghost"
size="sm"
:class="form.id === tmpl.id ? 'template-chip active' : 'template-chip'"
@click="applyTemplate(tmpl)"
>
{{ t(tmpl.nameKey) }}
</RcButton>
</div>
<div class="field">
<label>{{ t("routeEditor.name") }}</label>
<RcInput v-model="form.name" :placeholder="t('routeEditor.namePlaceholder')" required />
</div>
<div class="field">
<label>{{ t("routeEditor.id") }}</label>
<RcInput v-model="form.id" placeholder="my-route" required />
<div class="hint">{{ t("routeEditor.idHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionOptions") }}</h3>
<div class="field inline">
<RcSwitch v-model="form.enabled" :label="t('routeEditor.enabled')" />
</div>
<div class="field inline">
<RcCheckbox v-model="form.fallback" :label="t('routeEditor.fallback')" />
<span class="lbl-note">{{ t("routeEditor.fallbackHint") }}</span>
</div>
<div class="field inline">
<RcCheckbox v-model="form.stop" :label="t('routeEditor.stop')" />
<span class="lbl-note">{{ t("routeEditor.stopHint") }}</span>
</div>
<div class="field">
<label>{{ t("routeEditor.discordRoles") }}</label>
<RcTagInput
v-model="discordRoles"
separator=","
:placeholder="t('routeEditor.discordRolesPlaceholder')"
/>
<div class="hint">{{ t("routeEditor.discordRolesHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionFilters") }}</h3>
<div class="field">
<label>{{ t("routeEditor.filters") }}</label>
</div>
<div class="field">
<FilterNodeEditor :node="root" />
</div>
<div v-if="filterError" class="err">{{ filterError }}</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.testMatch") }}</h3>
<div class="field">
<RcInput v-model="testEvent" :placeholder="t('routeEditor.testEvent')" />
</div>
<div class="field">
<RcTextarea
v-model="testPayload"
class="test-payload"
:rows="6"
:placeholder="t('routeEditor.testPayloadPlaceholder')"
/>
</div>
<div class="field">
<RcButton type="button" variant="ghost" :loading="testing" @click="runTest">
{{ testing ? "…" : t("routeEditor.testRun") }}
</RcButton>
</div>
<div v-if="testResult" class="test-result" :class="{ ok: testResult.matched }">
<span class="test-badge">
{{
testResult.matched ? t("routeEditor.testMatched") : t("routeEditor.testNotMatched")
}}
</span>
<span class="test-explanation">{{ testResult.explanation }}</span>
</div>
<div v-if="testError" class="err">{{ testError }}</div>
</section>
<section v-if="groupId" class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.fragments") }}</h3>
<div class="fragments-presets">
<span class="hint">{{ t("routeEditor.fragmentsPresets") }}</span>
<div v-for="preset in FRAGMENT_PRESETS" :key="preset.id" class="fragment-row">
<span class="fragment-name">{{ t(preset.nameKey) }}</span>
<RcButton
type="button"
variant="ghost"
size="sm"
class="fragment-action"
@click="insertNode(preset.node)"
>
{{ t("routeEditor.fragmentsInsert") }}
</RcButton>
</div>
<button class="icon-btn" :title="t('routeEditor.close')" @click="close">✕</button>
</div>
<form class="editor-body" @submit.prevent="save">
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionBasic") }}</h3>
<div v-if="!isEdit" class="templates">
<button
v-for="tmpl in ROUTE_TEMPLATES"
:key="tmpl.id"
type="button"
class="template-chip"
:class="{ active: form.id === tmpl.id }"
@click="applyTemplate(tmpl)"
>
{{ t(tmpl.nameKey) }}
</button>
</div>
<div class="field">
<label>{{ t("routeEditor.name") }}</label>
<input
v-model="form.name"
class="input"
:placeholder="t('routeEditor.namePlaceholder')"
required
/>
</div>
<div class="field">
<label>{{ t("routeEditor.id") }}</label>
<input v-model="form.id" class="input" placeholder="my-route" required />
<div class="hint">{{ t("routeEditor.idHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionOptions") }}</h3>
<div class="field inline">
<input v-model="form.enabled" type="checkbox" />
<span>{{ t("routeEditor.enabled") }}</span>
</div>
<div class="field inline">
<input v-model="form.fallback" type="checkbox" />
<span>
{{ t("routeEditor.fallback") }}
<span class="lbl-note">{{ t("routeEditor.fallbackHint") }}</span>
</span>
</div>
<div class="field inline">
<input v-model="form.stop" type="checkbox" />
<span>
{{ t("routeEditor.stop") }}
<span class="lbl-note">{{ t("routeEditor.stopHint") }}</span>
</span>
</div>
<div class="field">
<label>{{ t("routeEditor.discordRoles") }}</label>
<input
v-model="form.discordRolesText"
class="input"
:placeholder="t('routeEditor.discordRolesPlaceholder')"
/>
<div class="hint">{{ t("routeEditor.discordRolesHint") }}</div>
</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionFilters") }}</h3>
<div class="field">
<label>{{ t("routeEditor.filters") }}</label>
</div>
<div class="field">
<FilterNodeEditor :node="root" />
</div>
<div v-if="filterError" class="err">{{ filterError }}</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.testMatch") }}</h3>
<div class="field">
<input v-model="testEvent" class="input" :placeholder="t('routeEditor.testEvent')" />
</div>
<div class="field">
<textarea
v-model="testPayload"
class="input test-payload"
rows="6"
:placeholder="t('routeEditor.testPayloadPlaceholder')"
/>
</div>
<div class="field">
<button type="button" class="btn btn-ghost" :disabled="testing" @click="runTest">
{{ testing ? "…" : t("routeEditor.testRun") }}
</button>
</div>
<div v-if="testResult" class="test-result" :class="{ ok: testResult.matched }">
<span class="test-badge">
{{
testResult.matched
? t("routeEditor.testMatched")
: t("routeEditor.testNotMatched")
}}
</span>
<span class="test-explanation">{{ testResult.explanation }}</span>
</div>
<div v-if="testError" class="err">{{ testError }}</div>
</section>
<section v-if="groupId" class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.fragments") }}</h3>
<div class="fragments-presets">
<span class="hint">{{ t("routeEditor.fragmentsPresets") }}</span>
<div v-for="preset in FRAGMENT_PRESETS" :key="preset.id" class="fragment-row">
<span class="fragment-name">{{ t(preset.nameKey) }}</span>
<button
type="button"
class="btn btn-ghost fragment-action"
@click="insertNode(preset.node)"
>
{{ t("routeEditor.fragmentsInsert") }}
</button>
</div>
</div>
<div class="fragments-list">
<div v-if="!fragments.length" class="hint">{{ t("routeEditor.fragmentsEmpty") }}</div>
<div v-for="frag in fragments" :key="frag.id" class="fragment-row">
<span class="fragment-name">{{ frag.name }}</span>
<button
type="button"
class="btn btn-ghost fragment-action"
@click="insertFragment(frag)"
>
{{ t("routeEditor.fragmentsInsert") }}
</button>
<button
type="button"
class="icon-btn danger"
:title="t('routeEditor.fragmentsDelete')"
@click="deleteFragment(frag)"
>
✕
</button>
</div>
</div>
<div class="field fragment-save">
<input
v-model="fragmentName"
class="input"
:placeholder="t('routeEditor.fragmentsNamePlaceholder')"
/>
<button type="button" class="btn btn-ghost" @click="saveAsFragment">
{{ t("routeEditor.fragmentsSave") }}
</button>
</div>
<div v-if="fragmentError" class="err">{{ fragmentError }}</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionTargets") }}</h3>
<div v-for="(tg, i) in form.targets" :key="i" class="target-row">
<select v-model="tg.platform" class="tg-select">
<option value="discord">Discord</option>
<option value="telegram">Telegram</option>
<option value="feishu">{{ t("routeEditor.platformFeishu") }}</option>
</select>
<template v-if="tg.platform === 'discord'">
<input
v-model="tg.channelId"
class="input tg-in1"
:placeholder="t('routeEditor.channelPlaceholder')"
/>
<input
v-model="tg.threadId"
class="input tg-in2"
:placeholder="t('routeEditor.threadPlaceholder')"
/>
</template>
<template v-else-if="tg.platform === 'telegram'">
<input
v-model="tg.chatId"
class="input tg-in1"
:placeholder="t('routeEditor.chatPlaceholder')"
/>
<input
v-model="tg.topicId"
class="input tg-in2"
:placeholder="t('routeEditor.topicPlaceholder')"
/>
</template>
<template v-else>
<input
v-model="tg.chatId"
class="input tg-in1"
:placeholder="t('routeEditor.feishuChatPlaceholder')"
/>
</template>
<button
type="button"
class="icon-btn danger tg-del"
:title="t('routeEditor.remove')"
@click="form.targets.splice(i, 1)"
>
✕
</button>
</div>
<button type="button" class="btn btn-ghost add-filter" @click="addTarget">
{{ t("routeEditor.addTarget") }}
</button>
<div v-if="targetError" class="err">{{ targetError }}</div>
</section>
<div v-if="formError" class="err">{{ formError }}</div>
</form>
<div class="editor-foot">
<button class="btn btn-ghost" @click="close">{{ t("routeEditor.cancel") }}</button>
<button class="btn btn-accent" :disabled="saving" @click="save">
{{ t("routeEditor.save") }}
</button>
<div class="fragments-list">
<div v-if="!fragments.length" class="hint">{{ t("routeEditor.fragmentsEmpty") }}</div>
<div v-for="frag in fragments" :key="frag.id" class="fragment-row">
<span class="fragment-name">{{ frag.name }}</span>
<RcButton
type="button"
variant="ghost"
size="sm"
class="fragment-action"
@click="insertFragment(frag)"
>
{{ t("routeEditor.fragmentsInsert") }}
</RcButton>
<RcButton
type="button"
variant="destructive"
size="icon"
:title="t('routeEditor.fragmentsDelete')"
@click="deleteFragment(frag)"
>
✕
</RcButton>
</div>
</div>
</aside>
</Transition>
</Teleport>
<div class="field fragment-save">
<RcInput
v-model="fragmentName"
:placeholder="t('routeEditor.fragmentsNamePlaceholder')"
/>
<RcButton type="button" variant="ghost" @click="saveAsFragment">
{{ t("routeEditor.fragmentsSave") }}
</RcButton>
</div>
<div v-if="fragmentError" class="err">{{ fragmentError }}</div>
</section>
<section class="editor-section">
<h3 class="editor-section-title">{{ t("routeEditor.sectionTargets") }}</h3>
<div v-for="(tg, i) in form.targets" :key="i" class="target-row">
<RcSelect
v-model="tg.platform"
class="[grid-area:select]"
:options="[
{ label: 'Discord', value: 'discord' },
{ label: 'Telegram', value: 'telegram' },
{ label: t('routeEditor.platformFeishu'), value: 'feishu' },
]"
/>
<template v-if="tg.platform === 'discord'">
<RcInput
v-model="tg.channelId"
class="[grid-area:in1]"
:placeholder="t('routeEditor.channelPlaceholder')"
/>
<RcInput
v-model="tg.threadId"
class="[grid-area:in2]"
:placeholder="t('routeEditor.threadPlaceholder')"
/>
</template>
<template v-else-if="tg.platform === 'telegram'">
<RcInput
v-model="tg.chatId"
class="[grid-area:in1]"
:placeholder="t('routeEditor.chatPlaceholder')"
/>
<RcInput
v-model="tg.topicId"
class="[grid-area:in2]"
:placeholder="t('routeEditor.topicPlaceholder')"
/>
</template>
<template v-else>
<RcInput
v-model="tg.chatId"
class="[grid-area:in1]"
:placeholder="t('routeEditor.feishuChatPlaceholder')"
/>
</template>
<RcButton
type="button"
variant="destructive"
size="icon"
class="[grid-area:del] justify-self-end"
:title="t('routeEditor.remove')"
@click="form.targets.splice(i, 1)"
>
✕
</RcButton>
</div>
<RcButton type="button" variant="ghost" class="add-filter" @click="addTarget">
{{ t("routeEditor.addTarget") }}
</RcButton>
<div v-if="targetError" class="err">{{ targetError }}</div>
</section>
<div v-if="formError" class="err">{{ formError }}</div>
</form>
<template #footer>
<div class="editor-foot">
<RcButton variant="ghost" @click="close">{{ t("routeEditor.cancel") }}</RcButton>
<RcButton variant="primary" :loading="saving" @click="save">
{{ t("routeEditor.save") }}
</RcButton>
</div>
</template>
</RcDialog>
</template>
<style scoped>
:deep(.editor-foot) {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
border-top: 1px solid rgb(var(--wh-border));
background: rgb(var(--wh-surface));
padding: 1rem 1.5rem;
box-shadow: 0 -8px 24px -16px rgba(15, 23, 42, 0.18);
}
</style>
+39 -36
View File
@@ -4,25 +4,21 @@
<span class="kpi-label">{{ t("logs.lastSends", { n: logs.length }) }}</span>
<div class="log-filters">
<label class="filter-label">{{ t("logs.filterGroup") }}</label>
<select
<RcSelect
class="filter-select"
:value="selectedGroupId"
:model-value="selectedGroupId || 'all'"
:options="groupOptions"
:disabled="loading"
@change="onGroupFilter"
>
<option value="">{{ t("logs.allGroups") }}</option>
<option v-for="g in groups" :key="g.id" :value="g.id">
{{ g.name || g.id }}
</option>
</select>
@update:model-value="onGroupFilter"
/>
</div>
<button class="btn btn-ghost btn-sm" :disabled="loading" @click="refresh">
<RcButton variant="ghost" size="sm" :disabled="loading" @click="refresh">
{{ t("logs.refresh") }}
</button>
</RcButton>
</div>
<p v-if="error" class="err">{{ error }}</p>
<p v-else-if="!loading && !logs.length" class="empty-log">{{ t("logs.empty") }}</p>
<RcEmptyState v-else-if="!loading && !logs.length" :title="t('logs.empty')" class="empty-log" />
<div class="log-list">
<article
@@ -55,30 +51,28 @@
</article>
</div>
<div v-if="detailOpen" class="modal-overlay" @click.self="closeDetail">
<div class="log-detail">
<div class="detail-head">
<h3>{{ t("logs.detailTitle") }}</h3>
<button class="icon-btn" @click="closeDetail">✕</button>
</div>
<RcDialog
:open="detailOpen"
:title="t('logs.detailTitle')"
class="log-detail"
@update:open="onDetailOpenChange"
>
<div v-if="detailLoading" class="flex justify-center py-8"><RcSpinner size="sm" /></div>
<p v-else-if="detailError" class="err">{{ detailError }}</p>
<p v-if="detailLoading" class="empty-log">{{ t("status.loading") }}</p>
<p v-else-if="detailError" class="err">{{ detailError }}</p>
<dl v-else-if="detail" class="detail-grid">
<template v-for="row in detailRows" :key="row.label">
<dt>{{ row.label }}</dt>
<dd>
<pre v-if="row.block" class="log-block">{{ row.value }}</pre>
<code v-else-if="row.code">{{ row.value }}</code>
<span v-else>{{ row.value }}</span>
</dd>
</template>
</dl>
<dl v-else-if="detail" class="detail-grid">
<template v-for="row in detailRows" :key="row.label">
<dt>{{ row.label }}</dt>
<dd>
<pre v-if="row.block" class="log-block">{{ row.value }}</pre>
<code v-else-if="row.code">{{ row.value }}</code>
<span v-else>{{ row.value }}</span>
</dd>
</template>
</dl>
<p v-else class="err">{{ t("logs.detailMissing") }}</p>
</div>
</div>
<p v-else class="err">{{ t("logs.detailMissing") }}</p>
</RcDialog>
</div>
</template>
@@ -106,6 +100,11 @@ const detail = ref<SendRecord | null>(null);
const detailLoading = ref(false);
const detailError = ref("");
const groupOptions = computed(() => [
{ label: t("logs.allGroups"), value: "all" },
...props.groups.map((g) => ({ label: g.name || g.id, value: g.id })),
]);
const detailRows = computed(() => {
const l = detail.value;
if (!l) return [] as Array<{ label: string; value: string; code?: boolean; block?: boolean }>;
@@ -142,8 +141,8 @@ function refresh(): void {
emit("refresh");
}
function onGroupFilter(e: Event): void {
emit("update:selectedGroupId", (e.target as HTMLSelectElement).value);
function onGroupFilter(value: string): void {
emit("update:selectedGroupId", value === "all" ? "" : value);
emit("filter");
}
@@ -166,4 +165,8 @@ function closeDetail(): void {
detailOpen.value = false;
detail.value = null;
}
function onDetailOpenChange(open: boolean): void {
if (!open) closeDetail();
}
</script>
+8 -61
View File
@@ -1,68 +1,15 @@
<script setup lang="ts">
import { ref } from "vue";
const props = defineProps<{ modelValue: string[]; placeholder?: string }>();
const emit = defineEmits<{ (e: "update:modelValue", value: string[]): void }>();
const text = ref("");
function add(value: string) {
const v = value.trim();
if (!v) return;
if (props.modelValue.includes(v)) return;
emit("update:modelValue", [...props.modelValue, v]);
}
function onKeydown(e: KeyboardEvent) {
if (e.key === "Enter" || e.key === ",") {
e.preventDefault();
add(text.value);
text.value = "";
} else if (e.key === "Backspace" && text.value === "" && props.modelValue.length > 0) {
emit("update:modelValue", props.modelValue.slice(0, -1));
}
}
function onBlur() {
if (text.value) {
add(text.value);
text.value = "";
}
}
function remove(index: number) {
const next = [...props.modelValue];
next.splice(index, 1);
emit("update:modelValue", next);
}
</script>
<template>
<div
class="flex flex-wrap items-center gap-1 rounded-md border border-border bg-surface/60 px-2 py-1.5 focus-within:border-accent"
>
<span
v-for="(v, i) in modelValue"
:key="`${v}-${i}`"
class="inline-flex items-center gap-1 rounded bg-accent/15 px-2 py-0.5 text-xs text-accent"
>
{{ v }}
<button
type="button"
class="text-accent/70 hover:text-accent"
:aria-label="'remove'"
@click="remove(i)"
>
&times;
</button>
</span>
<input
v-model="text"
type="text"
class="min-w-[8rem] flex-1 bg-transparent text-sm text-text outline-none placeholder:text-text/40"
:placeholder="placeholder"
@keydown="onKeydown"
@blur="onBlur"
/>
</div>
<RcTagInput
:model-value="props.modelValue"
:placeholder="props.placeholder"
separator=","
unique
size="sm"
@update:model-value="emit('update:modelValue', $event)"
/>
</template>
+79
View File
@@ -0,0 +1,79 @@
<template>
<button
type="button"
class="theme-toggle-btn"
:title="label"
:aria-label="label"
@click="cycleTheme"
>
<component :is="currentIcon" :size="size" />
<span v-if="showLabel" class="theme-label">{{ shortLabel }}</span>
</button>
</template>
<script setup lang="ts">
import { Laptop, Moon, Sun } from "lucide-vue-next";
import { computed } from "vue";
import { useTheme } from "~/composables/useTheme";
const props = withDefaults(
defineProps<{
size?: number;
showLabel?: boolean;
compact?: boolean;
}>(),
{
size: 16,
showLabel: false,
compact: false,
},
);
const { theme, cycleTheme } = useTheme();
const currentIcon = computed(() => {
if (theme.value === "light") return Sun;
if (theme.value === "dark") return Moon;
return Laptop;
});
const label = computed(() => {
if (theme.value === "light") return "浅色模式 (点击切换为深色)";
if (theme.value === "dark") return "深色模式 (点击切换为跟随系统)";
return "跟随系统 (点击切换为浅色)";
});
const shortLabel = computed(() => {
if (theme.value === "light") return "浅色";
if (theme.value === "dark") return "深色";
return "自动";
});
</script>
<style scoped>
.theme-toggle-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.35rem;
padding: 0.4rem 0.55rem;
border-radius: 9999px;
border: 1px solid rgb(var(--wh-border));
background: rgb(var(--wh-surface));
color: rgb(var(--wh-muted));
font-size: 0.75rem;
font-weight: 600;
cursor: pointer;
transition: all 150ms ease;
}
.theme-toggle-btn:hover {
border-color: rgb(var(--wh-accent));
color: rgb(var(--wh-text));
background: rgb(var(--wh-surface-2));
}
.theme-label {
font-size: 0.75rem;
}
</style>
+16 -12
View File
@@ -1,5 +1,5 @@
<template>
<section class="members-panel webhook-panel">
<RcCard variant="outline" padding="md" class="members-panel webhook-panel">
<div class="panel-head">
<h3>{{ t("webhook.title") }}</h3>
<span class="lbl-note">{{ t("webhook.note") }}</span>
@@ -11,9 +11,9 @@
<div class="wh-row">
<span class="wh-label">{{ t("webhook.url") }}</span>
<code class="wh-value">{{ info.url }}</code>
<button class="btn btn-ghost btn-sm" @click="copy(info.url, 'url')">
<RcButton type="button" variant="ghost" size="sm" @click="copy(info.url, 'url')">
{{ copied === "url" ? t("webhook.copied") : t("webhook.copy") }}
</button>
</RcButton>
</div>
<div class="wh-row">
@@ -21,28 +21,32 @@
<code class="wh-value">{{
info.secret ? info.secret : info.hasSecret ? maskedSecret : t("webhook.noSecret")
}}</code>
<button
<RcButton
v-if="info.secret"
class="btn btn-ghost btn-sm"
type="button"
variant="ghost"
size="sm"
@click="copy(info.secret!, 'secret')"
>
{{ copied === "secret" ? t("webhook.copied") : t("webhook.copy") }}
</button>
</RcButton>
</div>
<p v-if="info.hasSecret && !info.secret" class="hint">{{ t("webhook.secretHidden") }}</p>
<div class="wh-actions">
<button class="btn btn-accent btn-sm" :disabled="busy" @click="onRegenerate">
<RcButton type="button" size="sm" :disabled="busy" @click="onRegenerate">
{{ info.hasSecret ? t("webhook.regenerate") : t("webhook.generate") }}
</button>
<button
</RcButton>
<RcButton
v-if="info.hasSecret"
class="btn btn-ghost btn-sm"
type="button"
variant="ghost"
size="sm"
:disabled="busy"
@click="onDisable"
>
{{ t("webhook.disable") }}
</button>
</RcButton>
</div>
<details class="wh-usage">
@@ -55,7 +59,7 @@
</template>
<div class="err">{{ error }}</div>
</section>
</RcCard>
</template>
<script setup lang="ts">
+12
View File
@@ -25,6 +25,11 @@ const en: Dict = {
"overview.recent": "Recent deliveries",
"overview.viewAll": "View all",
"overview.refreshed": "Refreshed",
"overview.thRoute": "Route",
"overview.thGroup": "Group",
"overview.thEvents": "Events",
"overview.thTargets": "Targets",
"overview.thState": "State",
"metrics.refresh": "Refresh",
"metrics.total": "Total",
"metrics.ok": "OK",
@@ -412,6 +417,11 @@ const zh: Dict = {
"overview.recent": "最近投递",
"overview.viewAll": "查看全部",
"overview.refreshed": "已刷新",
"overview.thRoute": "路由",
"overview.thGroup": "分组",
"overview.thEvents": "事件",
"overview.thTargets": "目标",
"overview.thState": "状态",
"metrics.refresh": "刷新",
"metrics.total": "总计",
"metrics.ok": "成功",
@@ -511,6 +521,8 @@ const zh: Dict = {
"webhook.usageGitea": "Gitea:仓库 Settings → Webhooks → Add Webhook,填写同样的 URL 和 secret。",
"webhook.usageCustom":
"自定义:用 X-WebHooker-Signature(sha256 HMAC)签名任意 JSON 后 POST。创建一条 event = custom 的路由即可接收:",
"groups.empty": "暂无分组。分组可按组织或用户划分路由并分配管理权限。",
"groups.createFirst": "创建第一个分组",
"groups.admins": "管理员",
"groups.owners": "来源",
"groups.members": "成员",
+88
View File
@@ -0,0 +1,88 @@
import { onMounted, readonly, ref } from "vue";
export type ThemePreference = "auto" | "light" | "dark";
const STORAGE_KEY = "wh-theme";
const theme = ref<ThemePreference>("auto");
const isDark = ref(false);
let initialized = false;
function resolveSystemDark(): boolean {
if (typeof window === "undefined") return false;
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
}
function applyTheme(targetTheme: ThemePreference) {
if (typeof document === "undefined") return;
const root = document.documentElement;
const darkActive = targetTheme === "dark" || (targetTheme === "auto" && resolveSystemDark());
isDark.value = darkActive;
if (darkActive) {
root.classList.add("dark");
root.setAttribute("data-theme", "dark");
} else {
root.classList.remove("dark");
if (targetTheme === "light") {
root.setAttribute("data-theme", "light");
} else {
root.removeAttribute("data-theme");
}
}
}
export function useTheme() {
function setTheme(next: ThemePreference) {
theme.value = next;
try {
if (next === "auto") {
localStorage.removeItem(STORAGE_KEY);
} else {
localStorage.setItem(STORAGE_KEY, next);
}
} catch {
// localStorage may fail in sandboxed or private contexts
}
applyTheme(next);
}
function cycleTheme() {
const order: readonly ThemePreference[] = ["auto", "light", "dark"] as const;
const idx = order.indexOf(theme.value);
const next = order[(idx + 1) % order.length];
if (next) {
setTheme(next);
}
}
onMounted(() => {
if (initialized) return;
initialized = true;
try {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored === "light" || stored === "dark" || stored === "auto") {
theme.value = stored;
}
} catch {
// fallback to auto
}
applyTheme(theme.value);
if (window.matchMedia) {
const mq = window.matchMedia("(prefers-color-scheme: dark)");
mq.addEventListener?.("change", () => {
if (theme.value === "auto") {
applyTheme("auto");
}
});
}
});
return {
theme: readonly(theme),
isDark: readonly(isDark),
setTheme,
cycleTheme,
};
}
+90 -126
View File
@@ -1,79 +1,79 @@
<template>
<div class="relative z-[1] mx-auto flex min-h-screen max-w-[720px] flex-col px-5 pb-16 pt-[72px]">
<div class="mb-10 text-center">
<div
class="mb-5 inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-white shadow-[0_8px_24px_-8px_var(--accent)]"
>
<svg
viewBox="0 0 64 64"
class="h-8 w-8"
fill="none"
stroke="currentColor"
stroke-width="6"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<path d="M41 23 V35.5 A10.5 10.5 0 0 1 20 35.5 L28 25.5" />
<circle cx="41" cy="18" r="4.5" fill="currentColor" stroke="none" />
</svg>
<template>
<main class="landing-shell">
<section class="landing-hero">
<RcBadge variant="brand" size="sm">ReCloud Studio</RcBadge>
<div class="brand-lockup">
<AppLogo :size="64" class="brand-logo" />
<div>
<p class="eyebrow">Event relay console</p>
<h1>Web<span>Hooker</span></h1>
</div>
</div>
<h1 class="mb-2.5 text-[34px] font-extrabold tracking-[-0.03em]">
Web<span class="text-accent">Hooker</span>
</h1>
<p class="m-0 text-[15px] leading-relaxed text-muted">
<p class="hero-copy">
{{
lang === "zh"
? "将 GitHub webhook 事件转发到 Discord 频道,并支持在 Discord 中以你本人身份操作 GitHub。"
: "Forward GitHub webhook events to Discord, and act on GitHub from Discord as yourself."
? "把 GitHub webhook 可靠地带到你的协作空间,并在一个清晰的控制台中掌控每一条路由。"
: "Bring GitHub webhook activity into your collaboration space, with every route under clear control."
}}
</p>
</div>
<nav class="grid gap-3">
<a
v-for="it in items"
<div class="hero-meta">
<span><GitBranch :size="15" /> GitHub</span>
<span class="meta-line" aria-hidden="true" />
<span><Radio :size="15" /> Discord · Telegram · Feishu</span>
</div>
</section>
<section class="landing-actions" :aria-label="t('导航', 'Navigation')">
<RcCard
v-for="(it, index) in items"
:key="it.label"
class="flex items-center gap-4 rounded-[14px] border border-border bg-surface px-5 py-[18px] text-text no-underline shadow-card transition-all duration-150 hover:-translate-y-0.5 hover:border-border-strong hover:shadow-card-hover"
:class="
it.primary
? 'border-accent bg-accent shadow-none hover:border-accent hover:shadow-accent-lg'
: ''
"
:href="it.href"
:target="it.external ? '_blank' : undefined"
:rel="it.external ? 'noopener noreferrer' : undefined"
>
<span
class="flex h-11 w-11 flex-none items-center justify-center rounded-[11px] text-accent"
:class="it.primary ? 'bg-white/15 text-white' : 'bg-surface-2'"
v-html="icon(it.icon)"
/>
<span class="flex min-w-0 flex-1 flex-col gap-0.5">
<span class="text-[15px] font-bold" :class="it.primary ? 'text-white' : ''">{{
it.label
}}</span>
<span class="text-[13px]" :class="it.primary ? 'text-white/80' : 'text-muted'">{{
it.desc
}}</span>
</span>
<span class="flex-none text-lg" :class="it.primary ? 'text-white' : 'text-faint'">{{
it.external ? "↗" : "→"
}}</span>
</a>
</nav>
<footer class="mt-auto flex flex-wrap items-center justify-between gap-3 pt-10">
<span class="text-[13px] text-muted">WebHooker · GitHub → Discord</span>
<NuxtLink
class="rounded-full border border-border bg-surface px-3.5 py-1.5 text-[13px] text-muted no-underline transition-colors hover:border-border-strong hover:text-text"
:to="`/?lang=${altLang}`"
>{{ lang === "zh" ? "English" : "中文" }}</NuxtLink
variant="outline"
:hoverable="true"
padding="none"
class="landing-action"
>
<a
:href="it.href"
:target="it.external ? '_blank' : undefined"
:rel="it.external ? 'noopener noreferrer' : undefined"
>
<span class="action-index">0{{ index + 1 }}</span>
<component :is="it.icon" class="action-icon" :size="22" :stroke-width="1.8" />
<span class="action-copy">
<strong>{{ it.label }}</strong>
<small>{{ it.desc }}</small>
</span>
<ArrowUpRight v-if="it.external" class="action-arrow" :size="19" />
<ArrowRight v-else class="action-arrow" :size="19" />
</a>
</RcCard>
</section>
<footer class="landing-footer">
<span>WebHooker <i /> GitHub event delivery</span>
<div class="landing-footer-actions">
<ThemeToggle show-label />
<NuxtLink :to="`/?lang=${altLang}`">
<Languages :size="15" /> {{ lang === "zh" ? "English" : "中文" }}
</NuxtLink>
</div>
</footer>
</div>
</main>
</template>
<script setup lang="ts">
import { computed } from "vue";
import {
ArrowRight,
ArrowUpRight,
BookOpen,
FileCheck2,
GitBranch,
Github,
Languages,
LogIn,
Radio,
ShieldCheck,
} from "lucide-vue-next";
const DEFAULT_REPO = "https://github.com/ReCloudStudio/WebHooker";
const DEFAULT_DOCS = "https://webhooker.docs.worldexecute.me";
@@ -94,71 +94,35 @@ const items = computed(() => {
const docs = lang.value === "zh" ? `${docsBase.value}/zh` : `${docsBase.value}/`;
const q = (p: string): string => `${p}?lang=${lang.value}`;
return [
{
href: docs,
label: t("文档", "Documentation"),
desc: t("部署、配置与事件参考", "Deployment, configuration & event reference"),
icon: "docs",
external: true,
},
{
href: repo.value,
label: t("GitHub 仓库", "GitHub Repository"),
desc: t("源代码、问题与发布", "Source code, issues & releases"),
icon: "github",
external: true,
},
{
href: q("/terms"),
label: t("服务条款", "Terms of Service"),
desc: t("使用本服务的条款", "The terms for using this service"),
icon: "terms",
external: false,
},
{
href: q("/privacy"),
label: t("隐私政策", "Privacy Policy"),
desc: t("我们如何处理你的数据", "How we handle your data"),
icon: "privacy",
external: false,
},
{
href: "/admin/login",
label: t("登录控制台", "Sign in to Console"),
desc: t("管理路由与分组", "Manage routes and groups"),
icon: "login",
external: false,
primary: true,
},
{ href: docs, label: t("文档", "Documentation"), desc: t("部署、配置与事件参考", "Deployment, configuration & event reference"), icon: BookOpen, external: true },
{ href: repo.value, label: t("GitHub 仓库", "GitHub Repository"), desc: t("源代码、问题与发布", "Source code, issues & releases"), icon: Github, external: true },
{ href: q("/terms"), label: t("服务条款", "Terms of Service"), desc: t("使用本服务的条款", "The terms for using this service"), icon: FileCheck2, external: false },
{ href: q("/privacy"), label: t("隐私政策", "Privacy Policy"), desc: t("我们如何处理你的数据", "How we handle your data"), icon: ShieldCheck, external: false },
{ href: "/admin", label: t("登录控制台", "Sign in to Console"), desc: t("管理路由与分组", "Manage routes and groups"), icon: LogIn, external: false },
];
});
const ICON_PATHS: Record<string, string> = {
docs: '<path d="M4 4a2 2 0 0 1 2-2h7l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4z"/><path d="M13 2v5h5"/><path d="M8 12h8M8 16h6"/>',
github:
'<path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.36 1.09 2.94.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.65 0 0 .84-.27 2.75 1.02a9.5 9.5 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.38.2 2.4.1 2.65.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2z"/>',
terms:
'<path d="M9 12h6M9 16h6M9 8h2"/><path d="M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z"/>',
privacy:
'<path d="M12 2l7 3v6c0 5-3.5 8.5-7 10-3.5-1.5-7-5-7-10V5l7-3z"/><path d="M9 12l2 2 4-4"/>',
login:
'<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><path d="M10 17l5-5-5-5"/><path d="M15 12H3"/>',
};
function icon(name: string): string {
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" width="22" height="22">${ICON_PATHS[name] ?? ""}</svg>`;
}
useHead({
title: "WebHooker",
meta: [
{
name: "description",
content:
lang.value === "zh"
? "GitHub webhook 转发到 Discord"
: "GitHub webhooks forwarded to Discord",
},
],
meta: [{ name: "description", content: lang.value === "zh" ? "GitHub webhook 转发到 Discord" : "GitHub webhooks forwarded to Discord" }],
});
</script>
<style scoped>
.landing-shell { position: relative; z-index: 1; width: min(100% - 2rem, 880px); min-height: 100vh; margin: 0 auto; padding: clamp(4rem, 10vh, 8rem) 0 2rem; overflow-x: clip; }
.landing-shell::before { position: absolute; z-index: -1; top: 3rem; right: -7rem; width: 24rem; height: 24rem; border-radius: 999px; background: radial-gradient(circle, color-mix(in srgb, rgb(var(--wh-accent)) 18%, transparent), transparent 68%); content: ""; filter: blur(10px); }
.landing-hero { max-width: 640px; animation: intro 500ms ease-out both; }
.brand-lockup { display: flex; align-items: center; gap: 1.1rem; margin: 1.5rem 0; }
.brand-logo { box-shadow: 0 16px 38px rgb(var(--wh-accent) / .28); }
.eyebrow { margin: 0 0 .25rem; color: rgb(var(--wh-accent)); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.55rem, 7vw, 4.6rem); font-weight: 800; letter-spacing: -.07em; line-height: .88; } h1 span { color: rgb(var(--wh-accent)); }
.hero-copy { margin: 1.75rem 0 1.2rem; color: rgb(var(--wh-muted)); font-size: clamp(1rem, 2vw, 1.15rem); line-height: 1.8; }
.hero-meta { display: flex; align-items: center; gap: .75rem; color: rgb(var(--wh-faint)); font-size: .77rem; font-weight: 700; letter-spacing: .025em; } .hero-meta span:not(.meta-line) { display: inline-flex; align-items: center; gap: .35rem; } .meta-line { width: 1.5rem; height: 1px; background: rgb(var(--wh-border-strong)); }
.landing-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin-top: clamp(2.5rem, 6vh, 4.5rem); }
.landing-action { overflow: hidden; animation: intro 500ms ease-out both; } .landing-action:nth-child(2) { animation-delay: 60ms; } .landing-action:nth-child(3) { animation-delay: 120ms; } .landing-action:nth-child(4) { animation-delay: 180ms; } .landing-action:nth-child(5) { animation-delay: 240ms; }
.landing-action a { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: .85rem; min-height: 6.7rem; padding: 1.15rem; color: inherit; text-decoration: none; }
.action-index { align-self: start; color: rgb(var(--wh-faint)); font-family: var(--font-mono); font-size: .63rem; } .action-icon { color: rgb(var(--wh-accent)); } .action-copy { display: grid; gap: .22rem; min-width: 0; } .action-copy strong { font-size: .95rem; } .action-copy small { color: rgb(var(--wh-muted)); font-size: .77rem; line-height: 1.4; } .action-arrow { color: rgb(var(--wh-faint)); transition: transform 150ms ease; } .landing-action:hover .action-arrow { color: rgb(var(--wh-accent)); transform: translate(2px, -2px); }
.landing-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; color: rgb(var(--wh-faint)); font-size: .75rem; } .landing-footer span { display: flex; align-items: center; gap: .45rem; } .landing-footer i { width: .22rem; height: .22rem; border-radius: 999px; background: rgb(var(--wh-accent)); } .landing-footer-actions { display: flex; align-items: center; gap: .75rem; } .landing-footer a { display: inline-flex; align-items: center; gap: .4rem; color: rgb(var(--wh-muted)); text-decoration: none; } .landing-footer a:hover { color: rgb(var(--wh-accent)); }
@keyframes intro { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 580px) { .landing-shell { width: min(100% - 1.5rem, 880px); padding-top: 3rem; } .landing-actions { grid-template-columns: 1fr; } .landing-footer { align-items: flex-start; flex-direction: column; } .hero-meta { align-items: flex-start; flex-direction: column; } .meta-line { display: none; } }
</style>
+4
View File
@@ -14,4 +14,8 @@ const route = useRoute();
const config = useRuntimeConfig();
const lang = computed(() => pickLang(String(route.query.lang ?? "")));
const contact = computed(() => legalContact(lang.value, String(config.public.legalContact ?? "")));
useHead({
meta: [{ name: "description", content: lang.value === "zh" ? "WebHooker 隐私政策" : "WebHooker Privacy Policy" }],
});
</script>
+4
View File
@@ -14,4 +14,8 @@ const route = useRoute();
const config = useRuntimeConfig();
const lang = computed(() => pickLang(String(route.query.lang ?? "")));
const contact = computed(() => legalContact(lang.value, String(config.public.legalContact ?? "")));
useHead({
meta: [{ name: "description", content: lang.value === "zh" ? "WebHooker 服务条款" : "WebHooker Terms of Service" }],
});
</script>