Files
Homarr/src/components/Settings/Common/Credits.tsx

73 lines
2.1 KiB
TypeScript
Raw Normal View History

2023-02-04 20:48:55 +01:00
import { Anchor, Box, Collapse, Flex, Table, Text } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
2022-08-22 09:50:54 +02:00
import { useTranslation } from 'next-i18next';
2023-02-04 20:48:55 +01:00
import { usePackageAttributesStore } from '../../../tools/client/zustands/usePackageAttributesStore';
2022-08-18 21:46:46 +02:00
2022-12-04 17:36:30 +01:00
export default function Credits() {
2022-08-22 09:50:54 +02:00
const { t } = useTranslation('settings/common');
2022-06-28 11:06:45 +02:00
return (
2023-02-04 20:48:55 +01:00
<Flex justify="center" direction="column" mt="xs">
2023-01-04 22:39:58 +09:00
<Text
style={{
fontSize: '0.90rem',
textAlign: 'center',
color: 'gray',
}}
>
{t('credits.madeWithLove')}
<Anchor
href="https://github.com/ajnart"
style={{ color: 'inherit', fontStyle: 'inherit', fontSize: 'inherit' }}
2022-06-28 11:06:45 +02:00
>
2023-01-04 22:39:58 +09:00
ajnart
2023-01-06 01:11:02 +09:00
</Anchor>{' '}
2023-01-13 11:10:09 +00:00
and you!
2023-01-04 22:39:58 +09:00
</Text>
2023-02-04 20:48:55 +01:00
<DependencyTable />
</Flex>
2022-06-28 11:06:45 +02:00
);
}
2023-02-04 20:48:55 +01:00
const DependencyTable = () => {
const { t } = useTranslation('settings/common');
const [opened, { toggle }] = useDisclosure(false);
const { attributes } = usePackageAttributesStore();
return (
<>
<Text variant="link" mx="auto" size="xs" opacity={0.3} onClick={toggle}>
{t('credits.thirdPartyContent')}
</Text>
<Collapse in={opened}>
<Box
sx={(theme) => ({
backgroundColor:
theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],
padding: theme.spacing.xl,
borderRadius: theme.radius.md,
})}
mt="md"
>
<Table>
<thead>
<tr>
<th>{t('credits.thirdPartyContentTable.dependencyName')}</th>
<th>{t('credits.thirdPartyContentTable.dependencyVersion')}</th>
</tr>
</thead>
{Object.keys(attributes.dependencies).map((key, index) => (
<tbody key={`dependency-${index}`}>
<tr>
<td>{key}</td>
<td>{attributes.dependencies[key]}</td>
</tr>
</tbody>
))}
</Table>
</Box>
</Collapse>
</>
);
};