-
Notifications
You must be signed in to change notification settings - Fork 9
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
TPI Frontend #3862
TPI Frontend #3862
Changes from 28 commits
06be346
491f327
5be177b
fd5eee0
46555c0
5bacf07
ab9d851
d7a6965
81844f4
f36cb61
4e651ee
7eac11e
1344dc4
cf50337
6a27e6b
5797062
bb1b3de
bbf19e9
f306c46
518bb41
82cbb29
af7bc88
5ed6210
d2b2de6
618ca60
b920342
12641d2
c013a41
d328405
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ interface InfoPanelProps { | |
// A component to host information in a side panel in ASA. | ||
const InfoPanel = React.forwardRef(({ children }: InfoPanelProps, ref: React.ForwardedRef<HTMLDivElement>) => { | ||
return ( | ||
<Grid data-testid="info-panel" item ref={ref} sx={{ width: '500px', overflowY: 'auto' }}> | ||
<Grid data-testid="info-panel" item ref={ref} sx={{ minWidth: '500px', maxWidth: '500px', overflowY: 'auto' }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, what's the purpose of setting both min and max width to be equal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No idea, picked it up from the existing commits in the branch but I can try undoing it 😅 |
||
{children} | ||
</Grid> | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react' | ||
import { Box, Grid, Typography } from '@mui/material' | ||
|
||
const FLAG_COLOUR = '#CCCCCC' | ||
|
||
interface ElevationFlagProps { | ||
testId?: string | ||
percent: number | ||
} | ||
|
||
const ElevationFlag = ({ percent, testId }: ElevationFlagProps) => { | ||
return ( | ||
<Grid item sx={{ display: 'flex', alignItems: 'center', flexGrow: 1, justifyContent: 'flex-start' }} xs={12}> | ||
<Box | ||
sx={{ | ||
backgroundColor: FLAG_COLOUR, | ||
clipPath: 'polygon(0 50%, 10% 0, 100% 0, 100% 100%, 10% 100%)', | ||
height: '32px', | ||
padding: '1px', | ||
width: '65%' | ||
}}> | ||
<Box | ||
sx={{ | ||
alignItems: 'center', | ||
backgroundImage: `linear-gradient(to right, ${FLAG_COLOUR} ${percent}%, #FFFFFFFF ${percent}%)`, | ||
clipPath: 'polygon(0 50%, 10% 0, 100% 0, 100% 100%, 10% 100%)', | ||
display: 'flex', | ||
height: '30px', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<Typography sx={{ fontSize: '0.75em' }} data-testid={testId}>{percent}%</Typography> | ||
</Box> | ||
</Box> | ||
</Grid> | ||
) | ||
} | ||
|
||
export default React.memo(ElevationFlag) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
import { Grid, Typography } from '@mui/material' | ||
|
||
interface ElevationLabelProps { | ||
label: string | ||
} | ||
|
||
const ElevationLabel = ({ label }: ElevationLabelProps) => { | ||
return ( | ||
<Grid item sx={{ alignItems: 'center', display: 'flex', height: '25%', justifyContent: 'flex-end' }} xs={12}> | ||
<Typography sx={{ fontSize: '0.75em' }}>{label}</Typography> | ||
</Grid> | ||
) | ||
} | ||
|
||
export default React.memo(ElevationLabel) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from 'react' | ||
import { useTheme } from '@mui/material/styles' | ||
import Grid from '@mui/material/Unstable_Grid2' | ||
import Typography from '@mui/material/Typography' | ||
import ElevationFlag from 'features/fba/components/viz/ElevationFlag' | ||
import ElevationLabel from 'features/fba/components/viz/ElevationLabel' | ||
import TPIMountain from 'features/fba/components/viz/TPIMountain' | ||
import { Box } from '@mui/material' | ||
|
||
enum ElevationOption { | ||
BOTTOM = 'Valley Bottom', | ||
MID = 'Mid Slope', | ||
Upper = 'Upper Slope' | ||
} | ||
|
||
interface ElevationStatusProps { | ||
bottom: number | ||
mid: number | ||
upper: number | ||
} | ||
|
||
const ElevationStatus = ({ bottom, mid, upper }: ElevationStatusProps) => { | ||
const theme = useTheme() | ||
return ( | ||
<Box sx={{ paddingBottom: theme.spacing(2), paddingTop: theme.spacing(2) }} data-testid="elevation-status"> | ||
<Grid container sx={{ minHeight: theme.spacing(19) }} xs={12}> | ||
<Grid container sx={{ paddingRight: theme.spacing(2) }} xs={4}> | ||
<Grid sx={{ alignItems: 'center', display: 'flex', height: '25%', justifyContent: 'flex-end' }} xs={12}> | ||
<Typography | ||
sx={{ | ||
fontSize: '0.75em', | ||
textAlign: 'right', | ||
fontWeight: 'bold', | ||
maxWidth: '75%' | ||
}} | ||
> | ||
Topographic Position: | ||
</Typography> | ||
</Grid> | ||
<ElevationLabel label={ElevationOption.Upper} /> | ||
<ElevationLabel label={ElevationOption.MID} /> | ||
<ElevationLabel label={ElevationOption.BOTTOM} /> | ||
</Grid> | ||
<Grid container sx={{ alignItems: 'flex-end', display: 'flex' }} xs={4} data-testid='tpi-mountain'> | ||
<Grid sx={{ display: 'flex', alignItems: 'flex-end', height: '80%', justifyContent: 'center' }} xs={12}> | ||
<TPIMountain /> | ||
</Grid> | ||
</Grid> | ||
<Grid container sx={{ paddingLeft: theme.spacing(2) }} xs={4}> | ||
<Grid sx={{ alignItems: 'center', display: 'flex', height: '25%', justifyContent: 'flex-start' }} xs={12}> | ||
<Typography | ||
sx={{ | ||
fontSize: '0.75em', | ||
textAlign: 'left', | ||
fontWeight: 'bold', | ||
maxWidth: '75%' | ||
}} | ||
> | ||
Proportion of Advisory Area: | ||
</Typography> | ||
</Grid> | ||
<ElevationFlag percent={upper} testId='upper-slope' /> | ||
<ElevationFlag percent={mid} testId='mid-slope' /> | ||
<ElevationFlag percent={bottom} testId='valley-bottom' /> | ||
</Grid> | ||
</Grid> | ||
</Box> | ||
) | ||
} | ||
|
||
export default ElevationStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is pixel_size needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's expected to compute the area in the TPI endpoint