mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-09 09:37:01 +02:00
* Started adding locale translations :) * Added some more translations * Working on translating even more pages * More translations * Added test default locale retrieval * replace `intl.formatMessage` with custom `t` hook * add more translations * improve title syntax * add more translations * translate admin config page * translated error messages * add language selecter * minor fixes * improve language handling * add upcoming languages * add `crowdin.yml` * run formatter --------- Co-authored-by: Steve Tautonico <stautonico@gmail.com>
106 lines
2.6 KiB
TypeScript
106 lines
2.6 KiB
TypeScript
import {
|
|
Center,
|
|
Col,
|
|
createStyles,
|
|
Grid,
|
|
Paper,
|
|
Stack,
|
|
Text,
|
|
Title,
|
|
} from "@mantine/core";
|
|
import Link from "next/link";
|
|
import { useEffect, useState } from "react";
|
|
import { TbRefresh, TbSettings, TbUsers } from "react-icons/tb";
|
|
import { FormattedMessage } from "react-intl";
|
|
import Meta from "../../components/Meta";
|
|
import useTranslate from "../../hooks/useTranslate.hook";
|
|
import configService from "../../services/config.service";
|
|
|
|
const useStyles = createStyles((theme) => ({
|
|
item: {
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
textAlign: "center",
|
|
height: 90,
|
|
"&:hover": {
|
|
boxShadow: `${theme.shadows.sm} !important`,
|
|
transform: "scale(1.01)",
|
|
},
|
|
},
|
|
}));
|
|
|
|
const Admin = () => {
|
|
const { classes, theme } = useStyles();
|
|
const t = useTranslate();
|
|
|
|
const [managementOptions, setManagementOptions] = useState([
|
|
{
|
|
title: t("admin.button.users"),
|
|
icon: TbUsers,
|
|
route: "/admin/users",
|
|
},
|
|
{
|
|
title: t("admin.button.config"),
|
|
icon: TbSettings,
|
|
route: "/admin/config/general",
|
|
},
|
|
]);
|
|
|
|
useEffect(() => {
|
|
configService.isNewReleaseAvailable().then((isNewReleaseAvailable) => {
|
|
if (isNewReleaseAvailable) {
|
|
setManagementOptions([
|
|
...managementOptions,
|
|
{
|
|
title: "Update",
|
|
icon: TbRefresh,
|
|
route:
|
|
"https://github.com/stonith404/pingvin-share/releases/latest",
|
|
},
|
|
]);
|
|
}
|
|
});
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
<Meta title={t("admin.title")} />
|
|
<Title mb={30} order={3}>
|
|
<FormattedMessage id="admin.title" />
|
|
</Title>
|
|
<Stack justify="space-between" style={{ height: "calc(100vh - 180px)" }}>
|
|
<Paper withBorder p={40}>
|
|
<Grid>
|
|
{managementOptions.map((item) => {
|
|
return (
|
|
<Col xs={6} key={item.route}>
|
|
<Paper
|
|
withBorder
|
|
component={Link}
|
|
href={item.route}
|
|
key={item.title}
|
|
className={classes.item}
|
|
>
|
|
<item.icon color={theme.colors.victoria[8]} size={35} />
|
|
<Text mt={7}>{item.title}</Text>
|
|
</Paper>
|
|
</Col>
|
|
);
|
|
})}
|
|
</Grid>
|
|
</Paper>
|
|
|
|
<Center>
|
|
<Text size="xs" color="dimmed">
|
|
<FormattedMessage id="admin.version" /> {process.env.VERSION}
|
|
</Text>
|
|
</Center>
|
|
</Stack>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Admin;
|