diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 094abe83..7917e0c1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -9,9 +9,8 @@ import { useEffect } from 'react' import { RootState } from '@/app/store' import CircularProgress from '@mui/material/CircularProgress' import Snackbar from '@mui/material/Snackbar' -import Alert from '@mui/material/Alert' -import L from 'leaflet' -import 'leaflet/dist/leaflet.css' // Import Leaflet CSS +import 'leaflet/dist/leaflet.css' + export default function App() { const status: string = useSelector((state: RootState) => state.omrr.status) const dispatch = useDispatch() @@ -20,11 +19,11 @@ export default function App() { dispatch(fetchOMRRData()) }, [dispatch]) return ( - +
- + {status === 'loading' ? ( ) : status === 'failed' ? ( diff --git a/frontend/src/components/AuthorizationDetails.tsx b/frontend/src/components/AuthorizationDetails.tsx index ecb81514..723042a9 100644 --- a/frontend/src/components/AuthorizationDetails.tsx +++ b/frontend/src/components/AuthorizationDetails.tsx @@ -1,56 +1,87 @@ import React from 'react' import { useLocation } from 'react-router-dom' -import { Button, Card, Grid, Stack,Chip } from '@mui/material' +import { Button, Card, Chip, Grid } from '@mui/material' import { MapContainer, Marker, TileLayer } from 'react-leaflet' import { useNavigate } from 'react-router' import L, { LatLngLiteral } from 'leaflet' -// @ts-ignore import pin from '../assets/marker-icon-2x-red.png' -// @ts-ignore import shadow from '../assets/marker-shadow.png' +import { useTheme } from '@mui/material/styles' +import useMediaQuery from '@mui/material/useMediaQuery' +import OmrrData from '@/interfaces/omrr' -export default function AuthorizationDetails() { - //define red icon - const redIcon = new L.Icon({ - //read from assets - iconUrl: pin, - shadowUrl: shadow, - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - shadowSize: [41, 41], - }) - const navigate = useNavigate() - const buttonClicked = (route: any) => { - navigate(route) // reset the state - } - const location = useLocation() - const data = location?.state?.data - const facilityLocation: LatLngLiteral = { lat: data.Latitude, lng: data.Longitude } - return ( - - - - - - - - {data['Regulated Party']} - - - +function authorizationSection(mdMatches: boolean, data: OmrrData) { + return <> + {mdMatches && <> + + + Authorization Status + + + Authorization Number + + + Effective/Issue Date + + + Last Amendment Date + + + + + + + + {data['Authorization Number']} + + + {data['Effective/Issue Date']?.toString()} + + + {data['Last Amendment Date']?.toString()} + + + } + {!mdMatches && <> + + Authorization Status - - + + Authorization Number - - + + + + + + + + {data['Authorization Number']} + + + + Effective/Issue Date - - + + Last Amendment Date - + + + + + + {data['Effective/Issue Date']?.toString()} + + + {data['Last Amendment Date']?.toString()} + + + } + +} + +export default function AuthorizationDetails() { + const theme = useTheme() + const mdMatches = useMediaQuery(theme.breakpoints.up('md')) + //define red icon + const redIcon = new L.Icon({ + //read from assets + iconUrl: pin, + shadowUrl: shadow, + iconSize: [25, 41], + iconAnchor: [12, 41], + popupAnchor: [1, -34], + shadowSize: [41, 41], + }) + const navigate = useNavigate() + const buttonClicked = (route: any) => { + navigate(route) // reset the state + } + const location = useLocation() + const data = location?.state?.data + const facilityLocation: LatLngLiteral = { lat: data.Latitude, lng: data.Longitude } + return ( + + + + + + + + {data['Regulated Party']} - - - + {authorizationSection(mdMatches, data)} + + + + + + + + + + - - - {data['Authorization Number']} - - - {data['Effective/Issue Date']} - - - {data['Last Amendment Date']} - + + + - - - - - - - - {/* Content of the third card */} - + + + + {/* Content of the third card */} + ) } diff --git a/frontend/src/components/AuthorizationList.tsx b/frontend/src/components/AuthorizationList.tsx index 99653e94..a5b935cb 100644 --- a/frontend/src/components/AuthorizationList.tsx +++ b/frontend/src/components/AuthorizationList.tsx @@ -60,12 +60,11 @@ export default function AuthorizationList() { const [location, setLocation] = useState(null)*/ const pagination = ( - - + ) const handleLocation = () => { @@ -145,6 +144,7 @@ export default function AuthorizationList() { @@ -179,20 +179,22 @@ export default function AuthorizationList() { > + - + Search by: + + - + - + + {expand && ( - + - - + + - + + */}