also looking at this
Harden AnalyticsHQ release and dashboard quality
#52
34 files
+1236
-340
| @@ -280,7 +280,7 @@ const regionGeoAllowed = privacy.geo.granularity === 'region' | ||
| 280 | 280 | let shareMode = false |
| 281 | 281 | // The owner's existing share token for the active site ('' if none), so the owner |
| 282 | 282 | // UI can show/copy/revoke the link. Bridged into the client block. |
| 283 | let shareToken = '' | |
| 283 | let __shareToken = '' | |
| 284 | 284 | |
| 285 | 285 | // Race all DB work against a short timeout: if PostgreSQL isn't reachable, a |
| 286 | 286 | // TCP connect can hang far longer than a render should wait, so we bail to the |
| @@ -383,7 +383,7 @@ async function loadData() { | ||
| 383 | 383 | || null |
| 384 | 384 | // Owner (not a share viewer): surface any existing share token for the link UI. |
| 385 | 385 | if (!shareMode) |
| 386 | shareToken = (await readSettings(siteId)).share_token || '' | |
| 386 | __shareToken = (await readSettings(siteId)).share_token || '' | |
| 387 | 387 | |
| 388 | 388 | // Team: who can already reach this site, and who has been invited but has not |
| 389 | 389 | // accepted yet. Resolved server-side and rendered with @foreach so the panel |
| @@ -1125,7 +1125,11 @@ const exportPayload = { | ||
| 1125 | 1125 | * because the snippets are built from server config but can only be *finished* |
| 1126 | 1126 | * on the client, which is the one thing that knows the real origin. |
| 1127 | 1127 | */ |
| 1128 | defineClientPayload({ 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. | |
| 1131 | const shareCapability = __shareToken | |
| 1132 | defineClientPayload({ activeSiteId, countryTotals, exportPayload, installOptions, liveNow, range, shareCapability }) | |
| 1129 | 1133 | |
| 1130 | 1134 | useSeoMeta({ |
| 1131 | 1135 | title: "Dashboard - analyticshq", |
| @@ -1144,12 +1148,12 @@ useSeoMeta({ | ||
| 1144 | 1148 | const goalError = state('') |
| 1145 | 1149 | const goalBusy = state(false) |
| 1146 | 1150 | const 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 | |
| 1148 | 1152 | // are server consts inlined here by the data bridge), then create/revoke live. |
| 1149 | 1153 | // Built by shareLinkFor rather than by a second copy of the same template -- it is |
| 1150 | 1154 | // declared further down and reached by hoisting, which is the trade for having one |
| 1151 | 1155 | // place that decides what a share URL looks like. |
| 1152 | const shareUrl = state(shareToken ? shareLinkFor(shareToken) : '') | |
| 1156 | const shareUrl = state(shareCapability ? shareLinkFor(shareCapability) : '') | |
| 1153 | 1157 | const shareBusy = state(false) |
| 1154 | 1158 | const shareCopied = state(false) |
| 1155 | 1159 | // Live "current visitors": seeded from the server render, then polled so the |
| @@ -2051,7 +2055,7 @@ onMount(() => { | ||
| 2051 | 2055 | {{-- The token block, body and .wordmark that stood here were byte-identical to |
| 2052 | 2056 | account.stx's and now live once in resources/layouts/app.stx. What remains is what |
| 2053 | 2057 | 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 | |
| 2055 | 2059 | body, so a loose block would still apply but from the wrong place. --}} |
| 2056 | 2060 | @push('styles') |
| 2057 | 2061 | {{-- ts-maps' own stylesheet. Same-origin from /vendor like the engine beside it |
| @@ -2122,7 +2126,7 @@ onMount(() => { | ||
| 2122 | 2126 | .range-link:hover { color: var(--text); } |
| 2123 | 2127 | .range-link[aria-current="page"] { |
| 2124 | 2128 | background: var(--accent); |
| 2125 | color: #fff; | |
| 2129 | color: var(--accent-ink); | |
| 2126 | 2130 | } |
| 2127 | 2131 | .range-tool { |
| 2128 | 2132 | display: inline-flex; |
| @@ -2153,7 +2157,7 @@ summary:focus-visible { | ||
| 2153 | 2157 | outline: 2px solid var(--accent); |
| 2154 | 2158 | outline-offset: 2px; |
| 2155 | 2159 | } |
| 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); } | |
| 2157 | 2161 | .range-tool i { width: 1rem; height: 1rem; } |
| 2158 | 2162 | .date-menu { position: relative; } |
| 2159 | 2163 | .date-menu > summary { list-style: none; } |
| @@ -2295,13 +2299,17 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2295 | 2299 | .ga-dot-v { background: var(--accent); } |
| 2296 | 2300 | .ga-dot-u { background: var(--text-3); } |
| 2297 | 2301 | .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; } | |
| 2300 | 2304 | .ga-tip-day { font-size: 11px; color: var(--text-2); margin-bottom: 5px; } |
| 2301 | 2305 | .ga-tip-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; line-height: 1.7; } |
| 2302 | 2306 | .ga-tip-row b { margin-left: auto; color: var(--text); font-weight: 600; } |
| 2303 | 2307 | .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 | } | |
| 2305 | 2313 | |
| 2306 | 2314 | /* Export CSV pill: hover tightens the border to the accent like the range pills. */ |
| 2307 | 2315 | #export-csv:hover { color: var(--text); border-color: var(--accent); } |
| @@ -2335,6 +2343,25 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2335 | 2343 | .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; } |
| 2336 | 2344 | .chrome-btn:hover { color: var(--text); border-color: var(--accent); } |
| 2337 | 2345 | .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 | } | |
| 2338 | 2365 | /* One glyph at a time. `theme.isDark()` writes data-t, and these pick the matching |
| 2339 | 2366 | icon -- the same contract bughq's header uses, so the two toggles behave alike. */ |
| 2340 | 2367 | .theme-btn .ic-sun, .theme-btn .ic-moon { display: none; } |
| @@ -2343,9 +2370,9 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2343 | 2370 | </style> |
| 2344 | 2371 | @endpush |
| 2345 | 2372 | |
| 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. | |
| 2349 | 2376 | Same classes as before, one tag name different. --}} |
| 2350 | 2377 | @section('content') |
| 2351 | 2378 | <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); } | ||
| 2470 | 2497 | <section class="grid grid-cols-2 lg:grid-cols-7 mb-6 border-border lg:divide-x panel reveal" aria-label="Key metrics"> |
| 2471 | 2498 | @foreach (kpiCards as kpi) |
| 2472 | 2499 | <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> | |
| 2475 | 2502 | @if (kpi.delta !== null) |
| 2476 | 2503 | <div class="mt-1.5 font-medium text-xs mono" style="color: {{ (kpi.delta >= 0) === kpi.goodUp ? '#10b981' : '#ef4444' }}"> |
| 2477 | 2504 | {{ 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); } | ||
| 2503 | 2530 | |
| 2504 | 2531 | The tab strip is x-for over the server-built catalogue, and the body is |
| 2505 | 2532 | 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 | |
| 2507 | 2534 | the tag shows as text rather than executing. --}} |
| 2508 | 2535 | @if (ownsActive) |
| 2509 | 2536 | <section class="border-border panel site-settings-panel"> |
| @@ -2514,7 +2541,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2514 | 2541 | <div class="pb-5 px-5"> |
| 2515 | 2542 | {{-- Tabs and prose are SERVER-rendered (@foreach, static labels, server |
| 2516 | 2543 | 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 | |
| 2518 | 2545 | body — x-cloak is display:none, so a new user with nothing to look |
| 2519 | 2546 | at but install instructions got a blank box. Only the code block |
| 2520 | 2547 | below is reactive, and only because the origin lives in the |
| @@ -2527,9 +2554,9 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2527 | 2554 | role="tab" |
| 2528 | 2555 | @click="installTab.set('{{ opt.id }}')" |
| 2529 | 2556 | :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' | |
| 2531 | 2558 | : '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" | |
| 2533 | 2560 | >{{ opt.label }}</button> |
| 2534 | 2561 | @endforeach |
| 2535 | 2562 | </div> |
| @@ -2553,7 +2580,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2553 | 2580 | |
| 2554 | 2581 | Lists are SERVER-rendered with @foreach and server mustaches, for the |
| 2555 | 2582 | 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. | |
| 2557 | 2584 | A mutation re-reads from the server rather than patching a reactive list |
| 2558 | 2585 | in place — invites are rare and correctness is worth more than avoiding a |
| 2559 | 2586 | reload here. |
| @@ -2611,21 +2638,22 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2611 | 2638 | <input |
| 2612 | 2639 | type="email" |
| 2613 | 2640 | x-model="inviteEmail" |
| 2641 | aria-label="Teammate email" | |
| 2614 | 2642 | placeholder="teammate@example.com" |
| 2615 | 2643 | autocomplete="off" |
| 2616 | 2644 | 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)" |
| 2617 | 2645 | > |
| 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)"> | |
| 2619 | 2647 | <option value="viewer">can view</option> |
| 2620 | 2648 | <option value="admin">can manage</option> |
| 2621 | 2649 | </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 | |
| 2624 | 2652 | a reactive mustache — so the primary control on this panel was |
| 2625 | 2653 | display:none until the bundle ran. Busy state is carried by |
| 2626 | 2654 | :disabled, an ATTRIBUTE binding, which does not cloak, and by |
| 2627 | 2655 | 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> | |
| 2629 | 2657 | <span :show="inviteBusy()" style="display:none;color:var(--text-3);font:400 12px/1 var(--sans,ui-sans-serif)">Sending…</span> |
| 2630 | 2658 | </div> |
| 2631 | 2659 | <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); } | ||
| 2636 | 2664 | <div class="mt-4 px-4 py-3" style="border: 1px solid var(--border); border-radius: 10px; background: var(--bg)"> |
| 2637 | 2665 | <p class="mb-1 font-semibold text-sm">Invite your teammates with Pro</p> |
| 2638 | 2666 | <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> | |
| 2640 | 2668 | </div> |
| 2641 | 2669 | @endif |
| 2642 | 2670 | @endif |
| @@ -2694,7 +2722,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2694 | 2722 | in separate elements for the same reason: a reactive child cloaks |
| 2695 | 2723 | its parent. --}} |
| 2696 | 2724 | <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> | |
| 2698 | 2726 | </div> |
| 2699 | 2727 | <p class="mt-2 text-text-3 text-xs" :show="gaProgress()" style="display:none">{{ gaProgress() }}</p> |
| 2700 | 2728 | <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); } | ||
| 2778 | 2806 | button's own text would hide the control until hydration. --}} |
| 2779 | 2807 | <div class="flex flex-wrap gap-3 items-center mt-4"> |
| 2780 | 2808 | <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> | |
| 2782 | 2810 | </div> |
| 2783 | 2811 | |
| 2784 | 2812 | <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); } | ||
| 2807 | 2835 | <div class="mt-1 px-4 py-3" style="border: 1px solid var(--border); border-radius: 10px; background: var(--bg)"> |
| 2808 | 2836 | <p class="mb-1 font-semibold text-sm">Import your Fathom history with Pro</p> |
| 2809 | 2837 | <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> | |
| 2811 | 2839 | </div> |
| 2812 | 2840 | @endif |
| 2813 | 2841 | </div> |
| @@ -2865,7 +2893,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2865 | 2893 | @endif |
| 2866 | 2894 | |
| 2867 | 2895 | {{-- 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 | |
| 2869 | 2897 | server-bridged existing token so the current link shows on load. --}} |
| 2870 | 2898 | @if (ownsActive) |
| 2871 | 2899 | <div class="p-5 panel site-settings-panel"> |
| @@ -2883,7 +2911,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 2883 | 2911 | <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> |
| 2884 | 2912 | <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> |
| 2885 | 2913 | </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> | |
| 2887 | 2915 | </div> |
| 2888 | 2916 | </div> |
| 2889 | 2917 | @endif |
| @@ -3170,9 +3198,9 @@ select.panel:hover { border-color: var(--accent); } | ||
| 3170 | 3198 | that way. The map is drawn into an empty div by a plain module script, so |
| 3171 | 3199 | nothing in this subtree is reactive and nothing can be hidden. |
| 3172 | 3200 | |
| 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. | |
| 3176 | 3204 | |
| 3177 | 3205 | The bar list below is NOT redundant. A browser-side map is blank until |
| 3178 | 3206 | 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); } | ||
| 3256 | 3284 | |
| 3257 | 3285 | {{-- Top referrers: the actual referring URLs (full referrer), a drill-down beneath the |
| 3258 | 3286 | 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. --}} | |
| 3260 | 3288 | <div class="mt-6 p-5 panel reveal"> |
| 3261 | 3289 | <h2 class="mb-4 font-semibold text-text-3 text-xs tracking-wider uppercase">Referrers</h2> |
| 3262 | 3290 | @forelse (referrerUrls as r) |
| @@ -3298,20 +3326,20 @@ select.panel:hover { border-color: var(--accent); } | ||
| 3298 | 3326 | /api/sites/{site}/goals via @submit=addGoal. Pattern is the event NAME for |
| 3299 | 3327 | event goals or the URL PATH for pageview goals. --}} |
| 3300 | 3328 | @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)"> | |
| 3304 | 3332 | <option value="event">Event</option> |
| 3305 | 3333 | <option value="pageview">Pageview</option> |
| 3306 | 3334 | </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)"> | |
| 3309 | 3337 | <option value="exact">exact</option> |
| 3310 | 3338 | <option value="contains">contains</option> |
| 3311 | 3339 | <option value="starts_with">starts with</option> |
| 3312 | 3340 | </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> | |
| 3315 | 3343 | </form> |
| 3316 | 3344 | <div class="mt-2 text-xs" :show="goalError()" style="display:none;color:#ef4444">{{ goalError() }}</div> |
| 3317 | 3345 | @endif |
| @@ -3340,7 +3368,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 3340 | 3368 | |
| 3341 | 3369 | {{-- Top outbound links / file downloads: the URLs behind the auto-tracked Outbound |
| 3342 | 3370 | 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. --}} | |
| 3344 | 3372 | <div class="grid gap-6 md:grid-cols-2 mt-6"> |
| 3345 | 3373 | <div class="p-5 panel reveal"> |
| 3346 | 3374 | <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); } | ||
| 3412 | 3440 | @if (user) |
| 3413 | 3441 | <h2 class="mb-2 font-semibold text-lg">No site to show yet</h2> |
| 3414 | 3442 | <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> | |
| 3416 | 3444 | @else |
| 3417 | 3445 | <h2 class="mb-2 font-semibold text-lg">Sign in to view analytics</h2> |
| 3418 | 3446 | <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> | |
| 3420 | 3448 | @endif |
| 3421 | 3449 | </div> |
| 3422 | 3450 | @endif |
| @@ -3432,7 +3460,7 @@ select.panel:hover { border-color: var(--accent); } | ||
| 3432 | 3460 | {{-- Pre-render token guard: send a signed-out visitor to /login before paint. |
| 3433 | 3461 | |
| 3434 | 3462 | 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 | |
| 3436 | 3464 | setup panel. Both halves are gone (#33): stacks 0.70.369 has LoginAction set the |
| 3437 | 3465 | cookie in its own response, so it is present on the very first authenticated |
| 3438 | 3466 | 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); } | ||
| 3545 | 3573 | dragging: false, |
| 3546 | 3574 | scrollWheelZoom: false, |
| 3547 | 3575 | doubleClickZoom: false, |
| 3548 | touchZoom: false, | |
| 3576 | pinchZoom: false, | |
| 3549 | 3577 | keyboard: false, |
| 3550 | 3578 | }) |
| 3551 | 3579 | layer = new GeoJSON(world, { style: styleFor(tokens()) }) |