@@ -3,19 +3,19 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
33import { DataTableColumnHeader } from '@/components/ui/DataTable/DataTableColumnHeader' ;
44import { QueryParamsDataTable } from '@/components/ui/DataTable/QueryParamsDataTable' ;
55import { Separator } from '@/components/ui/separator' ;
6+ import { ChevronRightIcon } from '@heroicons/react/24/outline' ;
67import { Link , useNavigate } from '@tanstack/react-router' ;
78import type { CellContext , ColumnDef } from '@tanstack/react-table' ;
89import { Plus } from 'lucide-react' ;
9- import { ChevronRightIcon } from '@heroicons/react/24/outline' ;
1010
11- import { usePushMessages } from '../../hooks/push-messages-queries' ;
12- import { format } from 'date-fns' ;
13- import type { PushMessageModel } from '../../models/push-message' ;
14- import { useCallback } from 'react' ;
1511import { DateTimeFormat } from '@/common/formats' ;
16- import type { TableCellProps } from '@/components/ui/DataTable/DataTable' ;
1712import type { FunctionComponent } from '@/common/types' ;
13+ import type { TableCellProps } from '@/components/ui/DataTable/DataTable' ;
1814import { useCurrentElectionRoundStore } from '@/context/election-round.store' ;
15+ import { format } from 'date-fns' ;
16+ import { useCallback } from 'react' ;
17+ import { usePushMessages } from '../../hooks/push-messages-queries' ;
18+ import type { PushMessageModel } from '../../models/push-message' ;
1919
2020function PushMessages ( ) : FunctionComponent {
2121 const pushMessagesColDefs : ColumnDef < PushMessageModel > [ ] = [
@@ -24,67 +24,37 @@ function PushMessages(): FunctionComponent {
2424 accessorKey : 'sentAt' ,
2525 enableSorting : false ,
2626 enableGlobalFilter : false ,
27- cell : ( { row } ) => < div > { format ( row . original . sentAt , DateTimeFormat ) } </ div >
27+ cell : ( { row } ) => < div > { format ( row . original . sentAt , DateTimeFormat ) } </ div > ,
2828 } ,
2929 {
3030 header : ( { column } ) => < DataTableColumnHeader title = 'Sender name' column = { column } /> ,
3131 accessorKey : 'sender' ,
3232 enableSorting : false ,
3333 enableGlobalFilter : false ,
34- cell : ( {
35- row : {
36- original : { sender } ,
37- } ,
38- } ) => (
39- < p >
40- { sender }
41- </ p >
42- ) ,
4334 } ,
4435 {
4536 header : ( { column } ) => < DataTableColumnHeader title = 'Targeted Observers' column = { column } /> ,
4637 accessorKey : 'numberOfTargetedObservers' ,
4738 enableSorting : false ,
4839 enableGlobalFilter : false ,
49- cell : ( {
50- row : {
51- original : { numberOfTargetedObservers } ,
52- } ,
53- } ) => (
54- < p >
55- { numberOfTargetedObservers }
56- </ p >
57- ) ,
40+ } ,
41+ {
42+ header : ( { column } ) => < DataTableColumnHeader title = 'Read notifications' column = { column } /> ,
43+ accessorKey : 'numberOfReadNotifications' ,
44+ enableSorting : false ,
45+ enableGlobalFilter : false ,
5846 } ,
5947 {
6048 header : ( { column } ) => < DataTableColumnHeader title = 'Title' column = { column } /> ,
6149 accessorKey : 'title' ,
6250 enableSorting : false ,
6351 enableGlobalFilter : false ,
64- cell : ( {
65- row : {
66- original : { title } ,
67- } ,
68- } ) => (
69- < p >
70- { title }
71- </ p >
72- ) ,
7352 } ,
7453 {
7554 header : ( { column } ) => < DataTableColumnHeader title = 'Body' column = { column } /> ,
7655 accessorKey : 'body' ,
7756 enableSorting : false ,
7857 enableGlobalFilter : false ,
79- cell : ( {
80- row : {
81- original : { body } ,
82- } ,
83- } ) => (
84- < p >
85- { body }
86- </ p >
87- ) ,
8858 } ,
8959 {
9060 header : '' ,
@@ -105,15 +75,14 @@ function PushMessages(): FunctionComponent {
10575
10676 const getCellProps = ( context : CellContext < PushMessageModel , unknown > ) : TableCellProps | void => {
10777 if ( context . column . id === 'body' || context . column . id === 'title' ) {
108-
10978 return {
11079 className : 'truncate hover:text-clip' ,
111- }
80+ } ;
11281 }
113- }
82+ } ;
11483
11584 const navigate = useNavigate ( ) ;
116- const currentElectionRoundId = useCurrentElectionRoundStore ( s => s . currentElectionRoundId ) ;
85+ const currentElectionRoundId = useCurrentElectionRoundStore ( ( s ) => s . currentElectionRoundId ) ;
11786
11887 const navigateToPushMessage = useCallback (
11988 ( id : string ) => {
0 commit comments