Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

feat(dashboard): one type scale with Inter, event side panel and chart markers (#578)

Carl-Gerhard Lindesvärdb57a7aa7e477
diff --git a/apps/start/e2e/data-events.spec.ts b/apps/start/e2e/data-events.spec.ts
index 1320adb12..33a535a65 100644
--- a/apps/start/e2e/data-events.spec.ts
+++ b/apps/start/e2e/data-events.spec.ts
@@ -156,61 +156,65 @@ test.describe('events list', () => {
expect(problems).toEqual([]);
});
- test('details modal shows properties and links to the profile', async ({
+ test('details drawer shows properties and links to the profile', async ({
page,
}) => {
const problems = watch(page);
await open(page, `${SHOP}/events/events?events=purchase`);
await rows(page).first().locator('button[title="purchase"]').click();
- const dialog = page.getByRole('dialog');
- await expect(dialog.getByText('Properties')).toBeVisible();
- await expect(dialog.getByText('Information')).toBeVisible();
- await expect(dialog.getByText('All events for purchase')).toBeVisible();
+ const drawer = page.getByRole('complementary', { name: 'Event details' });
+ await expect(page).toHaveURL(/[?&]event=/);
+ await expect(drawer.getByText('Properties')).toBeVisible();
+ await expect(drawer.getByText('Information')).toBeVisible();
+ await expect(drawer.getByText('All events for purchase')).toBeVisible();
await page.waitForLoadState('networkidle');
await page.screenshot({ path: `${SHOTS}/event-details.png` });
- await dialog.getByRole('button', { name: 'Detailed' }).click();
- await expect(dialog.getByText('Session Id')).toBeVisible();
- await dialog.getByRole('button', { name: 'View JSON' }).click();
- await expect(
- dialog.getByRole('button', { name: 'View Table' })
- ).toBeVisible();
- await page.screenshot({ path: `${SHOTS}/event-details-detailed.png` });
+ await drawer.getByRole('button', { name: 'Raw' }).click();
+ await expect(drawer.getByText('"sessionId"')).toBeVisible();
+ await page.screenshot({ path: `${SHOTS}/event-details-raw.png` });
+ await drawer.getByRole('button', { name: 'Pretty' }).click();
- await dialog.locator('a[href*="/profiles/"]').click();
+ await drawer.locator('a[href*="/profiles/"]').click();
await expect(page).toHaveURL(/\/profiles\/[^/]+/);
- await expect(page.getByRole('dialog')).toHaveCount(0);
+ await expect(
+ page.getByRole('complementary', { name: 'Event details' })
+ ).toHaveCount(0);
await expect(page.getByText('Profile Information')).toBeVisible();
await page.waitForLoadState('networkidle');
+ // The drawer lives in the URL, so back lands on the list with it open again.
await page.goBack();
- await expect(page).toHaveURL(/events\?events=purchase/);
+ await expect(page).toHaveURL(/[?&]events=purchase/);
+ await expect(page).toHaveURL(/[?&]event=/);
+ await expect(drawer).toHaveCount(1);
expect(problems).toEqual([]);
});
- test('clicking a property in the details modal filters by it', async ({
+ test('clicking a property in the details drawer filters by it', async ({
page,
}) => {
await open(page, `${SHOP}/events/events?events=purchase`);
await rows(page).first().locator('button[title]').click();
- const dialog = page.getByRole('dialog');
- await expect(dialog.getByText('Properties')).toBeVisible();
- await dialog.getByText('Payment', { exact: true }).click();
- await expect(page.getByRole('dialog')).toHaveCount(0);
+ const drawer = page.getByRole('complementary', { name: 'Event details' });
+ await expect(drawer.getByText('Properties')).toBeVisible();
+ await drawer.getByText('Payment', { exact: true }).click();
+ // The list filters beside the drawer; the drawer stays open.
await expect(page).toHaveURL(/f=properties\.payment/);
+ await expect(drawer).toHaveCount(1);
await page.waitForLoadState('networkidle');
await page.screenshot({ path: `${SHOTS}/events-filter-by-property.png` });
await expect(rows(page).first()).toBeVisible();
});
- test('"Show all" in the details modal filters by the event name', async ({
+ test('"Show all" in the details drawer filters by the event name', async ({
page,
}) => {
await open(page, `${SHOP}/events`);
await rows(page).first().locator('button[title]').click();
- const dialog = page.getByRole('dialog');
- await dialog.getByRole('button', { name: 'Show all' }).click();
- await expect(page.getByRole('dialog')).toHaveCount(0);
- await expect(page).toHaveURL(/events=/);
+ const drawer = page.getByRole('complementary', { name: 'Event details' });
+ await drawer.getByRole('button', { name: 'Show all' }).click();
+ await expect(page).toHaveURL(/[?&]events=/);
+ await expect(drawer).toHaveCount(1);
});
test('the Session ID column can be switched on and links to the session', async ({
diff --git a/apps/start/e2e/typography.spec.ts b/apps/start/e2e/typography.spec.ts
new file mode 100644
index 000000000..476c40d7d
--- /dev/null
+++ b/apps/start/e2e/typography.spec.ts
@@ -0,0 +1,46 @@
+// The dashboard's type defaults: Inter, 13px body text with a readable line
+// height. A custom scale once set every line-height equal to its font size,
+// which is what this guards against.
+
+import { expect, test } from './fixtures';
+
+const BODY_FONT_SIZE = '13px';
+const BODY_LINE_HEIGHT = '20px';
+const CAPTION_FONT_SIZE = '12px';
+const CAPTION_LINE_HEIGHT = '16px';
+
+test('text renders in Inter at 13px with a 20px line height', async ({
+ page,
+ seed,
+}) => {
+ await page.goto(`/${seed.organizationId}/${seed.projects[0]?.id}/settings`);
+ await expect(
+ page.getByRole('heading', { name: 'Project settings' })
+ ).toBeVisible();
+
+ const body = await page.evaluate(() => {
+ const style = getComputedStyle(document.body);
+ return {
+ fontFamily: style.fontFamily,
+ fontSize: style.fontSize,
+ lineHeight: style.lineHeight,
+ interLoaded: document.fonts.check('14px "Inter Variable"'),
+ };
+ });
+ expect(body.fontFamily).toContain('Inter Variable');
+ expect(body.fontSize).toBe(BODY_FONT_SIZE);
+ expect(body.lineHeight).toBe(BODY_LINE_HEIGHT);
+ expect(body.interLoaded).toBe(true);
+
+ const caption = await page.evaluate(() => {
+ const probe = document.createElement('span');
+ probe.className = 'text-xs';
+ document.body.append(probe);
+ const style = getComputedStyle(probe);
+ const result = { fontSize: style.fontSize, lineHeight: style.lineHeight };
+ probe.remove();
+ return result;
+ });
+ expect(caption.fontSize).toBe(CAPTION_FONT_SIZE);
+ expect(caption.lineHeight).toBe(CAPTION_LINE_HEIGHT);
+});
diff --git a/apps/start/package.json b/apps/start/package.json
index 7e19a0f24..688e49036 100644
--- a/apps/start/package.json
+++ b/apps/start/package.json
@@ -30,6 +30,7 @@
"@dnd-kit/sortable": "10.0.0",
"@dnd-kit/utilities": "3.2.2",
"@faker-js/faker": "9.9.0",
+ "@fontsource-variable/inter": "5.3.0",
"@hookform/resolvers": "5.2.2",
"@nivo/sankey": "0.99.0",
"@number-flow/react": "0.5.10",
diff --git a/apps/start/src/components/auth/sign-in-email-form.tsx b/apps/start/src/components/auth/sign-in-email-form.tsx
index 7ae26b65a..942dcde14 100644
--- a/apps/start/src/components/auth/sign-in-email-form.tsx
+++ b/apps/start/src/components/auth/sign-in-email-form.tsx
@@ -73,7 +73,7 @@ export function SignInEmailForm({
Sign in
</Button>
{isLastUsed && (
- <span className="absolute -top-2 right-3 rounded-full bg-highlight px-1.5 py-0.5 font-medium text-[10px] text-white leading-none">
+ <span className="absolute -top-2 right-3 rounded-full bg-highlight px-1.5 py-0.5 font-medium text-2xs text-white leading-none">
Used last time
</span>
)}
diff --git a/apps/start/src/components/auth/sign-in-github.tsx b/apps/start/src/components/auth/sign-in-github.tsx
index c21398385..78fb5ae70 100644
--- a/apps/start/src/components/auth/sign-in-github.tsx
+++ b/apps/start/src/components/auth/sign-in-github.tsx
@@ -54,7 +54,7 @@ export function SignInGithub({
{title()}
</Button>
{isLastUsed && (
- <span className="absolute -top-2 right-3 rounded-full bg-highlight px-1.5 py-0.5 font-medium text-[10px] text-white leading-none">
+ <span className="absolute -top-2 right-3 rounded-full bg-highlight px-1.5 py-0.5 font-medium text-2xs text-white leading-none">
Used last time
</span>
)}
diff --git a/apps/start/src/components/auth/sign-in-google.tsx b/apps/start/src/components/auth/sign-in-google.tsx
index 35125873f..125f59117 100644
--- a/apps/start/src/components/auth/sign-in-google.tsx
+++ b/apps/start/src/components/auth/sign-in-google.tsx
@@ -66,7 +66,7 @@ export function SignInGoogle({
{title()}
</Button>
{isLastUsed && (
- <span className="absolute -top-2 right-3 rounded-full bg-highlight px-1.5 py-0.5 font-medium text-[10px] text-white leading-none">
+ <span className="absolute -top-2 right-3 rounded-full bg-highlight px-1.5 py-0.5 font-medium text-2xs text-white leading-none">
Used last time
</span>
)}
diff --git a/apps/start/src/components/charts/heatmap/heatmap-tooltip.tsx b/apps/start/src/components/charts/heatmap/heatmap-tooltip.tsx
index 284e11244..58c9805a4 100644
--- a/apps/start/src/components/charts/heatmap/heatmap-tooltip.tsx
+++ b/apps/start/src/components/charts/heatmap/heatmap-tooltip.tsx
@@ -78,7 +78,7 @@ export const HeatmapTooltip = memo(function HeatmapTooltip({
{formatHeatmapTooltipWeekday(date)}
</div>
</TooltipHeader>
- <div className="px-3.5 py-3 text-left text-chart-tooltip-foreground text-sm">
+ <div className="px-3 py-2.5 text-left text-chart-tooltip-foreground text-sm">
{formatLabel(count, date)}
</div>
</TooltipBox>
diff --git a/apps/start/src/components/charts/markers/chart-markers.tsx b/apps/start/src/components/charts/markers/chart-markers.tsx
index 2e29246a9..f4635498e 100644
--- a/apps/start/src/components/charts/markers/chart-markers.tsx
+++ b/apps/start/src/components/charts/markers/chart-markers.tsx
@@ -58,7 +58,7 @@ export function MarkerTooltipContent({ markers }: MarkerTooltipContentProps) {
<div className="flex items-center gap-1.5 truncate font-medium text-chart-tooltip-foreground text-sm">
{marker.title}
{isClickable && (
- <span className="text-[10px] text-chart-tooltip-muted">
+ <span className="text-2xs text-chart-tooltip-muted">
↗
</span>
)}
diff --git a/apps/start/src/components/charts/op-date-pill.tsx b/apps/start/src/components/charts/op-date-pill.tsx
index 2d16b5c06..df6562567 100644
--- a/apps/start/src/components/charts/op-date-pill.tsx
+++ b/apps/start/src/components/charts/op-date-pill.tsx
@@ -91,9 +91,10 @@ function OPDatePillInner({
return null;
}
+ // Below the tooltip card (z-50) so the card wins when they overlap.
return createPortal(
<motion.div
- className="pointer-events-none absolute z-50"
+ className="pointer-events-none absolute z-40"
style={{
left: animatedX,
bottom: 4,
@@ -101,7 +102,7 @@ function OPDatePillInner({
maxWidth,
}}
>
- <div className="whitespace-nowrap rounded-full bg-foreground px-2.5 py-1 font-medium text-[11px] text-background tracking-tight shadow-md">
+ <div className="whitespace-nowrap rounded-full bg-foreground px-2.5 py-1 font-medium text-2xs text-background tracking-tight shadow-md">
{label}
</div>
</motion.div>,
diff --git a/apps/start/src/components/charts/op-tooltip.tsx b/apps/start/src/components/charts/op-tooltip.tsx
index a21f2eee7..cba5f5f6a 100644
--- a/apps/start/src/components/charts/op-tooltip.tsx
+++ b/apps/start/src/components/charts/op-tooltip.tsx
@@ -13,6 +13,8 @@ import { useFormatDateInterval } from '@/hooks/use-format-date-interval';
import { fancyMinutes, useNumber } from '@/hooks/use-numer-formatter';
import { cn } from '@/utils/cn';
+const TOOLTIP_MIN_WIDTH = 168;
+
export type OPTooltipUnit =
| 'currency'
| 'min'
@@ -61,7 +63,7 @@ export interface OPChartTooltipProps<T extends Record<string, unknown>>
rows: (point: T) => OPTooltipRow[];
/** Render extra content below the rows (e.g. referrer breakdown). */
extra?: (point: T) => ReactNode;
- /** Min width of the tooltip card. Default 200. */
+ /** Min width of the tooltip card. Default 168. */
minWidth?: number;
/** When set, references matching the hovered date are listed below the rows. */
references?: OPReferenceItem[] | null;
@@ -78,7 +80,7 @@ export function OPChartTooltip<T extends Record<string, unknown>>({
title,
rows,
extra,
- minWidth = 200,
+ minWidth = TOOLTIP_MIN_WIDTH,
references,
referencesLimit = 3,
spikes,
@@ -161,7 +163,7 @@ function OPTooltipBody<T extends Record<string, unknown>>({
return (
<OPTooltipCard style={{ minWidth }}>
{resolvedTitle != null && (
- <div className="flex justify-between gap-8 text-muted-foreground">
+ <div className="flex justify-between gap-6 text-muted-foreground text-xs">
<div>{resolvedTitle}</div>
</div>
)}
@@ -356,15 +358,13 @@ function OPAnnotationRow({
}) {
return (
<div className="flex items-start gap-2">
- <div className="mt-0.5 flex size-5 shrink-0 items-center justify-center overflow-hidden rounded-full border border-foreground text-foreground">
+ <div className="mt-px flex size-4 shrink-0 items-center justify-center overflow-hidden rounded-full border border-foreground text-foreground">
{icon}
</div>
<div className="col min-w-0 flex-1 gap-0.5">
- <div className="truncate font-medium text-sm leading-tight">
- {title}
- </div>
+ <div className="truncate font-medium">{title}</div>
{description && (
- <div className="truncate text-muted-foreground text-xs leading-snug">
+ <div className="truncate text-muted-foreground text-xs">
{description}
</div>
)}
@@ -384,7 +384,7 @@ export function OPTooltipCard({
}) {
return (
<div
- className={cn('col gap-2 p-3 text-foreground', className)}
+ className={cn('col gap-1.5 p-2.5 text-foreground text-sm', className)}
style={style}
>
{children}
@@ -406,8 +406,8 @@ function OPTooltipRowView({ row }: { row: OPTooltipRow }) {
return (
<div className="flex gap-2">
- <div className="w-[3px] rounded-full" style={{ background: row.color }} />
- <div className="col min-w-0 flex-1 gap-1">
+ <div className="w-0.5 rounded-full" style={{ background: row.color }} />
+ <div className="col min-w-0 flex-1 gap-0.5">
<div className="flex min-w-0 items-center gap-1">
{row.icon && (
<span className="flex shrink-0 items-center">{row.icon}</span>
@@ -415,7 +415,7 @@ function OPTooltipRowView({ row }: { row: OPTooltipRow }) {
<span className="truncate font-medium">{row.label}</span>
</div>
{hasValue && (
- <div className="flex items-center justify-between gap-8 font-medium font-mono">
+ <div className="flex items-center justify-between gap-6 font-medium tabular-nums">
<div className="row items-baseline gap-1">
<span>{formatValue(row.value!)}</span>
{showPrev && (
@@ -436,10 +436,10 @@ function OPTooltipRowView({ row }: { row: OPTooltipRow }) {
)}
{row.sub && row.sub.length > 0 && (
- <div className="col gap-1 text-sm">
+ <div className="col gap-0.5 text-xs">
{row.sub.map((s, i) => (
<div
- className="flex justify-between gap-8 font-medium font-mono"
+ className="flex justify-between gap-6 font-medium tabular-nums"
key={`${typeof s.label === 'string' ? s.label : i}-${i}`}
>
<span className="text-muted-foreground">{s.label}</span>
diff --git a/apps/start/src/components/charts/tooltip/chart-tooltip.tsx b/apps/start/src/components/charts/tooltip/chart-tooltip.tsx
index c08f4a807..bfae947c3 100644
--- a/apps/start/src/components/charts/tooltip/chart-tooltip.tsx
+++ b/apps/start/src/components/charts/tooltip/chart-tooltip.tsx
@@ -436,7 +436,7 @@ function DatePillTrackerInner({
return (
<motion.div
- className="pointer-events-none absolute z-50"
+ className="pointer-events-none absolute z-40"
style={{
left: discreteInteraction ? xWithMargin : animatedX,
transform: 'translateX(-50%)',
diff --git a/apps/start/src/components/charts/tooltip/tooltip-box.tsx b/apps/start/src/components/charts/tooltip/tooltip-box.tsx
index 645e12af9..19e1d7e57 100644
--- a/apps/start/src/components/charts/tooltip/tooltip-box.tsx
+++ b/apps/start/src/components/charts/tooltip/tooltip-box.tsx
@@ -48,17 +48,19 @@ export interface TooltipBoxProps {
backgroundColor?: string;
}
+const DEFAULT_TOOLTIP_OFFSET = 12;
+
/**
* Popover-style panel: rounded, 1px border, soft layered shadow and a 1px
* edge highlight (`before:`) — matches shadcn / coss popovers using only theme
* tokens (`border`, `--radius`) and Tailwind utilities.
*/
const TOOLTIP_PANEL_CLASS_NAME =
- 'relative min-w-[160px] rounded-xl border not-dark:bg-clip-padding text-chart-tooltip-foreground shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_rgb(0_0_0/0.04)] dark:before:shadow-[0_-1px_rgb(255_255_255/0.06)]';
+ 'relative min-w-[140px] rounded-lg border not-dark:bg-clip-padding text-chart-tooltip-foreground shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_rgb(0_0_0/0.04)] dark:before:shadow-[0_-1px_rgb(255_255_255/0.06)]';
/** Clips content to the panel's inner radius without clipping the edge highlight. */
const TOOLTIP_PANEL_INNER_CLASS_NAME =
- 'overflow-hidden rounded-[calc(var(--radius-xl)-1px)]';
+ 'overflow-hidden rounded-[calc(var(--radius-lg)-1px)]';
// Inner-only-on-visible so `useSpring` initializes at the cursor's actual x/y
// instead of (0, 0) on first hover.
@@ -84,7 +86,7 @@ function TooltipBoxInner({
y,
containerWidth,
containerHeight,
- offset = 16,
+ offset = DEFAULT_TOOLTIP_OFFSET,
className = '',
children,
left: leftOverride,
diff --git a/apps/start/src/components/charts/tooltip/tooltip-content.tsx b/apps/start/src/components/charts/tooltip/tooltip-content.tsx
index fc4122b9f..2916d1b24 100644
--- a/apps/start/src/components/charts/tooltip/tooltip-content.tsx
+++ b/apps/start/src/components/charts/tooltip/tooltip-content.tsx
@@ -30,7 +30,7 @@ export function TooltipHeader({ children, className }: TooltipHeaderProps) {
return (
<div
className={cn(
- 'border-b px-3.5 py-2.5 text-left font-medium text-chart-tooltip-foreground text-sm',
+ 'border-b px-3 py-2 text-left font-medium text-chart-tooltip-foreground text-sm',
className
)}
>
@@ -47,12 +47,12 @@ export function TooltipContent({ title, rows, children }: TooltipContentProps) {
<div>
{title && <TooltipHeader>{title}</TooltipHeader>}
{hasBody && (
- <div className="px-3.5 py-3">
+ <div className="px-3 py-2.5">
{rows.length > 0 && (
- <div className="space-y-2">
+ <div className="space-y-1.5">
{rows.map((row) => (
<div
- className="flex items-center justify-between gap-6"
+ className="flex items-center justify-between gap-5"
key={`${row.label}-${row.color}`}
>
<div className="flex min-w-0 items-center gap-2">
diff --git a/apps/start/src/components/chat/chat-composer.tsx b/apps/start/src/components/chat/chat-composer.tsx
index 160ae4336..0d9af8e72 100644
--- a/apps/start/src/components/chat/chat-composer.tsx
+++ b/apps/start/src/components/chat/chat-composer.tsx
@@ -69,7 +69,7 @@ export function ChatComposer({
<textarea
aria-label="Message"
className={cn(
- 'block w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base text-foreground leading-6 sm:text-sm',
+ 'block w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base text-foreground sm:text-sm',
'placeholder:text-muted-foreground/70',
'border-0 outline-none ring-0 focus:outline-none focus:ring-0'
)}
diff --git a/apps/start/src/components/chat/chat-conversations.tsx b/apps/start/src/components/chat/chat-conversations.tsx
index 2f0826af0..eee332180 100644
--- a/apps/start/src/components/chat/chat-conversations.tsx
+++ b/apps/start/src/components/chat/chat-conversations.tsx
@@ -73,9 +73,9 @@ export function ChatConversations({
return (
<div className={cn('flex h-full min-h-0 flex-col', className)}>
- <div className="p-3">
+ <div className="flex h-16 shrink-0 items-center px-3">
<Button
- className="w-full justify-start gap-2"
+ className="h-9 w-full justify-start gap-2"
onClick={onNew}
variant="outline"
>
@@ -91,7 +91,7 @@ export function ChatConversations({
)}
{groups.map((group) => (
<div className="mb-3" key={group.label}>
- <div className="px-2 py-1 font-medium text-[11px] text-muted-foreground uppercase tracking-wide">
+ <div className="mt-2 mb-1.5 px-2.5 font-medium text-muted-foreground text-xs">
{group.label}
</div>
{group.items.map((conversation) => {
diff --git a/apps/start/src/components/chat/chat-empty.tsx b/apps/start/src/components/chat/chat-empty.tsx
index 3419e2240..bb63ddbe4 100644
--- a/apps/start/src/components/chat/chat-empty.tsx
+++ b/apps/start/src/components/chat/chat-empty.tsx
@@ -102,9 +102,8 @@ export function ChatNotConfigured() {
<div>
<h1 className="font-semibold text-2xl">AI chat is not configured</h1>
<p className="mt-2 text-muted-foreground">
- Set <code className="font-mono text-sm">OPENAI_API_KEY</code> or{' '}
- <code className="font-mono text-sm">ANTHROPIC_API_KEY</code> on the
- API service and restart it.
+ Set <code>OPENAI_API_KEY</code> or <code>ANTHROPIC_API_KEY</code> on
+ the API service and restart it.
</p>
</div>
<div className="flex w-full flex-col gap-2">
diff --git a/apps/start/src/components/chat/chat-layout.tsx b/apps/start/src/components/chat/chat-layout.tsx
index 8f15de087..41aad1949 100644
--- a/apps/start/src/components/chat/chat-layout.tsx
+++ b/apps/start/src/components/chat/chat-layout.tsx
@@ -53,7 +53,7 @@ export function ChatLayout({
</Sheet>
<div className="flex min-h-0 min-w-0 flex-1 flex-col">
- <header className="flex h-12 shrink-0 items-center gap-2 border-b px-3">
+ <header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
<Button
aria-label="Conversations"
className="lg:hidden"
diff --git a/apps/start/src/components/chat/chat-markdown.tsx b/apps/start/src/components/chat/chat-markdown.tsx
index 69bba72f7..f81b886c3 100644
--- a/apps/start/src/components/chat/chat-markdown.tsx
+++ b/apps/start/src/components/chat/chat-markdown.tsx
@@ -38,7 +38,7 @@ function ChatMarkdownInner({
className={cn(
// Reasonable readable defaults for a chat surface: 14px body,
// 1.6 line height, list/heading rhythm.
- 'text-foreground leading-[1.6]',
+ 'text-foreground',
// Element styling via descendant selectors keeps the API tiny
// (no per-element override props for callers).
'[&>*+*]:mt-2',
@@ -54,8 +54,8 @@ function ChatMarkdownInner({
'[&_strong]:font-semibold',
'[&_em]:italic',
'[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:no-underline',
- '[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[12.5px]',
- '[&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:text-[12.5px]',
+ '[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-xs [&_code]:tabular-nums',
+ '[&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:text-xs',
'[&_pre>code]:bg-transparent [&_pre>code]:p-0',
'[&_blockquote]:border-muted-foreground/30 [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground',
'[&_hr]:my-3 [&_hr]:border-border',
@@ -92,7 +92,7 @@ function ChatMarkdownInner({
<td
className={cn(
'max-w-[320px] truncate px-3 py-1.5',
- NUMERIC_CELL.test(text) && 'text-right font-mono tabular-nums'
+ NUMERIC_CELL.test(text) && 'text-right tabular-nums'
)}
title={text}
>
diff --git a/apps/start/src/components/chat/chat-message.tsx b/apps/start/src/components/chat/chat-message.tsx
index b723acb49..bdb4a5082 100644
--- a/apps/start/src/components/chat/chat-message.tsx
+++ b/apps/start/src/components/chat/chat-message.tsx
@@ -29,8 +29,8 @@ import {
isErrorOutput,
isRowsOutput,
} from './types';
+import { useEventDrawer } from '@/components/events/use-event-drawer';
import { useAppParams } from '@/hooks/use-app-params';
-import { pushModal } from '@/modals';
import { cn } from '@/utils/cn';
export function ChatMessage({
@@ -295,15 +295,12 @@ function RowsTable({
}) {
const navigate = useNavigate();
const { organizationId, projectId } = useAppParams();
+ const { openEvent } = useEventDrawer();
let onRowClick: ((row: Record<string, unknown>) => void) | undefined;
if (toolName === 'query_events') {
onRowClick = (row) => {
if (typeof row.id === 'string' && typeof row.created_at === 'string') {
- pushModal('EventDetails', {
- id: row.id,
- createdAt: new Date(row.created_at),
- projectId,
- });
+ openEvent({ id: row.id, createdAt: row.created_at });
}
};
}
diff --git a/apps/start/src/components/chat/chat-model-picker.tsx b/apps/start/src/components/chat/chat-model-picker.tsx
index 6c380ce40..cb62ee3b7 100644
--- a/apps/start/src/components/chat/chat-model-picker.tsx
+++ b/apps/start/src/components/chat/chat-model-picker.tsx
@@ -57,7 +57,7 @@ export function ChatModelPicker({
{Object.entries(grouped).map(([provider, entries], index) => (
<div key={provider}>
{index > 0 && <DropdownMenuSeparator />}
- <DropdownMenuLabel className="text-[11px] text-muted-foreground uppercase tracking-wide">
+ <DropdownMenuLabel className="text-2xs text-muted-foreground uppercase tracking-wide">
{PROVIDER_LABELS[provider as ChatModelEntry['provider']]}
</DropdownMenuLabel>
{entries.map((model) => (
@@ -69,7 +69,7 @@ export function ChatModelPicker({
<div className="min-w-0">
<div className="flex items-center gap-2">
<span className="truncate">{model.label}</span>
- <span className="rounded border px-1 text-[10px] text-muted-foreground uppercase">
+ <span className="rounded border px-1 text-3xs text-muted-foreground uppercase">
{TIER_LABELS[model.tier]}
</span>
</div>
diff --git a/apps/start/src/components/chat/parts/approval-card.tsx b/apps/start/src/components/chat/parts/approval-card.tsx
index c8600e3af..720285caf 100644
--- a/apps/start/src/components/chat/parts/approval-card.tsx
+++ b/apps/start/src/components/chat/parts/approval-card.tsx
@@ -19,7 +19,7 @@ export function ApprovalCard({
<div className="font-medium text-sm">
{approvalPrompt(toolName, input)}
</div>
- <pre className="mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-all font-mono text-[11px] text-muted-foreground">
+ <pre className="mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-all text-muted-foreground">
{JSON.stringify(input, null, 2)}
</pre>
</div>
diff --git a/apps/start/src/components/chat/parts/billing-card.tsx b/apps/start/src/components/chat/parts/billing-card.tsx
index 82806b58b..9d4f708de 100644
--- a/apps/start/src/components/chat/parts/billing-card.tsx
+++ b/apps/start/src/components/chat/parts/billing-card.tsx
@@ -79,7 +79,7 @@ export function BillingCard({ output }: { output: BillingOutput }) {
<div className="border-t px-4 py-3">
<div className="mb-1 flex justify-between text-xs">
<span className="text-muted-foreground">Used this period</span>
- <span className="font-mono tabular-nums">
+ <span className="tabular-nums">
{number.format(usage.eventsThisPeriod)}
{usage.eventsLimit ? ` / ${number.format(usage.eventsLimit)}` : ''}
</span>
@@ -98,7 +98,7 @@ export function BillingCard({ output }: { output: BillingOutput }) {
{output.assistant && (
<div className="flex justify-between border-t px-4 py-2 text-xs">
<span className="text-muted-foreground">AI messages today</span>
- <span className="font-mono tabular-nums">
+ <span className="tabular-nums">
{number.format(output.assistant.messagesToday)}
{output.assistant.messagesPerDay === null
? ''
diff --git a/apps/start/src/components/chat/parts/table-card.tsx b/apps/start/src/components/chat/parts/table-card.tsx
index 3b3614b32..d18b93968 100644
--- a/apps/start/src/components/chat/parts/table-card.tsx
+++ b/apps/start/src/components/chat/parts/table-card.tsx
@@ -111,7 +111,7 @@ export function TableCard({
className={cn(
'max-w-[260px] truncate px-3 py-1.5',
typeof row[column] === 'number' &&
- 'text-right font-mono tabular-nums'
+ 'text-right tabular-nums'
)}
key={column}
title={cell(row[column])}
diff --git a/apps/start/src/components/chat/parts/tool-activity-group.tsx b/apps/start/src/components/chat/parts/tool-activity-group.tsx
index 9dc454b73..05c85d45c 100644
--- a/apps/start/src/components/chat/parts/tool-activity-group.tsx
+++ b/apps/start/src/components/chat/parts/tool-activity-group.tsx
@@ -126,7 +126,7 @@ export function ToolActivityGroup({ parts }: { parts: ToolPart[] }) {
</span>
)}
</summary>
- <pre className="max-h-72 overflow-auto whitespace-pre-wrap break-all border-t px-2.5 py-2 font-mono text-[11px]">
+ <pre className="max-h-72 overflow-auto whitespace-pre-wrap break-all border-t px-2.5 py-2">
{detailsOf(item.part)}
</pre>
</details>
diff --git a/apps/start/src/components/chat/parts/tool-card.tsx b/apps/start/src/components/chat/parts/tool-card.tsx
index d9afe262e..8a27d0f33 100644
--- a/apps/start/src/components/chat/parts/tool-card.tsx
+++ b/apps/start/src/components/chat/parts/tool-card.tsx
@@ -68,7 +68,7 @@ export function ToolDone({
/>
</button>
{open && (
- <pre className="max-h-72 overflow-auto whitespace-pre-wrap break-all border-t bg-muted/20 px-2.5 py-2 font-mono text-[11px]">
+ <pre className="max-h-72 overflow-auto whitespace-pre-wrap break-all border-t bg-muted/20 px-2.5 py-2">
{preview}
</pre>
)}
diff --git a/apps/start/src/components/chat/sidebar-chat-composer.tsx b/apps/start/src/components/chat/sidebar-chat-composer.tsx
deleted file mode 100644
index 1beaaafc3..000000000
--- a/apps/start/src/components/chat/sidebar-chat-composer.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { ArrowUpIcon, SparklesIcon } from 'lucide-react';
-import { useState } from 'react';
-import { useChatLaunch } from './chat-launch';
-import { Button } from '@/components/ui/button';
-import { cn } from '@/utils/cn';
-
-/** The sidebar's one-line "Ask AI" box; submitting opens the chat page with the question. */
-export function SidebarChatComposer() {
- const launch = useChatLaunch();
- const [text, setText] = useState('');
- const hasText = text.trim().length > 0;
-
- const submit = (event?: React.FormEvent) => {
- event?.preventDefault();
- launch(text);
- setText('');
- };
-
- return (
- <form
- className={cn(
- 'mb-4 flex items-center gap-2 rounded-md border border-border bg-def-100 pr-2 pl-3',
- 'transition-all focus-within:border-def-400 focus-within:ring-1 focus-within:ring-ring'
- )}
- onSubmit={submit}
- >
- <SparklesIcon className="size-5 shrink-0 text-muted-foreground" />
- <input
- className={cn(
- 'min-w-0 flex-1 bg-transparent py-2 font-medium text-[13px] text-foreground',
- 'placeholder:font-normal placeholder:text-muted-foreground',
- 'border-0 shadow-none outline-none ring-0',
- 'focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0'
- )}
- onChange={(event) => setText(event.target.value)}
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- event.preventDefault();
- submit();
- }
- }}
- placeholder="Ask AI anything…"
- type="text"
- value={text}
- />
- {hasText ? (
- <Button
- aria-label="Send to AI"
- className="size-6 shrink-0 rounded-sm"
- size="icon"
- type="submit"
- variant="default"
- >
- <ArrowUpIcon className="size-3.5" />
- </Button>
- ) : (
- <button
- aria-label="Open the chat (Cmd+J)"
- className={cn(
- 'shrink-0 rounded border border-border bg-def-200 px-1.5 py-0.5 font-mono text-[11px]',
- 'cursor-pointer text-muted-foreground'
- )}
- onClick={() => launch()}
- type="button"
- >
- ⌘J
- </button>
- )}
- </form>
- );
-}
diff --git a/apps/start/src/components/color-square.tsx b/apps/start/src/components/color-square.tsx
index 6d7198390..dda8d7dd5 100644
--- a/apps/start/src/components/color-square.tsx
+++ b/apps/start/src/components/color-square.tsx
@@ -7,7 +7,7 @@ export function ColorSquare({ children, className, color }: ColorSquareProps) {
return (
<div
className={cn(
- 'flex h-5 w-5 flex-shrink-0 items-center justify-center rounded bg-blue-600 font-medium font-mono text-sm text-white [.mini_&]:h-4 [.mini_&]:w-4 [.mini_&]:text-[0.6rem]',
+ 'flex h-5 w-5 flex-shrink-0 items-center justify-center rounded bg-blue-600 font-medium text-sm text-white tabular-nums [.mini_&]:h-4 [.mini_&]:w-4 [.mini_&]:text-[0.6rem]',
className
)}
style={{ backgroundColor: color }}
diff --git a/apps/start/src/components/delta-chip.tsx b/apps/start/src/components/delta-chip.tsx
index fe4d8e5b7..c7b6fa6cf 100644
--- a/apps/start/src/components/delta-chip.tsx
+++ b/apps/start/src/components/delta-chip.tsx
@@ -3,19 +3,19 @@ import { ArrowDownIcon, ArrowUpIcon } from 'lucide-react';
import { cn } from '@/utils/cn';
const deltaChipVariants = cva(
- 'flex items-center justify-center gap-1 rounded-full font-semibold',
+ 'flex items-center justify-center gap-0.5 font-medium tabular-nums',
{
variants: {
variant: {
- inc: 'bg-emerald-500/10 text-emerald-600 dark:text-emerald-400',
- dec: 'bg-red-500/10 text-red-600 dark:text-red-400',
- default: 'bg-muted text-muted-foreground',
+ inc: 'text-emerald-600 dark:text-emerald-400',
+ dec: 'text-red-600 dark:text-red-400',
+ default: 'text-muted-foreground',
},
size: {
- xs: 'px-1.5 py-0 text-[10px] leading-none',
- sm: 'px-2 py-1 text-xs',
- md: 'px-2 py-1 text-sm',
- lg: 'px-2 py-1 text-base',
+ xs: 'text-2xs',
+ sm: 'text-2xs',
+ md: 'text-sm',
+ lg: 'text-base',
},
},
defaultVariants: {
@@ -31,10 +31,10 @@ type DeltaChipProps = VariantProps<typeof deltaChipVariants> & {
};
const iconVariants: Record<NonNullable<DeltaChipProps['size']>, number> = {
- xs: 8,
- sm: 12,
- md: 16,
- lg: 20,
+ xs: 10,
+ sm: 10,
+ md: 14,
+ lg: 16,
};
const getVariant = (variant: DeltaChipProps['variant'], inverted?: boolean) => {
diff --git a/apps/start/src/components/error-boundary.tsx b/apps/start/src/components/error-boundary.tsx
new file mode 100644
index 000000000..09878f508
--- /dev/null
+++ b/apps/start/src/components/error-boundary.tsx
@@ -0,0 +1,30 @@
+import { Component, type ReactNode } from 'react';
+
+interface ErrorBoundaryProps {
+ children: ReactNode;
+ fallback: (error: Error) => ReactNode;
+}
+
+interface ErrorBoundaryState {
+ error: Error | null;
+}
+
+/** Keeps a render error inside one region; give it a `key` to reset per item. */
+// biome-ignore lint/style/useReactFunctionComponents: getDerivedStateFromError has no hook equivalent
+export class ErrorBoundary extends Component<
+ ErrorBoundaryProps,
+ ErrorBoundaryState
+> {
+ state: ErrorBoundaryState = { error: null };
+
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState {
+ return { error };
+ }
+
+ render() {
+ if (this.state.error) {
+ return this.props.fallback(this.state.error);
+ }
+ return this.props.children;
+ }
+}
diff --git a/apps/start/src/components/events/event-drawer.tsx b/apps/start/src/components/events/event-drawer.tsx
new file mode 100644
index 000000000..362b5be1b
--- /dev/null
+++ b/apps/start/src/components/events/event-drawer.tsx
@@ -0,0 +1,530 @@
+import type { IClickhouseEvent, IServiceEvent } from '@openpanel/core';
+import { useSuspenseQuery } from '@tanstack/react-query';
+import { FilterIcon, XIcon } from 'lucide-react';
+import { omit } from 'ramda';
+import { Suspense, useEffect, useState } from 'react';
+import { useEventDrawer } from './use-event-drawer';
+import { ErrorBoundary } from '@/components/error-boundary';
+import { ProjectLink } from '@/components/links';
+import {
+ WidgetButtons,
+ WidgetHead,
+} from '@/components/overview/overview-widget';
+import { SerieIcon } from '@/components/report-chart/common/serie-icon';
+import { ReportChartShortcut } from '@/components/report-chart/shortcut';
+import Syntax from '@/components/syntax';
+import { Button } from '@/components/ui/button';
+import { FieldValue, KeyValueGrid } from '@/components/ui/key-value-grid';
+import { WidgetBody } from '@/components/widget';
+import { useAppParams } from '@/hooks/use-app-params';
+import {
+ useEventQueryFilters,
+ useEventQueryNamesFilter,
+} from '@/hooks/use-event-query-filters';
+import { fancyMinutes } from '@/hooks/use-numer-formatter';
+import { useResizableDrawer } from '@/hooks/use-resizable-drawer';
+import { useTRPC } from '@/integrations/trpc/react';
+import { cn } from '@/utils/cn';
+import { getProfileName } from '@/utils/getters';
+
+const WIDTH_STORAGE_KEY = 'op-event-drawer-width';
+const DEFAULT_WIDTH = 480;
+const MIN_WIDTH = 380;
+const MAX_WIDTH = 800;
+
+const filterable: Partial<Record<keyof IServiceEvent, keyof IClickhouseEvent>> =
+ {
+ name: 'name',
+ referrer: 'referrer',
+ referrerName: 'referrer_name',
+ referrerType: 'referrer_type',
+ brand: 'brand',
+ model: 'model',
+ browser: 'browser',
+ browserVersion: 'browser_version',
+ os: 'os',
+ osVersion: 'os_version',
+ city: 'city',
+ region: 'region',
+ country: 'country',
+ device: 'device',
+ properties: 'properties',
+ path: 'path',
+ origin: 'origin',
+ };
+
+const TABS = {
+ pretty: { id: 'pretty', title: 'Pretty' },
+ raw: { id: 'raw', title: 'Raw' },
+} as const;
+type Tab = (typeof TABS)[keyof typeof TABS];
+
+/**
+ * Right-side drawer for one event. Mounts once in `_app.tsx` next to the chat
+ * drawer and, like it, pushes the page content aside on `lg+` instead of
+ * covering it, so the list stays usable while stepping through events.
+ */
+export function EventDrawer() {
+ const { projectId } = useAppParams();
+ const { eventId, createdAt, chatId, closeEvent } = useEventDrawer();
+ const { width, dragHandleProps } = useResizableDrawer({
+ defaultWidth: DEFAULT_WIDTH,
+ minWidth: MIN_WIDTH,
+ maxWidth: MAX_WIDTH,
+ storageKey: WIDTH_STORAGE_KEY,
+ });
+ const isOpen = Boolean(projectId && eventId);
+
+ // The chat drawer owns the same edge; it wins when it opens on top of us.
+ useEffect(() => {
+ if (isOpen && chatId !== null) {
+ closeEvent({ history: 'replace' });
+ }
+ }, [isOpen, chatId, closeEvent]);
+
+ useEffect(() => {
+ if (!isOpen) {
+ return;
+ }
+ // Radix overlays (sheets, dialogs, menus) handle Escape themselves; an
+ // Escape meant for one of them must not also close the drawer beneath.
+ const handler = (e: KeyboardEvent) => {
+ if (e.key !== 'Escape' || e.defaultPrevented) {
+ return;
+ }
+ const target = e.target instanceof Element ? e.target : null;
+ const insideOverlay = target?.closest(
+ '[role="dialog"], [role="menu"], [role="listbox"]'
+ );
+ const overlayOpen = document.querySelector(
+ '[role="dialog"][data-state="open"]'
+ );
+ if (insideOverlay || overlayOpen) {
+ return;
+ }
+ closeEvent();
+ };
+ window.addEventListener('keydown', handler);
+ return () => window.removeEventListener('keydown', handler);
+ }, [isOpen, closeEvent]);
+
+ if (!(projectId && eventId)) {
+ return null;
+ }
+
+ return (
+ <>
+ {/* The aside is `fixed`; this spacer makes the page shrink on `lg+`. */}
+ <div aria-hidden className="hidden shrink-0 lg:block" style={{ width }} />
+ <aside
+ aria-label="Event details"
+ className="fixed top-0 right-0 z-40 flex h-screen flex-col border-l bg-background shadow-2xl"
+ style={{ width }}
+ >
+ <div
+ aria-label="Resize event details"
+ aria-valuemax={MAX_WIDTH}
+ aria-valuemin={MIN_WIDTH}
+ aria-valuenow={width}
+ className="absolute top-0 left-0 z-10 h-full w-1 cursor-ew-resize transition-colors hover:bg-border"
+ {...dragHandleProps}
+ role="separator"
+ />
+ <ErrorBoundary
+ fallback={(error) => (
+ <EventDetailsError message={error.message} onClose={closeEvent} />
+ )}
+ key={`${projectId}:${eventId}:${createdAt?.toISOString() ?? ''}`}
+ >
+ <Suspense fallback={<EventDetailsSkeleton onClose={closeEvent} />}>
+ <EventDetailsContent
+ createdAt={createdAt}
+ id={eventId}
+ onClose={closeEvent}
+ projectId={projectId}
+ />
+ </Suspense>
+ </ErrorBoundary>
+ </aside>
+ </>
+ );
+}
+
+interface ContentProps {
+ id: string;
+ createdAt?: Date;
+ projectId: string;
+ onClose: () => void;
+}
+
+function EventDetailsContent({
+ id,
+ createdAt,
+ projectId,
+ onClose,
+}: ContentProps) {
+ const [, setEvents] = useEventQueryNamesFilter();
+ const [, setFilter] = useEventQueryFilters();
+ const [tab, setTab] = useState<Tab>(TABS.pretty);
+ const trpc = useTRPC();
+ const query = useSuspenseQuery(
+ trpc.event.details.queryOptions({
+ id,
+ projectId,
+ createdAt,
+ })
+ );
+
+ const { event, session } = query.data;
+
+ const profile = event.profile;
+
+ const data = (() => {
+ const data: {
+ name: keyof IServiceEvent | string;
+ value: any;
+ event: IServiceEvent;
+ }[] = [
+ {
+ name: 'createdAt',
+ value: event.createdAt,
+ },
+ {
+ name: 'name',
+ value: event.name,
+ },
+ {
+ name: 'origin',
+ value: event.origin,
+ },
+ {
+ name: 'path',
+ value: event.path,
+ },
+ {
+ name: 'country',
+ value: event.country,
+ },
+ {
+ name: 'region',
+ value: event.region,
+ },
+ {
+ name: 'city',
+ value: event.city,
+ },
+ {
+ name: 'referrer',
+ value: event.referrer,
+ },
+ {
+ name: 'referrerName',
+ value: event.referrerName,
+ },
+ {
+ name: 'referrerType',
+ value: event.referrerType,
+ },
+ {
+ name: 'brand',
+ value: event.brand,
+ },
+ {
+ name: 'model',
+ value: event.model,
+ },
+ ].map((item) => ({ ...item, event }));
+
+ return data.filter((item) => !!item.value);
+ })();
+
+ const properties = Object.entries(event.properties)
+ .filter(([name]) => !name.startsWith('__'))
+ .map(([name, value]) => ({
+ name,
+ value,
+ event,
+ }));
+ // The profile has its own card above; everything else is the event as the API returns it.
+ const eventJson = JSON.stringify(omit(['profile'], event), null, 2);
+
+ return (
+ <>
+ <WidgetHead className="shrink-0 rounded-none">
+ <div className="row items-center justify-between">
+ <div className="title truncate">{event.name}</div>
+ <div className="row items-center gap-2 pr-2">
+ <Button
+ aria-label="Close event details"
+ onClick={onClose}
+ size="icon"
+ variant={'ghost'}
+ >
+ <XIcon className="size-4" />
+ </Button>
+ </div>
+ </div>
+
+ <WidgetButtons>
+ {Object.values(TABS).map((item) => (
+ <button
+ aria-pressed={item.id === tab.id}
+ className={cn(item.id === tab.id && 'active')}
+ key={item.id}
+ onClick={() => setTab(item)}
+ type="button"
+ >
+ {item.title}
+ </button>
+ ))}
+ </WidgetButtons>
+ </WidgetHead>
+ <WidgetBody className="col flex-1 gap-4 overflow-y-auto bg-def-100">
+ {tab.id === TABS.raw.id && <Syntax code={eventJson} language="json" />}
+ {tab.id === TABS.pretty.id && profile && (
+ <ProjectLink
+ className="card col gap-2 p-4 py-2 hover:bg-def-100"
+ params={{ profileId: profile.id }}
+ to="/profiles/$profileId"
+ >
+ <div className="row items-center justify-between gap-2">
+ <div className="row min-w-0 items-center gap-2">
+ {profile.avatar && (
+ <img
+ alt=""
+ className="size-4 rounded-full bg-border"
+ height={16}
+ src={profile.avatar}
+ width={16}
+ />
+ )}
+ <div className="truncate font-medium">
+ {getProfileName(profile, false)}
+ </div>
+ </div>
+ <div className="row shrink-0 items-center gap-2">
+ <div className="row items-center gap-1">
+ <SerieIcon name={event.country} />
+ <SerieIcon name={event.os} />
+ <SerieIcon name={event.browser} />
+ </div>
+ <div className="max-w-40 truncate text-muted-foreground">
+ {event.referrerName || event.referrer}
+ </div>
+ </div>
+ </div>
+ {!!session && (
+ <div className="text-muted-foreground">
+ This session has{' '}
+ <span className="font-medium text-foreground">
+ {session.screenViewCount} screen views
+ </span>{' '}
+ and{' '}
+ <span className="font-medium text-foreground">
+ {session.eventCount} events
+ </span>
+ . Visit duration is{' '}
+ <span className="font-medium text-foreground">
+ {fancyMinutes(session.duration / 1000)}
+ </span>
+ .
+ </div>
+ )}
+ </ProjectLink>
+ )}
+
+ {tab.id === TABS.pretty.id && properties.length > 0 && (
+ <section>
+ <div className="mb-2 flex justify-between font-medium">
+ <div>Properties</div>
+ </div>
+ <KeyValueGrid
+ columns={1}
+ copyable
+ data={properties}
+ onItemClick={(item) => {
+ setFilter(`properties.${item.name}`, item.value as any);
+ }}
+ renderValue={(item) => (
+ <div className="flex items-center gap-2">
+ <span className="tabular-nums">{String(item.value)}</span>
+ <FilterIcon className="size-3 shrink-0" />
+ </div>
+ )}
+ />
+ </section>
+ )}
+ {tab.id === TABS.pretty.id && (
+ <section>
+ <div className="mb-2 flex justify-between font-medium">
+ <div>Information</div>
+ </div>
+ <KeyValueGrid
+ columns={1}
+ copyable
+ data={data}
+ onItemClick={(item) => {
+ const isFilterable =
+ item.value && (filterable as any)[item.name];
+ if (isFilterable) {
+ setFilter(item.name as keyof IServiceEvent, item.value);
+ }
+ }}
+ renderValue={(item) => {
+ const isFilterable =
+ item.value && (filterable as any)[item.name];
+ if (isFilterable) {
+ return (
+ <div className="flex items-center gap-2">
+ <FieldValue
+ event={event}
+ name={item.name}
+ value={item.value}
+ />
+ <FilterIcon className="size-3 shrink-0" />
+ </div>
+ );
+ }
+
+ return (
+ <FieldValue
+ event={event}
+ name={item.name}
+ value={item.value}
+ />
+ );
+ }}
+ />
+ </section>
+ )}
+ {tab.id === TABS.pretty.id && (
+ <section>
+ <div className="mb-2 flex justify-between font-medium">
+ <div>All events for {event.name}</div>
+ <button
+ className="text-muted-foreground hover:underline"
+ onClick={() => {
+ setEvents([event.name]);
+ }}
+ type="button"
+ >
+ Show all
+ </button>
+ </div>
+ <div className="card p-4">
+ <ReportChartShortcut
+ chartType="linear"
+ options={{ hideTable: true }}
+ projectId={event.projectId}
+ series={[
+ {
+ id: 'A',
+ name: event.name,
+ displayName: 'Similar events',
+ segment: 'event',
+ filters: [],
+ type: 'event',
+ },
+ ]}
+ />
+ </div>
+ </section>
+ )}
+ </WidgetBody>
+ </>
+ );
+}
+
+function EventDetailsError({
+ message,
+ onClose,
+}: {
+ message: string;
+ onClose: () => void;
+}) {
+ return (
+ <>
+ <WidgetHead className="shrink-0 rounded-none">
+ <div className="row items-center justify-between">
+ <div className="p-4 font-semibold">Event details</div>
+ <div className="row items-center gap-2 pr-2">
+ <Button
+ aria-label="Close event details"
+ onClick={onClose}
+ size="icon"
+ variant={'ghost'}
+ >
+ <XIcon className="size-4" />
+ </Button>
+ </div>
+ </div>
+ </WidgetHead>
+ <WidgetBody className="col flex-1 gap-2 bg-def-100">
+ <div className="card p-4">
+ <div className="font-medium">This event could not be loaded</div>
+ <p className="mt-1 text-muted-foreground">{message}</p>
+ </div>
+ </WidgetBody>
+ </>
+ );
+}
+
+function EventDetailsSkeleton({ onClose }: { onClose: () => void }) {
+ return (
+ <>
+ <WidgetHead className="shrink-0 rounded-none">
+ <div className="row items-center justify-between">
+ <div className="p-4">
+ <div className="h-6 w-32 animate-pulse rounded bg-muted" />
+ </div>
+ <div className="row items-center gap-2 pr-2">
+ <Button
+ aria-label="Close event details"
+ onClick={onClose}
+ size="icon"
+ variant={'ghost'}
+ >
+ <XIcon className="size-4" />
+ </Button>
+ </div>
+ </div>
+
+ <WidgetButtons>
+ <div className="h-8 w-20 animate-pulse rounded bg-muted" />
+ <div className="h-8 w-20 animate-pulse rounded bg-muted" />
+ </WidgetButtons>
+ </WidgetHead>
+ <WidgetBody className="col flex-1 gap-4 overflow-y-auto bg-def-100">
+ <div className="card col gap-2 p-4 py-2">
+ <div className="row items-center justify-between gap-2">
+ <div className="row min-w-0 items-center gap-2">
+ <div className="size-4 animate-pulse rounded-full bg-muted" />
+ <div className="h-4 w-24 animate-pulse rounded bg-muted" />
+ </div>
+ <div className="h-4 w-32 animate-pulse rounded bg-muted" />
+ </div>
+ <div className="h-4 w-64 animate-pulse rounded bg-muted" />
+ </div>
+
+ {[3, 6].map((rowCount) => (
+ <section key={rowCount}>
+ <div className="mb-2 flex justify-between font-medium">
+ <div className="h-5 w-20 animate-pulse rounded bg-muted" />
+ </div>
+ <div className="space-y-2">
+ {Array.from({ length: rowCount }).map((_, i) => (
+ <div
+ className="flex items-center justify-between rounded bg-muted/50 p-3"
+ key={i.toString()}
+ >
+ <div className="h-4 w-24 animate-pulse rounded bg-muted" />
+ <div className="h-4 w-32 animate-pulse rounded bg-muted" />
+ </div>
+ ))}
+ </div>
+ </section>
+ ))}
+ </WidgetBody>
+ </>
+ );
+}
diff --git a/apps/start/src/components/events/event-list-item.tsx b/apps/start/src/components/events/event-list-item.tsx
index b56045a65..9566146ed 100644
--- a/apps/start/src/components/events/event-list-item.tsx
+++ b/apps/start/src/components/events/event-list-item.tsx
@@ -2,15 +2,16 @@ import type { IServiceEvent, IServiceEventMinimal } from '@openpanel/core';
import { Link } from '@tanstack/react-router';
import { SerieIcon } from '../report-chart/common/serie-icon';
import { EventIcon } from './event-icon';
+import { useEventDrawer } from './use-event-drawer';
import { Tooltiper } from '@/components/ui/tooltip';
import { useAppParams } from '@/hooks/use-app-params';
-import { pushModal } from '@/modals';
import { cn } from '@/utils/cn';
import { getProfileName } from '@/utils/getters';
type EventListItemProps = IServiceEventMinimal | IServiceEvent;
export function EventListItem(props: EventListItemProps) {
+ const { openEvent } = useEventDrawer();
const { organizationId, projectId } = useAppParams();
const { createdAt, name, path, meta } = props;
const profile = 'profile' in props ? props.profile : null;
@@ -38,11 +39,7 @@ export function EventListItem(props: EventListItemProps) {
)}
onClick={() => {
if (!isMinimal) {
- pushModal('EventDetails', {
- id: props.id,
- projectId,
- createdAt,
- });
+ openEvent({ id: props.id, createdAt });
}
}}
type="button"
diff --git a/apps/start/src/components/events/event-listener.tsx b/apps/start/src/components/events/event-listener.tsx
index 08df9b61d..c09ca5cc2 100644
--- a/apps/start/src/components/events/event-listener.tsx
+++ b/apps/start/src/components/events/event-listener.tsx
@@ -33,7 +33,7 @@ export default function EventListener({
<Tooltip>
<TooltipTrigger asChild>
<button
- className="flex h-8 items-center gap-2 rounded-md border border-border bg-card px-3 font-medium leading-none"
+ className="flex h-8 items-center gap-2 rounded-md border border-border bg-card px-3 font-medium"
onClick={() => {
counter.set(0);
onRefresh();
diff --git a/apps/start/src/components/events/table/columns.tsx b/apps/start/src/components/events/table/columns.tsx
index 11690bd54..ad3611cea 100644
--- a/apps/start/src/components/events/table/columns.tsx
+++ b/apps/start/src/components/events/table/columns.tsx
@@ -1,5 +1,6 @@
import type { IServiceEvent } from '@openpanel/core';
import type { ColumnDef } from '@tanstack/react-table';
+import { useEventDrawer } from '../use-event-drawer';
import { ColumnCreatedAt } from '@/components/column-created-at';
import { EventIcon } from '@/components/events/event-icon';
import { ProjectLink } from '@/components/links';
@@ -11,6 +12,7 @@ import { pushModal } from '@/modals';
import { getProfileName } from '@/utils/getters';
export function useColumns() {
+ const { openEvent } = useEventDrawer();
const number = useNumber();
const columns: ColumnDef<IServiceEvent>[] = [
{
@@ -77,10 +79,9 @@ export function useColumns() {
<button
className="min-w-0 max-w-full truncate text-left font-medium hover:underline"
onClick={() => {
- pushModal('EventDetails', {
+ openEvent({
id: row.original.id,
createdAt: row.original.createdAt,
- projectId: row.original.projectId,
});
}}
title={fullTitle}
@@ -224,7 +225,7 @@ export function useColumns() {
<div className="flex flex-wrap gap-1">
{groups.map((g) => (
<span
- className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs"
+ className="rounded bg-muted px-1.5 py-0.5 text-xs tabular-nums"
key={g}
>
{g}
diff --git a/apps/start/src/components/events/table/index.tsx b/apps/start/src/components/events/table/index.tsx
index 9669c01f5..76e747ca4 100644
--- a/apps/start/src/components/events/table/index.tsx
+++ b/apps/start/src/components/events/table/index.tsx
@@ -11,6 +11,7 @@ import { last } from 'ramda';
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
import { useInViewport } from 'react-in-viewport';
import EventListener from '../event-listener';
+import { useEventDrawer } from '../use-event-drawer';
import { useColumns } from './columns';
import { FullPageEmptyState } from '@/components/full-page-empty-state';
import {
@@ -179,7 +180,7 @@ const VirtualizedEventsTable = ({
const width = `${column.getSize()}px`;
return (
<div
- className="flex h-10 items-center whitespace-nowrap px-4 text-left font-semibold text-[10px] text-foreground uppercase"
+ className="flex h-10 items-center whitespace-nowrap px-4 text-left font-semibold text-3xs text-foreground uppercase"
key={column.id}
style={{
width,
@@ -237,13 +238,13 @@ export const EventsTable = ({ query, showEventListener = false }: Props) => {
const { isLoading } = query;
const columns = useColumns();
- const handleRowClick = useCallback((row: any) => {
- pushModal('EventDetails', {
- id: row.original.id,
- createdAt: row.original.createdAt,
- projectId: row.original.projectId,
- });
- }, []);
+ const { openEvent } = useEventDrawer();
+ const handleRowClick = useCallback(
+ (row: any) => {
+ openEvent({ id: row.original.id, createdAt: row.original.createdAt });
+ },
+ [openEvent]
+ );
const data = useMemo(() => {
if (isLoading) {
diff --git a/apps/start/src/components/events/table/item.tsx b/apps/start/src/components/events/table/item.tsx
index d5b9a32e7..0713b072a 100644
--- a/apps/start/src/components/events/table/item.tsx
+++ b/apps/start/src/components/events/table/item.tsx
@@ -2,6 +2,7 @@ import type { IServiceEvent } from '@openpanel/core';
import { memo } from 'react';
import { Skeleton } from '../../skeleton';
import { EventIcon } from '../event-icon';
+import { useEventDrawer } from '../use-event-drawer';
import { ProfileAvatar } from '@/components/profiles/profile-avatar';
import { SerieIcon } from '@/components/report-chart/common/serie-icon';
import { Tooltiper } from '@/components/ui/tooltip';
@@ -18,6 +19,7 @@ interface EventItemProps {
export const EventItem = memo<EventItemProps>(
({ event, viewOptions, className }) => {
+ const { openEvent } = useEventDrawer();
let url: string | null = '';
if (event.path && event.origin) {
if (viewOptions.origin !== false && event.origin) {
@@ -48,19 +50,11 @@ export const EventItem = memo<EventItemProps>(
)}
data-slot="inner"
onClick={() => {
- pushModal('EventDetails', {
- id: event.id,
- projectId: event.projectId,
- createdAt: event.createdAt,
- });
+ openEvent({ id: event.id, createdAt: event.createdAt });
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
- pushModal('EventDetails', {
- id: event.id,
- projectId: event.projectId,
- createdAt: event.createdAt,
- });
+ openEvent({ id: event.id, createdAt: event.createdAt });
}
}}
>
@@ -78,7 +72,7 @@ export const EventItem = memo<EventItemProps>(
>
<EventIcon meta={event.meta} name={event.name} size="sm" />
</button>
- <span className="wrap-break-word min-w-0 whitespace-break-spaces break-all text-sm leading-normal">
+ <span className="wrap-break-word min-w-0 whitespace-break-spaces break-all text-sm">
{event.name === 'screen_view' ? (
<>
<span className="mr-2 text-muted-foreground">Visit:</span>
@@ -134,7 +128,7 @@ export const EventItem = memo<EventItemProps>(
className="border-neutral-200 border-t bg-def-100 p-4 py-2"
data-slot="extra"
>
- <pre className="text-sm leading-tight">
+ <pre className="text-xs">
{JSON.stringify(event.properties, null, 2)}
</pre>
</div>
@@ -171,7 +165,7 @@ function Pill({
return (
<Tooltiper
className={cn(
- 'inline-flex h-6 shrink-0 items-center gap-2 whitespace-nowrap rounded-full font-mono @3xl:text-muted-foreground text-xs',
+ 'inline-flex h-6 shrink-0 items-center gap-2 whitespace-nowrap rounded-full @3xl:text-muted-foreground text-xs tabular-nums',
className
)}
content={children}
diff --git a/apps/start/src/components/events/use-event-drawer.ts b/apps/start/src/components/events/use-event-drawer.ts
new file mode 100644
index 000000000..cca69e142
--- /dev/null
+++ b/apps/start/src/components/events/use-event-drawer.ts
@@ -0,0 +1,49 @@
+import { parseAsIsoDateTime, parseAsString, useQueryStates } from 'nuqs';
+import { useCallback } from 'react';
+
+const parsers = {
+ event: parseAsString,
+ eventAt: parseAsIsoDateTime,
+ chat: parseAsString,
+};
+
+export interface OpenEventInput {
+ id: string;
+ /** Narrows the ClickHouse lookup to the event's partition. */
+ createdAt?: Date | string;
+}
+
+/**
+ * `?event=<id>` is the single source of truth for the event details drawer,
+ * the same way `?chat` is for the chat drawer. Both drawers share the right
+ * edge, so opening an event closes the chat; the drawer itself closes when
+ * the chat opens on top of it.
+ */
+export function useEventDrawer() {
+ const [state, setState] = useQueryStates(parsers, { history: 'push' });
+
+ const openEvent = useCallback(
+ ({ id, createdAt }: OpenEventInput) =>
+ setState({
+ event: id,
+ eventAt: createdAt ? new Date(createdAt) : null,
+ chat: null,
+ }),
+ [setState]
+ );
+
+ const closeEvent = useCallback(
+ (options?: { history: 'push' | 'replace' }) =>
+ setState({ event: null, eventAt: null }, options),
+ [setState]
+ );
+
+ return {
+ eventId: state.event,
+ createdAt: state.eventAt ?? undefined,
+ chatId: state.chat,
+ isOpen: state.event !== null,
+ openEvent,
+ closeEvent,
+ };
+}
diff --git a/apps/start/src/components/feedback-button.tsx b/apps/start/src/components/feedback-button.tsx
index 234325126..95c77527e 100644
--- a/apps/start/src/components/feedback-button.tsx
+++ b/apps/start/src/components/feedback-button.tsx
@@ -1,12 +1,11 @@
import { useRouteContext } from '@tanstack/react-router';
-import { cn } from '@/lib/utils';
import { op } from '@/utils/op';
export function FeedbackButton({ className }: { className?: string }) {
const context = useRouteContext({ strict: false });
return (
<button
- className={cn('justify-start text-left text-[13px]', className)}
+ className={className}
onClick={() => {
op.track('feedback_button_clicked');
if ('uj' in window && window.uj !== undefined) {
diff --git a/apps/start/src/components/forms/copy-input.tsx b/apps/start/src/components/forms/copy-input.tsx
index 672c61077..ec7c36d5e 100644
--- a/apps/start/src/components/forms/copy-input.tsx
+++ b/apps/start/src/components/forms/copy-input.tsx
@@ -17,7 +17,7 @@ const CopyInput = ({ label, value, className }: Props) => {
type="button"
>
{!!label && <Label>{label}</Label>}
- <div className="flex items-center justify-between gap-2 rounded bg-muted p-2 px-3 font-mono">
+ <div className="flex items-center justify-between gap-2 rounded bg-muted p-2 px-3 tabular-nums">
<span className="min-w-0 flex-1 truncate">{value}</span>
<CopyIcon className="shrink-0" size={16} />
</div>
diff --git a/apps/start/src/components/forms/input-with-label.tsx b/apps/start/src/components/forms/input-with-label.tsx
index 4b74fcb8e..828a02a4d 100644
--- a/apps/start/src/components/forms/input-with-label.tsx
+++ b/apps/start/src/components/forms/input-with-label.tsx
@@ -40,9 +40,9 @@ export const WithLabel = ({
align="end"
asChild
content={error}
- tooltipClassName="max-w-80 leading-normal"
+ tooltipClassName="max-w-80"
>
- <div className="flex items-center gap-1 text-destructive leading-none">
+ <div className="flex items-center gap-1 text-destructive">
Issues
<BanIcon size={14} />
</div>
diff --git a/apps/start/src/components/groups/table/columns.tsx b/apps/start/src/components/groups/table/columns.tsx
index cfce07915..4d675b248 100644
--- a/apps/start/src/components/groups/table/columns.tsx
+++ b/apps/start/src/components/groups/table/columns.tsx
@@ -34,7 +34,7 @@ export function useGroupColumns(): ColumnDef<IServiceGroupWithStats>[] {
accessorKey: 'id',
header: 'ID',
cell: ({ row }) => (
- <span className="font-mono text-muted-foreground text-xs">
+ <span className="text-muted-foreground text-xs tabular-nums">
{row.original.id}
</span>
),
diff --git a/apps/start/src/components/insights/insight-card.tsx b/apps/start/src/components/insights/insight-card.tsx
index 971e2aeca..6d676d9af 100644
--- a/apps/start/src/components/insights/insight-card.tsx
+++ b/apps/start/src/components/insights/insight-card.tsx
@@ -1,9 +1,7 @@
-import { FilterIcon, RotateCcwIcon, SparklesIcon } from 'lucide-react';
+import { FilterIcon, RotateCcwIcon } from 'lucide-react';
import { useState } from 'react';
import { DeltaChip } from '../delta-chip';
import { SerieIcon } from '../report-chart/common/serie-icon';
-import { Badge } from '../ui/badge';
-import { Button } from '../ui/button';
import { pushModal } from '@/modals';
import type { RouterOutputs } from '@/trpc/client';
import { cn } from '@/utils/cn';
@@ -99,98 +97,84 @@ export function InsightCard({
return insight.displayName;
};
+ const openDetails = () => pushModal('InsightDetails', { insight });
+
return (
<div
className={cn(
- 'card group/card flex h-full flex-col p-4 transition-colors hover:bg-def-50',
+ 'card group/card flex h-full cursor-pointer flex-col p-3 transition-colors hover:bg-def-50',
className
)}
+ onClick={openDetails}
+ onKeyDown={(event) => {
+ // The metric and filter buttons handle their own keys.
+ if (event.target !== event.currentTarget) {
+ return;
+ }
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault();
+ openDetails();
+ }
+ }}
+ role="button"
+ tabIndex={0}
>
- <div
- className={cn(
- 'row h-4 items-center justify-between',
- onFilter && 'group-hover/card:hidden'
- )}
- >
- <Badge className="-ml-2" variant="outline">
+ <div className="flex items-center justify-between gap-3">
+ <div className="min-w-0 flex-1 truncate font-semibold text-sm">
+ {renderTitle()}
+ </div>
+ <div
+ className={cn(
+ 'shrink-0 text-2xs text-muted-foreground',
+ onFilter && 'group-focus-within/card:hidden group-hover/card:hidden'
+ )}
+ >
{formatWindowKind(insight.windowKind)}
- </Badge>
- {insight.severityBand && (
- <div className="flex shrink-0 items-center gap-1">
- <span
- className={cn(
- 'h-2 w-2 rounded-full',
- insight.severityBand === 'severe'
- ? 'bg-red-500'
- : insight.severityBand === 'moderate'
- ? 'bg-yellow-500'
- : 'bg-blue-500'
- )}
- />
- <span className="text-[11px] text-muted-foreground capitalize">
- {insight.severityBand}
- </span>
- </div>
- )}
- </div>
- {onFilter && (
- <div className="row hidden h-4 justify-between gap-2 group-hover/card:flex">
- {availableMetrics.length > 1 ? (
+ </div>
+ {onFilter && (
+ <div className="hidden shrink-0 items-center gap-2 group-focus-within/card:flex group-hover/card:flex">
+ {availableMetrics.length > 1 && (
+ <button
+ className="flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground"
+ onClick={(event) => {
+ event.stopPropagation();
+ setMetricIndex((metricIndex + 1) % availableMetrics.length);
+ }}
+ type="button"
+ >
+ <RotateCcwIcon className="size-2.5" />
+ {metricKeyToLabel(
+ availableMetrics[
+ (metricIndex + 1) % availableMetrics.length
+ ][0]
+ )}
+ </button>
+ )}
<button
- className="flex items-center gap-1 text-[11px] text-muted-foreground capitalize"
- onClick={() =>
- setMetricIndex((metricIndex + 1) % availableMetrics.length)
- }
+ className="flex items-center gap-1 text-2xs text-muted-foreground hover:text-foreground"
+ onClick={(event) => {
+ event.stopPropagation();
+ onFilter();
+ }}
type="button"
>
- <RotateCcwIcon className="size-2" />
- Show{' '}
- {metricKeyToLabel(
- availableMetrics[(metricIndex + 1) % availableMetrics.length][0]
- )}
+ Filter <FilterIcon className="size-2.5" />
</button>
- ) : (
- <div />
- )}
- <button
- className="flex items-center gap-1 text-[11px] text-muted-foreground capitalize"
- onClick={onFilter}
- type="button"
- >
- Filter <FilterIcon className="size-2" />
- </button>
- </div>
- )}
- <div className="mt-2 line-clamp-2 font-semibold text-sm leading-snug">
- {renderTitle()}
+ </div>
+ )}
</div>
{insight.aiSummary && (
- <p className="mt-1 line-clamp-3 text-muted-foreground text-xs leading-snug">
+ <p className="mt-1 line-clamp-2 text-muted-foreground text-xs">
{insight.aiSummary}
</p>
)}
- <div className="mt-auto pt-2">
- <div className="flex items-end justify-between gap-3">
- <div className="min-w-0">
- <div className="mb-1 text-[11px] text-muted-foreground">
- {metricLabel}
- </div>
-
- <div className="col gap-1">
- <div className="font-semibold text-2xl tracking-tight">
- {formatValue(currentValue)}
- </div>
-
- {compareValue != null && (
- <div className="text-muted-foreground text-xs">
- vs {formatValue(compareValue)}
- </div>
- )}
- </div>
+ <div className="mt-auto pt-3">
+ <div className="flex items-baseline gap-2">
+ <div className="font-semibold text-xl tabular-nums tracking-tight">
+ {formatValue(currentValue)}
</div>
-
<DeltaChip
size="sm"
variant={isIncrease ? 'inc' : isDecrease ? 'dec' : 'default'}
@@ -198,16 +182,10 @@ export function InsightCard({
{deltaText}
</DeltaChip>
</div>
-
- <Button
- className="mt-2 -ml-2 h-7 self-start px-2 text-muted-foreground text-xs"
- icon={SparklesIcon}
- onClick={() => pushModal('InsightDetails', { insight })}
- size="sm"
- variant="ghost"
- >
- Why did this happen?
- </Button>
+ <div className="mt-0.5 text-2xs text-muted-foreground">
+ {metricLabel}
+ {compareValue != null && ` · vs ${formatValue(compareValue)}`}
+ </div>
</div>
</div>
);
diff --git a/apps/start/src/components/integrations/integration-card.tsx b/apps/start/src/components/integrations/integration-card.tsx
index e8cab322a..cd5cf9193 100644
--- a/apps/start/src/components/integrations/integration-card.tsx
+++ b/apps/start/src/components/integrations/integration-card.tsx
@@ -125,7 +125,7 @@ export function IntegrationCardContent({
{icon}
<div className="col gap-1">
<h2 className="title">{name}</h2>
- <p className="text-muted-foreground leading-tight">{description}</p>
+ <p className="text-muted-foreground">{description}</p>
</div>
</div>
);
diff --git a/apps/start/src/components/notifications/rule-card.tsx b/apps/start/src/components/notifications/rule-card.tsx
index 726b26251..0f8865bb2 100644
--- a/apps/start/src/components/notifications/rule-card.tsx
+++ b/apps/start/src/components/notifications/rule-card.tsx
@@ -23,7 +23,7 @@ function EventBadge({
return (
<Tooltiper
content={
- <div className="col gap-2 font-mono">
+ <div className="col gap-2 tabular-nums">
{event.filters.map((filter) => (
<div key={filter.id}>
{filter.name} {filter.operator} {JSON.stringify(filter.value)}
@@ -81,7 +81,7 @@ export function RuleCard({
<div className="col gap-2">
{rule.config.events.map((event, index) => (
<div
- className="row items-center gap-2 font-mono"
+ className="row items-center gap-2 tabular-nums"
key={event.id}
>
<ColorSquare>{index + 1}</ColorSquare>
diff --git a/apps/start/src/components/onboarding-left-panel.tsx b/apps/start/src/components/onboarding-left-panel.tsx
index c66c09170..320a9ee07 100644
--- a/apps/start/src/components/onboarding-left-panel.tsx
+++ b/apps/start/src/components/onboarding-left-panel.tsx
@@ -62,7 +62,7 @@ function TestimonialSlide({
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-black/10" />
<div className="relative z-10 flex flex-col gap-4">
<QuoteIcon className="size-10 stroke-1 text-white/40" />
- <blockquote className="font-medium text-3xl text-white leading-relaxed">
+ <blockquote className="font-medium text-2xl text-white leading-relaxed">
{quote}
</blockquote>
<figcaption className="text-sm text-white/60">
diff --git a/apps/start/src/components/onboarding/activation-banner.tsx b/apps/start/src/components/onboarding/activation-banner.tsx
index 534737237..940420cd0 100644
--- a/apps/start/src/components/onboarding/activation-banner.tsx
+++ b/apps/start/src/components/onboarding/activation-banner.tsx
@@ -164,17 +164,17 @@ export default function ActivationBanner() {
<div className="@5xl:row col relative @5xl:items-center @5xl:justify-between @5xl:gap-10 gap-6 @5xl:p-6 p-4 @5xl:px-8">
<div className="row @5xl:contents min-w-0 flex-wrap items-start justify-between gap-4">
- <div className="col min-w-0 gap-1">
- <div className="row items-center gap-2 font-mono text-muted-foreground text-xs uppercase tracking-widest">
+ <div className="col min-w-0">
+ <div className="row items-center gap-1.5 text-3xs text-muted-foreground uppercase tabular-nums tracking-wider">
Setup funnel
<span className="text-emerald-600 dark:text-emerald-500">
{doneCount}/{steps.length}
</span>
</div>
- <div className="font-medium text-lg leading-tight">
- {headline.title}
+ <div className="font-semibold text-base">{headline.title}</div>
+ <div className="mt-0.5 text-muted-foreground text-sm">
+ {headline.sub}
</div>
- <div className="text-muted-foreground text-sm">{headline.sub}</div>
</div>
<div className="row @5xl:hidden shrink-0 items-center gap-2">
diff --git a/apps/start/src/components/onboarding/onboarding-verify-listener.tsx b/apps/start/src/components/onboarding/onboarding-verify-listener.tsx
index 10839f53f..227643a24 100644
--- a/apps/start/src/components/onboarding/onboarding-verify-listener.tsx
+++ b/apps/start/src/components/onboarding/onboarding-verify-listener.tsx
@@ -38,7 +38,7 @@ const VerifyListener = ({ events }: Props) => {
>
{renderIcon()}
<div className="flex-1">
- <div className="font-semibold text-foreground/90 text-lg leading-normal">
+ <div className="font-semibold text-foreground/90 text-lg">
{isConnected ? 'Successfully connected' : 'Waiting for events'}
</div>
{isConnected ? (
diff --git a/apps/start/src/components/onboarding/verify-faq.tsx b/apps/start/src/components/onboarding/verify-faq.tsx
index 247f2c7a1..90303e6ef 100644
--- a/apps/start/src/components/onboarding/verify-faq.tsx
+++ b/apps/start/src/components/onboarding/verify-faq.tsx
@@ -115,11 +115,7 @@ export function VerifyFaq({
For web tracking, the <code>clientId</code> in your snippet
must match this project. Copy it here if needed:
</span>
- <CopyInput
- className="[&_.font-mono]:text-sm"
- label="Client ID"
- value={client.id}
- />
+ <CopyInput className="" label="Client ID" value={client.id} />
</AlertDescription>
</Alert>
<Alert>
@@ -155,7 +151,7 @@ export function VerifyFaq({
</span>
{showSecret && (
<CopyInput
- className="[&_.font-mono]:text-sm"
+ className=""
label="Client secret"
value={secret}
/>
diff --git a/apps/start/src/components/organization/billing-prompt.tsx b/apps/start/src/components/organization/billing-prompt.tsx
index 2b70b158b..0aab71784 100644
--- a/apps/start/src/components/organization/billing-prompt.tsx
+++ b/apps/start/src/components/organization/billing-prompt.tsx
@@ -272,12 +272,12 @@ export default function BillingPrompt({
<div className="col gap-3 p-6 md:p-8">
<Badge variant={copy.badge.variant}>{copy.badge.label}</Badge>
<h1 className="font-semibold text-2xl">{copy.title}</h1>
- <p className="text-muted-foreground leading-relaxed">{copy.lead}</p>
+ <p className="text-muted-foreground">{copy.lead}</p>
</div>
<div className="row gap-3 px-6 md:px-8">
<div className="col flex-1 gap-1 rounded-md bg-def-200 p-4">
- <div className="font-bold font-mono text-2xl">
+ <div className="font-bold text-2xl tabular-nums">
{number.short(eventsCount)}
</div>
<div className="text-muted-foreground text-sm">
@@ -295,7 +295,7 @@ export default function BillingPrompt({
}
return (
<div className="col flex-1 gap-1 rounded-md bg-def-200 p-4">
- <div className="font-bold font-mono text-2xl">
+ <div className="font-bold text-2xl tabular-nums">
{formatDate(date)}
</div>
<div className="text-muted-foreground text-sm">
diff --git a/apps/start/src/components/organization/billing-usage.tsx b/apps/start/src/components/organization/billing-usage.tsx
index 3a076c44d..51e2f7a91 100644
--- a/apps/start/src/components/organization/billing-usage.tsx
+++ b/apps/start/src/components/organization/billing-usage.tsx
@@ -39,7 +39,7 @@ function Card({ title, value }: { title: string; value: string }) {
return (
<div className="col min-w-0 flex-1 gap-2 p-4" title={`${title}: ${value}`}>
<div className="truncate text-muted-foreground">{title}</div>
- <div className="truncate font-bold font-mono text-xl">{value}</div>
+ <div className="truncate font-bold text-xl tabular-nums">{value}</div>
</div>
);
}
diff --git a/apps/start/src/components/organization/cancel-subscription-flow.tsx b/apps/start/src/components/organization/cancel-subscription-flow.tsx
index 38a1a5b9f..b3ac2ea1a 100644
--- a/apps/start/src/components/organization/cancel-subscription-flow.tsx
+++ b/apps/start/src/components/organization/cancel-subscription-flow.tsx
@@ -305,7 +305,7 @@ export default function CancelSubscriptionFlow({
/>
<div className="scrollbar-thin col min-h-0 flex-1 overflow-y-auto">
<div className="row shrink-0 items-center gap-3 rounded-lg border bg-def-100 p-4">
- <span className="font-bold font-mono text-3xl text-emerald-600 dark:text-emerald-500">
+ <span className="font-bold text-3xl text-emerald-600 tabular-nums dark:text-emerald-500">
−30%
</span>
<span className="text-muted-foreground">for the next 12 months</span>
diff --git a/apps/start/src/components/organization/feedback-prompt.tsx b/apps/start/src/components/organization/feedback-prompt.tsx
index d8e0e1569..e52cfc51f 100644
--- a/apps/start/src/components/organization/feedback-prompt.tsx
+++ b/apps/start/src/components/organization/feedback-prompt.tsx
@@ -74,7 +74,7 @@ export default function FeedbackPrompt() {
title="Share Your Feedback"
>
<div className="col gap-4 px-6">
- <p className="text-foreground text-sm leading-normal">
+ <p className="text-foreground text-sm">
Your feedback helps us build features you actually need. Share your
thoughts, report bugs, or suggest improvements
</p>
diff --git a/apps/start/src/components/organization/prompt-card.tsx b/apps/start/src/components/organization/prompt-card.tsx
index c823f095a..38eb999f5 100644
--- a/apps/start/src/components/organization/prompt-card.tsx
+++ b/apps/start/src/components/organization/prompt-card.tsx
@@ -54,9 +54,7 @@ export function PromptCard({
}}
/>
<div className="row items-center justify-between">
- <h2 className="max-w-[200px] font-semibold text-xl leading-snug">
- {title}
- </h2>
+ <h2 className="max-w-[240px] font-semibold text-lg">{title}</h2>
<Button
className="rounded-full"
onClick={onClose}
diff --git a/apps/start/src/components/overview/live-counter.tsx b/apps/start/src/components/overview/live-counter.tsx
index c3d5e7336..67ddf6e76 100644
--- a/apps/start/src/components/overview/live-counter.tsx
+++ b/apps/start/src/components/overview/live-counter.tsx
@@ -25,7 +25,7 @@ export function LiveCounter({ projectId, shareId }: LiveCounterProps) {
<TooltipComplete
content={`${counter.debounced} unique visitors last 5 minutes`}
>
- <div className="flex h-8 items-center gap-2 rounded border border-border px-3 font-medium leading-none">
+ <div className="flex h-8 items-center gap-2 rounded border border-border px-3 font-medium">
<div className="relative">
<div
className={cn(
diff --git a/apps/start/src/components/overview/overview-line-chart.tsx b/apps/start/src/components/overview/overview-line-chart.tsx
index 9116512bc..a445ae819 100644
--- a/apps/start/src/components/overview/overview-line-chart.tsx
+++ b/apps/start/src/components/overview/overview-line-chart.tsx
@@ -12,6 +12,10 @@ import { OPChartTooltip } from '../charts/op-tooltip';
import { XAxis } from '../charts/x-axis';
import { YAxis } from '../charts/y-axis';
import { SerieIcon } from '../report-chart/common/serie-icon';
+import {
+ MARKERS_MAX_POINTS,
+ POINT_MARKER,
+} from '@/components/report-chart/common/time-series';
import type { RouterOutputs } from '@/trpc/client';
import { cn } from '@/utils/cn';
import { getChartColor } from '@/utils/theme';
@@ -143,6 +147,8 @@ export function OverviewLineChart({
dataKey={`${series.key}:pageviews`}
fadeEdges="left"
key={series.key}
+ markers={POINT_MARKER}
+ showMarkers={chartData.length <= MARKERS_MAX_POINTS}
stroke={series.color}
strokeWidth={1.5}
/>
diff --git a/apps/start/src/components/overview/overview-list-modal.tsx b/apps/start/src/components/overview/overview-list-modal.tsx
index a29b36ffa..3cff13e66 100644
--- a/apps/start/src/components/overview/overview-list-modal.tsx
+++ b/apps/start/src/components/overview/overview-list-modal.tsx
@@ -202,7 +202,7 @@ export function OverviewListModal<T extends OverviewListItem>({
{hasRevenue && (
<div className="flex items-center justify-end gap-2">
<span
- className="font-mono font-semibold text-sm"
+ className="font-semibold text-sm tabular-nums"
style={{ color: '#3ba974' }}
>
{(item.revenue ?? 0) > 0
@@ -216,13 +216,13 @@ export function OverviewListModal<T extends OverviewListItem>({
)}
{hasPageviews && (
- <div className="text-right font-mono font-semibold text-sm">
+ <div className="text-right font-semibold text-sm tabular-nums">
{number.short(item.pageviews)}
</div>
)}
{showSessions && (
- <div className="text-right font-mono font-semibold text-sm">
+ <div className="text-right font-semibold text-sm tabular-nums">
{number.short(item.sessions)}
</div>
)}
diff --git a/apps/start/src/components/overview/overview-live-histogram.tsx b/apps/start/src/components/overview/overview-live-histogram.tsx
index c03492e12..95c0c4f6b 100644
--- a/apps/start/src/components/overview/overview-live-histogram.tsx
+++ b/apps/start/src/components/overview/overview-live-histogram.tsx
@@ -76,7 +76,7 @@ export function OverviewLiveHistogram({
<MetricCardShell>
<div className="px-3 pt-2.5">
<div className="flex items-start justify-between gap-2">
- <span className="truncate font-medium text-[10px] text-muted-foreground uppercase tracking-wider">
+ <span className="truncate font-medium text-3xs text-muted-foreground uppercase tracking-wider">
Live · 30 min
</span>
<span className="relative flex h-2 w-2 items-center justify-center">
@@ -96,12 +96,12 @@ export function OverviewLiveHistogram({
/>
</span>
</div>
- <div className="mt-1 flex items-baseline gap-0.5 leading-none">
+ <div className="-my-0.5 flex items-baseline gap-0.5 leading-none">
<span className="truncate font-mono font-semibold text-foreground text-xl tabular-nums tracking-tight">
{number.short(displayCount)}
</span>
</div>
- <div className="mt-0.5 flex items-center justify-between gap-2 truncate text-[11px] text-muted-foreground leading-none">
+ <div className="mt-0.5 flex items-center justify-between gap-2 truncate text-2xs text-muted-foreground leading-none">
<span className="truncate">{displayLabel}</span>
{referrers.length > 0 && (
<div className="flex shrink-0 items-center gap-1.5">
@@ -112,7 +112,7 @@ export function OverviewLiveHistogram({
title={`${ref.referrer} · ${ref.count}`}
>
<SerieIcon name={ref.referrer} />
- <span className="font-mono tabular-nums">{ref.count}</span>
+ <span className="tabular-nums">{ref.count}</span>
</div>
))}
</div>
diff --git a/apps/start/src/components/overview/overview-metric-card.tsx b/apps/start/src/components/overview/overview-metric-card.tsx
index 5d3c222f9..8dc7aa437 100644
--- a/apps/start/src/components/overview/overview-metric-card.tsx
+++ b/apps/start/src/components/overview/overview-metric-card.tsx
@@ -82,6 +82,8 @@ export function OverviewMetricCard({
const diff = getPreviousMetric(displayValue, displayPrev);
const hasValue = !(isLoading || isError);
+ // While loading the sparkline area keeps its height so the card does not jump.
+ const hasSparkline = isLoading || data.length > 0;
return (
<MetricCardShell
@@ -91,29 +93,33 @@ export function OverviewMetricCard({
>
<div className="px-3 pt-2.5">
<div className="flex items-start justify-between gap-2">
- <span className="truncate font-medium text-[10px] text-muted-foreground uppercase tracking-wider">
+ <span className="truncate font-medium text-3xs text-muted-foreground uppercase tracking-wider">
{label}
</span>
{hasValue && (
- <PreviousDiffIndicatorPure
- {...diff}
- inverted={inverted}
- size="xs"
- />
+ <div className="absolute top-2.5 right-3">
+ <PreviousDiffIndicatorPure
+ {...diff}
+ inverted={inverted}
+ size="xs"
+ />
+ </div>
)}
</div>
- <div className="mt-1 flex items-baseline gap-0.5 leading-none">
+ <div className="-my-0.5 flex items-baseline gap-0.5 leading-none">
{isLoading && <Skeleton className="h-5 w-20" />}
{isError && <span className={VALUE_CLASS}>—</span>}
{hasValue && <MetricValue unit={unit} value={displayValue} />}
</div>
- <div className="mt-0.5 truncate text-[11px] text-muted-foreground leading-none">
+ <div className="mt-0.5 truncate text-2xs text-muted-foreground leading-none">
{isError ? METRIC_ERROR_LABEL : displayLabel}
</div>
</div>
- <div className={cn('mt-1.5', fill ? 'min-h-[40px] flex-1' : 'h-[40px]')}>
- {data.length > 0 && (
+ {hasSparkline ? (
+ <div
+ className={cn('mt-1.5', fill ? 'min-h-[40px] flex-1' : 'h-[40px]')}
+ >
<BarChart
animationDuration={0}
aspectRatio="auto"
@@ -132,8 +138,10 @@ export function OverviewMetricCard({
lineCap={fill ? BAR_RADIUS : SPARKLINE_BAR_RADIUS}
/>
</BarChart>
- )}
- </div>
+ </div>
+ ) : (
+ <div className="h-3" />
+ )}
</MetricCardShell>
);
}
@@ -179,7 +187,7 @@ export function MetricCardShell({
}
const VALUE_CLASS =
- 'truncate font-mono font-semibold text-xl text-foreground tracking-tight tabular-nums';
+ 'truncate font-mono font-semibold text-foreground text-xl tracking-tight tabular-nums';
function MetricValue({ value, unit }: { value: number; unit?: MetricUnit }) {
const number = useNumber();
@@ -219,7 +227,7 @@ function MetricValue({ value, unit }: { value: number; unit?: MetricUnit }) {
return (
<>
<span className={VALUE_CLASS}>{number.format(value)}</span>
- <span className="font-medium font-mono text-muted-foreground text-sm">
+ <span className="font-medium font-mono text-muted-foreground text-sm tabular-nums">
%
</span>
</>
diff --git a/apps/start/src/components/overview/overview-metrics.tsx b/apps/start/src/components/overview/overview-metrics.tsx
index 61a74fff8..c517be86d 100644
--- a/apps/start/src/components/overview/overview-metrics.tsx
+++ b/apps/start/src/components/overview/overview-metrics.tsx
@@ -14,6 +14,10 @@ import { OPSeriesDots } from '../charts/op-series-dots';
import { OPChartTooltip } from '../charts/op-tooltip';
import { XAxis } from '../charts/x-axis';
import { YAxis } from '../charts/y-axis';
+import {
+ MARKERS_MAX_POINTS,
+ POINT_MARKER,
+} from '../report-chart/common/time-series';
import { Skeleton } from '../skeleton';
import { Button } from '../ui/button';
import { OverviewLiveHistogram } from './overview-live-histogram';
@@ -143,7 +147,7 @@ export default function OverviewMetrics({
<div className="card p-4">
<div className="-mt-1 flex items-center justify-between">
- <div className="font-medium text-muted-foreground text-sm">
+ <div className="font-medium text-3xs text-muted-foreground uppercase tracking-wider">
{activeMetric.title}
</div>
{import.meta.env.DEV && (
@@ -338,6 +342,7 @@ function Chart({
const dashFromIndex = useDashedTail({ data, range, interval });
const primaryColor = isRevenueTab ? REVENUE_COLOR : getChartColor(0);
+ const showMarkers = chartData.length <= MARKERS_MAX_POINTS;
return (
<ComposedChart
@@ -362,22 +367,31 @@ function Chart({
fillOpacity={0.18}
gradientToOpacity={0}
key={activeMetric.key}
+ markers={POINT_MARKER}
+ showMarkers={showMarkers}
stroke={primaryColor}
strokeWidth={2}
/>
<Line
+ animate={false}
curve={curveMonotoneX}
dataKey={`prev_${activeMetric.key}`}
key={`prev-${activeMetric.key}`}
+ markers={POINT_MARKER}
+ showMarkers={showMarkers}
stroke={PREV_LINE_COLOR}
strokeWidth={2}
/>
{showRevenue && (
<Line
+ animate={false}
curve={curveMonotoneX}
dataKey="revenue_norm"
+ key={`revenue-${activeMetric.key}`}
+ markers={POINT_MARKER}
+ showMarkers={showMarkers}
stroke={REVENUE_COLOR}
strokeWidth={1.5}
/>
diff --git a/apps/start/src/components/overview/overview-user-journey.tsx b/apps/start/src/components/overview/overview-user-journey.tsx
index 98b005aeb..41b097e7a 100644
--- a/apps/start/src/components/overview/overview-user-journey.tsx
+++ b/apps/start/src/components/overview/overview-user-journey.tsx
@@ -337,17 +337,17 @@ export default function OverviewUserJourney({
</ChartTooltipHeader>
<ChartTooltipItem color={color} innerClassName="gap-2">
- <div className="flex items-center justify-between gap-8 font-medium font-mono">
+ <div className="flex items-center justify-between gap-8 font-medium tabular-nums">
<div className="text-muted-foreground">Sessions</div>
<div>{number.format(value)}</div>
</div>
- <div className="flex items-center justify-between gap-8 font-mono text-sm">
+ <div className="flex items-center justify-between gap-8 text-sm tabular-nums">
<div className="text-muted-foreground">
% of total
</div>
<div>{number.format(round(pctOfTotal, 1))} %</div>
</div>
- <div className="flex items-center justify-between gap-8 font-mono text-sm">
+ <div className="flex items-center justify-between gap-8 text-sm tabular-nums">
<div className="text-muted-foreground">
% of source
</div>
@@ -397,11 +397,11 @@ export default function OverviewUserJourney({
)}
</ChartTooltipHeader>
<ChartTooltipItem color={color} innerClassName="gap-2">
- <div className="flex items-center justify-between gap-8 font-medium font-mono">
+ <div className="flex items-center justify-between gap-8 font-medium tabular-nums">
<div className="text-muted-foreground">Sessions</div>
<div>{number.format(value)}</div>
</div>
- <div className="flex items-center justify-between gap-8 font-medium font-mono">
+ <div className="flex items-center justify-between gap-8 font-medium tabular-nums">
<div className="text-muted-foreground">Share</div>
<div>{number.format(round(pct, 1))} %</div>
</div>
diff --git a/apps/start/src/components/overview/overview-weekly-trends.tsx b/apps/start/src/components/overview/overview-weekly-trends.tsx
index 28f1b879d..1492f1952 100644
--- a/apps/start/src/components/overview/overview-weekly-trends.tsx
+++ b/apps/start/src/components/overview/overview-weekly-trends.tsx
@@ -181,7 +181,7 @@ export default function OverviewWeeklyTrends({
<div className="h-6" />
{Array.from({ length: 24 }, (_, hour) => (
<div
- className="flex h-4 items-center justify-end text-[10px] text-muted-foreground"
+ className="flex h-4 items-center justify-end text-2xs text-muted-foreground"
key={hour}
>
{hour % 3 === 0 ? `${String(hour).padStart(2, '0')}:00` : ''}
@@ -193,7 +193,7 @@ export default function OverviewWeeklyTrends({
<div className="flex h-6">
{SHORT_DAY_NAMES.map((day) => (
<div
- className="flex-1 text-center text-[11px] text-muted-foreground"
+ className="flex-1 text-center text-2xs text-muted-foreground"
key={day}
>
{day}
@@ -233,7 +233,7 @@ export default function OverviewWeeklyTrends({
</div>
</ChartTooltipHeader>
<ChartTooltipItem color="#10b981">
- <div className="flex items-center justify-between gap-6 font-medium font-mono text-sm">
+ <div className="flex items-center justify-between gap-6 font-medium text-sm tabular-nums">
<div className="text-muted-foreground">
{activeMetric.label}
</div>
diff --git a/apps/start/src/components/overview/overview-widget-table.tsx b/apps/start/src/components/overview/overview-widget-table.tsx
index dddd94ac7..f0517970d 100644
--- a/apps/start/src/components/overview/overview-widget-table.tsx
+++ b/apps/start/src/components/overview/overview-widget-table.tsx
@@ -60,7 +60,7 @@ function SortableHeader({
return (
<button
className={cn(
- 'row items-center gap-1 transition-opacity hover:opacity-80',
+ 'row items-center gap-1 uppercase transition-opacity hover:opacity-80',
isRightAligned && 'ml-auto justify-end'
)}
onClick={onClick}
@@ -192,7 +192,7 @@ export const OverviewWidgetTable = <T,>({
className: cn(
index === 0
? 'w-full min-w-0 text-left font-medium'
- : 'text-right font-mono',
+ : 'text-right tabular-nums',
// Remove old responsive logic - now handled by responsive prop
column.className
),
@@ -203,7 +203,7 @@ export const OverviewWidgetTable = <T,>({
return (
<div className={cn(className)}>
<WidgetTable
- className={'@container min-h-[358px] text-sm'}
+ className={'@container min-h-[358px] text-xs'}
columnClassName="[&_.cell:first-child]:pl-4 [&_.cell:last-child]:pr-4"
columns={columnsWithSortableHeaders}
data={sortedData}
diff --git a/apps/start/src/components/overview/overview-widget.tsx b/apps/start/src/components/overview/overview-widget.tsx
index d76583738..c6a75e608 100644
--- a/apps/start/src/components/overview/overview-widget.tsx
+++ b/apps/start/src/components/overview/overview-widget.tsx
@@ -123,7 +123,7 @@ export function WidgetButtons({
return (
<div
className={cn(
- '-mt-2 -mb-px flex flex-wrap justify-start self-stretch px-4 transition-opacity [&_button.active]:border-black [&_button.active]:border-b-2 [&_button.active]:opacity-100 dark:[&_button.active]:border-white [&_button]:whitespace-nowrap [&_button]:py-1 [&_button]:text-sm [&_button]:opacity-50',
+ '-mt-2 -mb-px flex flex-wrap justify-start self-stretch px-4 transition-opacity [&_button.active]:border-black [&_button.active]:border-b-2 [&_button.active]:opacity-100 dark:[&_button.active]:border-white [&_button]:whitespace-nowrap [&_button]:py-1 [&_button]:text-xs [&_button]:opacity-50',
className
)}
ref={container}
@@ -132,12 +132,7 @@ export function WidgetButtons({
>
{Children.map(children, (child, index) => {
return (
- <div
- className={cn(
- 'flex [&_button]:leading-normal',
- slice < index ? hidden : 'opacity-100'
- )}
- >
+ <div className={cn('flex', slice < index ? hidden : 'opacity-100')}>
{child}
</div>
);
@@ -252,7 +247,7 @@ export function WidgetHeadSearchable<T extends string>({
{tabs.map((tab) => (
<button
className={cn(
- 'shrink-0 rounded-md px-2 py-1.5 font-medium text-sm transition-colors',
+ 'shrink-0 rounded-md px-2 py-1.5 font-medium text-xs transition-colors',
activeTab === tab.key
? 'text-foreground'
: 'text-muted-foreground hover:bg-def-100 hover:text-foreground'
@@ -278,7 +273,7 @@ export function WidgetHeadSearchable<T extends string>({
<div className="relative">
<SearchIcon className="absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground" />
<Input
- className="rounded-none border-0 border-y bg-transparent pl-9 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-0"
+ className="rounded-none border-0 border-y bg-transparent pl-9 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-0"
onChange={(e) => onSearchChange(e.target.value)}
placeholder={searchPlaceholder}
type="search"
diff --git a/apps/start/src/components/page-header.tsx b/apps/start/src/components/page-header.tsx
index 734d1222c..8259fbcfc 100644
--- a/apps/start/src/components/page-header.tsx
+++ b/apps/start/src/components/page-header.tsx
@@ -18,9 +18,11 @@ export function PageHeader({
return (
<div className={cn('col md:row gap-2', className)}>
<div className={'flex-1 space-y-1'}>
- <h1 className="font-semibold text-2xl">{title}</h1>
+ <h1 className="font-semibold text-xl">{title}</h1>
{description && (
- <p className="font-medium text-muted-foreground">{description}</p>
+ <p className="font-medium text-base text-muted-foreground">
+ {description}
+ </p>
)}
{children}
</div>
diff --git a/apps/start/src/components/page/gsc-breakdown-table.tsx b/apps/start/src/components/page/gsc-breakdown-table.tsx
index 531052382..8d6102be2 100644
--- a/apps/start/src/components/page/gsc-breakdown-table.tsx
+++ b/apps/start/src/components/page/gsc-breakdown-table.tsx
@@ -104,7 +104,7 @@ export function GscBreakdownTable({
render(item) {
return (
<div className="min-w-0 overflow-hidden">
- <span className="block truncate font-mono text-xs">
+ <span className="block truncate text-xs tabular-nums">
{String(item[breakdownKey])}
</span>
</div>
@@ -117,7 +117,7 @@ export function GscBreakdownTable({
getSortValue: (item) => item.clicks as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.clicks as number).toLocaleString()}
</span>
);
@@ -129,7 +129,7 @@ export function GscBreakdownTable({
getSortValue: (item) => item.impressions as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.impressions as number).toLocaleString()}
</span>
);
@@ -141,7 +141,7 @@ export function GscBreakdownTable({
getSortValue: (item) => item.ctr as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{((item.ctr as number) * 100).toFixed(1)}%
</span>
);
@@ -153,7 +153,7 @@ export function GscBreakdownTable({
getSortValue: (item) => item.position as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.position as number).toFixed(1)}
</span>
);
diff --git a/apps/start/src/components/page/gsc-cannibalization.tsx b/apps/start/src/components/page/gsc-cannibalization.tsx
index f30a40c95..eda89fb9b 100644
--- a/apps/start/src/components/page/gsc-cannibalization.tsx
+++ b/apps/start/src/components/page/gsc-cannibalization.tsx
@@ -166,7 +166,7 @@ export function GscCannibalization({
</span>
</div>
<div className="flex shrink-0 items-center gap-4">
- <span className="whitespace-nowrap font-mono text-muted-foreground text-xs">
+ <span className="whitespace-nowrap text-muted-foreground text-xs tabular-nums">
{item.totalImpressions.toLocaleString()} impr ·{' '}
{(avgCtr * 100).toFixed(1)}% avg CTR
</span>
@@ -181,7 +181,7 @@ export function GscCannibalization({
{isOpen && (
<div className="border-t bg-muted/20 px-4 py-3">
- <p className="mb-3 text-muted-foreground text-xs leading-normal">
+ <p className="mb-3 text-muted-foreground text-xs">
These pages all rank for{' '}
<span className="font-medium text-foreground">
"{item.query}"
@@ -230,7 +230,7 @@ export function GscCannibalization({
}}
src={`${apiUrl}/misc/favicon?url=${origin}`}
/>
- <span className="min-w-0 flex-1 truncate font-mono text-xs">
+ <span className="min-w-0 flex-1 truncate text-xs tabular-nums">
{path || page.page}
</span>
{isWinner && (
@@ -238,7 +238,7 @@ export function GscCannibalization({
#1
</span>
)}
- <span className="shrink-0 whitespace-nowrap font-mono text-muted-foreground text-xs">
+ <span className="shrink-0 whitespace-nowrap text-muted-foreground text-xs tabular-nums">
pos {page.position.toFixed(1)} ·{' '}
{(page.ctr * 100).toFixed(1)}% CTR ·{' '}
{page.impressions.toLocaleString()} impr
diff --git a/apps/start/src/components/page/gsc-ctr-benchmark.tsx b/apps/start/src/components/page/gsc-ctr-benchmark.tsx
index 350f99f57..ccffb89e3 100644
--- a/apps/start/src/components/page/gsc-ctr-benchmark.tsx
+++ b/apps/start/src/components/page/gsc-ctr-benchmark.tsx
@@ -203,10 +203,10 @@ function renderPages(row: ChartRow) {
className="flex items-center justify-between gap-4 py-0.5"
key={page.path}
>
- <span className="max-w-40 truncate font-mono text-muted-foreground text-xs">
+ <span className="max-w-40 truncate text-muted-foreground text-xs tabular-nums">
{page.path}
</span>
- <span className="shrink-0 font-mono text-xs tabular-nums">
+ <span className="shrink-0 text-xs tabular-nums tabular-nums">
{formatPercent(page.ctr * 100)}
</span>
</div>
diff --git a/apps/start/src/components/page/pages-insights.tsx b/apps/start/src/components/page/pages-insights.tsx
index c7362cbbe..531dbd47e 100644
--- a/apps/start/src/components/page/pages-insights.tsx
+++ b/apps/start/src/components/page/pages-insights.tsx
@@ -336,15 +336,15 @@ export function PagesInsights({ projectId }: PagesInsightsProps) {
}}
src={`${apiUrl}/misc/favicon?url=${insight.origin}`}
/>
- <span className="truncate font-medium font-mono text-xs">
+ <span className="truncate font-medium text-xs tabular-nums">
{insight.path || insight.page}
</span>
- <span className="ml-auto shrink-0 whitespace-nowrap font-mono text-muted-foreground text-xs">
+ <span className="ml-auto shrink-0 whitespace-nowrap text-muted-foreground text-xs tabular-nums">
{insight.metrics}
</span>
</div>
- <p className="text-muted-foreground text-xs leading-relaxed">
+ <p className="text-muted-foreground text-xs">
<span className="font-medium text-foreground">
{insight.headline}.
</span>{' '}
diff --git a/apps/start/src/components/pages/table/columns.tsx b/apps/start/src/components/pages/table/columns.tsx
index 2410fef9a..967fe7acd 100644
--- a/apps/start/src/components/pages/table/columns.tsx
+++ b/apps/start/src/components/pages/table/columns.tsx
@@ -58,12 +58,12 @@ export function useColumns({
)}
<div className="min-w-0">
{page.title && (
- <div className="truncate font-medium text-sm leading-tight">
+ <div className="truncate font-medium text-sm">
{page.title}
</div>
)}
<div className="flex min-w-0 items-center gap-1">
- <span className="truncate font-mono text-muted-foreground text-xs">
+ <span className="truncate text-muted-foreground text-xs tabular-nums">
{page.path}
</span>
<a
@@ -99,7 +99,7 @@ export function useColumns({
header: createHeaderColumn('Views'),
size: 80,
cell: ({ row }) => (
- <span className="font-mono text-sm tabular-nums">
+ <span className="text-sm tabular-nums tabular-nums">
{number.short(row.original.pageviews)}
</span>
),
@@ -116,7 +116,7 @@ export function useColumns({
// previous period, so a missing `prev` hides the delta, not the
// number.
const count = (
- <span className="font-mono text-sm tabular-nums">
+ <span className="text-sm tabular-nums tabular-nums">
{number.short(row.original.sessions)}
</span>
);
@@ -141,7 +141,7 @@ export function useColumns({
<div className="flex items-center gap-2">
{count}
<span
- className={`font-mono text-sm tabular-nums ${isPos ? 'text-emerald-600 dark:text-emerald-400' : 'text-red-600 dark:text-red-400'}`}
+ className={`text-2xs tabular-nums ${isPos ? 'text-emerald-600 dark:text-emerald-400' : 'text-red-600 dark:text-red-400'}`}
>
{isPos ? '+' : ''}
{pct.toFixed(1)}%
@@ -155,7 +155,7 @@ export function useColumns({
header: createHeaderColumn('Bounce'),
size: 80,
cell: ({ row }) => (
- <span className="font-mono text-sm tabular-nums">
+ <span className="text-sm tabular-nums tabular-nums">
{row.original.bounce_rate.toFixed(0)}%
</span>
),
@@ -165,7 +165,7 @@ export function useColumns({
header: createHeaderColumn('Duration'),
size: 90,
cell: ({ row }) => (
- <span className="whitespace-nowrap font-mono text-sm tabular-nums">
+ <span className="whitespace-nowrap text-sm tabular-nums tabular-nums">
{fancyMinutes(row.original.avg_duration * SECONDS_PER_MINUTE)}
</span>
),
@@ -182,7 +182,7 @@ export function useColumns({
size: 80,
cell: ({ row }) =>
row.original.gsc ? (
- <span className="font-mono text-sm tabular-nums">
+ <span className="text-sm tabular-nums tabular-nums">
{number.short(row.original.gsc.impressions)}
</span>
) : (
@@ -197,7 +197,7 @@ export function useColumns({
size: 70,
cell: ({ row }) =>
row.original.gsc ? (
- <span className="font-mono text-sm tabular-nums">
+ <span className="text-sm tabular-nums tabular-nums">
{(row.original.gsc.ctr * 100).toFixed(1)}%
</span>
) : (
@@ -212,7 +212,7 @@ export function useColumns({
size: 80,
cell: ({ row }) =>
row.original.gsc ? (
- <span className="font-mono text-sm tabular-nums">
+ <span className="text-sm tabular-nums tabular-nums">
{number.short(row.original.gsc.clicks)}
</span>
) : (
diff --git a/apps/start/src/components/profile-toggle.tsx b/apps/start/src/components/profile-toggle.tsx
index 264f73c4f..374777022 100644
--- a/apps/start/src/components/profile-toggle.tsx
+++ b/apps/start/src/components/profile-toggle.tsx
@@ -40,10 +40,7 @@ export function ProfileToggle({ className }: Props) {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <button
- className={cn(className, 'center-center outline-0')}
- type="button"
- >
+ <button className={cn('outline-0', className)} type="button">
<UserIcon className="size-4" />
<span className="sr-only">Profile</span>
</button>
diff --git a/apps/start/src/components/profiles/table/columns.tsx b/apps/start/src/components/profiles/table/columns.tsx
index c5e1da6a1..4eb3beac0 100644
--- a/apps/start/src/components/profiles/table/columns.tsx
+++ b/apps/start/src/components/profiles/table/columns.tsx
@@ -128,7 +128,7 @@ export function useColumns(type: 'profiles' | 'power-users') {
<div className="flex flex-wrap gap-1">
{groups.map((g) => (
<ProjectLink
- className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs hover:underline"
+ className="rounded bg-muted px-1.5 py-0.5 text-xs tabular-nums hover:underline"
key={g}
params={{ groupId: g }}
to="/groups/$groupId"
diff --git a/apps/start/src/components/project-mapper.tsx b/apps/start/src/components/project-mapper.tsx
index 0758a4f2f..25b29dbe3 100644
--- a/apps/start/src/components/project-mapper.tsx
+++ b/apps/start/src/components/project-mapper.tsx
@@ -53,7 +53,7 @@ export function ProjectMapper({
</Button>
</div>
{fields.length === 0 && (
- <p className="text-muted-foreground text-sm leading-normal">
+ <p className="text-muted-foreground text-sm">
Map source project IDs to your OpenPanel projects. If you skip mapping
all data will be imported to your current project.
</p>
diff --git a/apps/start/src/components/project-selector.tsx b/apps/start/src/components/project-selector.tsx
index ba14eef18..3c1ee01c9 100644
--- a/apps/start/src/components/project-selector.tsx
+++ b/apps/start/src/components/project-selector.tsx
@@ -73,7 +73,7 @@ export default function ProjectSelector({
<DropdownMenuTrigger asChild>
<Button
aria-expanded={open}
- className="flex min-w-0 flex-1 items-center justify-start"
+ className="flex h-9 min-w-0 flex-1 items-center justify-start"
role="combobox"
size={'sm'}
variant="outline"
diff --git a/apps/start/src/components/public-page-card.tsx b/apps/start/src/components/public-page-card.tsx
index af2da39e8..1fcba43e9 100644
--- a/apps/start/src/components/public-page-card.tsx
+++ b/apps/start/src/components/public-page-card.tsx
@@ -24,9 +24,7 @@ export function PublicPageCard({
<LogoSquare className="mb-4 size-12" />
<div className="font-semibold text-xl">{title}</div>
{description && (
- <div className="text-lg text-muted-foreground leading-normal">
- {description}
- </div>
+ <div className="text-muted-foreground">{description}</div>
)}
</div>
{!!children && <div className="mt-6">{children}</div>}
diff --git a/apps/start/src/components/realtime/map/map-badge-detail-card.tsx b/apps/start/src/components/realtime/map/map-badge-detail-card.tsx
index 4b74e3509..25c204beb 100644
--- a/apps/start/src/components/realtime/map/map-badge-detail-card.tsx
+++ b/apps/start/src/components/realtime/map/map-badge-detail-card.tsx
@@ -139,7 +139,7 @@ export function MapBadgeDetailCard({
.replaceAll('www.', '') || '(Not set)'}
</span>
</div>
- <span className="font-mono">{item.count}</span>
+ <span className="tabular-nums">{item.count}</span>
</div>
))
) : (
@@ -160,7 +160,7 @@ export function MapBadgeDetailCard({
key={item.name}
>
<span className="truncate">{item.name}</span>
- <span className="font-mono">{item.count}</span>
+ <span className="tabular-nums">{item.count}</span>
</div>
))
) : (
@@ -183,7 +183,7 @@ export function MapBadgeDetailCard({
<span className="truncate">
{item.path || '(Not set)'}
</span>
- <span className="font-mono">{item.count}</span>
+ <span className="tabular-nums">{item.count}</span>
</div>
))
) : (
diff --git a/apps/start/src/components/realtime/map/map-marker-pill.tsx b/apps/start/src/components/realtime/map/map-marker-pill.tsx
index 3c921d86e..0a15642b5 100644
--- a/apps/start/src/components/realtime/map/map-marker-pill.tsx
+++ b/apps/start/src/components/realtime/map/map-marker-pill.tsx
@@ -11,7 +11,7 @@ export function MapMarkerPill({
return (
<button
className={cn(
- 'inline-flex select-none items-center gap-1.5 whitespace-nowrap rounded-lg border border-border/10 bg-background px-[10px] py-[5px] font-medium text-[11px] text-foreground shadow-[0_4px_16px] shadow-background/20',
+ 'inline-flex select-none items-center gap-1.5 whitespace-nowrap rounded-lg border border-border/10 bg-background px-[10px] py-[5px] font-medium text-2xs text-foreground shadow-[0_4px_16px] shadow-background/20',
onClick ? 'cursor-pointer' : 'cursor-default'
)}
onClick={onClick}
diff --git a/apps/start/src/components/realtime/realtime-active-sessions.tsx b/apps/start/src/components/realtime/realtime-active-sessions.tsx
index a54aaa76d..acb083e23 100644
--- a/apps/start/src/components/realtime/realtime-active-sessions.tsx
+++ b/apps/start/src/components/realtime/realtime-active-sessions.tsx
@@ -45,11 +45,11 @@ export function RealtimeActiveSessions({
>
<div className="col flex-1 gap-1">
{session.name === 'screen_view' && (
- <span className="text-muted-foreground text-xs leading-normal/80">
+ <span className="text-muted-foreground text-xs">
{session.origin}
</span>
)}
- <span className="truncate font-medium text-sm leading-normal">
+ <span className="truncate font-medium text-sm">
{session.name === 'screen_view'
? session.path
: session.name}
diff --git a/apps/start/src/components/realtime/realtime-live-histogram.tsx b/apps/start/src/components/realtime/realtime-live-histogram.tsx
index 86ab50dee..0c2136b6f 100644
--- a/apps/start/src/components/realtime/realtime-live-histogram.tsx
+++ b/apps/start/src/components/realtime/realtime-live-histogram.tsx
@@ -110,7 +110,7 @@ function renderReferrers(point: MinutePoint) {
{ref.referrer}
</span>
</div>
- <span className="font-mono">{ref.count}</span>
+ <span className="tabular-nums">{ref.count}</span>
</div>
))}
{hidden > 0 && (
@@ -131,13 +131,13 @@ function Wrapper({ children, count, icons }: WrapperProps) {
return (
<div className="flex flex-col">
<div className="row justify-between gap-2">
- <div className="relative font-medium text-muted-foreground text-sm leading-normal">
+ <div className="relative font-medium text-muted-foreground text-sm">
Unique visitors last 30 min
</div>
<div>{icons}</div>
</div>
<div className="col -mt-1 gap-2">
- <div className="font-bold font-mono text-6xl">
+ <div className="font-bold text-5xl tabular-nums">
<AnimatedNumber value={count} />
</div>
</div>
diff --git a/apps/start/src/components/report-chart/bar/bar-labels.tsx b/apps/start/src/components/report-chart/bar/bar-labels.tsx
index 7036d8faf..3b9a50713 100644
--- a/apps/start/src/components/report-chart/bar/bar-labels.tsx
+++ b/apps/start/src/components/report-chart/bar/bar-labels.tsx
@@ -76,7 +76,7 @@ export function BarLabels({
className="ml-auto flex items-center justify-end gap-1.5 pl-2"
style={{ width: margin.right }}
>
- <span className="font-mono font-semibold text-sm">
+ <span className="font-semibold text-sm tabular-nums">
{number.short(row.count)}
</span>
{comparesPrevious && !row.previous && row.count > 0 && (
diff --git a/apps/start/src/components/report-chart/common/previous-diff-indicator.tsx b/apps/start/src/components/report-chart/common/previous-diff-indicator.tsx
index fe7266d86..9c9b44eb3 100644
--- a/apps/start/src/components/report-chart/common/previous-diff-indicator.tsx
+++ b/apps/start/src/components/report-chart/common/previous-diff-indicator.tsx
@@ -68,7 +68,7 @@ export function PreviousDiffIndicator({
<>
<div
className={cn(
- 'flex items-center gap-1 font-medium font-mono',
+ 'flex items-center gap-1 font-medium tabular-nums',
size === 'lg' && 'gap-2',
className
)}
diff --git a/apps/start/src/components/report-chart/common/stat-strip.tsx b/apps/start/src/components/report-chart/common/stat-strip.tsx
index 36e4133c1..a89b71361 100644
--- a/apps/start/src/components/report-chart/common/stat-strip.tsx
+++ b/apps/start/src/components/report-chart/common/stat-strip.tsx
@@ -38,17 +38,17 @@ export function Stat({
}) {
return (
<div className="col min-w-0 gap-1 px-4 py-3 shadow-[0_0_0_0.5px] shadow-border">
- <span className="truncate font-medium text-[10px] text-muted-foreground uppercase tracking-wider">
+ <span className="truncate font-medium text-3xs text-muted-foreground uppercase tracking-wider">
{label}
</span>
<span className="flex items-baseline gap-2">
- <span className="truncate font-mono font-semibold text-xl tabular-nums tracking-tight">
+ <span className="truncate font-semibold text-xl tabular-nums tracking-tight">
{value}
</span>
{change}
</span>
{detail && (
- <span className="flex min-w-0 items-center gap-1.5 truncate text-[11px] text-muted-foreground">
+ <span className="flex min-w-0 items-center gap-1.5 truncate text-2xs text-muted-foreground">
{detail}
</span>
)}
diff --git a/apps/start/src/components/report-chart/common/time-series.tsx b/apps/start/src/components/report-chart/common/time-series.tsx
index 846537f7d..773aeaaf0 100644
--- a/apps/start/src/components/report-chart/common/time-series.tsx
+++ b/apps/start/src/components/report-chart/common/time-series.tsx
@@ -28,7 +28,7 @@ import { cn } from '@/utils/cn';
import { getChartColor } from '@/utils/theme';
const TOOLTIP_SERIES_LIMIT = 3;
-const MARKERS_MAX_POINTS = 8;
+export const MARKERS_MAX_POINTS = 8;
const PREVIOUS_PERIOD_OPACITY = '30%';
/** Small point markers for sparse series; bklit's default ring is sized for hero charts. */
diff --git a/apps/start/src/components/report-chart/funnel/steps-chart.tsx b/apps/start/src/components/report-chart/funnel/steps-chart.tsx
index c30c58ac4..ced296e81 100644
--- a/apps/start/src/components/report-chart/funnel/steps-chart.tsx
+++ b/apps/start/src/components/report-chart/funnel/steps-chart.tsx
@@ -99,13 +99,13 @@ function SingleFunnel({
<div className="flex shrink-0 items-center justify-center gap-2 text-muted-foreground text-sm">
<span>
Conversion{' '}
- <span className="font-mono font-semibold text-foreground">
+ <span className="font-semibold text-foreground tabular-nums">
{number.formatWithUnit(conversion / 100, '%')}
</span>
</span>
<span>
previous{' '}
- <span className="font-mono">
+ <span className="tabular-nums">
{number.formatWithUnit(previousConversion / 100, '%')}
</span>
</span>
diff --git a/apps/start/src/components/report-chart/pie/chart.tsx b/apps/start/src/components/report-chart/pie/chart.tsx
index 91e072433..732141b5f 100644
--- a/apps/start/src/components/report-chart/pie/chart.tsx
+++ b/apps/start/src/components/report-chart/pie/chart.tsx
@@ -90,7 +90,7 @@ export function Chart({ series }: Props) {
hoveredIndex === null ? null : slices[hoveredIndex];
return (
<div className="col max-w-[80%] items-center text-center">
- <div className="font-mono font-semibold text-lg">
+ <div className="font-semibold text-lg tabular-nums">
{number.short(value)}
</div>
<div className="w-full truncate text-muted-foreground text-xs">
@@ -134,10 +134,10 @@ export function Chart({ series }: Props) {
<div className="min-w-0 flex-1 overflow-hidden whitespace-nowrap">
<SerieName name={slice.names} />
</div>
- <span className="font-mono font-semibold">
+ <span className="font-semibold tabular-nums">
{number.short(slice.value)}
</span>
- <span className="w-12 text-right font-mono text-muted-foreground">
+ <span className="w-12 text-right text-muted-foreground tabular-nums">
{slice.share}%
</span>
</button>
diff --git a/apps/start/src/components/report-chart/sankey/chart.tsx b/apps/start/src/components/report-chart/sankey/chart.tsx
index 6af500bb9..7644aeb97 100644
--- a/apps/start/src/components/report-chart/sankey/chart.tsx
+++ b/apps/start/src/components/report-chart/sankey/chart.tsx
@@ -139,7 +139,7 @@ export function Chart({ data }: { data: ReportSankeyData }) {
const target = link.target as unknown as SankeyNodeInfo;
const sourceValue = source.value ?? 0;
return (
- <OPTooltipCard className="min-w-[220px]">
+ <OPTooltipCard className="min-w-[200px]">
<div className="font-medium">
{source.label}
<ArrowRightIcon className="mx-2 inline-block size-3" />
@@ -165,7 +165,7 @@ export function Chart({ data }: { data: ReportSankeyData }) {
};
const value = info.value ?? 0;
return (
- <OPTooltipCard className="min-w-[220px]">
+ <OPTooltipCard className="min-w-[200px]">
<div className="flex justify-between gap-4">
<span className="font-medium">{info.label}</span>
{info.step !== undefined && (
@@ -202,7 +202,7 @@ function TooltipStats({
return (
<div className="flex gap-2">
<div className="w-[3px] rounded-full" style={{ background: color }} />
- <div className="col flex-1 gap-1 font-mono text-sm">
+ <div className="col flex-1 gap-1 text-sm tabular-nums">
{rows.map(([label, value]) => (
<div className="flex justify-between gap-8" key={label}>
<span className="text-muted-foreground">{label}</span>
diff --git a/apps/start/src/components/report-table/report-data-table.tsx b/apps/start/src/components/report-table/report-data-table.tsx
index 5b116f0ad..fcffebaeb 100644
--- a/apps/start/src/components/report-table/report-data-table.tsx
+++ b/apps/start/src/components/report-table/report-data-table.tsx
@@ -318,7 +318,7 @@ function Cell<Row>({
<div
className={cn(
'relative flex shrink-0 items-center px-3',
- numeric && 'justify-end font-mono tabular-nums'
+ numeric && 'justify-end tabular-nums'
)}
style={{ width: column.width ?? DEFAULT_COLUMN_WIDTH }}
>
diff --git a/apps/start/src/components/report/report-item.tsx b/apps/start/src/components/report/report-item.tsx
index 51d0182a1..3aa35b429 100644
--- a/apps/start/src/components/report/report-item.tsx
+++ b/apps/start/src/components/report/report-item.tsx
@@ -105,7 +105,7 @@ export function ReportItem({
return (
<div className="card group flex h-full flex-col">
- <div className="tile-header flex items-center justify-between border-border border-b p-4 leading-none hover:bg-muted/50 [&_svg]:hover:opacity-100">
+ <div className="tile-header flex items-center justify-between border-border border-b p-4 hover:bg-muted/50 [&_svg]:hover:opacity-100">
<div
className="-m-4 flex-1 cursor-pointer p-4"
onClick={(event) => {
@@ -257,7 +257,7 @@ export function ReportItemReadOnly({
return (
<div className="card group flex h-full flex-col">
- <div className="flex items-center justify-between border-border border-b p-4 leading-none">
+ <div className="flex items-center justify-between border-border border-b p-4">
<div className="flex-1">
<div className="font-medium">{report.name}</div>
{chartRange !== null && (
diff --git a/apps/start/src/components/selling-points.tsx b/apps/start/src/components/selling-points.tsx
index 53f6c84a8..2bcc46729 100644
--- a/apps/start/src/components/selling-points.tsx
+++ b/apps/start/src/components/selling-points.tsx
@@ -30,7 +30,7 @@ function SellingPoint({
initial={{ opacity: 0, y: 20 }}
transition={{ duration: 0.6 }}
>
- <h2 className="mb-2 font-bold text-6xl text-white drop-shadow-2xl drop-shadow-highlight">
+ <h2 className="mb-2 font-bold text-5xl text-white drop-shadow-2xl drop-shadow-highlight">
{title}
</h2>
</motion.div>
@@ -39,7 +39,7 @@ function SellingPoint({
initial={{ opacity: 0, y: 20 }}
transition={{ duration: 0.6 }}
>
- <p className="text-lg text-white/70 leading-relaxed">{description}</p>
+ <p className="text-lg text-white/70">{description}</p>
</motion.div>
</div>
</div>
diff --git a/apps/start/src/components/sessions/replay/replay-controls.tsx b/apps/start/src/components/sessions/replay/replay-controls.tsx
index 6a4a10dfb..d3edb07d3 100644
--- a/apps/start/src/components/sessions/replay/replay-controls.tsx
+++ b/apps/start/src/components/sessions/replay/replay-controls.tsx
@@ -11,7 +11,7 @@ export function ReplayTime() {
const currentTime = useCurrentTime(250);
return (
- <span className="font-mono text-muted-foreground text-sm tabular-nums">
+ <span className="text-muted-foreground text-sm tabular-nums tabular-nums">
{formatDuration(currentTime)} / {formatDuration(duration)}
</span>
);
diff --git a/apps/start/src/components/sessions/replay/replay-timeline.tsx b/apps/start/src/components/sessions/replay/replay-timeline.tsx
index af3a1c012..3e84a96f5 100644
--- a/apps/start/src/components/sessions/replay/replay-timeline.tsx
+++ b/apps/start/src/components/sessions/replay/replay-timeline.tsx
@@ -232,7 +232,7 @@ export function ReplayTimeline({ events }: { events: IServiceEvent[] }) {
<div className="absolute top-1/2 left-0 h-4 w-px -translate-x-1/2 -translate-y-1/2 bg-foreground/30" />
<motion.div
animate={{ opacity: 1, y: 0, scale: 1 }}
- className="absolute bottom-6 left-1/2 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded bg-foreground px-1.5 py-0.5 text-[10px] text-background tabular-nums shadow"
+ className="absolute bottom-6 left-1/2 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded bg-foreground px-1.5 py-0.5 text-2xs text-background tabular-nums shadow"
exit={{ opacity: 0, y: 16, scale: 0.5 }}
initial={{ opacity: 0, y: 16, scale: 0.5 }}
transition={{ duration: 0.2 }}
diff --git a/apps/start/src/components/sessions/table/columns.tsx b/apps/start/src/components/sessions/table/columns.tsx
index aa1f5ed6e..104db52f3 100644
--- a/apps/start/src/components/sessions/table/columns.tsx
+++ b/apps/start/src/components/sessions/table/columns.tsx
@@ -90,7 +90,7 @@ export function useColumns() {
}
return (
<ProjectLink
- className="font-medium font-mono"
+ className="font-medium tabular-nums"
params={{ profileId: session.profileId }}
to="/profiles/$profileId"
>
@@ -107,7 +107,7 @@ export function useColumns() {
const session = row.original;
return (
<div className="min-w-0">
- <span className="font-mono">{session.entryPath || '/'}</span>
+ <span className="tabular-nums">{session.entryPath || '/'}</span>
</div>
);
},
@@ -120,7 +120,7 @@ export function useColumns() {
const session = row.original;
return (
<div className="min-w-0">
- <span className="font-mono">
+ <span className="tabular-nums">
{session.exitPath || session.entryPath || '/'}
</span>
</div>
@@ -290,7 +290,7 @@ export function useColumns() {
<div className="flex flex-wrap gap-1">
{groups.map((g) => (
<span
- className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs"
+ className="rounded bg-muted px-1.5 py-0.5 text-xs tabular-nums"
key={g}
>
{g}
diff --git a/apps/start/src/components/sessions/table/index.tsx b/apps/start/src/components/sessions/table/index.tsx
index 799bed28b..94762e814 100644
--- a/apps/start/src/components/sessions/table/index.tsx
+++ b/apps/start/src/components/sessions/table/index.tsx
@@ -211,7 +211,7 @@ const VirtualizedSessionsTable = ({
const width = `${column.getSize()}px`;
return (
<div
- className="flex h-10 items-center whitespace-nowrap px-4 text-left font-semibold text-[10px] text-foreground uppercase"
+ className="flex h-10 items-center whitespace-nowrap px-4 text-left font-semibold text-3xs text-foreground uppercase"
key={column.id}
style={{
width,
diff --git a/apps/start/src/components/sidebar-link.tsx b/apps/start/src/components/sidebar-link.tsx
index 39a1ac25b..e5ddc57f2 100644
--- a/apps/start/src/components/sidebar-link.tsx
+++ b/apps/start/src/components/sidebar-link.tsx
@@ -2,9 +2,53 @@ import type { LucideIcon } from 'lucide-react';
import { ProjectLink } from '@/components/links';
import { cn } from '@/utils/cn';
+const SIDEBAR_ICON_SIZE = 16;
+const SIDEBAR_ICON_STROKE_WIDTH = 1.75;
+
+/** Shared look for every row in the sidebar; TanStack's Link sets `data-status`. */
+export const sidebarItemClassName = cn(
+ 'group flex h-9 items-center gap-2.5 rounded-lg px-2.5 text-foregroundish text-nav',
+ 'transition-colors hover:bg-def-200 hover:text-foreground',
+ 'data-[status=active]:bg-def-200 data-[status=active]:text-foreground'
+);
+
+export const sidebarIconClassName = cn(
+ 'shrink-0 text-muted-foreground transition-colors',
+ 'group-hover:text-foreground group-data-[status=active]:text-foreground'
+);
+
+export function SidebarIcon({ icon: Icon }: { icon: LucideIcon }) {
+ return (
+ <Icon
+ className={sidebarIconClassName}
+ size={SIDEBAR_ICON_SIZE}
+ strokeWidth={SIDEBAR_ICON_STROKE_WIDTH}
+ />
+ );
+}
+
+export function SidebarSectionLabel({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <div
+ className={cn(
+ 'mt-5 mb-1.5 px-2.5 font-medium text-muted-foreground text-xs first:mt-0',
+ className
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
export function SidebarLink({
href,
- icon: Icon,
+ icon,
label,
className,
exact,
@@ -17,15 +61,12 @@ export function SidebarLink({
}) {
return (
<ProjectLink
- className={cn(
- 'flex items-center gap-2 rounded-md px-3 py-2 font-medium text-[13px] transition-all hover:bg-def-200',
- className
- )}
+ className={cn(sidebarItemClassName, className)}
exact={exact}
href={href}
>
- <Icon size={20} />
- <div className="flex-1">{label}</div>
+ <SidebarIcon icon={icon} />
+ <div className="flex-1 truncate">{label}</div>
</ProjectLink>
);
}
diff --git a/apps/start/src/components/sidebar-organization-menu.tsx b/apps/start/src/components/sidebar-organization-menu.tsx
index 1932774c8..9c819bec1 100644
--- a/apps/start/src/components/sidebar-organization-menu.tsx
+++ b/apps/start/src/components/sidebar-organization-menu.tsx
@@ -10,6 +10,7 @@ import {
UsersIcon,
} from 'lucide-react';
import { useEffect, useState } from 'react';
+import { SidebarIcon, sidebarItemClassName } from './sidebar-link';
import { Badge } from './ui/badge';
import {
DropdownMenu,
@@ -36,36 +37,30 @@ export default function SidebarOrganizationMenu({
<>
<Link
activeOptions={{ exact: true }}
- className={cn(
- 'flex items-center gap-2 rounded-md px-3 py-2 font-medium text-[13px] transition-all hover:bg-def-200'
- )}
+ className={sidebarItemClassName}
from="/$organizationId"
to="/$organizationId"
>
- <LayoutListIcon size={20} />
+ <SidebarIcon icon={LayoutListIcon} />
<div className="flex-1">Projects</div>
</Link>
<Link
activeOptions={{ exact: true }}
- className={cn(
- 'flex items-center gap-2 rounded-md px-3 py-2 font-medium text-[13px] transition-all hover:bg-def-200'
- )}
+ className={sidebarItemClassName}
from="/$organizationId"
to="/$organizationId/settings"
>
- <CogIcon size={20} />
+ <SidebarIcon icon={CogIcon} />
<div className="flex-1">Settings</div>
</Link>
{isAdmin && !isSelfHosted && (
<Link
activeOptions={{ exact: true }}
- className={cn(
- 'flex items-center gap-2 rounded-md px-3 py-2 font-medium text-[13px] transition-all hover:bg-def-200'
- )}
+ className={sidebarItemClassName}
from="/$organizationId"
to="/$organizationId/billing"
>
- <CreditCardIcon size={20} />
+ <SidebarIcon icon={CreditCardIcon} />
<div className="flex-1">Billing</div>
{(() => {
if (!organization) {
@@ -86,13 +81,11 @@ export default function SidebarOrganizationMenu({
)}
{isAdmin && (
<Link
- className={cn(
- 'flex items-center gap-2 rounded-md px-3 py-2 font-medium text-[13px] transition-all hover:bg-def-200'
- )}
+ className={sidebarItemClassName}
from="/$organizationId"
to="/$organizationId/members"
>
- <UsersIcon size={20} />
+ <SidebarIcon icon={UsersIcon} />
<div className="flex-1">Members</div>
</Link>
)}
@@ -143,19 +136,19 @@ export function ActionCTAButton() {
}
return (
- <div className="mb-4">
+ <div className="mb-3">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
className={cn(
- 'group flex w-full items-center gap-2 rounded-md border border-border bg-def-200 px-3 py-2 text-left',
- 'font-medium text-[13px] text-foreground',
+ 'group flex h-9 w-full items-center gap-2.5 rounded-lg border border-border bg-def-200 px-2.5 text-left',
+ 'text-foreground text-nav',
'transition-colors hover:bg-def-300',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'
)}
type="button"
>
- <PlusIcon className="size-5 shrink-0" />
+ <PlusIcon className="size-4 shrink-0" strokeWidth={1.75} />
<div className="relative flex h-5 flex-1 items-center overflow-hidden">
{/* `initial={false}` suppresses only the FIRST mount: framer writes
transform/opacity into the style attribute, and the SSR string
diff --git a/apps/start/src/components/sidebar-project-menu.tsx b/apps/start/src/components/sidebar-project-menu.tsx
index 1330a05a2..b0882466c 100644
--- a/apps/start/src/components/sidebar-project-menu.tsx
+++ b/apps/start/src/components/sidebar-project-menu.tsx
@@ -1,20 +1,15 @@
import type { IServiceDashboards } from '@openpanel/core';
import { useNavigate } from '@tanstack/react-router';
-import { AnimatePresence, motion } from 'framer-motion';
import {
BellIcon,
- BookOpenIcon,
Building2Icon,
ChartLineIcon,
- ChevronDownIcon,
CogIcon,
GanttChartIcon,
Globe2Icon,
GridIcon,
LayersIcon,
- LayoutDashboardIcon,
LayoutPanelTopIcon,
- PlusIcon,
SearchIcon,
SparklesIcon,
TargetIcon,
@@ -25,17 +20,16 @@ import {
WallpaperIcon,
WorkflowIcon,
} from 'lucide-react';
-import { useEffect, useState } from 'react';
-import { SidebarLink } from './sidebar-link';
+import { useEffect } from 'react';
import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from './ui/dropdown-menu';
+ SidebarIcon,
+ SidebarLink,
+ SidebarSectionLabel,
+ sidebarItemClassName,
+} from './sidebar-link';
import { useChatLaunch } from '@/components/chat/chat-launch';
-import { SidebarChatComposer } from '@/components/chat/sidebar-chat-composer';
-import { pushModal } from '@/modals';
+import { ProjectLink } from '@/components/links';
+import { useAppParams } from '@/hooks/use-app-params';
import { cn } from '@/utils/cn';
interface SidebarProjectMenuProps {
@@ -47,10 +41,9 @@ export default function SidebarProjectMenu({
}: SidebarProjectMenuProps) {
return (
<>
- <SidebarChatComposer />
- <div className="mb-2 font-medium text-muted-foreground text-sm">
- Analytics
- </div>
+ <SidebarReportLink />
+ <SidebarChatButton />
+ <SidebarSectionLabel>Analytics</SidebarSectionLabel>
<SidebarLink href={'/'} icon={WallpaperIcon} label="Overview" />
<SidebarLink
href={'/dashboards'}
@@ -70,9 +63,7 @@ export default function SidebarProjectMenu({
<SidebarLink href={'/profiles'} icon={UserCircleIcon} label="Profiles" />
<SidebarLink href={'/groups'} icon={Building2Icon} label="Groups" />
<SidebarLink href={'/cohorts'} icon={TargetIcon} label="Cohorts" />
- <div className="mt-4 mb-2 font-medium text-muted-foreground text-sm">
- Manage
- </div>
+ <SidebarSectionLabel>Manage</SidebarSectionLabel>
<SidebarLink
exact={false}
href={'/settings'}
@@ -97,116 +88,59 @@ export default function SidebarProjectMenu({
);
}
-export function ActionCTAButton() {
- const navigate = useNavigate();
- const launchChat = useChatLaunch();
+const REPORT_SHORTCUT_KEY = 'i';
+
+function isShortcut(event: KeyboardEvent, key: string) {
+ return (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === key;
+}
- const ACTIONS = [
- {
- label: 'Create report',
- icon: ChartLineIcon,
- onClick: () =>
- navigate({
- to: '/$organizationId/$projectId/reports',
- from: '/$organizationId/$projectId',
- }),
- },
- {
- label: 'Create reference',
- icon: BookOpenIcon,
- onClick: () => pushModal('AddReference'),
- },
- {
- label: 'Ask AI',
- icon: SparklesIcon,
- onClick: () => launchChat(),
- },
- {
- label: 'Create dashboard',
- icon: LayoutDashboardIcon,
- onClick: () => pushModal('AddDashboard'),
- },
- {
- label: 'Create notification rule',
- icon: BellIcon,
- onClick: () =>
- navigate({
- to: '/$organizationId/$projectId/notifications/rules',
- from: '/$organizationId/$projectId',
- }),
- },
- ];
+function SidebarKbd({ children }: { children: React.ReactNode }) {
+ return (
+ <kbd className="rounded border border-border bg-def-200 px-1.5 py-0.5 font-mono text-2xs text-muted-foreground">
+ {children}
+ </kbd>
+ );
+}
- const [currentActionIndex, setCurrentActionIndex] = useState(0);
+function SidebarReportLink() {
+ const navigate = useNavigate();
+ const { organizationId, projectId } = useAppParams();
useEffect(() => {
- const interval = setInterval(() => {
- setCurrentActionIndex((prevIndex) => {
- const nextIndex = (prevIndex + 1) % ACTIONS.length;
- if (nextIndex === 0 && prevIndex !== 0) {
- clearInterval(interval);
- return 0;
- }
- return nextIndex;
+ const handler = (event: KeyboardEvent) => {
+ if (!isShortcut(event, REPORT_SHORTCUT_KEY)) {
+ return;
+ }
+ event.preventDefault();
+ navigate({
+ to: '/$organizationId/$projectId/reports',
+ params: { organizationId, projectId },
});
- }, 2000);
+ };
+ window.addEventListener('keydown', handler);
+ return () => window.removeEventListener('keydown', handler);
+ }, [navigate, organizationId, projectId]);
- return () => clearInterval(interval);
- }, []);
+ return (
+ <ProjectLink className={sidebarItemClassName} href="/reports">
+ <SidebarIcon icon={ChartLineIcon} />
+ <div className="flex-1 truncate">Report</div>
+ <SidebarKbd>⌘I</SidebarKbd>
+ </ProjectLink>
+ );
+}
+function SidebarChatButton() {
+ const launchChat = useChatLaunch();
return (
- <div className="mb-2">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- className={cn(
- 'group flex w-full items-center gap-2 rounded-md border border-border bg-def-200 px-3 py-2 text-left',
- 'font-medium text-[13px] text-foreground',
- 'transition-colors hover:bg-def-300',
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'
- )}
- type="button"
- >
- <PlusIcon className="size-5 shrink-0" />
- <div className="relative flex h-5 flex-1 items-center overflow-hidden">
- {/* `initial={false}` suppresses only the FIRST mount: framer writes
- transform/opacity into the style attribute, and the SSR string
- differs from the client's first frame. The
- cycling animation between actions is unaffected. */}
- <AnimatePresence initial={false} mode="popLayout">
- <motion.span
- animate={{ y: 0, opacity: 1 }}
- className="absolute whitespace-nowrap"
- exit={{ y: -16, opacity: 0 }}
- initial={{ y: 16, opacity: 0 }}
- key={currentActionIndex}
- transition={{
- type: 'spring',
- stiffness: 300,
- damping: 25,
- duration: 0.3,
- }}
- >
- {ACTIONS[currentActionIndex].label}
- </motion.span>
- </AnimatePresence>
- </div>
- <ChevronDownIcon className="size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="w-56">
- {ACTIONS.map((action) => (
- <DropdownMenuItem
- className="cursor-pointer"
- key={action.label}
- onClick={action.onClick}
- >
- <action.icon className="mr-2 size-4" />
- {action.label}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
+ <button
+ className={cn(sidebarItemClassName, 'w-full text-left')}
+ onClick={() => launchChat()}
+ type="button"
+ >
+ <SidebarIcon icon={SparklesIcon} />
+ <div className="flex-1 truncate">Chat</div>
+ <SidebarKbd>⌘J</SidebarKbd>
+ </button>
);
}
diff --git a/apps/start/src/components/sidebar.tsx b/apps/start/src/components/sidebar.tsx
index 141f49535..eb5f3c4cf 100644
--- a/apps/start/src/components/sidebar.tsx
+++ b/apps/start/src/components/sidebar.tsx
@@ -1,19 +1,24 @@
import type { IServiceOrganization } from '@openpanel/core';
import { useQuery } from '@tanstack/react-query';
import { Link, useLocation, useParams } from '@tanstack/react-router';
-import { MenuIcon, SparklesIcon, XIcon } from 'lucide-react';
+import {
+ BookOpenIcon,
+ HeartIcon,
+ MenuIcon,
+ SparklesIcon,
+ XIcon,
+} from 'lucide-react';
import { useEffect, useState } from 'react';
import { useChatLaunch } from './chat/chat-launch';
import { FeedbackButton } from './feedback-button';
import { LogoSquare } from './logo';
import { ProfileToggle } from './profile-toggle';
import ProjectSelector from './project-selector';
+import { SidebarSectionLabel } from './sidebar-link';
import SidebarOrganizationMenu, {
ActionCTAButton as ActionOrganizationCTAButton,
} from './sidebar-organization-menu';
-import SidebarProjectMenu, {
- ActionCTAButton as ActionProjectCTAButton,
-} from './sidebar-project-menu';
+import SidebarProjectMenu from './sidebar-project-menu';
import { Button } from './ui/button';
import { useAppContext } from '@/hooks/use-app-context';
import { useTRPC } from '@/integrations/trpc/react';
@@ -47,7 +52,6 @@ export function Sidebar() {
if (projectId && organizationId) {
return (
<SidebarContainer organizations={organizations} projects={projects}>
- <ActionProjectCTAButton />
<SidebarProjectMenu dashboards={dashboards} />
</SidebarContainer>
);
@@ -57,7 +61,7 @@ export function Sidebar() {
return (
<SidebarContainer organizations={organizations} projects={projects}>
<ActionOrganizationCTAButton />
- <div className="mb-2 font-medium text-muted-foreground">Organization</div>
+ <SidebarSectionLabel className="mt-2">Organization</SidebarSectionLabel>
<SidebarOrganizationMenu
organization={organizations.find((o) => o.id === organizationId)!}
/>
@@ -71,6 +75,11 @@ interface SidebarContainerProps {
children: React.ReactNode;
}
+const SIDEBAR_FOOTER_BUTTON = cn(
+ 'flex h-8 items-center justify-center gap-1.5 rounded-md font-medium text-muted-foreground text-xs',
+ 'transition-colors hover:bg-def-200 hover:text-foreground'
+);
+
export function SidebarContainer({
organizations,
projects,
@@ -114,7 +123,7 @@ export function SidebarContainer({
{active ? <XIcon size={16} /> : <MenuIcon size={16} />}
</Button>
</div>
- <div className="flex h-16 shrink-0 items-center gap-2 border-border border-b px-4">
+ <div className="flex h-16 shrink-0 items-center gap-2 px-3">
<Link to="/">
<LogoSquare className="max-h-8" />
</Link>
@@ -124,49 +133,53 @@ export function SidebarContainer({
projects={projects}
/>
</div>
- <div
- className={cn([
- 'hide-scrollbar flex-1 overflow-auto p-4',
- "[&_a[data-status='active']]:bg-def-200",
- ])}
- >
+ <div className="hide-scrollbar flex flex-1 flex-col gap-0.5 overflow-auto px-3 pb-4">
{children}
</div>
- <div className="relative">
+ <div className="relative shrink-0">
<div className="pointer-events-none absolute right-0 bottom-full left-0 h-8 bg-gradient-to-t from-card to-card/0" />
- <div className="border-border border-t bg-card">
- <div className="flex items-center">
- <FeedbackButton className="h-12 flex-1 whitespace-nowrap rounded-none border-border border-r px-4 text-muted-foreground outline-0 hover:bg-accent hover:text-accent-foreground" />
- <a
- className="flex h-12 flex-1 items-center justify-center gap-2 border-border border-r font-medium text-muted-foreground text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
- href="https://openpanel.dev/docs"
- rel="noopener noreferrer"
- target="_blank"
- >
- Docs
- </a>
- {projectId && (
- <button
- aria-label="Open AI chat"
- className="flex h-12 w-12 items-center justify-center border-border border-r font-medium text-muted-foreground text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
- onClick={() => launchChat()}
- title="Open AI chat (⌘J)"
- type="button"
- >
- <SparklesIcon size={16} />
- </button>
+ {isSelfHosted && (
+ <a
+ className={cn(
+ 'mx-3 mb-2 flex h-9 items-center gap-2.5 rounded-lg bg-def-200 px-2.5 font-medium text-sm',
+ 'text-foreground/75 transition-colors hover:bg-def-300 hover:text-foreground'
)}
- <ProfileToggle className="h-12 flex-1 rounded-none hover:bg-accent hover:text-accent-foreground" />
- </div>
- {isSelfHosted && (
- <a
- className="center-center flex h-12 cursor-pointer gap-2 border-border border-t px-4 font-medium text-muted-foreground text-sm transition-colors hover:bg-accent hover:text-accent-foreground"
- href="https://openpanel.dev/supporter"
+ href="https://openpanel.dev/supporter"
+ >
+ <HeartIcon
+ className="size-4 shrink-0 text-rose-500"
+ strokeWidth={1.75}
+ />
+ <span className="flex-1 truncate">Support us</span>
+ <span className="text-muted-foreground text-xs">
+ Pay what you want
+ </span>
+ </a>
+ )}
+ <div className="flex items-center gap-0.5 border-border border-t px-3 py-2">
+ <FeedbackButton className={cn(SIDEBAR_FOOTER_BUTTON, 'px-2')} />
+ <a
+ className={cn(SIDEBAR_FOOTER_BUTTON, 'px-2')}
+ href="https://openpanel.dev/docs"
+ rel="noopener noreferrer"
+ target="_blank"
+ >
+ <BookOpenIcon className="size-4" />
+ Docs
+ </a>
+ <div className="flex-1" />
+ {projectId && (
+ <button
+ aria-label="Open AI chat"
+ className={cn(SIDEBAR_FOOTER_BUTTON, 'size-8')}
+ onClick={() => launchChat()}
+ title="Open AI chat (⌘J)"
+ type="button"
>
- <span>Support Us</span>
- <span>Pay What You Want</span>
- </a>
+ <SparklesIcon className="size-4" />
+ </button>
)}
+ <ProfileToggle className={cn(SIDEBAR_FOOTER_BUTTON, 'size-8')} />
</div>
</div>
</div>
diff --git a/apps/start/src/components/stats.tsx b/apps/start/src/components/stats.tsx
index 7f2c423e9..47a129586 100644
--- a/apps/start/src/components/stats.tsx
+++ b/apps/start/src/components/stats.tsx
@@ -49,7 +49,7 @@ export function StatsCard({
<div className="row justify-between gap-4">
<div
className={cn(
- 'font-mono leading-snug',
+ 'tabular-nums',
size === 'sm' ? 'font-medium text-sm' : 'font-bold text-lg'
)}
>
diff --git a/apps/start/src/components/syntax.tsx b/apps/start/src/components/syntax.tsx
index 4d1e14c1f..db904297f 100644
--- a/apps/start/src/components/syntax.tsx
+++ b/apps/start/src/components/syntax.tsx
@@ -48,8 +48,8 @@ export default function Syntax({
padding: '1rem',
paddingTop: '0.5rem',
paddingBottom: '0.5rem',
- fontSize: 14,
- lineHeight: 1.3,
+ fontSize: 12,
+ lineHeight: '18px',
}}
language={language}
style={docco}
diff --git a/apps/start/src/components/ui/alert.tsx b/apps/start/src/components/ui/alert.tsx
index 827845271..4478f03c5 100644
--- a/apps/start/src/components/ui/alert.tsx
+++ b/apps/start/src/components/ui/alert.tsx
@@ -39,7 +39,7 @@ const AlertTitle = React.forwardRef<
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, children, ...props }, ref) => (
<h5
- className={cn('mb-1 font-medium leading-none tracking-tight', className)}
+ className={cn('mb-1 font-medium tracking-tight', className)}
ref={ref}
{...props}
>
@@ -52,11 +52,7 @@ const AlertDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
- <div
- className={cn('[&_p]:leading-relaxed', className)}
- ref={ref}
- {...props}
- />
+ <div className={cn('text-sm', className)} ref={ref} {...props} />
));
AlertDescription.displayName = 'AlertDescription';
diff --git a/apps/start/src/components/ui/button.tsx b/apps/start/src/components/ui/button.tsx
index cdb1fc67a..2e8502fd5 100644
--- a/apps/start/src/components/ui/button.tsx
+++ b/apps/start/src/components/ui/button.tsx
@@ -8,7 +8,7 @@ import { Spinner, type SpinnerProps } from './spinner';
import { cn } from '@/utils/cn';
const buttonVariants = cva(
- 'inline-flex flex-shrink-0 select-none items-center justify-center whitespace-nowrap rounded-md font-medium ring-offset-background transition-all hover:translate-y-[-0.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
+ 'inline-flex flex-shrink-0 select-none items-center justify-center whitespace-nowrap rounded-md font-medium text-sm ring-offset-background transition-all hover:translate-y-[-0.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
{
variants: {
variant: {
diff --git a/apps/start/src/components/ui/calendar.tsx b/apps/start/src/components/ui/calendar.tsx
index 0673f170c..00144e9ef 100644
--- a/apps/start/src/components/ui/calendar.tsx
+++ b/apps/start/src/components/ui/calendar.tsx
@@ -82,7 +82,7 @@ function Calendar({
table: 'w-full border-collapse',
weekdays: cn('flex', defaultClassNames.weekdays),
weekday: cn(
- 'flex-1 select-none rounded-md font-normal text-[0.8rem] text-muted-foreground',
+ 'flex-1 select-none rounded-md font-normal text-muted-foreground text-xs',
defaultClassNames.weekday
),
week: cn('mt-2 flex w-full', defaultClassNames.week),
@@ -91,7 +91,7 @@ function Calendar({
defaultClassNames.week_number_header
),
week_number: cn(
- 'select-none text-[0.8rem] text-muted-foreground',
+ 'select-none text-muted-foreground text-xs',
defaultClassNames.week_number
),
day: cn(
diff --git a/apps/start/src/components/ui/checkbox.tsx b/apps/start/src/components/ui/checkbox.tsx
index d65c5dad5..660476363 100644
--- a/apps/start/src/components/ui/checkbox.tsx
+++ b/apps/start/src/components/ui/checkbox.tsx
@@ -50,7 +50,7 @@ const CheckboxInput = React.forwardRef<
)}
>
<Checkbox ref={ref} {...props} className="relative top-0.5" />
- <div className="font-medium leading-5">{props.children}</div>
+ <div className="font-medium">{props.children}</div>
</label>
));
CheckboxInput.displayName = 'CheckboxInput';
diff --git a/apps/start/src/components/ui/combobox-events.tsx b/apps/start/src/components/ui/combobox-events.tsx
index 30b54ecda..3feb36475 100644
--- a/apps/start/src/components/ui/combobox-events.tsx
+++ b/apps/start/src/components/ui/combobox-events.tsx
@@ -291,7 +291,7 @@ export function ComboboxEvents<
<span className="flex-1 truncate font-medium">
{item.name === '*' ? 'Any events' : item.name}
</span>
- <span className="font-medium font-mono text-muted-foreground">
+ <span className="font-medium text-muted-foreground tabular-nums">
{number.short(item.count)}
</span>
</CommandItem>
diff --git a/apps/start/src/components/ui/data-table/data-table-column-header.tsx b/apps/start/src/components/ui/data-table/data-table-column-header.tsx
index a836be991..4a47acc82 100644
--- a/apps/start/src/components/ui/data-table/data-table-column-header.tsx
+++ b/apps/start/src/components/ui/data-table/data-table-column-header.tsx
@@ -35,7 +35,7 @@ export function DataTableColumnHeader<TData, TValue>({
<DropdownMenu>
<DropdownMenuTrigger
className={cn(
- '-ml-1.5 flex h-8 items-center gap-1.5 rounded-md px-2 py-1.5 text-[10px] uppercase hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring data-[state=open]:bg-accent [&_svg]:size-3 [&_svg]:shrink-0 [&_svg]:text-muted-foreground',
+ '-ml-1.5 flex h-8 items-center gap-1.5 rounded-md px-2 py-1.5 text-3xs uppercase hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring data-[state=open]:bg-accent [&_svg]:size-3 [&_svg]:shrink-0 [&_svg]:text-muted-foreground',
className
)}
{...props}
diff --git a/apps/start/src/components/ui/data-table/data-table-faceted-filter.tsx b/apps/start/src/components/ui/data-table/data-table-faceted-filter.tsx
index 088cb07c6..25f75ae20 100644
--- a/apps/start/src/components/ui/data-table/data-table-faceted-filter.tsx
+++ b/apps/start/src/components/ui/data-table/data-table-faceted-filter.tsx
@@ -156,7 +156,7 @@ export function DataTableFacetedFilter<TData, TValue>({
{option.icon && <option.icon className="mr-2 size-4" />}
<span className="truncate">{option.label}</span>
{option.count && (
- <span className="ml-auto font-mono text-xs">
+ <span className="ml-auto text-xs tabular-nums">
{option.count}
</span>
)}
diff --git a/apps/start/src/components/ui/data-table/data-table-slider-filter.tsx b/apps/start/src/components/ui/data-table/data-table-slider-filter.tsx
index e99a70076..7c401f063 100644
--- a/apps/start/src/components/ui/data-table/data-table-slider-filter.tsx
+++ b/apps/start/src/components/ui/data-table/data-table-slider-filter.tsx
@@ -158,7 +158,7 @@ export function DataTableSliderFilter<TData>({
</PopoverTrigger>
<PopoverContent align="start" className="flex w-auto flex-col gap-4">
<div className="flex flex-col gap-3">
- <p className="font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
+ <p className="font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
{title}
</p>
<div className="flex items-center gap-4">
diff --git a/apps/start/src/components/ui/data-table/data-table-toolbar.tsx b/apps/start/src/components/ui/data-table/data-table-toolbar.tsx
index 4895cf436..f3d705f03 100644
--- a/apps/start/src/components/ui/data-table/data-table-toolbar.tsx
+++ b/apps/start/src/components/ui/data-table/data-table-toolbar.tsx
@@ -208,7 +208,7 @@ export function AnimatedSearchInput({
'absolute inset-0 h-full w-full rounded-md border-0 bg-transparent py-2 pr-7 pl-7 shadow-none',
'focus-visible:ring-0 focus-visible:ring-offset-0',
'transition-opacity duration-200',
- 'truncate align-baseline font-medium text-[14px]'
+ 'truncate align-baseline font-medium text-sm'
)}
onBlur={() => setIsFocused(false)}
onChange={(e) => onChange(e.target.value)}
diff --git a/apps/start/src/components/ui/dialog.tsx b/apps/start/src/components/ui/dialog.tsx
index a39aa2ae7..079547f03 100644
--- a/apps/start/src/components/ui/dialog.tsx
+++ b/apps/start/src/components/ui/dialog.tsx
@@ -60,8 +60,8 @@ function DialogContent({
'max-h-screen overflow-y-auto overflow-x-hidden', // Ensure the dialog is scrollable if it exceeds the screen height
'mt-auto', // Add margin-top: auto for all screen sizes
'transition-none focus:outline-none focus:ring-0',
- 'border bg-def-100 shadow-lg sm:rounded-lg md:max-h-[90vh]',
- 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-def-100 p-6 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg [&>*]:min-w-0',
+ 'border bg-card shadow-2xl sm:rounded-xl md:max-h-[90vh]',
+ 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl border bg-card p-6 shadow-2xl duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg [&>*]:min-w-0',
className
)}
data-slot="dialog-content"
@@ -96,7 +96,7 @@ function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
return (
<div
className={cn(
- 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
+ '-mx-6 mt-2 -mb-6 flex flex-col-reverse gap-2 rounded-b-xl border-border border-t bg-def-100 px-6 py-4 sm:flex-row sm:justify-end',
className
)}
data-slot="dialog-footer"
@@ -111,7 +111,7 @@ function DialogTitle({
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
return (
<DialogPrimitive.Title
- className={cn('font-semibold text-lg leading-none', className)}
+ className={cn('font-semibold text-xl', className)}
data-slot="dialog-title"
{...props}
/>
diff --git a/apps/start/src/components/ui/dropdown-menu.tsx b/apps/start/src/components/ui/dropdown-menu.tsx
index f83dbcb24..cd1423811 100644
--- a/apps/start/src/components/ui/dropdown-menu.tsx
+++ b/apps/start/src/components/ui/dropdown-menu.tsx
@@ -23,7 +23,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
>(({ className, inset, children, ...props }, ref) => (
<DropdownMenuPrimitive.SubTrigger
className={cn(
- 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent data-[state=open]:bg-accent',
+ 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-nav outline-none focus:bg-accent data-[state=open]:bg-accent',
inset && 'pl-8',
className
)}
@@ -80,7 +80,7 @@ const DropdownMenuItem = React.forwardRef<
>(({ className, inset, variant, ...props }, ref) => (
<DropdownMenuPrimitive.Item
className={cn(
- 'relative flex min-h-8 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:mr-2',
+ 'relative flex min-h-8 cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-nav outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:mr-2',
inset && 'pl-8',
variant === 'destructive' &&
'text-destructive hover:text-destructive-foreground',
@@ -99,7 +99,7 @@ const DropdownMenuCheckboxItem = React.forwardRef<
<DropdownMenuPrimitive.CheckboxItem
checked={checked}
className={cn(
- 'relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 pl-8 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:mr-2',
+ 'relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-nav outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:mr-2',
className
)}
ref={ref}
@@ -122,7 +122,7 @@ const DropdownMenuRadioItem = React.forwardRef<
>(({ className, children, ...props }, ref) => (
<DropdownMenuPrimitive.RadioItem
className={cn(
- 'relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 pl-8 outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
+ 'relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pr-2 pl-8 text-nav outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
)}
ref={ref}
@@ -145,7 +145,11 @@ const DropdownMenuLabel = React.forwardRef<
}
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Label
- className={cn('px-2 py-1.5 font-semibold', inset && 'pl-8', className)}
+ className={cn(
+ 'px-2 py-1.5 font-medium text-muted-foreground text-xs',
+ inset && 'pl-8',
+ className
+ )}
ref={ref}
{...props}
/>
@@ -170,10 +174,7 @@ const DropdownMenuShortcut = ({
}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
- className={cn(
- 'ml-auto font-mono text-sm tracking-widest opacity-60',
- className
- )}
+ className={cn('ml-auto text-xs tracking-wider opacity-60', className)}
{...props}
/>
);
diff --git a/apps/start/src/components/ui/input.tsx b/apps/start/src/components/ui/input.tsx
index c40c01413..98578fced 100644
--- a/apps/start/src/components/ui/input.tsx
+++ b/apps/start/src/components/ui/input.tsx
@@ -4,7 +4,7 @@ import * as React from 'react';
import { cn } from '@/utils/cn';
const inputVariant = cva(
- 'flex w-full rounded-md border border-input bg-card ring-offset-background file:border-0 file:bg-transparent file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50',
+ 'flex w-full rounded-md border border-input bg-card text-sm ring-offset-background file:border-0 file:bg-transparent file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50',
{
variants: {
size: {
diff --git a/apps/start/src/components/ui/key-value-grid.tsx b/apps/start/src/components/ui/key-value-grid.tsx
index fe31fecd1..7a04b0265 100644
--- a/apps/start/src/components/ui/key-value-grid.tsx
+++ b/apps/start/src/components/ui/key-value-grid.tsx
@@ -147,7 +147,7 @@ export function KeyValueGrid({
</div>
<div
className={cn(
- 'min-w-0 max-w-[60%] truncate text-right font-mono text-sm',
+ 'min-w-0 max-w-[60%] truncate text-right text-sm tabular-nums',
valueClassName
)}
title={stringValue}
diff --git a/apps/start/src/components/ui/key-value.tsx b/apps/start/src/components/ui/key-value.tsx
index 7eff72e9d..a4f970c1b 100644
--- a/apps/start/src/components/ui/key-value.tsx
+++ b/apps/start/src/components/ui/key-value.tsx
@@ -23,7 +23,7 @@ export function KeyValue({ href, onClick, name, value }: KeyValueProps) {
<div className="bg-black/5 p-1 px-2 capitalize">{name}</div>
<div
className={cn(
- 'max-w-[300px] overflow-hidden text-ellipsis whitespace-nowrap bg-card p-1 px-2 font-mono text-highlight',
+ 'max-w-[300px] overflow-hidden text-ellipsis whitespace-nowrap bg-card p-1 px-2 text-highlight tabular-nums',
clickable && 'group-hover:underline'
)}
>
diff --git a/apps/start/src/components/ui/label.tsx b/apps/start/src/components/ui/label.tsx
index 0da71a75f..f820d93e9 100644
--- a/apps/start/src/components/ui/label.tsx
+++ b/apps/start/src/components/ui/label.tsx
@@ -5,7 +5,7 @@ import * as React from 'react';
import { cn } from '@/utils/cn';
const labelVariants = cva(
- 'mb-3 block min-h-3.5 font-medium text-foreground/70 text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
+ 'mb-2 block font-medium text-foreground/70 text-sm peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
);
const Label = React.forwardRef<
diff --git a/apps/start/src/components/ui/progress.tsx b/apps/start/src/components/ui/progress.tsx
index e7cfa1694..94e5bbd3e 100644
--- a/apps/start/src/components/ui/progress.tsx
+++ b/apps/start/src/components/ui/progress.tsx
@@ -30,7 +30,7 @@ const Progress = React.forwardRef<
}}
/>
{value && size !== 'sm' && (
- <div className="absolute top-0 bottom-0 z-5 flex items-center px-2 font-medium font-mono text-sm">
+ <div className="absolute top-0 bottom-0 z-5 flex items-center px-2 font-medium text-sm tabular-nums">
<div>{round(value, 2)}%</div>
</div>
)}
diff --git a/apps/start/src/components/ui/select.tsx b/apps/start/src/components/ui/select.tsx
index ae29853c8..b3abc32a6 100644
--- a/apps/start/src/components/ui/select.tsx
+++ b/apps/start/src/components/ui/select.tsx
@@ -32,7 +32,7 @@ function SelectTrigger({
return (
<SelectPrimitive.Trigger
className={cn(
- "flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[size=default]:h-8 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
+ "flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 font-medium text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[size=default]:h-8 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
className
)}
data-size={size}
@@ -88,7 +88,10 @@ function SelectLabel({
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
return (
<SelectPrimitive.Label
- className={cn('px-2 py-1.5 text-muted-foreground text-xs', className)}
+ className={cn(
+ 'px-2 py-1.5 font-medium text-muted-foreground text-xs',
+ className
+ )}
data-slot="select-label"
{...props}
/>
@@ -103,7 +106,7 @@ function SelectItem({
return (
<SelectPrimitive.Item
className={cn(
- "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-nav outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
className
)}
data-slot="select-item"
diff --git a/apps/start/src/components/ui/sheet.tsx b/apps/start/src/components/ui/sheet.tsx
index b87497113..f1ef5e94d 100644
--- a/apps/start/src/components/ui/sheet.tsx
+++ b/apps/start/src/components/ui/sheet.tsx
@@ -29,7 +29,7 @@ const SheetOverlay = React.forwardRef<
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
const sheetVariants = cva(
- 'fixed z-50 flex flex-col gap-4 overflow-y-auto rounded-lg bg-def-100 p-6 shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:duration-300 data-[state=open]:duration-500 max-sm:w-[calc(100%-theme(spacing.8))]',
+ 'fixed z-50 flex flex-col gap-4 overflow-y-auto rounded-xl bg-card p-6 shadow-2xl transition ease-in-out data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:duration-300 data-[state=open]:duration-500 max-sm:w-[calc(100%-theme(spacing.8))]',
{
variants: {
side: {
@@ -67,7 +67,7 @@ const SheetContent = React.forwardRef<
{children}
<SheetPrimitive.Close className="hidden" id="close-sheet" />
<SheetPrimitive.Close
- className="absolute top-6 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-def-100"
+ className="absolute top-6 right-6 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-def-100"
onClick={onClose}
>
<XIcon className="h-4 w-4" />
@@ -85,7 +85,7 @@ const SheetHeader = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- 'relative -m-6 mb-0 flex justify-between rounded-t-lg border-b bg-def-100 p-6',
+ 'relative -mx-6 -mt-6 mb-0 flex justify-between border-border border-b p-6 pb-5',
className
)}
{...props}
@@ -103,7 +103,7 @@ const SheetFooter = ({
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
- 'mt-auto flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
+ '-mx-6 mt-auto -mb-6 flex flex-col-reverse gap-2 rounded-b-xl border-border border-t bg-def-100 px-6 py-4 sm:flex-row sm:justify-end',
className
)}
{...props}
@@ -116,7 +116,7 @@ const SheetTitle = React.forwardRef<
React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
>(({ className, ...props }, ref) => (
<SheetPrimitive.Title
- className={cn('font-semibold text-2xl text-foreground', className)}
+ className={cn('font-semibold text-foreground text-xl', className)}
ref={ref}
{...props}
/>
diff --git a/apps/start/src/components/ui/table.tsx b/apps/start/src/components/ui/table.tsx
index f716e656f..0ce131592 100644
--- a/apps/start/src/components/ui/table.tsx
+++ b/apps/start/src/components/ui/table.tsx
@@ -80,7 +80,7 @@ function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
return (
<th
className={cn(
- 'h-10 whitespace-nowrap px-4 text-left align-middle font-medium text-[10px] text-foreground uppercase [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
+ 'h-10 whitespace-nowrap px-4 text-left align-middle font-medium text-3xs text-foreground uppercase tracking-wider [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
className
)}
data-slot="table-head"
diff --git a/apps/start/src/components/ui/textarea.tsx b/apps/start/src/components/ui/textarea.tsx
index 818a1a967..bde7c006d 100644
--- a/apps/start/src/components/ui/textarea.tsx
+++ b/apps/start/src/components/ui/textarea.tsx
@@ -8,7 +8,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
- 'flex min-h-[80px] w-full rounded-md border border-input bg-card px-3 py-2 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
+ 'flex min-h-[80px] w-full rounded-md border border-input bg-card px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className
)}
ref={ref}
diff --git a/apps/start/src/components/widget-table.tsx b/apps/start/src/components/widget-table.tsx
index 5a78bc3db..7d56b6d5e 100644
--- a/apps/start/src/components/widget-table.tsx
+++ b/apps/start/src/components/widget-table.tsx
@@ -55,7 +55,7 @@ export const WidgetTableHead = ({
return (
<thead
className={cn(
- 'sticky top-0 z-10 border-border border-b bg-def-100 text-def-1000 [&_th:first-child]:text-left [&_th:last-child]:text-right [&_th]:whitespace-nowrap [&_th]:p-4 [&_th]:py-2 [&_th]:text-right [&_th]:font-medium',
+ 'sticky top-0 z-10 border-border border-b bg-def-100 text-def-1000 [&_th:first-child]:text-left [&_th:last-child]:text-right [&_th]:whitespace-nowrap [&_th]:p-4 [&_th]:py-2 [&_th]:text-right [&_th]:font-medium [&_th]:text-3xs [&_th]:uppercase [&_th]:tracking-wider',
className
)}
>
@@ -181,7 +181,7 @@ export function WidgetTable<T>({
return (
<div
className={cn(
- 'cell whitespace-nowrap p-2 font-medium font-sans text-sm',
+ 'cell whitespace-nowrap p-2 font-medium font-sans text-3xs uppercase tracking-wider',
columns.length > 1 && column !== columns[0]
? 'text-right'
: 'text-left',
diff --git a/apps/start/src/lib/utils.ts b/apps/start/src/lib/utils.ts
index 9ad0df426..ef64ee968 100644
--- a/apps/start/src/lib/utils.ts
+++ b/apps/start/src/lib/utils.ts
@@ -1,6 +1 @@
-import { type ClassValue, clsx } from 'clsx';
-import { twMerge } from 'tailwind-merge';
-
-export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs));
-}
+export { cn } from '@/utils/cn';
diff --git a/apps/start/src/modals/Instructions.tsx b/apps/start/src/modals/Instructions.tsx
index 0df3ae69a..6e285ea6b 100644
--- a/apps/start/src/modals/Instructions.tsx
+++ b/apps/start/src/modals/Instructions.tsx
@@ -22,7 +22,7 @@ const Header = ({ framework }: Pick<Props, 'framework'>) => (
);
const Footer = ({ framework }: Pick<Props, 'framework'>) => (
- <SheetFooter className="absolute right-0 bottom-0 left-0 p-4">
+ <SheetFooter className="absolute right-0 bottom-0 left-0 mx-0 mb-0">
<Button
className="flex-1"
icon={XIcon}
diff --git a/apps/start/src/modals/Modal/Container.tsx b/apps/start/src/modals/Modal/Container.tsx
index 89a7126f4..eb32d87c8 100644
--- a/apps/start/src/modals/Modal/Container.tsx
+++ b/apps/start/src/modals/Modal/Container.tsx
@@ -69,18 +69,14 @@ export function ModalHeader({
return (
<div
className={cn(
- 'relative -m-6 mb-4 flex justify-between rounded-t-lg p-6 pb-0',
+ 'relative -m-6 mb-2 flex justify-between p-6 pb-0',
className
)}
>
<div className="row relative w-full justify-between gap-4">
- <div className="col flex-1 gap-2">
+ <div className="col flex-1 gap-1">
<DialogTitle>{title}</DialogTitle>
- {!!text && (
- <div className="text-lg text-muted-foreground leading-normal">
- {text}
- </div>
- )}
+ {!!text && <div className="text-muted-foreground">{text}</div>}
</div>
{onClose !== false && (
<Button
diff --git a/apps/start/src/modals/add-cohort.tsx b/apps/start/src/modals/add-cohort.tsx
index f5e1eee9d..4273dd3bb 100644
--- a/apps/start/src/modals/add-cohort.tsx
+++ b/apps/start/src/modals/add-cohort.tsx
@@ -6,10 +6,10 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { CohortCriteriaBuilder } from '@/components/cohort/cohort-criteria-builder';
import { InputWithLabel, WithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
@@ -114,14 +114,14 @@ export default function AddCohort() {
/>
</div>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Create
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/add-dashboard.tsx b/apps/start/src/modals/add-dashboard.tsx
index c3410ed68..3f04b5cc3 100644
--- a/apps/start/src/modals/add-dashboard.tsx
+++ b/apps/start/src/modals/add-dashboard.tsx
@@ -6,9 +6,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { useAppParams } from '@/hooks/use-app-params';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -73,14 +73,14 @@ export default function AddDashboard({ name }: AddDashboardProps = {}) {
placeholder="Name of the dashboard"
{...register('name')}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Create
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/add-group.tsx b/apps/start/src/modals/add-group.tsx
index 59b3667b2..6f95724f4 100644
--- a/apps/start/src/modals/add-group.tsx
+++ b/apps/start/src/modals/add-group.tsx
@@ -7,9 +7,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { useAppParams } from '@/hooks/use-app-params';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -122,7 +122,7 @@ export default function AddGroup() {
))}
</div>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
@@ -132,7 +132,7 @@ export default function AddGroup() {
>
Create
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/add-project.tsx b/apps/start/src/modals/add-project.tsx
index 62041bc69..fc743c7c4 100644
--- a/apps/start/src/modals/add-project.tsx
+++ b/apps/start/src/modals/add-project.tsx
@@ -15,12 +15,12 @@ import type { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
import AnimateHeight from '@/components/animate-height';
-import { ButtonContainer } from '@/components/button-container';
import { CreateClientSuccess } from '@/components/clients/create-client-success';
import { CheckboxItem } from '@/components/forms/checkbox-item';
import { InputWithLabel, WithLabel } from '@/components/forms/input-with-label';
import TagInput from '@/components/forms/tag-input';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { useAppParams } from '@/hooks/use-app-params';
import { ONBOARDING_SECRET_KEY } from '@/hooks/use-client-secret';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -108,7 +108,7 @@ export default function AddProject() {
{mutation.data.client && (
<CreateClientSuccess {...mutation.data.client} />
)}
- <ButtonContainer className="justify-end">
+ <DialogFooter>
<Button onClick={() => popModal()} variant="outline">
Close
</Button>
@@ -134,7 +134,7 @@ export default function AddProject() {
Set up tracking
</a>
</Button>
- </ButtonContainer>
+ </DialogFooter>
</>
) : (
<>
@@ -248,7 +248,7 @@ export default function AddProject() {
/>
</div>
- <ButtonContainer className="justify-end">
+ <DialogFooter>
<Button
icon={SaveIcon}
loading={mutation.isPending}
@@ -256,7 +256,7 @@ export default function AddProject() {
>
Create project
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</>
)}
diff --git a/apps/start/src/modals/add-reference.tsx b/apps/start/src/modals/add-reference.tsx
index 21e45bc68..d76d28013 100644
--- a/apps/start/src/modals/add-reference.tsx
+++ b/apps/start/src/modals/add-reference.tsx
@@ -6,9 +6,9 @@ import { toast } from 'sonner';
import type { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { InputDateTime } from '@/components/ui/input-date-time';
import { useAppParams } from '@/hooks/use-app-params';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -68,14 +68,14 @@ export default function AddReference({
<InputDateTime {...field} label="Date and time" />
)}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Create
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/billing-success.tsx b/apps/start/src/modals/billing-success.tsx
index d9c6a6659..b20234920 100644
--- a/apps/start/src/modals/billing-success.tsx
+++ b/apps/start/src/modals/billing-success.tsx
@@ -31,10 +31,10 @@ export default function BillingSuccess() {
</div>
</div>
- <h2 className="mb-4 font-semibold text-3xl">
+ <h2 className="mb-4 font-semibold text-2xl">
Subscription updated successfully
</h2>
- <p className="mb-12 max-w-md text-center text-base leading-normal">
+ <p className="mb-12 max-w-md text-center text-base">
Thank you for your purchase! You have now full access to OpenPanel. If
you have any questions or feedback, please don't hesitate to contact
us.
diff --git a/apps/start/src/modals/confirm.tsx b/apps/start/src/modals/confirm.tsx
index 04a77df61..c2c3bbd10 100644
--- a/apps/start/src/modals/confirm.tsx
+++ b/apps/start/src/modals/confirm.tsx
@@ -1,7 +1,7 @@
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
export type ConfirmProps = {
title: string;
@@ -19,8 +19,8 @@ export default function Confirm({
return (
<ModalContent>
<ModalHeader title={title} />
- <p className="-mt-2 text-lg leading-normal">{text}</p>
- <ButtonContainer>
+ <p className="-mt-2 text-base">{text}</p>
+ <DialogFooter>
<Button
onClick={() => {
popModal('Confirm');
@@ -38,7 +38,7 @@ export default function Confirm({
>
Yes
</Button>
- </ButtonContainer>
+ </DialogFooter>
</ModalContent>
);
}
diff --git a/apps/start/src/modals/create-invite.tsx b/apps/start/src/modals/create-invite.tsx
index 44553f244..9eaa25353 100644
--- a/apps/start/src/modals/create-invite.tsx
+++ b/apps/start/src/modals/create-invite.tsx
@@ -109,7 +109,7 @@ export default function CreateInvite() {
</div>
</SheetHeader>
<form
- className="flex flex-col gap-8"
+ className="flex flex-1 flex-col gap-8"
onSubmit={handleSubmit((values) => mutation.mutate(values))}
>
<InputWithLabel
diff --git a/apps/start/src/modals/custom-event.tsx b/apps/start/src/modals/custom-event.tsx
index d877663d3..67c8c8572 100644
--- a/apps/start/src/modals/custom-event.tsx
+++ b/apps/start/src/modals/custom-event.tsx
@@ -6,11 +6,11 @@ import { useState } from 'react';
import { toast } from 'sonner';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { FiltersBuilder } from '@/components/filters/FiltersBuilder';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
import { ComboboxEvents } from '@/components/ui/combobox-events';
+import { DialogFooter } from '@/components/ui/dialog';
import { Label } from '@/components/ui/label';
import { useAppParams } from '@/hooks/use-app-params';
import { useEventNames } from '@/hooks/use-event-names';
@@ -132,14 +132,14 @@ export default function CustomEvent({ customEvent }: CustomEventProps = {}) {
</div>
))}
</div>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!isValid} loading={isPending} type="submit">
Save
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/date-time-picker.tsx b/apps/start/src/modals/date-time-picker.tsx
index 7ef6d6b1f..54e1848f2 100644
--- a/apps/start/src/modals/date-time-picker.tsx
+++ b/apps/start/src/modals/date-time-picker.tsx
@@ -122,7 +122,7 @@ export default function DateTimePicker({
</span>
<div className="h-4 w-px bg-border" />
<ClockIcon className="h-4 w-4 text-muted-foreground" />
- <span className="font-medium font-mono">
+ <span className="font-medium tabular-nums">
{format(selectedDate, 'HH:mm')}
</span>
</div>
@@ -144,7 +144,7 @@ export default function DateTimePicker({
{timeOptions.map((time) => (
<Button
className={cn(
- 'mb-0.5 h-8 w-full justify-start font-mono text-xs transition-all duration-200',
+ 'mb-0.5 h-8 w-full justify-start text-xs tabular-nums transition-all duration-200',
currentTimeValue === time.value
? 'bg-primary text-primary-foreground shadow-sm'
: 'hover:bg-muted'
diff --git a/apps/start/src/modals/edit-client.tsx b/apps/start/src/modals/edit-client.tsx
index 2460baff6..e0f70b9b7 100644
--- a/apps/start/src/modals/edit-client.tsx
+++ b/apps/start/src/modals/edit-client.tsx
@@ -6,9 +6,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { handleError, useTRPC } from '@/integrations/trpc/react';
type EditClientProps = IPublicClient;
@@ -51,14 +51,14 @@ export default function EditClient({ id, name }: EditClientProps) {
<ModalHeader title="Edit client" />
<form onSubmit={handleSubmit((values) => mutation.mutate(values))}>
<InputWithLabel label="Name" placeholder="Name" {...register('name')} />
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Save
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/edit-cohort.tsx b/apps/start/src/modals/edit-cohort.tsx
index 72d870a05..c4c83fd84 100644
--- a/apps/start/src/modals/edit-cohort.tsx
+++ b/apps/start/src/modals/edit-cohort.tsx
@@ -6,10 +6,10 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { CohortCriteriaBuilder } from '@/components/cohort/cohort-criteria-builder';
import { InputWithLabel, WithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
import { Textarea } from '@/components/ui/textarea';
@@ -116,14 +116,14 @@ export default function EditCohort(props: EditCohortProps) {
/>
</div>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Save changes
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/edit-dashboard.tsx b/apps/start/src/modals/edit-dashboard.tsx
index 04f3f615d..b1fc376e7 100644
--- a/apps/start/src/modals/edit-dashboard.tsx
+++ b/apps/start/src/modals/edit-dashboard.tsx
@@ -6,9 +6,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { useTRPC } from '@/integrations/trpc/react';
type EditDashboardProps = Exclude<IServiceDashboard, null>;
@@ -58,14 +58,14 @@ export default function EditDashboard({ id, name }: EditDashboardProps) {
{...register('name')}
defaultValue={name}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Update
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/edit-event.tsx b/apps/start/src/modals/edit-event.tsx
index 31332a8a4..2a33b12f1 100644
--- a/apps/start/src/modals/edit-event.tsx
+++ b/apps/start/src/modals/edit-event.tsx
@@ -97,7 +97,7 @@ export default function EditEvent({ id }: Props) {
transition={{ duration: 0.15 }}
>
<div className="row mb-4 items-center justify-between">
- <div className="font-medium leading-none">Pick an icon</div>
+ <div className="font-medium">Pick an icon</div>
{
<button onClick={() => setStep('color')} type="button">
<Badge variant="outline">
@@ -147,7 +147,7 @@ export default function EditEvent({ id }: Props) {
transition={{ duration: 0.15 }}
>
<div className="row mb-4 items-center justify-between">
- <div className="font-medium leading-none">Pick a color</div>
+ <div className="font-medium">Pick a color</div>
<button onClick={() => setStep('icon')} type="button">
<Badge variant="outline">
Select icon
diff --git a/apps/start/src/modals/edit-group.tsx b/apps/start/src/modals/edit-group.tsx
index 5caf7270a..d4b9e0eef 100644
--- a/apps/start/src/modals/edit-group.tsx
+++ b/apps/start/src/modals/edit-group.tsx
@@ -8,9 +8,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { handleError, useTRPC } from '@/integrations/trpc/react';
const zForm = zUpdateGroup
@@ -130,7 +130,7 @@ export default function EditGroup({
))}
</div>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
@@ -140,7 +140,7 @@ export default function EditGroup({
>
Update
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/edit-member.tsx b/apps/start/src/modals/edit-member.tsx
index 86edee567..c703ed834 100644
--- a/apps/start/src/modals/edit-member.tsx
+++ b/apps/start/src/modals/edit-member.tsx
@@ -8,9 +8,9 @@ import { useState } from 'react';
import { toast } from 'sonner';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { ProjectScopePicker } from '@/components/settings/project-scope-picker';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { handleError, useTRPC } from '@/integrations/trpc/react';
type EditMemberProps = IServiceMember;
@@ -74,7 +74,7 @@ export default function EditMember(member: EditMemberProps) {
projects={projects}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
@@ -94,7 +94,7 @@ export default function EditMember(member: EditMemberProps) {
>
Save
</Button>
- </ButtonContainer>
+ </DialogFooter>
</div>
</ModalContent>
);
diff --git a/apps/start/src/modals/edit-reference.tsx b/apps/start/src/modals/edit-reference.tsx
index 5db3b7302..c90d5ad0b 100644
--- a/apps/start/src/modals/edit-reference.tsx
+++ b/apps/start/src/modals/edit-reference.tsx
@@ -6,9 +6,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { InputDateTime } from '@/components/ui/input-date-time';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -79,14 +79,14 @@ export default function EditReference({
<InputDateTime {...field} label="Date and time" />
)}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Update
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/edit-report.tsx b/apps/start/src/modals/edit-report.tsx
index b1d30e088..2c045875b 100644
--- a/apps/start/src/modals/edit-report.tsx
+++ b/apps/start/src/modals/edit-report.tsx
@@ -4,9 +4,9 @@ import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
const validator = z.object({
name: z.string().min(1),
@@ -30,14 +30,14 @@ export default function EditReport({ form, onSubmit }: EditReportProps) {
<ModalHeader title="Edit report" />
<form onSubmit={handleSubmit(onSubmit)}>
<InputWithLabel label="Name" placeholder="Name" {...register('name')} />
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
<Button disabled={!formState.isDirty} type="submit">
Update
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/event-details.tsx b/apps/start/src/modals/event-details.tsx
deleted file mode 100644
index 1ab6d3f87..000000000
--- a/apps/start/src/modals/event-details.tsx
+++ /dev/null
@@ -1,446 +0,0 @@
-import type { IClickhouseEvent, IServiceEvent } from '@openpanel/core';
-import { useSuspenseQuery } from '@tanstack/react-query';
-import { FilterIcon, XIcon } from 'lucide-react';
-import { omit } from 'ramda';
-import { Suspense, useState } from 'react';
-import { popModal } from '.';
-import { ModalContent } from './Modal/Container';
-import { ProjectLink } from '@/components/links';
-import {
- WidgetButtons,
- WidgetHead,
-} from '@/components/overview/overview-widget';
-import { SerieIcon } from '@/components/report-chart/common/serie-icon';
-import { ReportChartShortcut } from '@/components/report-chart/shortcut';
-import Syntax from '@/components/syntax';
-import { Button } from '@/components/ui/button';
-import { FieldValue, KeyValueGrid } from '@/components/ui/key-value-grid';
-import { Widget, WidgetBody } from '@/components/widget';
-import {
- useEventQueryFilters,
- useEventQueryNamesFilter,
-} from '@/hooks/use-event-query-filters';
-import { fancyMinutes } from '@/hooks/use-numer-formatter';
-import { useTRPC } from '@/integrations/trpc/react';
-import { cn } from '@/utils/cn';
-import { getProfileName } from '@/utils/getters';
-
-interface Props {
- id: string;
- createdAt?: Date;
- projectId: string;
-}
-
-const filterable: Partial<Record<keyof IServiceEvent, keyof IClickhouseEvent>> =
- {
- name: 'name',
- referrer: 'referrer',
- referrerName: 'referrer_name',
- referrerType: 'referrer_type',
- brand: 'brand',
- model: 'model',
- browser: 'browser',
- browserVersion: 'browser_version',
- os: 'os',
- osVersion: 'os_version',
- city: 'city',
- region: 'region',
- country: 'country',
- device: 'device',
- properties: 'properties',
- path: 'path',
- origin: 'origin',
- };
-
-export default function EventDetails(props: Props) {
- return (
- <ModalContent className="!p-0">
- <Widget className="min-w-0 border-0 bg-transparent">
- <Suspense fallback={<EventDetailsSkeleton />}>
- <EventDetailsContent {...props} />
- </Suspense>
- </Widget>
- </ModalContent>
- );
-}
-
-function EventDetailsContent({ id, createdAt, projectId }: Props) {
- const [, setEvents] = useEventQueryNamesFilter();
- const [, setFilter] = useEventQueryFilters();
- const TABS = {
- essentials: {
- id: 'essentials',
- title: 'Essentials',
- },
- detailed: {
- id: 'detailed',
- title: 'Detailed',
- },
- };
- const [widget, setWidget] = useState(TABS.essentials);
- const [propertiesMode, setPropertiesMode] = useState<'table' | 'json'>(
- 'table'
- );
- const trpc = useTRPC();
- const query = useSuspenseQuery(
- trpc.event.details.queryOptions({
- id,
- projectId,
- createdAt,
- })
- );
-
- const { event, session } = query.data;
-
- const profile = event.profile;
-
- const data = (() => {
- const data: {
- name: keyof IServiceEvent | string;
- value: any;
- event: IServiceEvent;
- }[] = [
- {
- name: 'createdAt',
- value: event.createdAt,
- },
- {
- name: 'name',
- value: event.name,
- },
- {
- name: 'origin',
- value: event.origin,
- },
- {
- name: 'path',
- value: event.path,
- },
- {
- name: 'country',
- value: event.country,
- },
- {
- name: 'region',
- value: event.region,
- },
- {
- name: 'city',
- value: event.city,
- },
- {
- name: 'referrer',
- value: event.referrer,
- },
- {
- name: 'referrerName',
- value: event.referrerName,
- },
- {
- name: 'referrerType',
- value: event.referrerType,
- },
- {
- name: 'brand',
- value: event.brand,
- },
- {
- name: 'model',
- value: event.model,
- },
- ].map((item) => ({ ...item, event }));
-
- if (widget.id === TABS.detailed.id) {
- data.length = 0;
- Object.entries(omit(['properties', 'profile', 'meta'], event)).forEach(
- ([name, value]) => {
- if (!name.startsWith('__')) {
- data.push({
- name: name as keyof IServiceEvent,
- value: value as any,
- event,
- });
- }
- }
- );
- }
-
- return data.filter((item) => {
- if (widget.id === TABS.essentials.id) {
- return !!item.value;
- }
-
- return true;
- });
- })();
-
- const properties = Object.entries(event.properties)
- .filter(([name]) => !name.startsWith('__'))
- .map(([name, value]) => ({
- name,
- value,
- event,
- }));
-
- return (
- <>
- <WidgetHead>
- <div className="row items-center justify-between">
- <div className="title">{event.name}</div>
- <div className="row items-center gap-2 pr-2">
- <Button onClick={() => popModal()} size="icon" variant={'ghost'}>
- <XIcon className="size-4" />
- </Button>
- </div>
- </div>
-
- <WidgetButtons>
- {Object.entries(TABS).map(([, tab]) => (
- <button
- className={cn(tab.id === widget.id && 'active')}
- key={tab.id}
- onClick={() => setWidget(tab)}
- type="button"
- >
- {tab.title}
- </button>
- ))}
- </WidgetButtons>
- </WidgetHead>
- <WidgetBody className="col gap-4 bg-def-100">
- {profile && (
- <ProjectLink
- className="card col gap-2 p-4 py-2 hover:bg-def-100"
- onClick={() => popModal()}
- params={{ profileId: profile.id }}
- to="/profiles/$profileId"
- >
- <div className="row items-center justify-between gap-2">
- <div className="row min-w-0 items-center gap-2">
- {profile.avatar && (
- <img
- className="size-4 rounded-full bg-border"
- src={profile.avatar}
- />
- )}
- <div className="truncate font-medium">
- {getProfileName(profile, false)}
- </div>
- </div>
- <div className="row shrink-0 items-center gap-2">
- <div className="row items-center gap-1">
- <SerieIcon name={event.country} />
- <SerieIcon name={event.os} />
- <SerieIcon name={event.browser} />
- </div>
- <div className="max-w-40 truncate text-muted-foreground">
- {event.referrerName || event.referrer}
- </div>
- </div>
- </div>
- {!!session && (
- <div className="text-sm">
- This session has {session.screenViewCount} screen views and{' '}
- {session.eventCount} events. Visit duration is{' '}
- {fancyMinutes(session.duration / 1000)}.
- </div>
- )}
- </ProjectLink>
- )}
-
- {properties.length > 0 && (
- <section>
- <div className="mb-2 flex justify-between font-medium">
- <div>Properties</div>
- <button
- className="text-muted-foreground transition-colors hover:text-foreground"
- onClick={() =>
- setPropertiesMode((p) => (p === 'table' ? 'json' : 'table'))
- }
- type="button"
- >
- {propertiesMode === 'table' ? 'View JSON' : 'View Table'}
- </button>
- </div>
- {propertiesMode === 'table' && (
- <KeyValueGrid
- columns={1}
- copyable
- data={properties}
- onItemClick={(item) => {
- popModal();
- setFilter(`properties.${item.name}`, item.value as any);
- }}
- renderValue={(item) => (
- <div className="flex items-center gap-2">
- <span className="font-mono">{String(item.value)}</span>
- <FilterIcon className="size-3 shrink-0" />
- </div>
- )}
- />
- )}
- {propertiesMode === 'json' && (
- <Syntax
- code={JSON.stringify(properties, null, 2)}
- language="json"
- />
- )}
- </section>
- )}
- <section>
- <div className="mb-2 flex justify-between font-medium">
- <div>Information</div>
- </div>
- <KeyValueGrid
- columns={1}
- copyable
- data={data}
- onItemClick={(item) => {
- const isFilterable = item.value && (filterable as any)[item.name];
- if (isFilterable) {
- popModal();
- setFilter(item.name as keyof IServiceEvent, item.value);
- }
- }}
- renderValue={(item) => {
- const isFilterable = item.value && (filterable as any)[item.name];
- if (isFilterable) {
- return (
- <div className="flex items-center gap-2">
- <FieldValue
- event={event}
- name={item.name}
- value={item.value}
- />
- <FilterIcon className="size-3 shrink-0" />
- </div>
- );
- }
-
- return (
- <FieldValue event={event} name={item.name} value={item.value} />
- );
- }}
- />
- </section>
- <section>
- <div className="mb-2 flex justify-between font-medium">
- <div>All events for {event.name}</div>
- <button
- className="text-muted-foreground hover:underline"
- onClick={() => {
- setEvents([event.name]);
- popModal();
- }}
- type="button"
- >
- Show all
- </button>
- </div>
- <div className="card p-4">
- <ReportChartShortcut
- chartType="linear"
- options={{ hideTable: true }}
- projectId={event.projectId}
- series={[
- {
- id: 'A',
- name: event.name,
- displayName: 'Similar events',
- segment: 'event',
- filters: [],
- type: 'event',
- },
- ]}
- />
- </div>
- </section>
- </WidgetBody>
- </>
- );
-}
-
-function EventDetailsSkeleton() {
- return (
- <>
- <WidgetHead>
- <div className="row items-center justify-between">
- <div className="h-6 w-32 animate-pulse rounded bg-muted" />
- <div className="row items-center gap-2 pr-2">
- <div className="h-8 w-8 animate-pulse rounded bg-muted" />
- <div className="h-8 w-8 animate-pulse rounded bg-muted" />
- <div className="h-8 w-8 animate-pulse rounded bg-muted" />
- </div>
- </div>
-
- <WidgetButtons>
- <div className="h-8 w-20 animate-pulse rounded bg-muted" />
- <div className="h-8 w-20 animate-pulse rounded bg-muted" />
- </WidgetButtons>
- </WidgetHead>
- <WidgetBody className="col gap-4 bg-def-100">
- <div className="card col gap-2 p-4 py-2">
- <div className="row items-center justify-between gap-2">
- <div className="row min-w-0 items-center gap-2">
- <div className="size-4 animate-pulse rounded-full bg-muted" />
- <div className="h-4 w-24 animate-pulse rounded bg-muted" />
- </div>
- <div className="row shrink-0 items-center gap-2">
- <div className="row items-center gap-1">
- <div className="size-4 animate-pulse rounded bg-muted" />
- <div className="size-4 animate-pulse rounded bg-muted" />
- <div className="size-4 animate-pulse rounded bg-muted" />
- </div>
- <div className="h-4 w-32 animate-pulse rounded bg-muted" />
- </div>
- </div>
- <div className="h-4 w-64 animate-pulse rounded bg-muted" />
- </div>
-
- <section>
- <div className="mb-2 flex justify-between font-medium">
- <div className="h-5 w-20 animate-pulse rounded bg-muted" />
- </div>
- <div className="space-y-2">
- {Array.from({ length: 3 }).map((_, i) => (
- <div
- className="flex items-center justify-between rounded bg-muted/50 p-3"
- key={i.toString()}
- >
- <div className="h-4 w-24 animate-pulse rounded bg-muted" />
- <div className="h-4 w-32 animate-pulse rounded bg-muted" />
- </div>
- ))}
- </div>
- </section>
-
- <section>
- <div className="mb-2 flex justify-between font-medium">
- <div className="h-5 w-24 animate-pulse rounded bg-muted" />
- </div>
- <div className="space-y-2">
- {Array.from({ length: 6 }).map((_, i) => (
- <div
- className="flex items-center justify-between rounded bg-muted/50 p-3"
- key={i.toString()}
- >
- <div className="h-4 w-20 animate-pulse rounded bg-muted" />
- <div className="h-4 w-28 animate-pulse rounded bg-muted" />
- </div>
- ))}
- </div>
- </section>
-
- <section>
- <div className="mb-2 flex justify-between font-medium">
- <div className="h-5 w-40 animate-pulse rounded bg-muted" />
- <div className="h-4 w-16 animate-pulse rounded bg-muted" />
- </div>
- <div className="card p-4">
- <div className="h-32 w-full animate-pulse rounded bg-muted" />
- </div>
- </section>
- </WidgetBody>
- </>
- );
-}
diff --git a/apps/start/src/modals/gsc-details.tsx b/apps/start/src/modals/gsc-details.tsx
index 17d47ce7d..9e5bab4a1 100644
--- a/apps/start/src/modals/gsc-details.tsx
+++ b/apps/start/src/modals/gsc-details.tsx
@@ -104,7 +104,7 @@ export default function GscDetails(props: Props) {
return (
<SheetContent className="flex flex-col gap-6 overflow-y-auto sm:max-w-xl">
<SheetHeader>
- <SheetTitle className="truncate pr-8 font-medium font-mono text-sm">
+ <SheetTitle className="truncate pr-8 font-medium text-sm tabular-nums">
{value}
</SheetTitle>
</SheetHeader>
@@ -185,7 +185,7 @@ export default function GscDetails(props: Props) {
render(item) {
return (
<div className="min-w-0 overflow-hidden">
- <span className="block truncate font-mono text-xs">
+ <span className="block truncate text-xs tabular-nums">
{String(item[breakdownKey])}
</span>
</div>
@@ -198,7 +198,7 @@ export default function GscDetails(props: Props) {
getSortValue: (item) => item.clicks as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.clicks as number).toLocaleString()}
</span>
);
@@ -210,7 +210,7 @@ export default function GscDetails(props: Props) {
getSortValue: (item) => item.impressions as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.impressions as number).toLocaleString()}
</span>
);
@@ -222,7 +222,7 @@ export default function GscDetails(props: Props) {
getSortValue: (item) => item.ctr as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{((item.ctr as number) * 100).toFixed(1)}%
</span>
);
@@ -234,7 +234,7 @@ export default function GscDetails(props: Props) {
getSortValue: (item) => item.position as number,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.position as number).toFixed(1)}
</span>
);
diff --git a/apps/start/src/modals/index.tsx b/apps/start/src/modals/index.tsx
index 95ad5c416..91771da97 100644
--- a/apps/start/src/modals/index.tsx
+++ b/apps/start/src/modals/index.tsx
@@ -26,7 +26,6 @@ import EditGroup from './edit-group';
import EditMember from './edit-member';
import EditReference from './edit-reference';
import EditReport from './edit-report';
-import EventDetails from './event-details';
import Instructions from './Instructions';
import InsightDetails from './insight-details';
import MoveReport from './move-report';
@@ -59,7 +58,6 @@ const modals = {
EditEvent,
CustomEvent,
EditMember,
- EventDetails,
InsightDetails,
EditClient,
AddProject,
diff --git a/apps/start/src/modals/insight-details.tsx b/apps/start/src/modals/insight-details.tsx
index 68d09f22c..89a7994d0 100644
--- a/apps/start/src/modals/insight-details.tsx
+++ b/apps/start/src/modals/insight-details.tsx
@@ -134,16 +134,14 @@ export default function InsightDetails({ insight }: { insight: Insight }) {
<SeverityDot band={insight.severityBand} />
)}
</div>
- <SheetTitle className="text-lg leading-snug">
+ <SheetTitle className="text-lg">
{insight.displayName || insight.title}
</SheetTitle>
</div>
</SheetHeader>
{insight.aiSummary && (
- <p className="text-muted-foreground leading-normal">
- {insight.aiSummary}
- </p>
+ <p className="text-muted-foreground">{insight.aiSummary}</p>
)}
{primary && (
@@ -196,7 +194,7 @@ export default function InsightDetails({ insight }: { insight: Insight }) {
)}
{explanation && (
- <div className="flex flex-col gap-3 text-sm leading-normal">
+ <div className="flex flex-col gap-3 text-sm">
<p>{explanation.summary}</p>
{explanation.drivers.length > 0 && (
<ul className="flex flex-col gap-2">
@@ -213,7 +211,7 @@ export default function InsightDetails({ insight }: { insight: Insight }) {
Possibly related: {explanation.relatedReference}
</p>
)}
- <p className="text-[10px] text-muted-foreground uppercase tracking-wide">
+ <p className="text-3xs text-muted-foreground uppercase tracking-wide">
Confidence: {explanation.confidence}
</p>
</div>
diff --git a/apps/start/src/modals/move-report.tsx b/apps/start/src/modals/move-report.tsx
index 6baa63aa2..6d7e9dbc0 100644
--- a/apps/start/src/modals/move-report.tsx
+++ b/apps/start/src/modals/move-report.tsx
@@ -5,9 +5,9 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { SelectDashboard } from '@/components/dashboards/select-dashboard';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { useAppParams } from '@/hooks/use-app-params';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -72,7 +72,7 @@ export default function MoveReport({ reportId, dashboardId }: MoveReportProps) {
);
}}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button
onClick={() => popModal()}
size="default"
@@ -88,7 +88,7 @@ export default function MoveReport({ reportId, dashboardId }: MoveReportProps) {
>
Move
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/page-details.tsx b/apps/start/src/modals/page-details.tsx
index 5d4a571e8..b5b4033ef 100644
--- a/apps/start/src/modals/page-details.tsx
+++ b/apps/start/src/modals/page-details.tsx
@@ -13,7 +13,7 @@ export default function PageDetails({ type, projectId, value }: Props) {
return (
<SheetContent className="flex flex-col gap-6 overflow-y-auto sm:max-w-xl">
<SheetHeader>
- <SheetTitle className="truncate pr-8 font-medium font-mono text-sm">
+ <SheetTitle className="truncate pr-8 font-medium text-sm tabular-nums">
{value}
</SheetTitle>
</SheetHeader>
diff --git a/apps/start/src/modals/save-report.tsx b/apps/start/src/modals/save-report.tsx
index ae15d59bb..d8def0316 100644
--- a/apps/start/src/modals/save-report.tsx
+++ b/apps/start/src/modals/save-report.tsx
@@ -7,10 +7,10 @@ import { toast } from 'sonner';
import { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { SelectDashboard } from '@/components/dashboards/select-dashboard';
import { InputWithLabel } from '@/components/forms/input-with-label';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { useAppParams } from '@/hooks/use-app-params';
import { handleError, useTRPC } from '@/integrations/trpc/react';
@@ -124,7 +124,7 @@ export default function SaveReport({
);
}}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button
onClick={() => popModal()}
size="default"
@@ -136,7 +136,7 @@ export default function SaveReport({
<Button disabled={!formState.isValid} size="default" type="submit">
Save
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/share-dashboard-modal.tsx b/apps/start/src/modals/share-dashboard-modal.tsx
index ccf7c320a..4acb4edc1 100644
--- a/apps/start/src/modals/share-dashboard-modal.tsx
+++ b/apps/start/src/modals/share-dashboard-modal.tsx
@@ -9,8 +9,8 @@ import { toast } from 'sonner';
import type { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Tooltiper } from '@/components/ui/tooltip';
import { useAppParams } from '@/hooks/use-app-params';
@@ -183,7 +183,7 @@ export default function ShareDashboardModal({
size="large"
type={password === STORED_PASSWORD_PLACEHOLDER ? 'text' : 'password'}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
@@ -191,7 +191,7 @@ export default function ShareDashboardModal({
<Button type="submit">
{isShared ? 'Update' : 'Make it public'}
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/share-overview-modal.tsx b/apps/start/src/modals/share-overview-modal.tsx
index bd20b8e92..4a4557574 100644
--- a/apps/start/src/modals/share-overview-modal.tsx
+++ b/apps/start/src/modals/share-overview-modal.tsx
@@ -9,8 +9,8 @@ import { toast } from 'sonner';
import type { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Tooltiper } from '@/components/ui/tooltip';
import { useAppParams } from '@/hooks/use-app-params';
@@ -174,7 +174,7 @@ export default function ShareOverviewModal() {
size="large"
type={password === STORED_PASSWORD_PLACEHOLDER ? 'text' : 'password'}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
@@ -182,7 +182,7 @@ export default function ShareOverviewModal() {
<Button type="submit">
{isShared ? 'Update' : 'Make it public'}
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/modals/share-report-modal.tsx b/apps/start/src/modals/share-report-modal.tsx
index aad7008b5..fc3a8cf2a 100644
--- a/apps/start/src/modals/share-report-modal.tsx
+++ b/apps/start/src/modals/share-report-modal.tsx
@@ -9,8 +9,8 @@ import { toast } from 'sonner';
import type { z } from 'zod';
import { popModal } from '.';
import { ModalContent, ModalHeader } from './Modal/Container';
-import { ButtonContainer } from '@/components/button-container';
import { Button } from '@/components/ui/button';
+import { DialogFooter } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Tooltiper } from '@/components/ui/tooltip';
import { useAppParams } from '@/hooks/use-app-params';
@@ -175,7 +175,7 @@ export default function ShareReportModal({ reportId }: { reportId: string }) {
size="large"
type={password === STORED_PASSWORD_PLACEHOLDER ? 'text' : 'password'}
/>
- <ButtonContainer>
+ <DialogFooter>
<Button onClick={() => popModal()} type="button" variant="outline">
Cancel
</Button>
@@ -183,7 +183,7 @@ export default function ShareReportModal({ reportId }: { reportId: string }) {
<Button type="submit">
{isShared ? 'Update' : 'Make it public'}
</Button>
- </ButtonContainer>
+ </DialogFooter>
</form>
</ModalContent>
);
diff --git a/apps/start/src/routes/__root.tsx b/apps/start/src/routes/__root.tsx
index 48f9bb672..a492d643b 100644
--- a/apps/start/src/routes/__root.tsx
+++ b/apps/start/src/routes/__root.tsx
@@ -121,7 +121,7 @@ function RootDocument({ children }: { children: React.ReactNode }) {
<head>
<HeadContent />
</head>
- <body className="grainy min-h-screen bg-def-100 font-sans text-base leading-normal antialiased">
+ <body className="grainy min-h-screen bg-def-100 font-sans text-sm antialiased">
<OpIdentify />
<Providers>{children}</Providers>
<ThemeScriptOnce />
diff --git a/apps/start/src/routes/_app.$organizationId.$projectId.seo.tsx b/apps/start/src/routes/_app.$organizationId.$projectId.seo.tsx
index aee41abfe..3554601a0 100644
--- a/apps/start/src/routes/_app.$organizationId.$projectId.seo.tsx
+++ b/apps/start/src/routes/_app.$organizationId.$projectId.seo.tsx
@@ -395,12 +395,12 @@ function TrafficSourceWidget({
<h3 className="font-medium text-sm">{title}</h3>
{!isLoading && total > 0 && (
<div className="flex items-center gap-2">
- <span className="font-medium font-mono text-sm tabular-nums">
+ <span className="font-medium text-sm tabular-nums tabular-nums">
{total.toLocaleString()}
</span>
{pctChange !== null && (
<span
- className={`font-mono text-xs tabular-nums ${pctChange >= 0 ? 'text-emerald-600 dark:text-emerald-400' : 'text-red-600 dark:text-red-400'}`}
+ className={`text-xs tabular-nums tabular-nums ${pctChange >= 0 ? 'text-emerald-600 dark:text-emerald-400' : 'text-red-600 dark:text-red-400'}`}
>
{pctChange >= 0 ? '+' : ''}
{pctChange.toFixed(1)}%
@@ -443,10 +443,10 @@ function TrafficSourceWidget({
<span className="min-w-0 flex-1 truncate text-xs capitalize">
{engine.name.replace(/\..+$/, '')}
</span>
- <span className="shrink-0 font-mono text-xs tabular-nums">
+ <span className="shrink-0 text-xs tabular-nums tabular-nums">
{engine.sessions.toLocaleString()}
</span>
- <span className="shrink-0 font-mono text-muted-foreground text-xs">
+ <span className="shrink-0 text-muted-foreground text-xs tabular-nums">
{pct.toFixed(0)}%
</span>
</div>
@@ -661,7 +661,7 @@ function GscTable({
return (
<div className="min-w-0 overflow-hidden">
<button
- className="block w-full truncate text-left font-mono text-xs hover:underline"
+ className="block w-full truncate text-left text-xs tabular-nums hover:underline"
onClick={() => onRowClick?.(String(item[keyField]))}
type="button"
>
@@ -677,7 +677,7 @@ function GscTable({
getSortValue: (item) => item.clicks,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{item.clicks.toLocaleString()}
</span>
);
@@ -689,7 +689,7 @@ function GscTable({
getSortValue: (item) => item.impressions,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{item.impressions.toLocaleString()}
</span>
);
@@ -701,7 +701,7 @@ function GscTable({
getSortValue: (item) => item.ctr,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{(item.ctr * 100).toFixed(1)}%
</span>
);
@@ -713,7 +713,7 @@ function GscTable({
getSortValue: (item) => item.position,
render(item) {
return (
- <span className="font-mono font-semibold text-xs">
+ <span className="font-semibold text-xs tabular-nums">
{item.position.toFixed(1)}
</span>
);
diff --git a/apps/start/src/routes/_app.$organizationId.$projectId.sessions_.$sessionId.tsx b/apps/start/src/routes/_app.$organizationId.$projectId.sessions_.$sessionId.tsx
index c32918efb..f0402a612 100644
--- a/apps/start/src/routes/_app.$organizationId.$projectId.sessions_.$sessionId.tsx
+++ b/apps/start/src/routes/_app.$organizationId.$projectId.sessions_.$sessionId.tsx
@@ -2,6 +2,7 @@ import type { IServiceEvent, IServiceSession } from '@openpanel/core';
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
import { createFileRoute, Link } from '@tanstack/react-router';
import { EventIcon } from '@/components/events/event-icon';
+import { useEventDrawer } from '@/components/events/use-event-drawer';
import FullPageLoadingState from '@/components/full-page-loading-state';
import { PageContainer } from '@/components/page-container';
import { PageHeader } from '@/components/page-header';
@@ -139,6 +140,7 @@ function EventDistribution({ events }: { events: IServiceEvent[] }) {
function Component() {
const { projectId, sessionId, organizationId } = Route.useParams();
const trpc = useTRPC();
+ const { openEvent } = useEventDrawer();
const number = useNumber();
const { data: session } = useSuspenseQuery(
@@ -352,7 +354,7 @@ function Component() {
>
<div className="col min-w-0 flex-1 gap-0.5">
<span className="truncate font-medium">{group.name}</span>
- <span className="truncate font-mono text-muted-foreground text-sm">
+ <span className="truncate text-muted-foreground text-sm tabular-nums">
{group.id}
</span>
</div>
@@ -381,9 +383,13 @@ function Component() {
</WidgetHead>
<div className="divide-y">
{events.map((event) => (
- <div
- className="row items-center gap-3 px-4 py-2"
+ <button
+ className="row w-full items-center gap-3 px-4 py-2 text-left transition-colors hover:bg-def-100"
key={event.id}
+ onClick={() =>
+ openEvent({ id: event.id, createdAt: event.createdAt })
+ }
+ type="button"
>
<EventIcon meta={event.meta} name={event.name} size="sm" />
<div className="col min-w-0 flex-1">
@@ -396,7 +402,7 @@ function Component() {
<span className="shrink-0 text-muted-foreground text-xs tabular-nums">
{formatDateTime(event.createdAt)}
</span>
- </div>
+ </button>
))}
{events.length === 0 && (
<div className="py-8 text-center text-muted-foreground text-sm">
diff --git a/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.gsc.tsx b/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.gsc.tsx
index e01ae8bed..d5674c5fe 100644
--- a/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.gsc.tsx
+++ b/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.gsc.tsx
@@ -238,7 +238,7 @@ function GscSettings() {
revoked. Please reconnect to continue syncing data.
</p>
{connection.lastSyncError && (
- <p className="break-words font-mono text-muted-foreground text-xs">
+ <p className="break-words text-muted-foreground text-xs tabular-nums">
{connection.lastSyncError}
</p>
)}
@@ -295,7 +295,7 @@ function GscSettings() {
<div className="divide-y rounded-lg border">
<div className="flex items-center justify-between p-4">
<div className="font-medium text-sm">Property</div>
- <div className="font-mono text-muted-foreground text-sm">
+ <div className="text-muted-foreground text-sm tabular-nums">
{connection.siteUrl}
</div>
</div>
@@ -350,7 +350,7 @@ function GscSettings() {
<div className="font-medium text-destructive text-sm">
Last error
</div>
- <div className="mt-1 break-words font-mono text-muted-foreground text-sm">
+ <div className="mt-1 break-words text-muted-foreground text-sm tabular-nums">
{connection.lastSyncError}
</div>
</div>
diff --git a/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.imports.tsx b/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.imports.tsx
index f2e9943cf..5451060a8 100644
--- a/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.imports.tsx
+++ b/apps/start/src/routes/_app.$organizationId.$projectId.settings._tabs.imports.tsx
@@ -228,7 +228,7 @@ function ImportsSettings() {
</TableCell>
<TableCell>
{imp.totalEvents > 0 ? (
- <div className="space-y-1 font-mono">
+ <div className="space-y-1 tabular-nums">
<div className="text-sm">
{imp.processedEvents.toLocaleString()}
{' / '}
@@ -252,7 +252,7 @@ function ImportsSettings() {
)}
</div>
) : imp.totalEvents === -1 ? (
- <div className="font-mono text-sm">
+ <div className="text-sm tabular-nums">
{imp.processedEvents.toLocaleString()}
{' / '}
N/A
@@ -265,7 +265,7 @@ function ImportsSettings() {
<TableCell>
<Tooltiper
content={
- <pre className="whitespace-pre-wrap break-words font-mono text-sm leading-normal">
+ <pre className="whitespace-pre-wrap break-words text-xs tabular-nums">
{JSON.stringify(imp.config, null, 2)}
</pre>
}
diff --git a/apps/start/src/routes/_app.$organizationId.account._tabs.two-factor.tsx b/apps/start/src/routes/_app.$organizationId.account._tabs.two-factor.tsx
index f8783989d..526d275de 100644
--- a/apps/start/src/routes/_app.$organizationId.account._tabs.two-factor.tsx
+++ b/apps/start/src/routes/_app.$organizationId.account._tabs.two-factor.tsx
@@ -24,7 +24,7 @@ function Component() {
<span className="title">Two-factor authentication</span>
</WidgetHead>
<WidgetBody className="col gap-4">
- <p className="text-muted-foreground text-sm leading-normal">
+ <p className="text-muted-foreground text-sm">
Protect your account with an authenticator app (Google Authenticator,
1Password, Authy, etc.). You'll be asked for a 6-digit code each time
you sign in with email and password.
@@ -51,7 +51,7 @@ function DisabledView({ hasEmailProvider }: { hasEmailProvider: boolean }) {
<ShieldOffIcon className="size-4 text-muted-foreground" />
<span>Two-factor authentication is not available.</span>
</div>
- <p className="text-muted-foreground leading-normal">
+ <p className="text-muted-foreground">
Your account signs in with Google or GitHub, which handle two-factor
authentication in their account settings. Enable it in your provider's
security settings.
diff --git a/apps/start/src/routes/_app.tsx b/apps/start/src/routes/_app.tsx
index ffcc628eb..2bdf17eef 100644
--- a/apps/start/src/routes/_app.tsx
+++ b/apps/start/src/routes/_app.tsx
@@ -7,6 +7,7 @@ import {
import { ConstructionIcon } from 'lucide-react';
import { useEffect } from 'react';
import { useChatLaunch } from '@/components/chat/chat-launch';
+import { EventDrawer } from '@/components/events/event-drawer';
import { FullPageEmptyState } from '@/components/full-page-empty-state';
import { Sidebar } from '@/components/sidebar';
import { buttonVariants } from '@/components/ui/button';
@@ -55,6 +56,7 @@ function AppLayout() {
<div className="block h-16 lg:hidden" />
<Outlet />
</div>
+ <EventDrawer />
</div>
);
}
diff --git a/apps/start/src/routes/widget/badge.tsx b/apps/start/src/routes/widget/badge.tsx
index 66d0093e9..16117cad5 100644
--- a/apps/start/src/routes/widget/badge.tsx
+++ b/apps/start/src/routes/widget/badge.tsx
@@ -64,10 +64,10 @@ function BadgeWidget({ visitors, isLoading, color }: BadgeWidgetProps) {
</div>
<div className="-mt-px flex min-w-0 flex-1 flex-col items-start gap-0.5">
- <div className="font-medium text-[10px] text-white/80 uppercase tracking-wide">
+ <div className="font-medium text-3xs text-white/80 uppercase tracking-wide">
ANALYTICS FROM
</div>
- <div className="font-semibold text-white leading-tight">OpenPanel</div>
+ <div className="font-semibold text-white">OpenPanel</div>
</div>
<div className="col center-center flex-shrink-0 gap-1">
diff --git a/apps/start/src/routes/widget/realtime.tsx b/apps/start/src/routes/widget/realtime.tsx
index 6dd375311..da57537a9 100644
--- a/apps/start/src/routes/widget/realtime.tsx
+++ b/apps/start/src/routes/widget/realtime.tsx
@@ -143,7 +143,7 @@ function RealtimeWidget({ shareId, data, limit, color }: RealtimeWidgetProps) {
</div>
<div className="row">
- <div className="h-18 font-bold font-mono text-6xl text-foreground">
+ <div className="h-18 font-bold text-5xl text-foreground tabular-nums">
<AnimatedNumber value={data.liveCount} />
</div>
</div>
@@ -180,7 +180,7 @@ function RealtimeWidget({ shareId, data, limit, color }: RealtimeWidgetProps) {
/>
</BarChart>
</div>
- <div className="row justify-between pt-1 text-[10px] text-muted-foreground">
+ <div className="row justify-between pt-1 text-2xs text-muted-foreground">
<span>{firstMinute}</span>
<span>{lastMinute}</span>
</div>
@@ -440,7 +440,7 @@ function RealtimeWidgetSkeleton({ limit }: { limit: number }) {
</div>
<div className="row">
- <div className="row flex h-18 items-center gap-1 py-4 font-bold font-mono text-6xl">
+ <div className="row flex h-18 items-center gap-1 py-4 font-bold text-5xl tabular-nums">
<div className="h-full w-6 rounded bg-muted" />
<div className="h-full w-6 rounded bg-muted" />
</div>
diff --git a/apps/start/src/styles.css b/apps/start/src/styles.css
index 5a5979c03..8651a1d74 100644
--- a/apps/start/src/styles.css
+++ b/apps/start/src/styles.css
@@ -1,5 +1,6 @@
@import "tailwindcss";
@import "react-grid-layout/css/styles.css";
+@import "@fontsource-variable/inter";
@import "tw-animate-css";
@@ -9,23 +10,10 @@
body {
@apply m-0;
- font-family:
- ui-sans-serif,
- system-ui,
- sans-serif,
- Apple Color Emoji,
- Segoe UI Emoji,
- Segoe UI Symbol,
- Noto Color Emoji;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
-code {
- font-family:
- source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
-}
-
:root {
/* Core colors converted from HSL to OKLCH using convert-to-oklch tool */
--highlight: oklch(55.1% 0.21 262); /* hsl(220, 84%, 53%) -> #2266ec */
@@ -137,7 +125,7 @@ code {
--def-300: oklch(27.1% 0 0); /* hsl(0, 0%, 15.1%) -> #262626 */
--def-400: oklch(37.3% 0 0); /* hsl(0, 0%, 25.23%) -> #404040 */
- --foregroundish: oklch(83.9% 0 0); /* hsl(0, 0%, 79.23%) */
+ --foregroundish: oklch(86.3% 0 0); /* #d4d4d4 */
--background: oklch(23.8% 0 0); /* hsl(0, 0%, 12.02%) -> #1e1e1e */
--foreground: oklch(98.5% 0 0); /* hsl(0, 0%, 98%) -> #fafafa */
@@ -163,33 +151,36 @@ code {
}
@theme {
- /* Font sizes matching dashboard config */
- --text-xs: 10px;
- --text-xs--line-height: 10px;
- --text-sm: 12px;
- --text-sm--line-height: 12px;
+ --font-sans:
+ "Inter Variable", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
+ "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+
+ /* The dashboard's type scale. `sm` is the default for almost everything
+ (body, inputs, buttons); `3xs` is for uppercase micro labels and table
+ headers, `2xs` for captions and percentages beside 13px text, `xs` for
+ dense tables, `xl` for h1 and sheet/modal titles. Larger steps keep
+ Tailwind's defaults for display numbers. */
+ --text-3xs: 10px;
+ --text-3xs--line-height: 14px;
+ --text-2xs: 11px;
+ --text-2xs--line-height: 16px;
+ --text-xs: 12px;
+ --text-xs--line-height: 16px;
+ --text-sm: 13px;
+ --text-sm--line-height: 20px;
--text-base: 14px;
- --text-base--line-height: 14px;
+ --text-base--line-height: 20px;
--text-lg: 16px;
- --text-lg--line-height: 16px;
- --text-xl: 18px;
- --text-xl--line-height: 18px;
- --text-2xl: 20px;
- --text-2xl--line-height: 20px;
- --text-3xl: 24px;
- --text-3xl--line-height: 24px;
- --text-4xl: 30px;
- --text-4xl--line-height: 30px;
- --text-5xl: 36px;
- --text-5xl--line-height: 36px;
- --text-6xl: 48px;
- --text-6xl--line-height: 48px;
- --text-7xl: 64px;
- --text-7xl--line-height: 64px;
- --text-8xl: 72px;
- --text-8xl--line-height: 72px;
- --text-9xl: 96px;
- --text-9xl--line-height: 96px;
+ --text-lg--line-height: 24px;
+ --text-xl: 20px;
+ --text-xl--line-height: 28px;
+
+ /* Sidebar rows: a touch smaller and lighter than body text; the fractional
+ weight needs the variable font. */
+ --text-nav: 13px;
+ --text-nav--line-height: 20px;
+ --text-nav--letter-spacing: -0.06px;
+ --text-nav--font-weight: 480;
/* Color variables */
--color-background: var(--background);
@@ -262,17 +253,24 @@ code {
@apply bg-background text-foreground;
}
- /* Typography classes from globals.css */
+ /* Monospace reads a step larger than Inter, so code sits one size below body text. */
+ code,
+ kbd,
+ samp,
+ pre {
+ @apply text-xs;
+ }
+
.h1 {
- @apply text-3xl font-medium;
+ @apply text-xl font-semibold;
}
.h2 {
- @apply text-xl font-medium;
+ @apply text-lg font-medium;
}
.h3 {
- @apply text-lg font-medium;
+ @apply text-base font-medium;
}
.h4 {
@@ -284,7 +282,7 @@ code {
}
.heading {
- @apply text-3xl font-semibold;
+ @apply text-xl font-semibold;
}
.title {
diff --git a/apps/start/src/utils/cn.ts b/apps/start/src/utils/cn.ts
index 568578c5a..70fbb3639 100644
--- a/apps/start/src/utils/cn.ts
+++ b/apps/start/src/utils/cn.ts
@@ -1,6 +1,16 @@
import type { ClassValue } from 'clsx';
import { clsx } from 'clsx';
-import { twMerge } from 'tailwind-merge';
+import { extendTailwindMerge } from 'tailwind-merge';
+
+// Font sizes added in styles.css; without this tailwind-merge reads `text-nav`
+// as a color and drops the real color class next to it.
+const twMerge = extendTailwindMerge({
+ extend: {
+ classGroups: {
+ 'font-size': ['text-3xs', 'text-2xs', 'text-nav'],
+ },
+ },
+});
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
diff --git a/bun.lock b/bun.lock
index aabf22adc..2a43b3ea1 100644
--- a/bun.lock
+++ b/bun.lock
@@ -106,6 +106,7 @@
"@dnd-kit/sortable": "10.0.0",
"@dnd-kit/utilities": "3.2.2",
"@faker-js/faker": "9.9.0",
+ "@fontsource-variable/inter": "5.3.0",
"@hookform/resolvers": "5.2.2",
"@nivo/sankey": "0.99.0",
"@number-flow/react": "0.5.10",
@@ -1322,6 +1323,8 @@
"@floating-ui/utils": ["@floating-ui/[email protected]", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="],
+ "@fontsource-variable/inter": ["@fontsource-variable/[email protected]", "", {}, "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA=="],
+
"@formatjs/fast-memoize": ["@formatjs/[email protected]", "", {}, "sha512-zXfhLpvA6T7+efdt9JLbBwZ00tT7NsBMDVnDu8rpHeNNv8KfRZAMo2gkG0k9lK/Nzc//3kJ9pImsfuJxk3KhUA=="],
"@formatjs/intl-localematcher": ["@formatjs/[email protected]", "", { "dependencies": { "@formatjs/fast-memoize": "3.1.7" } }, "sha512-kHEAFOkeJSPNi7c5PaKaRjxcBrJwzzt81ifUu+8uve1EDW/VJl83KsxmqgqNZLzcFEhSliZGvx3+pk/RH0IOmg=="],