@atelic-action/ui 7.2.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +439 -132
- package/bin/atelic-check-sentry.ts +5 -0
- package/dist/gate/middleware.js +15 -1
- package/dist/monitoring/server.d.ts +72 -0
- package/dist/monitoring/server.js +201 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/marketing-config.d.ts +28 -1
- package/dist/vite/marketing-config.js +62 -0
- package/package.json +23 -11
- package/src/app/ErrorFallback.tsx +6 -2
- package/src/app/context/AppContext.tsx +10 -1
- package/src/app/index.ts +0 -1
- package/src/app/layout/AppPage.tsx +36 -7
- package/src/app/layout/DesktopRail.tsx +15 -6
- package/src/app/layout/MobileMenu.tsx +14 -5
- package/src/app/layout/MobileTabBar.tsx +3 -2
- package/src/app/layout/PageError.tsx +7 -4
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/SectionCards.tsx +7 -2
- package/src/app/layout/UserMenu.tsx +13 -7
- package/src/app/ui/alert.tsx +42 -12
- package/src/app/ui/badge.tsx +1 -1
- package/src/app/ui/button.tsx +2 -1
- package/src/app/ui/command.tsx +86 -21
- package/src/app/ui/country-dropdown.tsx +26 -47
- package/src/app/ui/form.tsx +48 -9
- package/src/app/ui/pagination.tsx +1 -1
- package/src/app/ui/progress.tsx +26 -12
- package/src/app/ui/search-input.tsx +16 -3
- package/src/app/ui/select.tsx +8 -3
- package/src/app/ui/slider.tsx +62 -15
- package/src/artifact/AppErrorBoundary.tsx +12 -7
- package/src/artifact/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +102 -17
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +361 -0
- package/src/chrome/Footer.tsx +126 -31
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +399 -0
- package/src/chrome/SiteHeader.tsx +268 -23
- package/src/chrome/SiteMenu.tsx +200 -19
- package/src/chrome/SiteShell.tsx +151 -14
- package/src/chrome/StickyCTABar.tsx +60 -2
- package/src/chrome/brandMark.ts +56 -0
- package/src/chrome/icons.ts +58 -0
- package/src/chrome/index.ts +16 -0
- package/src/chrome/navSections.ts +55 -0
- package/src/components/ColumnChart.tsx +27 -2
- package/src/components/DataTable.tsx +104 -85
- package/src/components/Disclosure.tsx +3 -1
- package/src/components/Hint.tsx +3 -24
- package/src/components/NotFound.tsx +7 -3
- package/src/components/StarRating.tsx +45 -19
- package/src/components/ThresholdScale.tsx +36 -26
- package/src/email/atoms.tsx +13 -57
- package/src/email/frame.tsx +4 -6
- package/src/email/index.ts +4 -10
- package/src/email/scoreboard.tsx +107 -186
- package/src/email/text.ts +30 -0
- package/src/email/theme.tsx +76 -9
- package/src/gate/middleware.ts +15 -1
- package/src/hooks/useDismiss.ts +39 -0
- package/src/lib/emailText.tsx +26 -0
- package/src/lib/phoneText.tsx +40 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/monitoring/ErrorCatcherScript.tsx +15 -0
- package/src/monitoring/catcher.ts +118 -0
- package/src/monitoring/index.ts +25 -0
- package/src/monitoring/sdk.ts +112 -0
- package/src/monitoring/server.ts +244 -0
- package/src/monitoring/start.ts +118 -0
- package/src/primitives/Button.tsx +5 -1
- package/src/primitives/Eyebrow.tsx +6 -2
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- package/src/routing/index.ts +1 -0
- package/src/routing/miss.ts +32 -0
- package/src/scripts/check-sentry.ts +77 -0
- package/src/sections/BlogIndex.tsx +17 -3
- package/src/sections/BlogPost.tsx +10 -1
- package/src/sections/CTASection.tsx +2 -2
- package/src/sections/CalloutPanel.tsx +34 -0
- package/src/sections/ComparisonTable.tsx +23 -2
- package/src/sections/ContactForm.tsx +61 -17
- package/src/sections/FAQBrowser.tsx +11 -2
- package/src/sections/FeatureGrid.tsx +6 -2
- package/src/sections/FullBleedVideo.tsx +167 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +70 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +80 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +18 -5
- package/src/sections/LogoMarquee.tsx +43 -11
- package/src/sections/MapEmbed.tsx +13 -9
- package/src/sections/PageHero.tsx +16 -2
- package/src/sections/ProcessSteps.tsx +27 -4
- package/src/sections/ProfileCards.tsx +12 -2
- package/src/sections/ProofStrip.tsx +44 -0
- package/src/sections/RevealSlider.tsx +28 -7
- package/src/sections/ReviewCarousel.tsx +17 -4
- package/src/sections/ReviewWall.tsx +2 -2
- package/src/sections/SplitSection.tsx +2 -1
- package/src/sections/index.ts +15 -6
- package/src/sections/siteConfig.ts +101 -8
- package/src/styles/app.css +33 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +68 -13
- package/src/styles/chrome.css +1134 -56
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +140 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +108 -39
- package/src/styles/sections.css +500 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +220 -3
- package/src/vite/index.ts +4 -0
- package/src/vite/marketing-config.ts +81 -1
- package/src/app/CardErrorBoundary.tsx +0 -39
- package/src/sections/CTABanner.tsx +0 -93
- package/src/sections/DeviceShowcase.tsx +0 -39
- package/src/sections/MediaBand.tsx +0 -20
- package/src/sections/MenuList.tsx +0 -44
- package/src/sections/PressQuotes.tsx +0 -51
- package/src/sections/SocialStrip.tsx +0 -83
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
import { installCatcher } from "./catcher";
|
|
3
|
+
|
|
4
|
+
export interface ErrorReportingOptions {
|
|
5
|
+
/** The project's DSN, `VITE_SENTRY_DSN`. With none, nothing is installed or loaded. */
|
|
6
|
+
dsn?: string;
|
|
7
|
+
/** The release the errors are filed under: the build's commit (`import.meta.env.VITE_RELEASE`). */
|
|
8
|
+
release?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The environment the errors are filed under. Defaults to the build's
|
|
11
|
+
* `import.meta.env.VITE_ENVIRONMENT`, which `marketingConfig` sets from
|
|
12
|
+
* `VERCEL_ENV` (production, preview, development), falling back to the
|
|
13
|
+
* build's mode.
|
|
14
|
+
*/
|
|
15
|
+
environment?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The message the launch check's error carries, so it is plain in Sentry what it is. */
|
|
19
|
+
export const LAUNCH_CHECK_MESSAGE =
|
|
20
|
+
"Atelic error reporting launch check: thrown on purpose from @atelic-action/ui";
|
|
21
|
+
|
|
22
|
+
/** The environment the site's build names, when it names one. */
|
|
23
|
+
function buildEnvironment(): string | undefined {
|
|
24
|
+
try {
|
|
25
|
+
return import.meta.env?.VITE_ENVIRONMENT || undefined;
|
|
26
|
+
} catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Throws the launch check's error on the next turn, uncaught, from this module. */
|
|
32
|
+
export function throwLaunchCheck(): void {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
throw new Error(LAUNCH_CHECK_MESSAGE);
|
|
35
|
+
}, 0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The longest the SDK waits for first paint before it loads anyway. */
|
|
39
|
+
export const LOAD_CAP_MS = 10_000;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Runs `task` once, after the first contentful paint, falling back to the
|
|
43
|
+
* load event where the browser cannot report paints (no
|
|
44
|
+
* `PerformanceObserver`, or one without the `paint` entry type), and after
|
|
45
|
+
* ten seconds whatever happens, so a page that never paints still reports.
|
|
46
|
+
* The SDK waits for paint because loaded any earlier it competes with the
|
|
47
|
+
* page's own first paint, which is what a speed test measures.
|
|
48
|
+
*/
|
|
49
|
+
export function afterFirstPaint(task: () => void, win: Window = window): void {
|
|
50
|
+
let ran = false;
|
|
51
|
+
const once = () => {
|
|
52
|
+
if (ran) return;
|
|
53
|
+
ran = true;
|
|
54
|
+
task();
|
|
55
|
+
};
|
|
56
|
+
const Observer = (win as Window & { PerformanceObserver?: typeof PerformanceObserver })
|
|
57
|
+
.PerformanceObserver;
|
|
58
|
+
let watching = false;
|
|
59
|
+
if (Observer && (Observer.supportedEntryTypes ?? []).includes("paint")) {
|
|
60
|
+
try {
|
|
61
|
+
const observer = new Observer((entries) => {
|
|
62
|
+
if (entries.getEntriesByName("first-contentful-paint").length) {
|
|
63
|
+
observer.disconnect();
|
|
64
|
+
win.setTimeout(once, 0);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
observer.observe({ type: "paint", buffered: true });
|
|
68
|
+
watching = true;
|
|
69
|
+
} catch {
|
|
70
|
+
watching = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!watching) {
|
|
74
|
+
if (win.document.readyState === "complete") win.setTimeout(once, 0);
|
|
75
|
+
else win.addEventListener("load", once, { once: true });
|
|
76
|
+
}
|
|
77
|
+
win.setTimeout(once, LOAD_CAP_MS);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Starts error reporting in the browser: errors only, never tracing.
|
|
82
|
+
*
|
|
83
|
+
* At once it makes sure the early catcher is listening (the inline script
|
|
84
|
+
* from the root route, or one installed here), so nothing thrown before the
|
|
85
|
+
* SDK arrives is lost. After first paint it loads the SDK, set up for errors
|
|
86
|
+
* alone, replays what the catcher held (each tagged `early`), hands the
|
|
87
|
+
* catcher's later errors to the SDK, and takes the catcher's own listeners
|
|
88
|
+
* off, since the SDK's global handlers listen from then on and an error
|
|
89
|
+
* must never be reported twice.
|
|
90
|
+
*
|
|
91
|
+
* With no `dsn` it does nothing and loads nothing. Call it once, in the
|
|
92
|
+
* browser (a site's router module, guarded by `typeof window`).
|
|
93
|
+
*/
|
|
94
|
+
export function startErrorReporting({
|
|
95
|
+
dsn,
|
|
96
|
+
release,
|
|
97
|
+
environment = buildEnvironment(),
|
|
98
|
+
}: ErrorReportingOptions): void {
|
|
99
|
+
if (!dsn || typeof window === "undefined") return;
|
|
100
|
+
const win = window;
|
|
101
|
+
const catcher = installCatcher(win);
|
|
102
|
+
catcher.test = throwLaunchCheck;
|
|
103
|
+
afterFirstPaint(() => {
|
|
104
|
+
import("./sdk")
|
|
105
|
+
.then(({ initSentry }) => {
|
|
106
|
+
const capture = initSentry({ dsn, release, environment });
|
|
107
|
+
win.removeEventListener("error", catcher.onError);
|
|
108
|
+
win.removeEventListener("unhandledrejection", catcher.onRejection);
|
|
109
|
+
catcher.report = (error, kind) => capture(error, kind);
|
|
110
|
+
const held = catcher.q.splice(0, catcher.q.length);
|
|
111
|
+
for (const item of held) capture(item.error, item.kind, true, catcher.dropped);
|
|
112
|
+
})
|
|
113
|
+
.catch(() => {
|
|
114
|
+
// The SDK failed to load (offline, blocked by a content blocker):
|
|
115
|
+
// the catcher keeps holding, and the page is none the worse.
|
|
116
|
+
});
|
|
117
|
+
}, win);
|
|
118
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { newTabProps } from "../lib/newTabProps";
|
|
3
|
+
import { holdPhoneNumbers, isTel } from "../lib/phoneText";
|
|
3
4
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
4
5
|
|
|
5
6
|
export interface ButtonProps {
|
|
@@ -19,6 +20,7 @@ export interface ButtonProps {
|
|
|
19
20
|
newTab?: boolean;
|
|
20
21
|
/** Renders a real button element (e.g. form submit) when set. */
|
|
21
22
|
type?: "submit" | "button";
|
|
23
|
+
/** Called on a click, whether the button is a link or a real button. */
|
|
22
24
|
onClick?: () => void;
|
|
23
25
|
ariaLabel?: string;
|
|
24
26
|
className?: string;
|
|
@@ -51,9 +53,10 @@ export function Button({
|
|
|
51
53
|
.filter(Boolean)
|
|
52
54
|
.join(" ");
|
|
53
55
|
|
|
56
|
+
// A call button with words beside its number holds the number whole.
|
|
54
57
|
const content = (
|
|
55
58
|
<>
|
|
56
|
-
{children}
|
|
59
|
+
{isTel(href) ? holdPhoneNumbers(children) : children}
|
|
57
60
|
{arrow && (
|
|
58
61
|
<span className="arrow" aria-hidden="true">
|
|
59
62
|
→
|
|
@@ -69,6 +72,7 @@ export function Button({
|
|
|
69
72
|
className={classes}
|
|
70
73
|
style={style}
|
|
71
74
|
aria-label={ariaLabel}
|
|
75
|
+
onClick={onClick}
|
|
72
76
|
{...newTabProps(href, newTab)}
|
|
73
77
|
>
|
|
74
78
|
{content}
|
|
@@ -11,6 +11,8 @@ export interface EyebrowProps {
|
|
|
11
11
|
* Accepted so existing call sites keep compiling.
|
|
12
12
|
*/
|
|
13
13
|
run?: boolean;
|
|
14
|
+
/** Draws the trailing rule. Defaults to true; false sets the kicker alone. */
|
|
15
|
+
rule?: boolean;
|
|
14
16
|
children: ReactNode;
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -19,7 +21,9 @@ export interface EyebrowProps {
|
|
|
19
21
|
* that fades out to the right (the practice wordmark's signature), rendered
|
|
20
22
|
* from the primary token so it carries each site's brand color.
|
|
21
23
|
*/
|
|
22
|
-
export function Eyebrow({ onDark = false, center = false, children }: EyebrowProps) {
|
|
23
|
-
const classes = ["eyebrow", onDark && "on-dark", center && "center"
|
|
24
|
+
export function Eyebrow({ onDark = false, center = false, rule = true, children }: EyebrowProps) {
|
|
25
|
+
const classes = ["eyebrow", onDark && "on-dark", center && "center", !rule && "no-rule"]
|
|
26
|
+
.filter(Boolean)
|
|
27
|
+
.join(" ");
|
|
24
28
|
return <p className={classes}>{children}</p>;
|
|
25
29
|
}
|
|
@@ -162,7 +162,12 @@ function Figure({ block, withBase }: { block: ProseBlock; withBase: (path: strin
|
|
|
162
162
|
ref={dialogRef}
|
|
163
163
|
className="pb-lightbox"
|
|
164
164
|
aria-label={label}
|
|
165
|
-
|
|
165
|
+
// The close event lands a task after the dialog shuts, so a tile
|
|
166
|
+
// pressed again inside that task has already reopened it: a close
|
|
167
|
+
// heard while the dialog is open again is that stale one, and ignored.
|
|
168
|
+
onClose={(event) => {
|
|
169
|
+
if (!event.currentTarget.open) setOpen(false);
|
|
170
|
+
}}
|
|
166
171
|
onClick={(event) => {
|
|
167
172
|
// A click that lands outside the panel's box is a click on the backdrop; the
|
|
168
173
|
// panel's own padding and blank areas also target the dialog, so test coordinates.
|
|
@@ -27,7 +27,9 @@ export function SectionHeading({
|
|
|
27
27
|
as: Heading = "h2",
|
|
28
28
|
className,
|
|
29
29
|
}: SectionHeadingProps) {
|
|
30
|
-
const classes = ["section-head", center && "center", className]
|
|
30
|
+
const classes = ["section-head", center && "center", onDark && "on-dark", className]
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.join(" ");
|
|
31
33
|
return (
|
|
32
34
|
<div className={classes}>
|
|
33
35
|
{eyebrow && (
|
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
import { Star } from "lucide-react";
|
|
1
|
+
import { Star, StarHalf } from "lucide-react";
|
|
2
2
|
|
|
3
3
|
export interface StarRowProps {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The rating, 1 to 5, clamped into range. It is said as given (to one
|
|
6
|
+
* decimal) and drawn to the nearest half star, so a 4.5 reads and shows
|
|
7
|
+
* as four and a half, never as five.
|
|
8
|
+
*/
|
|
5
9
|
rating: number;
|
|
6
10
|
/** Glyph size in px. */
|
|
7
11
|
size?: number;
|
|
8
12
|
className?: string;
|
|
9
13
|
}
|
|
10
14
|
|
|
15
|
+
/** The rating clamped to 1 to 5 and kept to one decimal, as it is said. */
|
|
16
|
+
function spoken(rating: number): number {
|
|
17
|
+
return Math.round(Math.max(1, Math.min(5, rating)) * 10) / 10;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
/**
|
|
12
21
|
* A row of filled stars, rendered as a single labeled image so screen
|
|
13
|
-
* readers announce "4 out of 5 stars" instead of
|
|
14
|
-
*
|
|
15
|
-
*
|
|
22
|
+
* readers announce "4.5 out of 5 stars" instead of the decorative glyphs.
|
|
23
|
+
* Whole stars draw filled and a half star draws as one; a whole rating
|
|
24
|
+
* looks as it always has. Shared by the review components; render one only
|
|
25
|
+
* when the source actually shows a rating, never invent one.
|
|
16
26
|
*/
|
|
17
27
|
export function StarRow({ rating, size = 15, className }: StarRowProps) {
|
|
18
|
-
const
|
|
28
|
+
const value = spoken(rating);
|
|
29
|
+
// Drawn to the nearest half: 4.3 shows four and a half, 4.2 shows four.
|
|
30
|
+
const halves = Math.round(value * 2);
|
|
31
|
+
const whole = Math.floor(halves / 2);
|
|
32
|
+
const half = halves % 2 === 1;
|
|
19
33
|
return (
|
|
20
34
|
<span
|
|
21
35
|
className={["star-row", className].filter(Boolean).join(" ")}
|
|
22
36
|
role="img"
|
|
23
|
-
aria-label={`${
|
|
37
|
+
aria-label={`${value} out of 5 stars`}
|
|
24
38
|
>
|
|
25
|
-
{Array.from({ length:
|
|
39
|
+
{Array.from({ length: whole }, (_, i) => (
|
|
26
40
|
<Star
|
|
27
41
|
// biome-ignore lint/suspicious/noArrayIndexKey: static decorative row
|
|
28
42
|
key={i}
|
|
@@ -32,6 +46,7 @@ export function StarRow({ rating, size = 15, className }: StarRowProps) {
|
|
|
32
46
|
aria-hidden="true"
|
|
33
47
|
/>
|
|
34
48
|
))}
|
|
49
|
+
{half && <StarHalf size={size} strokeWidth={1.5} fill="currentColor" aria-hidden="true" />}
|
|
35
50
|
</span>
|
|
36
51
|
);
|
|
37
52
|
}
|
package/src/routing/index.ts
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the router's matches are a miss: the catch all route took the
|
|
3
|
+
* path (an unknown page), or a route with params says its params name a page
|
|
4
|
+
* it does not have (a blog slug nobody wrote) through `staticData.missing`.
|
|
5
|
+
* Router free: it reads the plain fields every TanStack match carries, so a
|
|
6
|
+
* site's root route asks it from `head` and from `useMatches`.
|
|
7
|
+
*
|
|
8
|
+
* Under `staticNotFoundRouting` a miss is still pending while the page
|
|
9
|
+
* hydrates, and a route's `notFound()` lands as late, so the question is
|
|
10
|
+
* answered from the matches alone, before anything has loaded. A site's root
|
|
11
|
+
* uses it twice: to emit the 404's head tags from the root (tags on the
|
|
12
|
+
* pending catch all route would be emitted twice), and to draw a miss inside
|
|
13
|
+
* the site's shell from the root layout, so the shell stays mounted while
|
|
14
|
+
* the not found body swaps from its pending render to its own.
|
|
15
|
+
*/
|
|
16
|
+
export interface MissMatch {
|
|
17
|
+
routeId: string;
|
|
18
|
+
params: Record<string, string>;
|
|
19
|
+
staticData?: { missing?: (params: Record<string, string>) => boolean };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The catch all route's id in a TanStack file route tree. */
|
|
23
|
+
export const CATCH_ALL_ROUTE_ID = "/$";
|
|
24
|
+
|
|
25
|
+
export function isMiss(
|
|
26
|
+
matches: ReadonlyArray<MissMatch>,
|
|
27
|
+
catchAllId: string = CATCH_ALL_ROUTE_ID,
|
|
28
|
+
): boolean {
|
|
29
|
+
return matches.some(
|
|
30
|
+
(match) => match.routeId === catchAllId || match.staticData?.missing?.(match.params) === true,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fails a production deploy that would ship without error reporting. The
|
|
3
|
+
* first step of a marketing site's `bun run build`: on Vercel's production
|
|
4
|
+
* build (`VERCEL_ENV=production`) an empty `VITE_SENTRY_DSN` stops the build,
|
|
5
|
+
* since a site never launches without Sentry. A preview or a local build
|
|
6
|
+
* passes with a one line note. A site with a real reason to launch without
|
|
7
|
+
* it passes `--allow-missing`, which lets the build go on under a loud
|
|
8
|
+
* warning.
|
|
9
|
+
*
|
|
10
|
+
* The DSN is read the way Vite will read it for the build: the environment,
|
|
11
|
+
* then the site's `.env` files for production mode. A DSN that is set but
|
|
12
|
+
* malformed fails every build, since it would send nothing.
|
|
13
|
+
*
|
|
14
|
+
* Usage: atelic-check-sentry [--allow-missing] (from the site's root)
|
|
15
|
+
*/
|
|
16
|
+
import { loadEnv } from "vite";
|
|
17
|
+
import { parseDSN } from "../monitoring/server";
|
|
18
|
+
|
|
19
|
+
export interface SentryCheckInput {
|
|
20
|
+
/** The build's environment, where `VERCEL_ENV` and the DSN are read. */
|
|
21
|
+
env: Record<string, string | undefined>;
|
|
22
|
+
/** The command's arguments. */
|
|
23
|
+
args: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SentryCheckResult {
|
|
27
|
+
/** The exit code: 1 only for a production build with no DSN and no waiver. */
|
|
28
|
+
code: 0 | 1;
|
|
29
|
+
/** What the command prints, one line, or a warning block for a waiver. */
|
|
30
|
+
message: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The check, kept pure so it can be tested without a build. */
|
|
34
|
+
export function checkSentry({ env, args }: SentryCheckInput): SentryCheckResult {
|
|
35
|
+
const production = env.VERCEL_ENV === "production";
|
|
36
|
+
const dsn = (env.VITE_SENTRY_DSN ?? "").trim();
|
|
37
|
+
// A DSN that is set but cannot be read sends nothing, whatever the build:
|
|
38
|
+
// it fails here, on any environment, waiver or not.
|
|
39
|
+
if (dsn && !parseDSN(dsn)) {
|
|
40
|
+
return {
|
|
41
|
+
code: 1,
|
|
42
|
+
message:
|
|
43
|
+
"[sentry] VITE_SENTRY_DSN is set but is not a DSN (https://<key>@<host>/<project>). Copy it again from the Sentry project's Client Keys.",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (dsn) return { code: 0, message: "[sentry] VITE_SENTRY_DSN is set; errors will be reported." };
|
|
47
|
+
if (!production) {
|
|
48
|
+
return {
|
|
49
|
+
code: 0,
|
|
50
|
+
message: `[sentry] no VITE_SENTRY_DSN on this ${env.VERCEL_ENV ?? "local"} build; errors are not reported, which only a production deploy forbids.`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (args.includes("--allow-missing")) {
|
|
54
|
+
return {
|
|
55
|
+
code: 0,
|
|
56
|
+
message: [
|
|
57
|
+
"[sentry] ************************************************************",
|
|
58
|
+
"[sentry] WARNING: this PRODUCTION build has no VITE_SENTRY_DSN and ships with --allow-missing.",
|
|
59
|
+
"[sentry] Nothing that breaks on this site will be reported. Set the DSN on the Vercel project.",
|
|
60
|
+
].join("\n"),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
code: 1,
|
|
65
|
+
message:
|
|
66
|
+
"[sentry] this production build has no VITE_SENTRY_DSN. Set it on the Vercel project (README, Error Reporting), or pass --allow-missing for a site with a real reason to launch without Sentry.",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The command: checks the build in the working directory and exits with the result. */
|
|
71
|
+
export function main(args: readonly string[] = process.argv.slice(2)): void {
|
|
72
|
+
const env = { ...loadEnv("production", process.cwd(), "VITE_"), ...process.env };
|
|
73
|
+
const result = checkSentry({ env, args });
|
|
74
|
+
if (result.code === 0) console.log(result.message);
|
|
75
|
+
else console.error(result.message);
|
|
76
|
+
process.exit(result.code);
|
|
77
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { displayDate } from "../lib/displayDate";
|
|
2
2
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
3
|
+
import type { Surface } from "./siteConfig";
|
|
3
4
|
|
|
4
5
|
export interface BlogIndexItem {
|
|
5
6
|
slug: string;
|
|
@@ -16,22 +17,35 @@ export interface BlogIndexProps {
|
|
|
16
17
|
basePath?: string;
|
|
17
18
|
id?: string;
|
|
18
19
|
className?: string;
|
|
20
|
+
/** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
|
|
21
|
+
surface?: Surface;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
* The blog listing: every post, newest first, as a plain readable stack
|
|
23
26
|
* rather than a card grid. These are articles, not products, and a list
|
|
24
|
-
* that reads top to bottom suits a small archive better than a
|
|
27
|
+
* that reads top to bottom suits a small archive better than a grid
|
|
25
28
|
* that pads it out.
|
|
26
29
|
*
|
|
27
30
|
* Every entry is a real anchor to a prerendered page, which is what lets
|
|
28
31
|
* the build's link crawler discover the posts without an explicit page
|
|
29
32
|
* list in the vite config.
|
|
30
33
|
*/
|
|
31
|
-
export function BlogIndex({
|
|
34
|
+
export function BlogIndex({
|
|
35
|
+
items,
|
|
36
|
+
basePath = "/blog",
|
|
37
|
+
id,
|
|
38
|
+
className,
|
|
39
|
+
surface = "default",
|
|
40
|
+
}: BlogIndexProps) {
|
|
32
41
|
const withBase = useWithBase();
|
|
33
42
|
return (
|
|
34
|
-
<section
|
|
43
|
+
<section
|
|
44
|
+
className={["section", "blog-index", surface === "alt" && "surface-alt", className]
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join(" ")}
|
|
47
|
+
id={id}
|
|
48
|
+
>
|
|
35
49
|
<div className="wrap">
|
|
36
50
|
<ol className="bi-list">
|
|
37
51
|
{items.map((item) => (
|
|
@@ -2,6 +2,7 @@ import { ArrowLeft } from "lucide-react";
|
|
|
2
2
|
import { displayDate } from "../lib/displayDate";
|
|
3
3
|
import { type ProseBlock, ProseBlocks } from "../primitives/ProseBlocks";
|
|
4
4
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
5
|
+
import type { Surface } from "./siteConfig";
|
|
5
6
|
|
|
6
7
|
export interface BlogPostDoc {
|
|
7
8
|
title: string;
|
|
@@ -19,6 +20,8 @@ export interface BlogPostProps {
|
|
|
19
20
|
backLabel?: string;
|
|
20
21
|
id?: string;
|
|
21
22
|
className?: string;
|
|
23
|
+
/** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
|
|
24
|
+
surface?: Surface;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
/**
|
|
@@ -33,6 +36,7 @@ export interface BlogPostProps {
|
|
|
33
36
|
* has touched.
|
|
34
37
|
*/
|
|
35
38
|
export function BlogPost({
|
|
39
|
+
surface = "default",
|
|
36
40
|
doc,
|
|
37
41
|
basePath = "/blog",
|
|
38
42
|
backLabel = "All posts",
|
|
@@ -41,7 +45,12 @@ export function BlogPost({
|
|
|
41
45
|
}: BlogPostProps) {
|
|
42
46
|
const withBase = useWithBase();
|
|
43
47
|
return (
|
|
44
|
-
<article
|
|
48
|
+
<article
|
|
49
|
+
className={["section", "blog-post", surface === "alt" && "surface-alt", className]
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.join(" ")}
|
|
52
|
+
id={id}
|
|
53
|
+
>
|
|
45
54
|
<div className="wrap bp-wrap">
|
|
46
55
|
<a className="bp-back" href={withBase(basePath)}>
|
|
47
56
|
<ArrowLeft size={15} strokeWidth={2} aria-hidden="true" />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Eyebrow, Lead } from "../primitives";
|
|
3
3
|
import { PrimaryButton, SecondaryButton } from "../primitives/CallToAction";
|
|
4
|
-
import type { SiteConfig } from "./siteConfig";
|
|
4
|
+
import type { SiteConfig, Surface } from "./siteConfig";
|
|
5
5
|
|
|
6
6
|
export interface CTASectionProps {
|
|
7
7
|
/** The site's primary action, `site.cta`; a whole `SiteConfig` passes as it is. */
|
|
@@ -17,7 +17,7 @@ export interface CTASectionProps {
|
|
|
17
17
|
primary?: { label: string; href: string; newTab?: boolean };
|
|
18
18
|
/** Page-contextual secondary action; always a ghost button, always second. */
|
|
19
19
|
secondary?: { label: string; href: string; newTab?: boolean };
|
|
20
|
-
surface?:
|
|
20
|
+
surface?: Surface;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/** The standard closing CTA: primary action from the site config, ghost secondary. */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/** One callout: a heavy title over a short subtitle. */
|
|
4
|
+
export interface CalloutPanelItem {
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
subtitle?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CalloutPanelProps {
|
|
10
|
+
items: CalloutPanelItem[];
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A set of short callouts on the primary field, set inside a section after
|
|
16
|
+
* its copy: four across on a desktop and two by two below. The titles share
|
|
17
|
+
* one line across a row and the subtitles another, whatever a title's
|
|
18
|
+
* length, so a two line title never pushes its subtitle out of step with its
|
|
19
|
+
* neighbors' (each item spans two rows of a subgrid). Not `Callout`, which is
|
|
20
|
+
* one finding with a tone; these are the business's headline claims.
|
|
21
|
+
*/
|
|
22
|
+
export function CalloutPanel({ items, className }: CalloutPanelProps) {
|
|
23
|
+
return (
|
|
24
|
+
<ul className={["callout-panel", "on-primary", className].filter(Boolean).join(" ")}>
|
|
25
|
+
{items.map((item, i) => (
|
|
26
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: callouts are static content in a fixed order
|
|
27
|
+
<li key={i}>
|
|
28
|
+
<strong className="callout-panel-title">{item.title}</strong>
|
|
29
|
+
<span className="callout-panel-sub">{item.subtitle}</span>
|
|
30
|
+
</li>
|
|
31
|
+
))}
|
|
32
|
+
</ul>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import { useScrollsSideways } from "../lib/useScrollsSideways";
|
|
2
3
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -42,6 +43,12 @@ export interface ComparisonTableProps {
|
|
|
42
43
|
columns?: { stage?: string; before?: string; after?: string };
|
|
43
44
|
/** Small print under the table, e.g. what the grades mean. */
|
|
44
45
|
footnote?: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* What a screen reader calls the table's box while the table is wider
|
|
48
|
+
* than the page and scrolls inside it, as on a phone; defaults to
|
|
49
|
+
* "Comparison". Name what the table compares ("The site, before and after").
|
|
50
|
+
*/
|
|
51
|
+
ariaLabel?: string;
|
|
45
52
|
className?: string;
|
|
46
53
|
}
|
|
47
54
|
|
|
@@ -72,8 +79,18 @@ function Cell({ state, highlight }: { state: ComparisonState; highlight: boolean
|
|
|
72
79
|
);
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
export function ComparisonTable({
|
|
82
|
+
export function ComparisonTable({
|
|
83
|
+
rows,
|
|
84
|
+
columns,
|
|
85
|
+
footnote,
|
|
86
|
+
ariaLabel = "Comparison",
|
|
87
|
+
className,
|
|
88
|
+
}: ComparisonTableProps) {
|
|
76
89
|
const withBase = useWithBase();
|
|
90
|
+
// The box scrolls sideways on a phone, where the table keeps its shape
|
|
91
|
+
// (Component Rules 6), so while it scrolls it is a named region a
|
|
92
|
+
// keyboard can reach and scroll, as DataTable's is.
|
|
93
|
+
const scrolls = useScrollsSideways();
|
|
77
94
|
const heads = {
|
|
78
95
|
stage: columns?.stage ?? "Area",
|
|
79
96
|
before: columns?.before ?? "Before",
|
|
@@ -82,7 +99,11 @@ export function ComparisonTable({ rows, columns, footnote, className }: Comparis
|
|
|
82
99
|
|
|
83
100
|
return (
|
|
84
101
|
<div className={["comparison", className].filter(Boolean).join(" ")}>
|
|
85
|
-
<div
|
|
102
|
+
<div
|
|
103
|
+
ref={scrolls.ref}
|
|
104
|
+
className="cmp-scroll"
|
|
105
|
+
{...(scrolls.active ? { tabIndex: 0, role: "region", "aria-label": ariaLabel } : {})}
|
|
106
|
+
>
|
|
86
107
|
<table className="cmp-table">
|
|
87
108
|
<colgroup>
|
|
88
109
|
<col className="cmp-col-stage" />
|