Skip to content

Commit 1a3f712

Browse files
committed
Use a bigger pie chart for over 7 worlds or servers
Affects issues: - Fixed #4489
1 parent 3334eed commit 1a3f712

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

Plan/react/dashboard/src/components/graphs/ServerPie.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {usePreferences} from "../../hooks/preferencesHook.jsx";
1010
import {useTimePreferences} from "../text/FormattedTime.jsx";
1111
import {formatTimeAmount} from "../../util/format/TimeAmountFormat.js";
1212
import {localeService} from "../../service/localeService.js";
13+
import {classNames} from "../../util/classNames.ts";
1314

1415
const ServerPie = ({colors, series}) => {
1516
const {t} = useTranslation();
@@ -64,7 +65,7 @@ const ServerPie = ({colors, series}) => {
6465

6566
if (!preferencesLoaded) return <Loader/>;
6667

67-
return (<div className="chart-pie" id="server-pie"/>);
68+
return (<div className={classNames("chart-pie", series.length > 7 ? 'big' : undefined)} id="server-pie"/>);
6869
}
6970

7071
export default ServerPie;

Plan/react/dashboard/src/components/graphs/WorldPie.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {usePreferences} from "../../hooks/preferencesHook.jsx";
1212
import Loader from "../navigation/Loader.jsx";
1313
import {formatTimeAmount} from "../../util/format/TimeAmountFormat.js";
1414
import {useThemeStorage} from "../../hooks/context/themeContextHook.tsx";
15+
import {classNames} from "../../util/classNames.ts";
1516

1617
const WorldPie = ({id, worldSeries, gmSeries}) => {
1718
const {t} = useTranslation();
@@ -88,7 +89,7 @@ const WorldPie = ({id, worldSeries, gmSeries}) => {
8889

8990
if (!preferencesLoaded) return <Loader/>;
9091

91-
return (<div className="chart-pie" id={id}/>)
92+
return (<div className={classNames("chart-pie", worldSeries.length > 7 ? 'big' : undefined)} id={id}/>)
9293
}
9394

9495
export default WorldPie;

Plan/react/dashboard/src/style/sb-admin-2.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ img {
281281
width: 100%;
282282
}
283283

284+
.chart-pie.big {
285+
height: 27rem;
286+
}
287+
284288
/*!
285289
* Start Bootstrap - SB Admin 2 v4.1.3 (https://startbootstrap.com/theme/sb-admin-2)
286290
* Copyright 2013-2020 Start Bootstrap
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type stringOrUndefined = string | undefined
2+
3+
export const classNames = (...names: stringOrUndefined[]) => {
4+
return names.filter(Boolean).join(' ');
5+
}

0 commit comments

Comments
 (0)