ReviewOS

also looking at this

stacks/analyticshq

Harden AnalyticsHQ release and dashboard quality

#52
Merged glennmichael123 wants to merge docs/bunpress-product-guide into main
34 files +1236 -340
resources/views/dashboard.stxmodified+75-47
Changes to resources/views/dashboard.stx
@@ -280,7 +280,7 @@ const regionGeoAllowed = privacy.geo.granularity === 'region'
280280let shareMode = false
281281// The owner's existing share token for the active site ('' if none), so the owner
282282// UI can show/copy/revoke the link. Bridged into the client block.
283let shareToken = ''
283let __shareToken = ''
284284
285285// Race all DB work against a short timeout: if PostgreSQL isn't reachable, a
286286// TCP connect can hang far longer than a render should wait, so we bail to the
@@ -383,7 +383,7 @@ async function loadData() {
383383 || null
384384 // Owner (not a share viewer): surface any existing share token for the link UI.
385385 if (!shareMode)
386 shareToken = (await readSettings(siteId)).share_token || ''
386 __shareToken = (await readSettings(siteId)).share_token || ''
387387
388388 // Team: who can already reach this site, and who has been invited but has not
389389 // accepted yet. Resolved server-side and rendered with @foreach so the panel
@@ -1125,7 +1125,11 @@ const exportPayload = {
11251125 * because the snippets are built from server config but can only be *finished*
11261126 * on the client, which is the one thing that knows the real origin.
11271127 */
1128defineClientPayload({ activeSiteId, countryTotals, exportPayload, installOptions, liveNow, range, shareToken })
1128// This capability is intentionally available only to the authenticated owner
1129// UI so it can display the existing share link. The underlying server binding
1130// stays private and only this exact scalar crosses the bridge.
1131const shareCapability = __shareToken
1132defineClientPayload({ activeSiteId, countryTotals, exportPayload, installOptions, liveNow, range, shareCapability })
11291133
11301134useSeoMeta({
11311135 title: "Dashboard - analyticshq",
@@ -1144,12 +1148,12 @@ useSeoMeta({
11441148const goalError = state('')
11451149const goalBusy = state(false)
11461150const isPro = state(false)
1147// Share link: seeded from the server-bridged existing token (shareToken/activeSiteId
1151// Share link: seeded from the server-bridged existing capability and activeSiteId
11481152// are server consts inlined here by the data bridge), then create/revoke live.
11491153// Built by shareLinkFor rather than by a second copy of the same template -- it is
11501154// declared further down and reached by hoisting, which is the trade for having one
11511155// place that decides what a share URL looks like.
1152const shareUrl = state(shareToken ? shareLinkFor(shareToken) : '')
1156const shareUrl = state(shareCapability ? shareLinkFor(shareCapability) : '')
11531157const shareBusy = state(false)
11541158const shareCopied = state(false)
11551159// Live "current visitors": seeded from the server render, then polled so the
@@ -2051,7 +2055,7 @@ onMount(() => {
20512055{{-- The token block, body and .wordmark that stood here were byte-identical to
20522056 account.stx's and now live once in resources/layouts/app.stx. What remains is what
20532057 only the dashboard uses. It is pushed rather than left loose: under a layout stx
2054 sweeps every orphan <style> out of the page and appends it AFTER the content, in the
2058 sweeps every orphan style block out of the page and appends it AFTER the content, in the
20552059 body, so a loose block would still apply but from the wrong place. --}}
20562060@push('styles')
20572061{{-- ts-maps' own stylesheet. Same-origin from /vendor like the engine beside it
@@ -2122,7 +2126,7 @@ onMount(() => {
21222126.range-link:hover { color: var(--text); }
21232127.range-link[aria-current="page"] {
21242128 background: var(--accent);
2125 color: #fff;
2129 color: var(--accent-ink);
21262130}
21272131.range-tool {
21282132 display: inline-flex;
@@ -2153,7 +2157,7 @@ summary:focus-visible {
21532157 outline: 2px solid var(--accent);
21542158 outline-offset: 2px;
21552159}
2156.range-tool.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }
2160.range-tool.is-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
21572161.range-tool i { width: 1rem; height: 1rem; }
21582162.date-menu { position: relative; }
21592163.date-menu > summary { list-style: none; }
@@ -2295,13 +2299,17 @@ select.panel:hover { border-color: var(--accent); }
22952299.ga-dot-v { background: var(--accent); }
22962300.ga-dot-u { background: var(--text-3); }
22972301.ga-col:hover .ga-dot { opacity: 1; }
2298.ga-tip { position: absolute; left: 50%; transform: translateX(-50%) translateY(calc(-100% - 12px)); min-width: 124px; padding: 8px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.14); opacity: 0; visibility: hidden; transition: opacity 0.12s ease; pointer-events: none; z-index: 20; }
2299.ga-col:hover .ga-tip { opacity: 1; visibility: visible; }
2302.ga-tip { display: none; position: absolute; left: 50%; transform: translateX(-50%) translateY(calc(-100% - 12px)); min-width: 124px; padding: 8px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0,0,0,0.14); pointer-events: none; z-index: 20; }
2303.ga-col:hover .ga-tip { display: block; }
23002304.ga-tip-day { font-size: 11px; color: var(--text-2); margin-bottom: 5px; }
23012305.ga-tip-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; line-height: 1.7; }
23022306.ga-tip-row b { margin-left: auto; color: var(--text); font-weight: 600; }
23032307.ga-sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
2304@media (prefers-reduced-motion: reduce) { .ga-dot, .ga-tip { transition: none; } }
2308@media (max-width: 1023px) {
2309 .ga-col:hover::before,
2310 .ga-dot,
2311 .ga-tip { display: none; }
2312}
23052313
23062314/* Export CSV pill: hover tightens the border to the accent like the range pills. */
23072315#export-csv:hover { color: var(--text); border-color: var(--accent); }
@@ -2335,6 +2343,25 @@ select.panel:hover { border-color: var(--accent); }
23352343.chrome-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); color: var(--text-2); font: 500 13px/1 var(--sans, ui-sans-serif); text-decoration: none; cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease; }
23362344.chrome-btn:hover { color: var(--text); border-color: var(--accent); }
23372345.chrome-icon { padding: 7px 10px; font-size: 14px; line-height: 1; }
2346
2347@media (max-width: 767px) {
2348 .site-switcher,
2349 .range-tool,
2350 .live-status,
2351 .chrome-btn,
2352 .range-link,
2353 .ga-row,
2354 .goal-form input,
2355 .goal-form select,
2356 .goal-form button { min-height: 2.75rem; }
2357
2358 .site-switcher { height: 2.75rem; }
2359 .range-link { display: inline-flex; align-items: center; justify-content: center; }
2360 .range-tool { min-width: 2.75rem; }
2361 .ga-row { align-items: center; }
2362 .kpi-label { min-height: 2rem; }
2363 .kpi-value { font-size: clamp(1.375rem, 7.25vw, 1.875rem); line-height: 1.2; white-space: nowrap; }
2364}
23382365/* One glyph at a time. `theme.isDark()` writes data-t, and these pick the matching
23392366 icon -- the same contract bughq's header uses, so the two toggles behave alike. */
23402367.theme-btn .ic-sun, .theme-btn .ic-moon { display: none; }
@@ -2343,9 +2370,9 @@ select.panel:hover { border-color: var(--accent); }
23432370</style>
23442371@endpush
23452372
2346{{-- A <div>, not <main>. The router container is the single <main> in
2347 resources/layouts/app.stx: fragment extraction slices from the first <main> to the
2348 LAST </main>, so a page that declares its own makes the router swap the wrong span.
2373{{-- A div rather than another main. The router container is owned by
2374 resources/layouts/app.stx: fragment extraction uses that single container,
2375 so a page that declares its own makes the router swap the wrong span.
23492376 Same classes as before, one tag name different. --}}
23502377@section('content')
23512378<div class="px-4 py-7 md:px-8 lg:px-10 min-h-[100dvh]">
@@ -2470,8 +2497,8 @@ select.panel:hover { border-color: var(--accent); }
24702497 <section class="grid grid-cols-2 lg:grid-cols-7 mb-6 border-border lg:divide-x panel reveal" aria-label="Key metrics">
24712498 @foreach (kpiCards as kpi)
24722499 <div class="px-5 py-5 border-border">
2473 <div class="mb-2 font-medium text-text-3 text-xs tracking-wider uppercase">{{ kpi.label }}</div>
2474 <div class="font-semibold text-3xl tracking-tight mono">{{ kpi.value }}</div>
2500 <div class="mb-2 font-medium text-text-3 text-xs tracking-wider uppercase kpi-label">{{ kpi.label }}</div>
2501 <div class="font-semibold text-3xl tracking-tight kpi-value mono">{{ kpi.value }}</div>
24752502 @if (kpi.delta !== null)
24762503 <div class="mt-1.5 font-medium text-xs mono" style="color: {⁠{ (kpi.delta >= 0) === kpi.goodUp ? '#10b981' : '#ef4444' }}">
24772504 {{ kpi.delta >= 0 ? '▲' : '▼' }} {{ Math.abs(kpi.delta) }}% <span class="text-text-3">vs prev</span>
@@ -2503,7 +2530,7 @@ select.panel:hover { border-color: var(--accent); }
25032530
25042531 The tab strip is x-for over the server-built catalogue, and the body is
25052532 reactive because the origin can only be resolved in the browser — see the
2506 installCode() note in the client block. {{ }} HTML-escapes the snippet so
2533 installCode() note in the client block. Server interpolation HTML-escapes the snippet so
25072534 the tag shows as text rather than executing. --}}
25082535 @if (ownsActive)
25092536 <section class="border-border panel site-settings-panel">
@@ -2514,7 +2541,7 @@ select.panel:hover { border-color: var(--accent); }
25142541 <div class="pb-5 px-5">
25152542 {{-- Tabs and prose are SERVER-rendered (@foreach, static labels, server
25162543 mustaches) so this panel still says something useful before the
2517 bundle runs. An x-for with a reactive {{ }} label cloaked the whole
2544 bundle runs. An x-for with a reactive text label cloaked the whole
25182545 body — x-cloak is display:none, so a new user with nothing to look
25192546 at but install instructions got a blank box. Only the code block
25202547 below is reactive, and only because the origin lives in the
@@ -2527,9 +2554,9 @@ select.panel:hover { border-color: var(--accent); }
25272554 role="tab"
25282555 @click="installTab.set('{⁠{ opt.id }}')"
25292556 :style="installTab() === '{⁠{ opt.id }}'
2530 ? 'padding:5px 11px;border-radius:999px;border:1px solid var(--accent);background:var(--accent);color:#fff;font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer'
2557 ? 'padding:5px 11px;border-radius:999px;border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer'
25312558 : 'padding:5px 11px;border-radius:999px;border:1px solid var(--border);background:transparent;color:var(--text-2);font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer'"
2532 style="padding:5px 11px;border-radius:999px;border:1px solid {⁠{ opt.id === 'html' ? 'var(--accent)' : 'var(--border)' }};background:{⁠{ opt.id === 'html' ? 'var(--accent)' : 'transparent' }};color:{⁠{ opt.id === 'html' ? '#fff' : 'var(--text-2)' }};font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer"
2559 style="padding:5px 11px;border-radius:999px;border:1px solid {⁠{ opt.id === 'html' ? 'var(--accent)' : 'var(--border)' }};background:{⁠{ opt.id === 'html' ? 'var(--accent)' : 'transparent' }};color:{⁠{ opt.id === 'html' ? 'var(--accent-ink)' : 'var(--text-2)' }};font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer"
25332560 >{{ opt.label }}</button>
25342561 @endforeach
25352562 </div>
@@ -2553,7 +2580,7 @@ select.panel:hover { border-color: var(--accent); }
25532580
25542581 Lists are SERVER-rendered with @foreach and server mustaches, for the
25552582 reason spelled out on the install panel above: an x-for whose rows carry
2556 reactive {{ }} makes stx cloak the container, and x-cloak is display:none.
2583 reactive text makes stx cloak the container, and x-cloak is display:none.
25572584 A mutation re-reads from the server rather than patching a reactive list
25582585 in place — invites are rare and correctness is worth more than avoiding a
25592586 reload here.
@@ -2611,21 +2638,22 @@ select.panel:hover { border-color: var(--accent); }
26112638 <input
26122639 type="email"
26132640 x-model="inviteEmail"
2641 aria-label="Teammate email"
26142642 placeholder="teammate@example.com"
26152643 autocomplete="off"
26162644 style="flex:1 1 15rem;min-height:34px;padding:0 0.65rem;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);font:400 13px/1 var(--sans,ui-sans-serif)"
26172645 >
2618 <select x-model="inviteRole" style="min-height:34px;padding:0 0.5rem;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);font:400 13px/1 var(--sans,ui-sans-serif)">
2646 <select x-model="inviteRole" aria-label="Teammate role" style="min-height:34px;padding:0 0.5rem;border:1px solid var(--border);border-radius:8px;background:var(--bg);color:var(--text);font:400 13px/1 var(--sans,ui-sans-serif)">
26192647 <option value="viewer">can view</option>
26202648 <option value="admin">can manage</option>
26212649 </select>
2622 {{-- Static label. It was `{⁠{ inviteBusy() ? 'Sending…' : 'Send
2623 invitation' }}`, and stx cloaks any element whose own text is
2650 {{-- Static label. It used to choose between Sending and Send
2651 invitation reactively, and stx cloaks any element whose own text is
26242652 a reactive mustache — so the primary control on this panel was
26252653 display:none until the bundle ran. Busy state is carried by
26262654 :disabled, an ATTRIBUTE binding, which does not cloak, and by
26272655 the sibling below, which is supposed to start hidden. --}}
2628 <button type="button" @click="sendInvite()" :disabled="inviteBusy()" style="padding:7px 14px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Send invitation</button>
2656 <button type="button" @click="sendInvite()" :disabled="inviteBusy()" style="padding:7px 14px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Send invitation</button>
26292657 <span :show="inviteBusy()" style="display:none;color:var(--text-3);font:400 12px/1 var(--sans,ui-sans-serif)">Sending…</span>
26302658 </div>
26312659 <p class="mt-2 text-text-3 text-xs">They get an emailed link that works once, for that address only, and expires in 14 days.</p>
@@ -2636,7 +2664,7 @@ select.panel:hover { border-color: var(--accent); }
26362664 <div class="mt-4 px-4 py-3" style="border: 1px solid var(--border); border-radius: 10px; background: var(--bg)">
26372665 <p class="mb-1 font-semibold text-sm">Invite your teammates with Pro</p>
26382666 <p class="mb-3 text-text-3 text-xs">Share this site with as many people as you like, each with their own login and their own level of access. Included in Pro at no extra cost per person.</p>
2639 <StxLink to="/pricing" class="inline-block" style="padding:7px 14px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);text-decoration:none">Upgrade to Pro</StxLink>
2667 <StxLink to="/pricing" class="inline-block" style="padding:7px 14px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);text-decoration:none">Upgrade to Pro</StxLink>
26402668 </div>
26412669 @endif
26422670 @endif
@@ -2694,7 +2722,7 @@ select.panel:hover { border-color: var(--accent); }
26942722 in separate elements for the same reason: a reactive child cloaks
26952723 its parent. --}}
26962724 <div class="flex flex-wrap gap-3 items-center mt-4">
2697 <button type="button" @click="importFromGa" :disabled="gaBusy()" style="padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Import my history</button>
2725 <button type="button" @click="importFromGa" :disabled="gaBusy()" style="padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Import my history</button>
26982726 </div>
26992727 <p class="mt-2 text-text-3 text-xs" :show="gaProgress()" style="display:none">{{ gaProgress() }}</p>
27002728 <p class="mt-3 text-sm text-text-2" :show="gaResult()" style="display:none">{{ gaResult() }}</p>
@@ -2778,7 +2806,7 @@ select.panel:hover { border-color: var(--accent); }
27782806 button's own text would hide the control until hydration. --}}
27792807 <div class="flex flex-wrap gap-3 items-center mt-4">
27802808 <button type="button" @click="checkFathomExport" :disabled="fathomBusy()" style="padding:8px 13px;border-radius:9px;border:1px solid var(--border);background:transparent;color:var(--text-2);font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Check this export</button>
2781 <button type="button" @click="importFromFathom" :disabled="fathomBusy()" style="padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Import my history</button>
2809 <button type="button" @click="importFromFathom" :disabled="fathomBusy()" style="padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">Import my history</button>
27822810 </div>
27832811
27842812 <p class="mt-2 text-text-3 text-xs" :show="fathomProgress()" style="display:none">{{ fathomProgress() }}</p>
@@ -2807,7 +2835,7 @@ select.panel:hover { border-color: var(--accent); }
28072835 <div class="mt-1 px-4 py-3" style="border: 1px solid var(--border); border-radius: 10px; background: var(--bg)">
28082836 <p class="mb-1 font-semibold text-sm">Import your Fathom history with Pro</p>
28092837 <p class="mb-3 text-text-3 text-xs">Upload your Fathom export and keep every number you already have, sitting alongside the traffic we start tracking today. Included in Pro at no extra cost.</p>
2810 <StxLink to="/pricing" class="inline-block" style="padding:7px 14px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);text-decoration:none">Upgrade to Pro</StxLink>
2838 <StxLink to="/pricing" class="inline-block" style="padding:7px 14px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);text-decoration:none">Upgrade to Pro</StxLink>
28112839 </div>
28122840 @endif
28132841 </div>
@@ -2865,7 +2893,7 @@ select.panel:hover { border-color: var(--accent); }
28652893 @endif
28662894
28672895 {{-- Share control (owner-only): reactive create/copy/revoke of a read-only link.
2868 Signals live in the <script client> block; shareUrl is seeded from the
2896 Signals live in the client script block; shareUrl is seeded from the
28692897 server-bridged existing token so the current link shows on load. --}}
28702898 @if (ownsActive)
28712899 <div class="p-5 panel site-settings-panel">
@@ -2883,7 +2911,7 @@ select.panel:hover { border-color: var(--accent); }
28832911 <button type="button" @click="copyShare" style="padding:6px 11px;border-radius:8px;border:1px solid var(--border);background:var(--panel);color:var(--text-2);font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer">{{ shareCopied() ? 'Copied' : 'Copy' }}</button>
28842912 <button type="button" @click="revokeShare" :disabled="shareBusy()" style="padding:6px 11px;border-radius:8px;border:1px solid var(--border);background:var(--panel);color:var(--text-3);font:600 12px/1 var(--sans,ui-sans-serif);cursor:pointer">Revoke</button>
28852913 </div>
2886 <button type="button" @click="createShare" :disabled="shareBusy()" :show="!shareUrl()" style="display:none;padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">{{ shareBusy() ? 'Creating…' : 'Create share link' }}</button>
2914 <button type="button" @click="createShare" :disabled="shareBusy()" :show="!shareUrl()" style="display:none;padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">{{ shareBusy() ? 'Creating…' : 'Create share link' }}</button>
28872915 </div>
28882916 </div>
28892917 @endif
@@ -3170,9 +3198,9 @@ select.panel:hover { border-color: var(--accent); }
31703198 that way. The map is drawn into an empty div by a plain module script, so
31713199 nothing in this subtree is reactive and nothing can be hidden.
31723200
3173 A <div>, not <main>: the router's fragment extraction slices from the
3174 first <main> to the last </main>, so a second one makes the SPA swap the
3175 wrong span.
3201 This remains a div because the router's fragment extraction expects the
3202 one main owned by the layout. A second one makes the SPA swap the wrong
3203 span.
31763204
31773205 The bar list below is NOT redundant. A browser-side map is blank until
31783206 the bundle runs, and it is the only thing a reader gets with JS off, on a
@@ -3256,7 +3284,7 @@ select.panel:hover { border-color: var(--accent); }
32563284
32573285 {{-- Top referrers: the actual referring URLs (full referrer), a drill-down beneath the
32583286 normalized Top sources / channels. Clickable to filter; excludes empty/direct traffic.
3259 {{ }} escapes the (beacon-supplied) url. --}}
3287 Server interpolation escapes the beacon-supplied URL. --}}
32603288 <div class="mt-6 p-5 panel reveal">
32613289 <h2 class="mb-4 font-semibold text-text-3 text-xs tracking-wider uppercase">Referrers</h2>
32623290 @forelse (referrerUrls as r)
@@ -3298,20 +3326,20 @@ select.panel:hover { border-color: var(--accent); }
32983326 /api/sites/{site}/goals via @submit=addGoal. Pattern is the event NAME for
32993327 event goals or the URL PATH for pageview goals. --}}
33003328 @if (ownsActive)
3301 <form @submit="addGoal" class="flex flex-wrap gap-2 items-center mt-4 pt-4" style="border-top:1px solid var(--border)">
3302 <input name="name" required maxlength="255" placeholder="Goal name" style="flex:1;min-width:110px;padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3303 <select name="type" style="padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3329 <form @submit="addGoal" class="flex flex-wrap gap-2 items-center mt-4 pt-4 goal-form" style="border-top:1px solid var(--border)">
3330 <input name="name" required maxlength="255" placeholder="Goal name" aria-label="Goal name" style="flex:1;min-width:110px;padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3331 <select name="type" aria-label="Goal type" style="padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
33043332 <option value="event">Event</option>
33053333 <option value="pageview">Pageview</option>
33063334 </select>
3307 <input name="pattern" required maxlength="255" placeholder="Event name or /path" style="flex:1;min-width:110px;padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3308 <select name="match" style="padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3335 <input name="pattern" required maxlength="255" placeholder="Event name or /path" aria-label="Goal event or path" style="flex:1;min-width:110px;padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3336 <select name="match" aria-label="Goal matching rule" style="padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
33093337 <option value="exact">exact</option>
33103338 <option value="contains">contains</option>
33113339 <option value="starts_with">starts with</option>
33123340 </select>
3313 <input name="value" type="number" step="any" placeholder="Value" style="width:80px;padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3314 <button type="submit" :disabled="goalBusy()" style="padding:7px 13px;border-radius:8px;border:0;background:var(--accent);color:#fff;font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">{{ goalBusy() ? 'Adding…' : 'Add goal' }}</button>
3341 <input name="value" type="number" step="any" placeholder="Value" aria-label="Goal value" style="width:80px;padding:6px 9px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:500 13px/1.2 var(--sans,ui-sans-serif)">
3342 <button type="submit" :disabled="goalBusy()" style="padding:7px 13px;border-radius:8px;border:0;background:var(--accent);color:var(--accent-ink);font:600 13px/1 var(--sans,ui-sans-serif);cursor:pointer">{{ goalBusy() ? 'Adding…' : 'Add goal' }}</button>
33153343 </form>
33163344 <div class="mt-2 text-xs" :show="goalError()" style="display:none;color:#ef4444">{{ goalError() }}</div>
33173345 @endif
@@ -3340,7 +3368,7 @@ select.panel:hover { border-color: var(--accent); }
33403368
33413369 {{-- Top outbound links / file downloads: the URLs behind the auto-tracked Outbound
33423370 Link / File Download events (properties.url). GROUP BY properties (dialect-portable,
3343 no JSON_EXTRACT); site+range scoped like Events. Display-only; {{ }} escapes the url. --}}
3371 no JSON_EXTRACT); site+range scoped like Events. Server interpolation escapes the URL. --}}
33443372 <div class="grid gap-6 md:grid-cols-2 mt-6">
33453373 <div class="p-5 panel reveal">
33463374 <h2 class="mb-4 font-semibold text-text-3 text-xs tracking-wider uppercase">Outbound links</h2>
@@ -3412,11 +3440,11 @@ select.panel:hover { border-color: var(--accent); }
34123440 @if (user)
34133441 <h2 class="mb-2 font-semibold text-lg">No site to show yet</h2>
34143442 <p class="mb-5 text-sm text-text-2">Add a site to get a tracking snippet and start seeing analytics here.</p>
3415 <StxLink to="/sites/new" class="inline-block px-4 py-2 font-semibold text-sm" style="border-radius:10px;background:var(--accent);color:#fff;text-decoration:none">Add a site</StxLink>
3443 <StxLink to="/sites/new" class="inline-block px-4 py-2 font-semibold text-sm" style="border-radius:10px;background:var(--accent);color:var(--accent-ink);text-decoration:none">Add a site</StxLink>
34163444 @else
34173445 <h2 class="mb-2 font-semibold text-lg">Sign in to view analytics</h2>
34183446 <p class="mb-5 text-sm text-text-2">This dashboard is private to the site owner.</p>
3419 <StxLink to="/login" class="inline-block px-4 py-2 font-semibold text-sm" style="border-radius:10px;background:var(--accent);color:#fff;text-decoration:none">Sign in</StxLink>
3447 <StxLink to="/login" class="inline-block px-4 py-2 font-semibold text-sm" style="border-radius:10px;background:var(--accent);color:var(--accent-ink);text-decoration:none">Sign in</StxLink>
34203448 @endif
34213449 </div>
34223450 @endif
@@ -3432,7 +3460,7 @@ select.panel:hover { border-color: var(--accent); }
34323460{{-- Pre-render token guard: send a signed-out visitor to /login before paint.
34333461
34343462 This USED to also mirror the localStorage token into the analyticshq_token cookie
3435 and reload once, so the <script server> block could owner-scope the switcher and
3463 and reload once, so the server script block could owner-scope the switcher and
34363464 setup panel. Both halves are gone (#33): stacks 0.70.369 has LoginAction set the
34373465 cookie in its own response, so it is present on the very first authenticated
34383466 document request — and the cookie is HttpOnly, so this block could not have written
@@ -3545,7 +3573,7 @@ select.panel:hover { border-color: var(--accent); }
35453573 dragging: false,
35463574 scrollWheelZoom: false,
35473575 doubleClickZoom: false,
3548 touchZoom: false,
3576 pinchZoom: false,
35493577 keyboard: false,
35503578 })
35513579 layer = new GeoJSON(world, { style: styleFor(tokens()) })