Files
swiss-datashare/frontend/src/pages/index.tsx

160 lines
4.0 KiB
TypeScript
Raw Normal View History

2022-04-25 15:15:17 +02:00
import {
Button,
Container,
createStyles,
Group,
List,
Text,
ThemeIcon,
Title,
} from "@mantine/core";
2022-10-31 11:20:54 +01:00
import Link from "next/link";
2023-02-09 18:17:53 +01:00
import { useRouter } from "next/router";
import { useEffect } from "react";
import { TbCheck } from "react-icons/tb";
import Logo from "../components/Logo";
2022-04-28 15:31:37 +02:00
import Meta from "../components/Meta";
2023-02-09 18:17:53 +01:00
import useUser from "../hooks/user.hook";
2022-10-18 14:27:14 +02:00
2022-04-25 15:15:17 +02:00
const useStyles = createStyles((theme) => ({
inner: {
display: "flex",
justifyContent: "space-between",
2023-03-10 09:01:33 +01:00
paddingTop: `calc(${theme.spacing.md} * 4)`,
paddingBottom: `calc(${theme.spacing.md} * 4)`,
2022-04-25 15:15:17 +02:00
},
content: {
maxWidth: 480,
2023-03-10 09:01:33 +01:00
marginRight: `calc(${theme.spacing.md} * 3)`,
2022-04-25 15:15:17 +02:00
[theme.fn.smallerThan("md")]: {
maxWidth: "100%",
marginRight: 0,
},
},
title: {
color: theme.colorScheme === "dark" ? theme.white : theme.black,
fontSize: 44,
lineHeight: 1.2,
fontWeight: 900,
[theme.fn.smallerThan("xs")]: {
fontSize: 28,
},
},
control: {
[theme.fn.smallerThan("xs")]: {
flex: 1,
},
},
image: {
[theme.fn.smallerThan("md")]: {
display: "none",
},
},
highlight: {
position: "relative",
backgroundColor:
theme.colorScheme === "dark"
? theme.fn.rgba(theme.colors[theme.primaryColor][6], 0.55)
: theme.colors[theme.primaryColor][0],
borderRadius: theme.radius.sm,
padding: "4px 12px",
},
}));
export default function Home() {
const { classes } = useStyles();
2023-02-09 18:17:53 +01:00
const { refreshUser } = useUser();
const router = useRouter();
// If the user is already logged in, redirect to the upload page
useEffect(() => {
refreshUser().then((user) => {
if (user) {
router.replace("/upload");
}
});
}, []);
2022-04-25 15:15:17 +02:00
return (
<>
<Meta title="Home" />
<Container>
<div className={classes.inner}>
<div className={classes.content}>
<Title className={classes.title}>
A <span className={classes.highlight}>self-hosted</span> <br />{" "}
file sharing platform.
</Title>
<Text color="dimmed" mt="md">
Do you really want to give your personal files in the hand of
third parties like WeTransfer?
</Text>
<List
mt={30}
spacing="sm"
size="sm"
icon={
<ThemeIcon size={20} radius="xl">
<TbCheck size={12} />
</ThemeIcon>
}
>
<List.Item>
<div>
<b>Self-Hosted</b> - Host Pingvin Share on your own machine.
</div>
</List.Item>
<List.Item>
<div>
<b>Privacy</b> - Your files are your files and should never
get into the hands of third parties.
</div>
</List.Item>
<List.Item>
<div>
<b>No annoying file size limit</b> - Upload as big files as
you want. Only your hard drive will be your limit.
</div>
</List.Item>
</List>
2022-04-25 15:15:17 +02:00
<Group mt={30}>
<Button
component={Link}
href="/auth/signUp"
radius="xl"
size="md"
className={classes.control}
>
Get started
</Button>
<Button
component={Link}
href="https://github.com/stonith404/pingvin-share"
target="_blank"
variant="default"
radius="xl"
size="md"
className={classes.control}
>
Source code
</Button>
2022-04-28 15:15:30 +02:00
</Group>
2022-04-25 15:15:17 +02:00
</div>
<Group className={classes.image} align="center">
<Logo width={200} height={200} />
</Group>
</div>
</Container>
</>
);
2022-04-25 15:15:17 +02:00
}