diff --git a/client/src/pages/End/End.jsx b/client/src/pages/End/End.jsx new file mode 100644 index 0000000..9e99090 --- /dev/null +++ b/client/src/pages/End/End.jsx @@ -0,0 +1,55 @@ +import "./styles.sass"; +import {useContext, useEffect} from "react"; +import {socket} from "@/common/utils/socket.js"; +import {GroupContext} from "@/common/contexts/GroupContext.jsx"; +import {Navigate} from "react-router"; + +const localeOptions = { + style: "decimal", + minimumFractionDigits: 2, + maximumFractionDigits: 2, + signDisplay: "never" +} + +export const End = () => { + + const {groups, allGroups} = useContext(GroupContext); + + if (groups.length === 0) return ; + + useEffect(() => { + socket.disconnect(); + }, []); + + return ( +
+ {[...groups, ...allGroups].map(group => ( +
+
+

Unternehmen

+

{group.name}

+
+ +
+

Startkapital

+

25.000 €

+
+ +
+

Gewinn/Verlust

+ {group.capital - 25000 > 0 && +

+ {(group.capital - 25000)?.toLocaleString("de-DE", localeOptions)} €

} + {group.capital - 25000 < 0 && +

- {(group.capital - 25000)?.toLocaleString("de-DE", localeOptions)} €

} + {group.capital - 25000 === 0 &&

0 €

} +
+ +
+

Firmenwert

+

{group.capital < 5000 ? "Pleite" : group.capital?.toLocaleString("de-DE", localeOptions) + " €"}

+
+
+ ))} +
+ ); +} \ No newline at end of file