Skip to content

Commit

Permalink
feat: align UI with wireframes (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp authored Mar 19, 2024
1 parent 357b331 commit bb8cef6
Show file tree
Hide file tree
Showing 14 changed files with 1,160 additions and 281 deletions.
1 change: 0 additions & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
steps:
- uses: bcgov-nr/[email protected]
with:
keep_versions: 50
package: ${{ matrix.package }}
tag: ${{ github.event.number }}
tag_fallback: latest
Expand Down
4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="Description" content="OMRR" />
<meta name="Description" content="Organics Info" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="theme-color" content="#003366" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="preload" href="https://fonts.googleapis.com/css?family=Material+Icons" as="style" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
<title>OMRR</title>
<title>Organics Info</title>
</head>
<body>
<div id="root"></div>
Expand Down
72 changes: 36 additions & 36 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import Box from '@mui/material/Box'
import Grid from '@mui/material/Grid'
import Header from '@/components/Header'
import Footer from '@/components/Footer'
import AppRoutes from '@/routes'
import { BrowserRouter } from 'react-router-dom'
import LeftDrawer from '@/components/LeftDrawer'
import { Stack } from '@mui/system'
import { useDispatch } from 'react-redux'
import { useDispatch, useSelector } from 'react-redux'
import { fetchOMRRData } from '@/features/omrr/omrr-slice'
import { useEffect } from 'react'
import apiService from '@/service/api-service'
import { AxiosResponse } from '~/axios'

const styles = {
container: {
display: 'flex',
flexDirection: 'column',
minHeight: '100vh',
},
content: {
flexGrow: 1,
marginTop: '5em',
marginRight: '1em',
marginLeft: '1em',
marginBottom: '5em',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'flex-start',
},
}

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
export default function App() {
const status: string = useSelector((state: RootState) => state.omrr.status)
const dispatch = useDispatch()
useEffect(() => {
//@ts-expect-error
dispatch(fetchOMRRData())
}, [dispatch])
return (
<Box sx={styles.container}>
<Header />
<BrowserRouter>
<Stack direction="row" spacing={2} sx={{ margin: '5em' }}>
<LeftDrawer />
<AppRoutes />
</Stack>
</BrowserRouter>
<Footer />
</Box>
<Grid container spacing={0}>
<Grid item xs={12}>
<Header />
</Grid>
<Grid item style={{ flexGrow: 1, minHeight:'93vh' }} xs={12}>
{status === 'loading' ? (
<CircularProgress />
) : status === 'failed' ? (
<Snackbar
message="Loading Failed, Please try later refreshing the page"
sx={{ background: '#fffffff', backgroundColor: '#fffffff' }}
color="error"
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
autoHideDuration={6000}
draggable
open={true}
></Snackbar>
) : (
<BrowserRouter>
<AppRoutes />
</BrowserRouter>
)}
</Grid>
<Grid item xs={12}>
<Footer />
</Grid>
</Grid>
)
}
139 changes: 139 additions & 0 deletions frontend/src/components/AuthorizationDetails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import React from 'react'
import { useLocation } from 'react-router-dom'
import { Button, Card, Grid, Stack,Chip } 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'

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 (

<Grid container spacing={1} sx={{marginTop:'6em', marginLeft:'2em', maxWidth:'95%' }}>
<Grid item xs={3} sm={6} md={12}>
<Button sx={{
background: '#8D8D8D',
padding: '8px 16px',
borderRadius: '6px;',
color:'#000000',
textTransform: 'none',
}} onClick={() => buttonClicked('/search')}>Back To Search</Button>
</Grid>
<Grid item xs={3} sm={6} md={12} >
<Stack direction="row" justifyContent="space-between">
<span style={{
color:'#000000',
fontFamily: 'BC Sans',
fontStyle: 'bold',
fontSize: '2em',
lineHeight: '3em',
}}>{data['Regulated Party']}</span>
</Stack>
<Grid container direction="row" spacing={1}>
<Grid item xs={3}>
<span style={{
color: '#000000',
fontFamily: 'BC Sans',
fontStyle: 'normal',
fontWeight: 'bold',
fontSize: '1em',
lineHeight: '1em',
}}>Authorization Status</span>
</Grid>
<Grid item xs={3}>
<span style={{
color: '#000000',
fontFamily: 'BC Sans',
fontStyle: 'normal',
fontWeight: 'bold',
fontSize: '1em',
lineHeight: '1em',
}}>Authorization Number</span>
</Grid>
<Grid item xs={3}>
<span style={{
color: '#000000',
fontFamily: 'BC Sans',
fontStyle: 'normal',
fontWeight: 'bold',
fontSize: '1em',
lineHeight: '1em',
}}>Effective/Issue Date</span>
</Grid>
<Grid item xs={3}>
<span style={{
color: '#000000',
fontFamily: 'BC Sans',
fontStyle: 'normal',
fontWeight: 'bold',
fontSize: '1em',
lineHeight: '1em',
}}>Last Amendment Date</span>
</Grid>
</Grid>
<Grid container direction="row" spacing={1}>
<Grid item xs={3}>
<Chip
sx={{
background:
data['Authorization Status'] === 'Active'
? '#353433'
: '#605E5C',
color: '#ffffff',
}}
label={data['Authorization Status']}
/>
</Grid>
<Grid item xs={3}>
<span>{data['Authorization Number']}</span>
</Grid>
<Grid item xs={3}>
<span>{data['Effective/Issue Date']}</span>
</Grid>
<Grid item xs={3}>
<span>{data['Last Amendment Date']}</span>
</Grid>
</Grid>
</Grid>
<Grid item xs={12} sx={{marginTop:'2em'}}>
<MapContainer
id="map"
center={facilityLocation}
scrollWheelZoom={false}
zoom={12}
style={{ height: '60em' }}
className="map-container"
>
<TileLayer
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<Marker key={data['Authorization Number']} position={facilityLocation} icon={redIcon} />
</MapContainer>
</Grid>
<Grid item xs={4}>
<Card>{/* Content of the third card */}</Card>
</Grid>
</Grid>
)
}
Loading

0 comments on commit bb8cef6

Please sign in to comment.