diff --git a/CLAUDE.md b/CLAUDE.md index 960d9388..f5889207 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -82,8 +82,9 @@ server (`docs/architecture.md`, "The language bar"). every call through `useApi()` with `credentials: 'omit'`, so no cookie lands on a public page. - The theme follows the OS by default; `localStorage.theme` holds an explicit - choice. `/black-friday` alone is always dark. The portal is another origin and - keeps its own. + choice. Every page follows it, `/black-friday` and the sale's banner and notice + included: light mode is light throughout, with no dark island. The portal is + another origin and keeps its own. ## Conventions diff --git a/app/Support/Banner.php b/app/Support/Banner.php index 48594c10..ef7a2bc2 100644 --- a/app/Support/Banner.php +++ b/app/Support/Banner.php @@ -44,6 +44,14 @@ final class Banner */ public const CAMPAIGN_PAGE = 'landing.black-friday'; + /** + * Base route names where the sale's banner shows but its notice does not + * open over the page: Pricing already carries the sale on its plan cards. + * + * @var list + */ + public const CAMPAIGN_NOTICE_HIDDEN_ON = ['landing.pricing']; + public const KIND_CAMPAIGN = 'campaign'; public const KIND_LICENSE = 'license'; @@ -75,15 +83,23 @@ public static function hiddenOnIosDevices(Request $request): bool /** * The shared `banner` prop, or null where no banner is on this page. Null * rather than a flag, so the component renders nothing at all. Only which - * banner and its link: the words are the `banner` and `campaign` catalogs', - * and neither banner can be closed, so there is no version to close it at. + * banner and its link: the words are the `banner` and `campaign` catalogs'. + * The license banner cannot be closed, so there is no version to close it at. + * + * The sale's carries `notice`: whether its notice (`CampaignNotice`) may + * open over this page on load. Whether it does is the reader's browser's + * call, since the page sits in the edge cache. * - * @return array{kind: string, href: string}|null + * @return array{kind: string, href: string, notice?: bool}|null */ public static function forRequest(Request $request): ?array { return match (self::kind($request)) { - self::KIND_CAMPAIGN => ['kind' => self::KIND_CAMPAIGN, 'href' => '/black-friday'], + self::KIND_CAMPAIGN => [ + 'kind' => self::KIND_CAMPAIGN, + 'href' => '/black-friday', + 'notice' => ! in_array(self::page($request), self::CAMPAIGN_NOTICE_HIDDEN_ON, true), + ], self::KIND_LICENSE => ['kind' => self::KIND_LICENSE, 'href' => (string) config('banner.href')], default => null, }; diff --git a/docs/architecture.md b/docs/architecture.md index 42638dd9..3e54448e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -400,7 +400,11 @@ Events keep the names the Plausible goals had: `download_click` (`location`, `newsletter_signup_clicked` (`source`). The license banner adds `license_banner_view` and `license_banner_click`, without parameters, so a banner's clicks can be compared with its views and with `checkout_started`. -It cannot be closed, so there is no dismiss event. GA4 stores the parameters +It cannot be closed, so there is no dismiss event. The dated sale's banner sends +`campaign_banner_view`, `campaign_banner_click` and `campaign_banner_close`; +its notice (`CampaignNotice`) sends `campaign_notice_view` (`kind`: `dialog` +or `card`), `campaign_notice_click` (`action`: `buy`, `both` or `deal`) and +`campaign_notice_close` (`action`: what closed it). GA4 stores the parameters from the first hit but only shows them in reports once each is registered as an event-scoped custom dimension under Admin → Custom definitions. Page changes between Inertia visits are counted by enhanced measurement's "page changes diff --git a/docs/rebuild/design/design-system.md b/docs/rebuild/design/design-system.md index 1a043c1c..0c6b3d2f 100644 --- a/docs/rebuild/design/design-system.md +++ b/docs/rebuild/design/design-system.md @@ -266,20 +266,19 @@ Every row of the §2.3 table becomes an assertion. Add a gamut assertion: no tok if (t === 'dark' || t === 'system' || t === 'light') { choice = t; } } catch (e) {} var root = document.documentElement; - var forced = root.dataset.themeForced === 'dark'; - var dark = forced || choice === 'dark' || (choice === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches); + var dark = choice === 'dark' || (choice === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches); if (dark) { root.classList.add('dark'); } root.dataset.themeChoice = choice; /* drives the control's icon without hydration */ root.style.colorScheme = dark ? 'dark' : 'light'; var m = document.querySelector('meta[name="theme-color"]'); - if (m) { m.setAttribute('content', forced ? '#060606' : dark ? '#121212' : '#ffffff'); } + if (m) { m.setAttribute('content', dark ? '#121212' : '#ffffff'); } })(); ``` `#ffffff` and `#121212` are the two `--background` values in §2.2. -**The one forced page.** `/black-friday` is dark in both themes, from the banner to the footer (owner decision, 2026-11-18). Blade stamps `html[data-theme-forced="dark"]` and `LandingLayout`'s `alwaysDark` holds it across visits inside the app. The reader's stored choice is untouched, the theme control is hidden there, and `--background`, `--surface` and `--raised` drop to `oklch(0.12 0 0)` (`#060606`), `oklch(0.15 0 0)` and `oklch(0.18 0 0)`. +**No forced page.** Every page and every part of one follows the reader's theme, `/black-friday`, the sale's banner and its notice included (owner decision, 2026-11-28, replacing the always-dark sale page of 2026-11-18): light mode is light throughout, with no dark island in it. **Rules:** @@ -1040,6 +1039,7 @@ One shared file, `components/shared/theme-control.tsx` (architecture §1.10 and - Actions are right-aligned: **Cancel** (`quiet`, default focus on destructive dialogs), then **confirm** (`danger` or `primary`). - Below 480 the actions stack full width in the same order. - Escape cancels. The confirm button shows a busy state; on error the dialog stays open with an inline `Callout danger`. +- The dated sale's notice (`CampaignNotice`, positioning "Dated sales") is the one dialog outside this shape: 520px, on `--raised` in the reader's theme, focus on the dialog itself when it opens, one `primary` action full width and `Not now` as `quiet`. Escape, the backdrop and every action close it. **Toast:** @@ -1321,11 +1321,10 @@ The ceiling drops from 320ms to 240ms, and `--dur-row` goes with the row bar. - autoplay video - hover lifts (`translateY`) or shadow blooms -**The dated sale is the exception** (owner decision, 2026-11-06: "ban the AI look, not motion"). On the sale's black ground only (`/black-friday` and its banner), and never under reduced motion: +**The dated sale is the exception** (owner decision, 2026-11-06: "ban the AI look, not motion"). On the sale's own ground only (`/black-friday` and its banner), and never under reduced motion: - **The load sequence,** once per visit: the headline settles (`sale-rise`, 560ms, `--ease-panel`), a drawn line strikes the list prices, then the sale prices arrive. Under a second in all. - **The countdown digits roll**, each one only when it changes (`roll-in`, `roll-out`, 320ms). -- **The light under the pointer** (`campaign-spot`): a 30rem accent radial at 13% that follows a mouse, never a finger, and fades out when the pointer leaves. - **The Pro capture crossfade** (`sale-stage`, `--dur-panel`): only when the reader picks another feature. **Pricing** (owner decision, 2026-11-06), on the plan block wherever it shows (/pricing, the homepage, /teams), never under reduced motion: diff --git a/docs/rebuild/design/positioning.md b/docs/rebuild/design/positioning.md index 711c254e..0ecac774 100644 --- a/docs/rebuild/design/positioning.md +++ b/docs/rebuild/design/positioning.md @@ -447,7 +447,16 @@ prices, with a code that works only inside the window (`App\Support\Pricing\Camp - **Where, while it is live:** the banner slot on every page but the sale's own, and the plan cards of the cycles it covers. No band above a page's hero (owner, 2026-11-23). Checkout from the site attaches the code. Before and after the window, only the sale's own page mentions it. -- **The sale's own page,** `/black-friday`, keeps one URL from year to year and is black throughout, in both themes. Before the sale it states the window and +- **The notice** (owner, 2026-11-28, `CampaignNotice`): once per page load, as the page opens. From 640px a modal + dialog in the reader's theme: the percentage off, the two offers as ruled rows with their struck prices, the + countdown, a button that buys Pro one-time at its sale price, a link to the sale's page and "Not now". Below + 640px a card at the bottom of the screen that blocks nothing (Google's guidance on intrusive dialogs): the + percentage, Pro one-time's sale price, the countdown and the sale's page. It never opens on the sale's page or + Pricing, while the consent bar is asking (one thing asks at a time), for a reader whose regional discount takes + more off, or again once the reader has answered it, a click on an offer included: closing it or the banner closes + it for the rest of the sale (`tablepro:campaign-closed`). No coloured dot, glow or accent rule on it; the accent + is the one button. +- **The sale's own page,** `/black-friday`, keeps one URL from year to year and follows the reader's theme like every other page. Before the sale it states the window and the prices, and offers a calendar file for the start instead of a button that cannot be pressed; during it the offers can be bought from it; after it, its title, heading and description say the sale has ended, and nothing on it is offered. Its copy stays near 150 words: the offers as two ruled rows, Pro one-time first and larger, then the Pro @@ -466,8 +475,9 @@ prices, with a code that works only inside the window (`App\Support\Pricing\Camp - **The regional discount** stays as above: never named outside the plan block. Checkout takes one discount per order, so the site sends the sale's code only when it takes at least as much off as the reader's regional discount. -- **The black ground** is an island of the dark theme (`.dark` on the element), so the design system's text pairs - hold on it in either theme. +- **The theme:** the banner, the notice and the sale's page follow the reader's theme (owner, 2026-11-28, replacing + the always-black sale of 2026-11-18): light mode is light throughout. Only the share card, an image shown off the + site, keeps its black ground. --- diff --git a/resources/css/app.css b/resources/css/app.css index 7a2e6826..437cb6e2 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -219,10 +219,15 @@ html.has-language-bar .support-banner { * reader's clock passes the end, so nothing offers a code checkout no longer * takes. * - * The banner and the sale page's ground are an island of the dark theme - * whatever the reader chose: the element carries `.dark`, so every token - * inside resolves to its dark value and the design system's text pairs hold. - * The glow is the brand hue thinning out from the top right. Positioning §12.2. + * The banner, the notice and the sale page follow the reader's theme like + * every other part of the site: light mode is light throughout (owner, + * 2026-11-28). Flat: no glow and no light under the pointer, as the accent + * never colours a glow (design-system §1). Positioning §12.2. + * + * The slot holds one bar: the language bar, when it shows, takes it from the + * sale's banner as it does from the license banner. The rule names all three + * classes so it outweighs the one that shows the banner; with only + * `has-language-bar` it lost on specificity and both bars stacked. */ .campaign-banner { display: none; @@ -233,47 +238,11 @@ html.has-banner.campaign-live .campaign-banner { height: var(--banner-h); } -html.has-language-bar .campaign-banner { - display: none; -} - -.campaign-surface { - background-color: oklch(0.12 0 0); - color: var(--foreground); -} - -/* /black-friday is black from the banner to the footer in either theme, so its hero's ground is the page's. */ -@media screen { - html[data-theme-forced] { - --background: oklch(0.12 0 0); - --surface: oklch(0.15 0 0); - --raised: oklch(0.18 0 0); - } -} - -html[data-theme-forced] .theme-setting { +html.has-language-bar.has-banner.campaign-live .campaign-banner { display: none; } -.campaign-banner { - border-bottom: 1px solid color-mix(in oklab, var(--accent) 45%, var(--rule)); -} - -.campaign-glow { - background-image: radial-gradient( - 56rem 28rem at 100% 0%, - color-mix(in oklab, var(--accent) 16%, transparent), - transparent 70% - ); -} - -@media (forced-colors: active) { - .campaign-glow { - background-image: none; - } -} - -/* The global rails are drawn in the page's theme; on the black ground they would be a light line in the light theme. */ +/* The sale's own rails, drawn over its banner and ground, which sit above the global ones. */ .campaign-rails { position: absolute; inset: 0; @@ -302,30 +271,6 @@ html[data-theme-forced] .theme-setting { } } -/* The light under the pointer on the sale's black ground. Mouse only. */ -.campaign-spot { - position: absolute; - inset: 0; - pointer-events: none; - opacity: 0; - background: radial-gradient( - 30rem circle at var(--spot-x, 50%) var(--spot-y, 50%), - color-mix(in oklab, var(--accent) 13%, transparent), - transparent 70% - ); - transition: opacity var(--dur-panel) var(--ease-feedback); -} - -[data-spot="on"] > .campaign-spot { - opacity: 1; -} - -@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce), (forced-colors: active) { - .campaign-spot { - display: none; - } -} - .sale-display { font-size: clamp(3.5rem, 15vw, 9.5rem); line-height: 0.92; diff --git a/resources/js/components/campaign/campaign-banner.tsx b/resources/js/components/campaign/campaign-banner.tsx index 2a754976..7470d3b1 100644 --- a/resources/js/components/campaign/campaign-banner.tsx +++ b/resources/js/components/campaign/campaign-banner.tsx @@ -8,7 +8,8 @@ import { trackEvent } from '@/lib/analytics'; import { PRICING } from '@/lib/data/pricing'; import Countdown from './countdown'; -// Local storage: the id of the sale whose banner the reader closed. Listed in the privacy policy. +// Local storage: the id of the sale whose banner the reader closed, or `{id}:notice` once they closed only its notice +// (`noticeClosedValue`, CampaignNotice). Listed in the privacy policy as the closed sale notice. export const CLOSED_KEY = 'tablepro:campaign-closed'; // Closable, because its countdown updates by itself on every page (WCAG 2.2.2). @@ -47,7 +48,7 @@ export default function CampaignBanner() { } return ( -
+
+ +

+ {fmt(copy.headline, { percent: campaign.percent })} + {copy.product} +

+

{fmt(copy.window, { endsOn: prop.endsOn, endsAtTime: prop.endsAtTime })}

+ +
    + {rows.map((row) => ( +
  • +
    +

    {row.name}

    +

    {row.detail}

    +
    +

    + + {fmt(m.campaign.offer.listPrice, { price: usd(row.list) })} + + + +

    +
  • + ))} +
+ + + + + {flow.error !== null && ( + +

{flow.error.message}

+
+ )} + +
+ { + trackEvent('campaign_notice_click', { action: 'both' }); + onClose('both'); + }} + className={textLinkClasses('standalone', 'type-small py-2.5 font-medium')} + > + {copy.both} + + +
+ +

{fmt(copy.footnote, { listPriceSince: prop.listPriceSince })}

+
+ + ); +} + +function NoticeCard({ campaign, href, onClose }: NoticeProps) { + const { m, fmt } = useI18n(); + const titleId = useId(); + const card = useRef(null); + + // Keeps a focused element from scrolling underneath it (WCAG 2.4.11), as the consent bar does. + useEffect(() => { + const root = document.documentElement; + const node = card.current; + + if (node === null || root.style.scrollPaddingBottom !== '') { + return; + } + + root.style.scrollPaddingBottom = `${node.offsetHeight + 24}px`; + + return () => { + root.style.scrollPaddingBottom = ''; + }; + }, []); + const copy = m.campaign.notice; + const lifetime = discountedAmount(PRICING.tiers.starter.prices.lifetime, campaign.percent); + + return ( +
+
+

+ {fmt(copy.card, { percent: campaign.percent })} +

+ +
+
+
+

{fmt(copy.cardPrice, { price: formatUsd(lifetime, m.pricing.currency) })}

+ +
+ { + trackEvent('campaign_notice_click', { action: 'deal' }); + onClose('deal'); + }} + className="inline-flex min-h-11 shrink-0 items-center rounded-control bg-accent px-4 text-sm font-medium text-accent-foreground transition-colors duration-(--dur-tap) ease-(--ease-feedback) hover:bg-accent-hover active:bg-accent-active" + > + {m.campaign.banner.cta} + +
+
+ ); +} diff --git a/resources/js/components/campaign/countdown.tsx b/resources/js/components/campaign/countdown.tsx index f2328f26..7c53ebd4 100644 --- a/resources/js/components/campaign/countdown.tsx +++ b/resources/js/components/campaign/countdown.tsx @@ -7,8 +7,9 @@ import { cn } from '@/lib/utils'; interface CountdownProps { to: 'start' | 'end'; - // `inline`: one line of text, for the banner. `digits`: large rolling digits with their units, for the band and the sale's page. - variant: 'inline' | 'digits'; + // `inline`: one line of text, for the banner. `row`: one line of rolling digits with their units, for the sale's notice. + // `digits`: large rolling digits with their units, for the band and the sale's page. + variant: 'inline' | 'row' | 'digits'; className?: string; } @@ -52,6 +53,26 @@ export default function Countdown({ to, variant, className }: CountdownProps) { [left.seconds, copy.units.seconds], ]; + if (variant === 'row') { + return ( +
+ + {left !== null && ( + + )} +
+ ); + } + return (

{item.detail}{' '} - + {/* Underlined, not arrowed: beside the muted sentence, colour alone would not mark it (WCAG 1.4.1). */} + {item.link} -

diff --git a/resources/js/components/shared/footer-bar.tsx b/resources/js/components/shared/footer-bar.tsx index 2ba46888..12d20d86 100644 --- a/resources/js/components/shared/footer-bar.tsx +++ b/resources/js/components/shared/footer-bar.tsx @@ -148,7 +148,7 @@ export default function FooterBar({ copyright, language, themeLabels, chat = fal style={chat ? { paddingRight: `max(0px, calc(${LAUNCHER_REACH}px - max(var(--cell-bleed), (100vw - 76rem) / 2)))` } : undefined} > {language} - +
); diff --git a/resources/js/components/site/language-bar.tsx b/resources/js/components/site/language-bar.tsx index 6aca9e07..b30ab848 100644 --- a/resources/js/components/site/language-bar.tsx +++ b/resources/js/components/site/language-bar.tsx @@ -11,7 +11,7 @@ import { languageCopy } from '@/i18n'; * the header and in place of the license banner (TopBanner). * * It speaks the language it offers, never the page's, since the reader it is - * for may not read the page's: "Đọc trang này bằng tiếng Việt →" on an English + * for may not read the page's: "Đọc trang này bằng tiếng Việt" on an English * page. Those few strings ship for every locale (`languageCopy`). The link is * the switcher's own option for that language, a plain `` to the same page * there, and following it is the reader's pick (`pickLanguage`). ✕ means that @@ -50,7 +50,6 @@ export default function LanguageBar() { className={textLinkClasses('standalone', 'relative whitespace-nowrap after:absolute after:-inset-x-1 after:-inset-y-3')} > {copy.action} -