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

scenario card arrows added #149

Merged
merged 9 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 7 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
35 changes: 35 additions & 0 deletions frontend/src/components/ScenarioCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import {Dictionary} from '../util/util';
import {useTranslation} from 'react-i18next';
import {NumberFormatter} from '../util/hooks';
import {CheckBoxOutlineBlank, CheckBox} from '@mui/icons-material';
import ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import ArrowRightIcon from '@mui/icons-material/ArrowRight';

/**
* React Component to render individual Scenario Card
Expand Down Expand Up @@ -202,6 +205,7 @@ export default function ScenarioCard(props: ScenarioCardProps): JSX.Element {
{compartments.map((compartment, i) => (
// hide compartment if expandProperties false and index > 4
// highlight compartment if selectedProperty === compartment

<ListItem
key={compartment}
sx={{
Expand Down Expand Up @@ -234,6 +238,37 @@ export default function ScenarioCard(props: ScenarioCardProps): JSX.Element {
flexBasis: '45%',
}}
/>
<ArrowDropDownIcon
color={'success'}
fontSize={'medium'}
// shows downwards green arrows if getCompartmentRate < 0%
sx={{display: parseFloat(getCompartmentRate(compartment)) < 0 ? 'block' : 'none'}}
></ArrowDropDownIcon>
<ArrowDropUpIcon
color={'error'}
fontSize={'medium'}
sx={{
display:
// shows upwards red arrows if getCompartmentRate > 3%. If there is no RKI value for that compartment i.e., getCompartmentRate is Null, then it will check the getCompartmentValue (scenario values only) which will always me positive.
parseFloat(getCompartmentRate(compartment)) > 3 ||
(parseFloat(getCompartmentValue(compartment)) > 0 && getCompartmentRate(compartment) === 'N/A')
? 'block'
: 'none',
}}
></ArrowDropUpIcon>
<ArrowRightIcon
color={'action'}
fontSize={'medium'}
// shows grey arrows (stagnation) if getCompartmentRate is between 0 and 3 %. If there is no RKI value and then it checks for getCompartmentValue.
sx={{
display:
(parseFloat(getCompartmentRate(compartment)) >= 0 &&
parseFloat(getCompartmentRate(compartment)) <= 3) ||
parseFloat(getCompartmentValue(compartment)) === 0
? 'block'
: 'none',
}}
></ArrowRightIcon>
</ListItem>
))}
</List>
Expand Down
16 changes: 13 additions & 3 deletions frontend/src/components/Sidebar/DistrictMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import HeatLegendEdit from './HeatLegendEdit';
import {HeatmapLegend} from '../../types/heatmapLegend';
import {LockOpen} from '@mui/icons-material';
import LoadingContainer from '../shared/LoadingContainer';

import HomeIcon from '@mui/icons-material/Home';
NXXR marked this conversation as resolved.
Show resolved Hide resolved
const {useRef} = React;

interface IRegionPolygon {
Expand All @@ -32,7 +32,7 @@ interface IRegionPolygon {

export default function DistrictMap(): JSX.Element {
const [geodata, setGeodata] = useState<GeoJSON.GeoJSON | null>(null);
//const selectedDistrict = useAppSelector((state) => state.dataSelection.district);
const selectedDistrict = useAppSelector((state) => state.dataSelection.district);
NXXR marked this conversation as resolved.
Show resolved Hide resolved
const selectedScenario = useAppSelector((state) => state.dataSelection.scenario);
const selectedCompartment = useAppSelector((state) => state.dataSelection.compartment);
const selectedDate = useAppSelector((state) => state.dataSelection.date);
Expand Down Expand Up @@ -256,7 +256,10 @@ export default function DistrictMap(): JSX.Element {
isFetching,
legend,
]);

useEffect(() => {
// search polygon list for selected district
// apply hover effect or highlight hovering effect.
}, [selectedDistrict]);
NXXR marked this conversation as resolved.
Show resolved Hide resolved
return (
<LoadingContainer show={isFetching} overlayColor={theme.palette.background.default}>
<Box id='mapdiv' height={'650px'} />
Expand All @@ -275,6 +278,13 @@ export default function DistrictMap(): JSX.Element {
/>
</Grid>
<Grid item container justifyContent='center' xs={1}>
<HomeIcon
color='primary'
fontSize='large'
onClick={() => {
dispatch(selectDistrict({ags: '00000', name: t('germany'), type: ''}));
}}
/>
NXXR marked this conversation as resolved.
Show resolved Hide resolved
<Tooltip title={t('heatlegend.lock').toString()} placement='right' arrow>
<IconButton
color={'primary'}
Expand Down