2023-05-18 13:17:41 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-11-02 21:48:22 +01:00
|
|
|
import React, { useContext, useEffect } from 'react';
|
2021-09-09 17:51:22 +04:30
|
|
|
import List from '@mui/material/List';
|
|
|
|
|
import ListItem from '@mui/material/ListItem';
|
|
|
|
|
import ListItemText from '@mui/material/ListItemText';
|
2021-11-17 15:42:57 +03:30
|
|
|
import ListItemLink from 'components/util/ListItemLink';
|
|
|
|
|
import NavbarContext from 'components/context/NavbarContext';
|
|
|
|
|
import LoadingPlaceholder from 'components/util/LoadingPlaceholder';
|
2023-03-23 13:59:32 +01:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2023-05-18 13:25:19 +02:00
|
|
|
import requestManager from 'lib/RequestManager';
|
2021-05-25 21:06:27 +04:30
|
|
|
|
|
|
|
|
export default function About() {
|
2023-03-23 13:59:32 +01:00
|
|
|
const { t } = useTranslation();
|
2021-05-25 21:06:27 +04:30
|
|
|
const { setTitle, setAction } = useContext(NavbarContext);
|
|
|
|
|
|
2023-02-06 10:06:33 +01:00
|
|
|
useEffect(() => {
|
2023-03-23 13:59:32 +01:00
|
|
|
setTitle(t('settings.about.title'));
|
2023-03-11 18:05:58 +01:00
|
|
|
setAction(null);
|
2023-03-28 23:14:03 +02:00
|
|
|
}, [t]);
|
2021-05-25 21:06:27 +04:30
|
|
|
|
2023-05-18 13:25:19 +02:00
|
|
|
const { data: about } = requestManager.useGetAbout();
|
2021-05-25 21:06:27 +04:30
|
|
|
|
|
|
|
|
if (about === undefined) {
|
2021-11-17 15:42:57 +03:30
|
|
|
return <LoadingPlaceholder />;
|
2021-05-25 21:06:27 +04:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const version = () => {
|
|
|
|
|
if (about.buildType === 'Stable') return `${about.version}`;
|
|
|
|
|
return `${about.version}-${about.revision}`;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const buildTime = () => new Date(about.buildTime * 1000).toUTCString();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<List>
|
|
|
|
|
<ListItem>
|
2023-03-23 13:59:32 +01:00
|
|
|
<ListItemText
|
|
|
|
|
primary={t('settings.about.label.server')}
|
|
|
|
|
secondary={`${about.name} ${about.buildType}`}
|
|
|
|
|
/>
|
2021-05-25 21:06:27 +04:30
|
|
|
</ListItem>
|
|
|
|
|
<ListItem>
|
2023-03-23 13:59:32 +01:00
|
|
|
<ListItemText primary={t('settings.about.label.server_version')} secondary={version()} />
|
2021-05-25 21:06:27 +04:30
|
|
|
</ListItem>
|
|
|
|
|
<ListItem>
|
2023-03-23 13:59:32 +01:00
|
|
|
<ListItemText primary={t('settings.about.label.build_time')} secondary={buildTime()} />
|
2021-05-25 21:06:27 +04:30
|
|
|
</ListItem>
|
2023-03-25 11:35:25 -07:00
|
|
|
<ListItemLink directLink to={about.github}>
|
2023-03-23 13:59:32 +01:00
|
|
|
<ListItemText primary={t('settings.about.label.github')} secondary={about.github} />
|
2021-05-25 21:06:27 +04:30
|
|
|
</ListItemLink>
|
2023-03-25 11:35:25 -07:00
|
|
|
<ListItemLink directLink to={about.discord}>
|
2023-03-23 13:59:32 +01:00
|
|
|
<ListItemText primary={t('settings.about.label.discord')} secondary={about.discord} />
|
2021-05-25 21:06:27 +04:30
|
|
|
</ListItemLink>
|
|
|
|
|
</List>
|
|
|
|
|
);
|
|
|
|
|
}
|