Files
umami/src/app/(main)/websites/WebsitesTable.tsx
T
Mike CaoandClaude Opus 4.6 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

42 lines
1.3 KiB
TypeScript

import { DataColumn, DataTable, type DataTableProps, Icon } from '@umami/react-zen';
import type { ReactNode } from 'react';
import { LinkButton } from '@/components/common/LinkButton';
import { useMessages, useNavigation } from '@/components/hooks';
import { SquarePen } from '@/components/icons';
export interface WebsitesTableProps extends DataTableProps {
showActions?: boolean;
allowEdit?: boolean;
allowView?: boolean;
renderLink?: (row: any) => ReactNode;
}
export function WebsitesTable({ showActions, renderLink, ...props }: WebsitesTableProps) {
const { t, labels } = useMessages();
const { renderUrl } = useNavigation();
return (
<DataTable {...props}>
<DataColumn id="name" label={t(labels.name)}>
{renderLink}
</DataColumn>
<DataColumn id="domain" label={t(labels.domain)} />
{showActions && (
<DataColumn id="action" label=" " align="end">
{(row: any) => {
const websiteId = row.id;
return (
<LinkButton href={renderUrl(`/websites/${websiteId}/settings`)} variant="quiet">
<Icon>
<SquarePen />
</Icon>
</LinkButton>
);
}}
</DataColumn>
)}
</DataTable>
);
}