-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Florian Jud
committed
May 16, 2024
1 parent
9eb1d97
commit d490ad5
Showing
13 changed files
with
720 additions
and
78 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Stack, Typography } from '@mui/material'; | ||
import { LineChart } from '@mui/x-charts'; | ||
import { BarChart } from '@mui/x-charts/BarChart'; | ||
import { useAppSelector } from '../store/hooks'; | ||
import DayjsUtils from '../utils/DayjsUtils'; | ||
|
||
const Charts = () => { | ||
const evaluateTimes = useAppSelector((state) => state.times.evaluateTimes); | ||
|
||
const dataset = evaluateTimes.map((item) => ({ | ||
month: DayjsUtils.monthStringByNumber(item.month), | ||
workingTime: (item.workingTime?.balance || 0) / 60, | ||
availableTime: (item.availableTime?.balance || 0) / 60, | ||
})); | ||
|
||
return ( | ||
<> | ||
{evaluateTimes && ( | ||
<Stack direction="column" alignItems="center" spacing={2} pt={4}> | ||
<Stack direction="column" alignItems="center" spacing={0}> | ||
<Typography variant="h6">Verfügungszeit-Saldo je Monat (Std.)</Typography> | ||
<BarChart | ||
dataset={dataset} | ||
xAxis={[{ scaleType: 'band', dataKey: 'month' }]} | ||
yAxis={[ | ||
{ | ||
colorMap: { | ||
type: 'piecewise', | ||
thresholds: [0], | ||
colors: ['#ffa680', '#49a7cc'], | ||
}, | ||
}, | ||
]} | ||
series={[{ dataKey: 'availableTime' }]} | ||
width={window.innerWidth * 0.8} | ||
height={300} | ||
borderRadius={18} | ||
/> | ||
</Stack> | ||
<Stack direction="column" alignItems="center" spacing={0}> | ||
<Typography variant="h6">Arbeitszeit-Saldo je Monat (Std.)</Typography> | ||
<LineChart | ||
dataset={dataset} | ||
xAxis={[{ scaleType: 'band', dataKey: 'month' }]} | ||
series={[{ dataKey: 'workingTime' }]} | ||
width={window.innerWidth * 0.8} | ||
height={300} | ||
/> | ||
</Stack> | ||
</Stack> | ||
)} | ||
</> | ||
); | ||
}; | ||
export default Charts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import AirplanemodeActiveIcon from '@mui/icons-material/AirplanemodeActive'; | ||
import { Card, CardContent, Stack, Typography } from '@mui/material'; | ||
import { Gauge } from '@mui/x-charts'; | ||
|
||
interface VacationGaugePropertioes { | ||
value: number; | ||
valueMax: number; | ||
} | ||
|
||
const VacationGauge = ({ value, valueMax }: VacationGaugePropertioes) => { | ||
return ( | ||
<Card sx={{ minWidth: 256 }}> | ||
<CardContent> | ||
<Stack direction="column" justifyContent="flex-start" alignItems="flex-start" gap={2} width="100%"> | ||
<Stack direction="row" justifyContent="space-between" alignItems="flex-start" gap={2} width="100%"> | ||
<Typography variant="body1" color="text.secondary"> | ||
Freie Urlaubstage | ||
</Typography> | ||
<AirplanemodeActiveIcon color="secondary" /> | ||
</Stack> | ||
|
||
<Gauge value={value} startAngle={-110} endAngle={110} height={100} text={() => `${value} / ${valueMax}`} /> | ||
<Typography variant="body2" color="text.disabled"> | ||
In diesem Jahr | ||
</Typography> | ||
</Stack> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default VacationGauge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.