umami/src/app/(main)/websites/[websiteId]/(reports)/journeys/JourneysPage.tsx
Mike Cao 50edb71687 Simplify i18n: remove old react-intl artifacts, rename formatMessage to t, replace FormattedMessage with t.rich().
- Rewrite messages.ts to plain string key maps (remove MessageDescriptor)
- Rewrite useMessages hook to expose t from useTranslations() directly
- Rename formatMessage → t across 193 consumer files
- Replace custom FormattedMessage component with next-intl t.rich()
- Update 52 language files to use rich text tags (<b>, <a>)
- Remove all direct imports from @/components/messages in favor of useMessages()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 11:19:04 -08:00

82 lines
2.2 KiB
TypeScript

'use client';
import { Column, Grid, ListItem, Row, SearchField, Select } from '@umami/react-zen';
import { useState } from 'react';
import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
import { Panel } from '@/components/common/Panel';
import { useDateRange, useMessages } from '@/components/hooks';
import { FilterButtons } from '@/components/input/FilterButtons';
import { Journey } from './Journey';
const JOURNEY_STEPS = [2, 3, 4, 5, 6, 7];
const DEFAULT_STEP = 3;
export function JourneysPage({ websiteId }: { websiteId: string }) {
const { t, labels } = useMessages();
const {
dateRange: { startDate, endDate },
} = useDateRange();
const [view, setView] = useState('all');
const [steps, setSteps] = useState(DEFAULT_STEP);
const [startStep, setStartStep] = useState('');
const [endStep, setEndStep] = useState('');
const buttons = [
{
id: 'all',
label: t(labels.all),
},
{
id: 'views',
label: t(labels.views),
},
{
id: 'events',
label: t(labels.events),
},
];
return (
<Column gap>
<WebsiteControls websiteId={websiteId} />
<Grid columns="repeat(3, 1fr)" gap>
<Select label={t(labels.steps)} value={steps} defaultValue={steps} onChange={setSteps}>
{JOURNEY_STEPS.map(step => (
<ListItem key={step} id={step}>
{step}
</ListItem>
))}
</Select>
<Column>
<SearchField
label={t(labels.startStep)}
value={startStep}
onSearch={setStartStep}
delay={1000}
/>
</Column>
<Column>
<SearchField
label={t(labels.endStep)}
value={endStep}
onSearch={setEndStep}
delay={1000}
/>
</Column>
</Grid>
<Row justifyContent="flex-end">
<FilterButtons items={buttons} value={view} onChange={setView} />
</Row>
<Panel height="900px" allowFullscreen>
<Journey
websiteId={websiteId}
startDate={startDate}
endDate={endDate}
steps={steps}
startStep={startStep}
endStep={endStep}
view={view}
/>
</Panel>
</Column>
);
}