From b5f91f11f0a5636df9e19648a4cfeda1d22f4731 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Fri, 27 Feb 2026 16:42:58 -0800 Subject: [PATCH] update formatMessage to t. add session replay labels --- .../migrations/09_add_performance.sql | 2 +- db/clickhouse/schema.sql | 2 +- public/intl/messages/en-US.json | 10 +++++++++ .../[websiteId]/replays/ReplaysTable.tsx | 16 +++++++------- .../settings/WebsiteReplaySettings.tsx | 22 +++++++++---------- src/components/messages.ts | 10 +++++++++ 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/db/clickhouse/migrations/09_add_performance.sql b/db/clickhouse/migrations/09_add_performance.sql index 762db074e..4b5249541 100644 --- a/db/clickhouse/migrations/09_add_performance.sql +++ b/db/clickhouse/migrations/09_add_performance.sql @@ -69,4 +69,4 @@ SELECT count() as sample_count, toStartOfHour(created_at) as created_at FROM umami.website_performance -GROUP BY website_id, url_path, toStartOfHour(created_at); +GROUP BY website_id, url_path, created_at; diff --git a/db/clickhouse/schema.sql b/db/clickhouse/schema.sql index 18f634563..1050cdf8a 100644 --- a/db/clickhouse/schema.sql +++ b/db/clickhouse/schema.sql @@ -353,7 +353,7 @@ SELECT count() as sample_count, toStartOfHour(created_at) as created_at FROM umami.website_performance -GROUP BY website_id, url_path, toStartOfHour(created_at); +GROUP BY website_id, url_path, created_at; -- Create session_replay CREATE TABLE umami.session_replay diff --git a/public/intl/messages/en-US.json b/public/intl/messages/en-US.json index 25f529a1c..d455978f5 100644 --- a/public/intl/messages/en-US.json +++ b/public/intl/messages/en-US.json @@ -29,6 +29,7 @@ "back": "Back", "before": "Before", "behavior": "Behavior", + "block-selector": "Block selector", "boards": "Boards", "bounce-rate": "Bounce rate", "breakdown": "Breakdown", @@ -100,6 +101,7 @@ "domain": "Domain", "download": "Download", "dropoff": "Dropoff", + "duration": "Duration", "edit": "Edit", "edit-member": "Edit member", "email": "Email", @@ -174,7 +176,9 @@ "logout": "Logout", "manage": "Manage", "manager": "Manager", + "mask-level": "Mask level", "max": "Max", + "max-duration": "Max duration", "match": "Match", "match-all": "All", "match-any": "Any", @@ -235,6 +239,7 @@ "query": "Query", "query-parameters": "Query parameters", "realtime": "Realtime", + "recorded-at": "Recorded at", "referral": "Referral", "referrer": "Referrer", "referrers": "Referrers", @@ -245,11 +250,15 @@ "remaining": "Remaining", "remove": "Remove", "remove-member": "Remove member", + "replay": "Replay", + "replay-enabled": "Replay enabled", + "replays": "Replays", "reports": "Reports", "required": "Required", "reset": "Reset", "reset-website": "Reset website", "retention": "Retention", + "retention-days": "Retention days", "retention-description": "Measure your website stickiness by tracking how often users return.", "revenue": "Revenue", "revenue-description": "Look into your revenue data and how users are spending.", @@ -258,6 +267,7 @@ "save": "Save", "save-cohort": "Save cohort", "save-segment": "Save segment", + "sample-rate": "Sample rate", "sample-size": "Sample size", "screen": "Screen", "screens": "Screens", diff --git a/src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx b/src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx index aa762e2b7..1082cf6a0 100644 --- a/src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx +++ b/src/app/(main)/websites/[websiteId]/replays/ReplaysTable.tsx @@ -14,40 +14,40 @@ function formatDuration(ms: number) { } export function ReplaysTable({ websiteId, ...props }: DataTableProps & { websiteId: string }) { - const { formatMessage, labels } = useMessages(); + const { t, labels } = useMessages(); const { formatValue } = useFormat(); return ( - + {(row: any) => } - + {(row: any) => formatDuration(row.duration || 0)} - - + + {(row: any) => ( {formatValue(row.country, 'country')} )} - + {(row: any) => ( {formatValue(row.browser, 'browser')} )} - + {(row: any) => ( {formatValue(row.os, 'os')} )} - + {(row: any) => } diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteReplaySettings.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteReplaySettings.tsx index c1e339153..8a65e5d13 100644 --- a/src/app/(main)/websites/[websiteId]/settings/WebsiteReplaySettings.tsx +++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteReplaySettings.tsx @@ -21,8 +21,8 @@ interface ReplayConfig { export function WebsiteReplaySettings({ websiteId }: { websiteId: string }) { const website = useWebsite(); - const { formatMessage, labels, messages } = useMessages(); - const { mutateAsync, error, touch, toast } = useUpdateQuery(`/websites/${websiteId}`); + const { t, labels, messages } = useMessages(); + const { mutateAsync, touch, toast } = useUpdateQuery(`/websites/${websiteId}`); const [enabled, setEnabled] = useState(website?.replayEnabled ?? false); const config = (website?.replayConfig as ReplayConfig) || {}; @@ -41,7 +41,7 @@ export function WebsiteReplaySettings({ websiteId }: { websiteId: string }) { }, { onSuccess: async () => { - toast(formatMessage(messages.saved)); + toast(t(messages.saved)); touch('websites'); touch(`website:${website.id}`); }, @@ -61,35 +61,35 @@ export function WebsiteReplaySettings({ websiteId }: { websiteId: string }) { }} > - + - {formatMessage(labels.replayEnabled)} + {t(labels.replayEnabled)} {enabled && ( <> - + - + - + - + )} - {formatMessage(labels.save)} + {t(labels.save)} ); diff --git a/src/components/messages.ts b/src/components/messages.ts index 5b2cfe10f..9b403b43b 100644 --- a/src/components/messages.ts +++ b/src/components/messages.ts @@ -355,6 +355,16 @@ export const labels: Record = { needsImprovement: 'label.needs-improvement', poor: 'label.poor', sampleSize: 'label.sample-size', + replays: 'label.replays', + replay: 'label.replay', + replayEnabled: 'label.replay-enabled', + sampleRate: 'label.sample-rate', + maskLevel: 'label.mask-level', + maxDuration: 'label.max-duration', + blockSelector: 'label.block-selector', + retentionDays: 'label.retention-days', + duration: 'label.duration', + recordedAt: 'label.recorded-at', }; export const messages: Record = {