Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UI updates #39

Merged
merged 8 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@bcgov/bc-sans": "^2.1.0",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@js-joda/core": "^5.6.1",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.1",
"@mui/system": "^5.15.9",
Expand Down
34 changes: 32 additions & 2 deletions frontend/src/components/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import Table from '@mui/material/Table'
import TableBody from '@mui/material/TableBody'
import TableCell from '@mui/material/TableCell'
import TableRow from '@mui/material/TableRow'
import { DataGrid, GridColDef, GridToolbar } from '@mui/x-data-grid'
import {
DataGrid,
GridColDef,
GridFilterModel,
GridToolbar,
} from '@mui/x-data-grid'
import { useState } from 'react'
import { useSelector } from 'react-redux'
const columns: GridColDef[] = [
Expand Down Expand Up @@ -92,7 +97,15 @@ export default function DataTable() {
const status: string = useSelector((state: RootState) => state.omrr.status)

const [selectedRow, setSelectedRow] = useState(null)

const [filterModel, setFilterModel] = useState<GridFilterModel>({
items: [
{
field: 'Authorization Status',
operator: 'equals',
value: 'Active',
},
],
})
const handleClose = () => {
setSelectedRow(null)
}
Expand All @@ -107,12 +120,29 @@ export default function DataTable() {
}}
>
<DataGrid
sx={{
'& .MuiDataGrid-toolbarContainer': {
border: '1px solid #385a8a',
backgroundColor: '#385a8a',
color: '#ffffff',
},
'& .MuiInputBase-root': {
backgroundColor: '#ffffff',
},
}}
slots={{ toolbar: GridToolbar }}
disableColumnSelector
slotProps={{
toolbar: {
showQuickFilter: true,
quickFilterProps: {
placeholder: 'Search across all fields',
debounceMs: 250,
},
},
}}
filterModel={filterModel}
onFilterModelChange={(newFilterModel) => setFilterModel(newFilterModel)}
experimentalFeatures={{ ariaV7: true }}
checkboxSelection={false}
rows={data}
Expand Down
31 changes: 19 additions & 12 deletions frontend/src/features/omrr/omrr-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { createSlice } from '@reduxjs/toolkit'
import { RootState } from '@/app/store'
import apiService from '@/service/api-service'
import { DateTimeFormatter, nativeJs } from '~/@js-joda/core'

export interface OmrrSliceState {
value: OmrrData[]
Expand Down Expand Up @@ -56,23 +57,29 @@ export const omrrSlice = createSlice({
state.status = 'succeeded'
// Store the data in the state

let omrrData = [];
for(const item of action.payload){
let omrrData = []
for (const item of action.payload) {
const individualData = {
...item
...item,
}
if(individualData['Effective/Issue Date']){
individualData['Effective/Issue Date'] = new Date(item['Effective/Issue Date']).toLocaleDateString();
}else{
individualData['Effective/Issue Date'] = undefined;
if (individualData['Effective/Issue Date']) {
const date = new Date(item['Effective/Issue Date'])
individualData['Effective/Issue Date'] = nativeJs(date).format(
DateTimeFormatter.ISO_LOCAL_DATE,
)
} else {
individualData['Effective/Issue Date'] = undefined
}
if(item['Last Amendment Date']){
individualData['Last Amendment Date'] = new Date(item['Last Amendment Date']).toLocaleDateString();
}else{
individualData['Last Amendment Date'] = undefined;
if (item['Last Amendment Date']) {
const date = new Date(item['Last Amendment Date'])
individualData['Last Amendment Date'] = nativeJs(date).format(
DateTimeFormatter.ISO_LOCAL_DATE,
)
} else {
individualData['Last Amendment Date'] = undefined
}

omrrData.push(individualData);
omrrData.push(individualData)
}
state.value = omrrData
state.mapValue = state.value?.filter(
Expand Down
36 changes: 20 additions & 16 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
@font-face {
font-family: 'BCSans';
font-style: normal;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-Regular.woff') format('woff');
font-family: 'BCSans';
font-style: normal;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-Regular.woff')
format('woff');
}

@font-face {
font-family: 'BCSans-Italic';
font-style: italic;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-Italic.woff') format('woff');
font-family: 'BCSans-Italic';
font-style: italic;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-Italic.woff')
format('woff');
}

@font-face {
font-family: 'BCSans-Bold';
font-weight: 700;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-Bold.woff') format('woff');
font-family: 'BCSans-Bold';
font-weight: 700;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-Bold.woff')
format('woff');
}

@font-face {
font-family: 'BCSans-BoldItalic';
font-style: italic;
font-weight: 700;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-BoldItalic.woff') format('woff');
font-family: 'BCSans-BoldItalic';
font-style: italic;
font-weight: 700;
src: url('../node_modules/@bcgov/bc-sans/fonts/BCSans-BoldItalic.woff')
format('woff');
}

.MuiDrawer-paperAnchorLeft {
margin-top: 4.2em !important;
margin-top: 4.2em !important;
}

.map-container {
border-radius: 4px;
z-index: 1;
border-radius: 4px;
z-index: 1;
}
2 changes: 1 addition & 1 deletion frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CssBaseline } from '@mui/material'
import theme from './theme'
import App from './App'
import { store } from './app/store'
import "./index.css";
import './index.css'
import { Provider } from 'react-redux'

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
Expand Down