Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { NotificationHistoryScreen } from '@/components/notification-history-screen';

export default function NotificationHistoryRoute() {
return <NotificationHistoryScreen />;
}
45 changes: 45 additions & 0 deletions apps/mobile/src/components/notification-history-row.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { type inferRouterOutputs, type MobileRouter } from '@kilocode/trpc/mobile';
import { useTranslation } from 'react-i18next';
import { Pressable, View } from 'react-native';

import { Text } from '@/components/ui/text';
import { notificationHistoryCopy } from '@/lib/notification-history';
import { parseTimestamp, timeAgo } from '@/lib/utils';

type HistoryPage = inferRouterOutputs<MobileRouter>['user']['getNotificationHistory'];
export type HistoryRow = HistoryPage['items'][number];

/** One recorded notification: the copy a push showed, and how long ago. */
export function HistoryRowView({
row,
now,
onOpen,
}: Readonly<{
row: HistoryRow;
now: number;
onOpen: (payload: Record<string, unknown>) => void;
}>) {
const { i18n } = useTranslation();
const copy = notificationHistoryCopy(row, i18n.language);
return (
<Pressable
className="mb-3 rounded-2xl border border-border bg-card px-4 py-3 active:opacity-70"
accessibilityRole="button"
onPress={() => {
onOpen(row.payload);
}}
>
<View className="flex-row items-start gap-3">
<Text className="flex-1 text-sm font-medium" numberOfLines={2}>
{copy.title}
</Text>
<Text variant="muted" className="text-xs">
{timeAgo(parseTimestamp(row.createdAt), undefined, now)}
</Text>
</View>
<Text variant="muted" className="mt-1 text-sm" numberOfLines={3}>
{copy.body}
</Text>
</Pressable>
);
}
Loading
Loading