@@ -42,13 +42,6 @@ interface DashboardRowFilters {
4242 'project-filter' ?: string ;
4343}
4444
45- const DASHBOARD_COLUMNS = [
46- { label : 'Dashboard' , key : 'name' as keyof DashboardRow , index : 0 } ,
47- { label : 'Project' , key : 'project' as keyof DashboardRow , index : 1 } ,
48- { label : 'Created on' , key : 'created' as keyof DashboardRow , index : 2 } ,
49- { label : 'Last Modified' , key : 'modified' as keyof DashboardRow , index : 3 } ,
50- ] ;
51-
5245const sortDashboardData = (
5346 data : DashboardRow [ ] ,
5447 sortBy : keyof DashboardRow | undefined ,
@@ -101,10 +94,18 @@ const DashboardsTable: React.FunctionComponent<DashboardsTableProps> = ({
10194 const pagination = useDataViewPagination ( { perPage : perPageOptions [ 0 ] . value } ) ;
10295 const { page, perPage } = pagination ;
10396
104- const sortByIndex = useMemo (
105- ( ) => DASHBOARD_COLUMNS . findIndex ( ( item ) => item . key === sortBy ) ,
106- [ sortBy ] ,
97+ const DASHBOARD_COLUMNS = useMemo (
98+ ( ) => [
99+ { label : t ( 'Dashboard' ) , key : 'name' as keyof DashboardRow , index : 0 } ,
100+ { label : t ( 'Project' ) , key : 'project' as keyof DashboardRow , index : 1 } ,
101+ { label : t ( 'Created on' ) , key : 'created' as keyof DashboardRow , index : 2 } ,
102+ { label : t ( 'Last Modified' ) , key : 'modified' as keyof DashboardRow , index : 3 } ,
103+ ] ,
104+ [ t ] ,
107105 ) ;
106+ const sortByIndex = useMemo ( ( ) => {
107+ return DASHBOARD_COLUMNS . findIndex ( ( item ) => item . key === sortBy ) ;
108+ } , [ DASHBOARD_COLUMNS , sortBy ] ) ;
108109
109110 const getSortParams = ( columnIndex : number ) : ThProps [ 'sort' ] => ( {
110111 sortBy : {
@@ -195,11 +196,15 @@ const DashboardsTable: React.FunctionComponent<DashboardsTableProps> = ({
195196 pagination = { < PaginationTool /> }
196197 filters = {
197198 < DataViewFilters onChange = { ( _e , values ) => onSetFilters ( values ) } values = { filters } >
198- < DataViewTextFilter filterId = "name" title = "Name" placeholder = "Filter by name" />
199+ < DataViewTextFilter
200+ filterId = "name"
201+ title = { t ( 'Name' ) }
202+ placeholder = { t ( 'Filter by name' ) }
203+ />
199204 < DataViewTextFilter
200205 filterId = "project-filter"
201- title = " Project"
202- placeholder = " Filter by project"
206+ title = { t ( ' Project' ) }
207+ placeholder = { t ( ' Filter by project' ) }
203208 />
204209 </ DataViewFilters >
205210 }
0 commit comments