'use client'; import * as React from 'react'; import Avatar from '@mui/material/Avatar'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import CardHeader from '@mui/material/CardHeader'; import Chip from '@mui/material/Chip'; import Select from '@mui/material/Select'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import { EnvelopeSimple as EnvelopeSimpleIcon } from '@phosphor-icons/react/dist/ssr/EnvelopeSimple'; import { dayjs } from '@/lib/dayjs'; import { DataTable } from '@/components/core/data-table'; import type { ColumnDef } from '@/components/core/data-table'; import { Option } from '@/components/core/option'; export interface Notification { id: string; type: string; status: 'delivered' | 'pending' | 'failed'; createdAt: Date; } const columns = [ { formatter: (row): React.JSX.Element => ( {row.type} ), name: 'Type', width: '300px', }, { formatter: (row): React.JSX.Element => { const mapping = { delivered: { label: 'Delivered', color: 'success' }, pending: { label: 'Pending', color: 'warning' }, failed: { label: 'Failed', color: 'error' }, } as const; const { label, color } = mapping[row.status] ?? { label: 'Unknown', color: 'secondary' }; return ; }, name: 'Status', width: '200px', }, { formatter: (row): React.JSX.Element => ( {dayjs(row.createdAt).format('MMM D, YYYY hh:mm A')} ), name: 'Date', align: 'right', }, ] satisfies ColumnDef[]; export interface NotificationsProps { notifications: Notification[]; } export function Notifications({ notifications }: NotificationsProps): React.JSX.Element { return ( } title="Notifications" /> Resend last invoice Send password reset Send verification } variant="contained"> Send email columns={columns} rows={notifications} /> ); }