-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add the same kind of arguments to the route resource - move some buttons to a drop down menu as the list was getting crowded -
- Loading branch information
1 parent
5df69fe
commit 3a95683
Showing
10 changed files
with
179 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as React from 'react' | ||
import { DeleteWithUndoButton } from 'react-admin' | ||
import { IconButton, Menu, MenuItem } from '@mui/material' | ||
import MoreVertIcon from '@mui/icons-material/MoreVert' | ||
|
||
import { ExportButton } from './Export' | ||
import { PushToProd } from './PushToApi' | ||
|
||
export function ExtraMenuActions({ resource }: { resource: string }) { | ||
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null) | ||
|
||
const handleClose = (e: React.MouseEvent) => { | ||
e.stopPropagation() | ||
setAnchorEl(null) | ||
} | ||
|
||
return ( | ||
<> | ||
<IconButton | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
setAnchorEl(e.currentTarget) | ||
}} | ||
> | ||
<MoreVertIcon /> | ||
</IconButton> | ||
<Menu open={!!anchorEl} anchorEl={anchorEl} onClose={handleClose}> | ||
<MenuItem onClick={handleClose}> | ||
<DeleteWithUndoButton /> | ||
</MenuItem> | ||
<MenuItem onClick={handleClose}> | ||
<ExportButton resource={resource} /> | ||
</MenuItem> | ||
<MenuItem | ||
onClick={handleClose} | ||
sx={{ display: { xs: 'flex', sm: 'none' } }} | ||
> | ||
<PushToProd resource={resource} /> | ||
</MenuItem> | ||
</Menu> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import * as React from 'react' | ||
import { | ||
// SavedQueriesList, | ||
FilterLiveSearch, | ||
FilterList, | ||
FilterListItem, | ||
} from 'react-admin' | ||
import { useQuery } from 'react-query' | ||
import { Card, CardContent } from '@mui/material' | ||
import AutoModeIcon from '@mui/icons-material/AutoMode' | ||
import SupervisedUserCircleIcon from '@mui/icons-material/SupervisedUserCircle' | ||
|
||
import { useStatic } from '@hooks/useStatic' | ||
import { RDM_ROUTES, UNOWN_ROUTES } from '@assets/constants' | ||
import { BasicKojiEntry, KojiResponse } from '@assets/types' | ||
import { fetchWrapper } from '@services/fetches' | ||
|
||
export function RouteFilter() { | ||
const { scannerType } = useStatic.getState() | ||
const { data } = useQuery('unique_geofences', () => | ||
fetchWrapper<KojiResponse<BasicKojiEntry[]>>( | ||
'/internal/admin/route/parent', | ||
), | ||
) | ||
return ( | ||
<Card sx={{ order: -1, width: 225 }}> | ||
<CardContent> | ||
{/* <SavedQueriesList /> */} | ||
<FilterLiveSearch /> | ||
<FilterList label="Mode" icon={<AutoModeIcon />}> | ||
{[ | ||
...(scannerType === 'rdm' ? RDM_ROUTES : UNOWN_ROUTES), | ||
'unset', | ||
].map((mode) => ( | ||
<FilterListItem key={mode} label={mode} value={{ mode }} /> | ||
))} | ||
</FilterList> | ||
<FilterList label="Geofence" icon={<SupervisedUserCircleIcon />}> | ||
<div style={{ maxHeight: 400, overflow: 'auto' }}> | ||
{(data?.data || []).map((fence) => ( | ||
<FilterListItem | ||
key={fence.id} | ||
label={fence.name} | ||
value={{ geofenceid: fence.id }} | ||
/> | ||
))} | ||
</div> | ||
</FilterList> | ||
</CardContent> | ||
</Card> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.