0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-01-29 01:28:59 -05:00

chore: upgrade to Next.js 13

This commit is contained in:
Elias Schneider 2022-10-31 11:20:54 +01:00
parent 880ad85a1e
commit 43299522ee
10 changed files with 760 additions and 788 deletions

File diff suppressed because it is too large Load diff

View file

@ -23,12 +23,12 @@
"file-saver": "^2.0.5", "file-saver": "^2.0.5",
"jose": "^4.8.1", "jose": "^4.8.1",
"moment": "^2.29.4", "moment": "^2.29.4",
"next": "^12.3.1", "next": "^13.0.0",
"next-cookies": "^2.0.3", "next-cookies": "^2.0.3",
"next-http-proxy-middleware": "^1.2.4", "next-http-proxy-middleware": "^1.2.4",
"next-pwa": "^5.6.0", "next-pwa": "^5.6.0",
"react": "18.0.0", "react": "^18.2.0",
"react-dom": "18.0.0", "react-dom": "^18.2.0",
"react-icons": "^4.4.0", "react-icons": "^4.4.0",
"yup": "^0.32.11" "yup": "^0.32.11"
}, },
@ -39,7 +39,7 @@
"axios": "^0.26.1", "axios": "^0.26.1",
"dotenv-cli": "^6.0.0", "dotenv-cli": "^6.0.0",
"eslint": "8.13.0", "eslint": "8.13.0",
"eslint-config-next": "12.1.5", "eslint-config-next": "^13.0.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"tar": "^6.1.11", "tar": "^6.1.11",

View file

@ -9,8 +9,8 @@ import {
Title, Title,
} from "@mantine/core"; } from "@mantine/core";
import { useForm, yupResolver } from "@mantine/form"; import { useForm, yupResolver } from "@mantine/form";
import { NextLink } from "@mantine/next";
import getConfig from "next/config"; import getConfig from "next/config";
import Link from "next/link";
import * as yup from "yup"; import * as yup from "yup";
import authService from "../../services/auth.service"; import authService from "../../services/auth.service";
import toast from "../../utils/toast.util"; import toast from "../../utils/toast.util";
@ -61,7 +61,7 @@ const AuthForm = ({ mode }: { mode: "signUp" | "signIn" }) => {
? "You have an account already?" ? "You have an account already?"
: "You don't have an account yet?"}{" "} : "You don't have an account yet?"}{" "}
<Anchor <Anchor
component={NextLink} component={Link}
href={mode == "signUp" ? "signIn" : "signUp"} href={mode == "signUp" ? "signIn" : "signUp"}
size="sm" size="sm"
> >

View file

@ -1,5 +1,5 @@
import { ActionIcon, Avatar, Menu } from "@mantine/core"; import { ActionIcon, Avatar, Menu } from "@mantine/core";
import { NextLink } from "@mantine/next"; import Link from "next/link";
import { TbDoorExit, TbLink } from "react-icons/tb"; import { TbDoorExit, TbLink } from "react-icons/tb";
import authService from "../../services/auth.service"; import authService from "../../services/auth.service";
@ -13,7 +13,7 @@ const ActionAvatar = () => {
</Menu.Target> </Menu.Target>
<Menu.Dropdown> <Menu.Dropdown>
<Menu.Item <Menu.Item
component={NextLink} component={Link}
href="/account/shares" href="/account/shares"
icon={<TbLink size={14} />} icon={<TbLink size={14} />}
> >

View file

@ -11,8 +11,8 @@ import {
Transition, Transition,
} from "@mantine/core"; } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import { NextLink } from "@mantine/next";
import getConfig from "next/config"; import getConfig from "next/config";
import Link from "next/link";
import { ReactNode, useEffect, useState } from "react"; import { ReactNode, useEffect, useState } from "react";
import useUser from "../../hooks/user.hook"; import useUser from "../../hooks/user.hook";
import Logo from "../Logo"; import Logo from "../Logo";
@ -22,7 +22,7 @@ const { publicRuntimeConfig } = getConfig();
const HEADER_HEIGHT = 60; const HEADER_HEIGHT = 60;
type Link = { type NavLink = {
link?: string; link?: string;
label?: string; label?: string;
component?: ReactNode; component?: ReactNode;
@ -122,7 +122,7 @@ const NavBar = () => {
}, },
]; ];
const [unauthenticatedLinks, setUnauthenticatedLinks] = useState<Link[]>([ const [unauthenticatedLinks, setUnauthenticatedLinks] = useState<NavLink[]>([
{ {
link: "/auth/signIn", link: "/auth/signIn",
label: "Sign in", label: "Sign in",
@ -161,7 +161,7 @@ const NavBar = () => {
); );
} }
return ( return (
<NextLink <Link
key={link.label} key={link.label}
href={link.link ?? ""} href={link.link ?? ""}
onClick={() => toggleOpened.toggle()} onClick={() => toggleOpened.toggle()}
@ -170,7 +170,7 @@ const NavBar = () => {
})} })}
> >
{link.label} {link.label}
</NextLink> </Link>
); );
})} })}
</> </>
@ -178,12 +178,12 @@ const NavBar = () => {
return ( return (
<Header height={HEADER_HEIGHT} mb={40} className={classes.root}> <Header height={HEADER_HEIGHT} mb={40} className={classes.root}>
<Container className={classes.header}> <Container className={classes.header}>
<NextLink href="/"> <Link href="/" passHref>
<Group> <Group>
<Logo height={35} width={35} /> <Logo height={35} width={35} />
<Text weight={600}>Pingvin Share</Text> <Text weight={600}>Pingvin Share</Text>
</Group> </Group>
</NextLink> </Link>
<Group spacing={5} className={classes.links}> <Group spacing={5} className={classes.links}>
<Group>{items} </Group> <Group>{items} </Group>
</Group> </Group>

View file

@ -10,14 +10,11 @@ import { useClipboard } from "@mantine/hooks";
import { useModals } from "@mantine/modals"; import { useModals } from "@mantine/modals";
import { ModalsContextProps } from "@mantine/modals/lib/context"; import { ModalsContextProps } from "@mantine/modals/lib/context";
import moment from "moment"; import moment from "moment";
import getConfig from "next/config";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { TbCopy } from "react-icons/tb"; import { TbCopy } from "react-icons/tb";
import { Share } from "../../../types/share.type"; import { Share } from "../../../types/share.type";
import toast from "../../../utils/toast.util"; import toast from "../../../utils/toast.util";
const { publicRuntimeConfig } = getConfig();
const showCompletedUploadModal = (modals: ModalsContextProps, share: Share) => { const showCompletedUploadModal = (modals: ModalsContextProps, share: Share) => {
return modals.openModal({ return modals.openModal({
closeOnClickOutside: false, closeOnClickOutside: false,

View file

@ -8,7 +8,7 @@ import {
Group, Group,
} from "@mantine/core"; } from "@mantine/core";
import Meta from "../components/Meta"; import Meta from "../components/Meta";
import { NextLink } from "@mantine/next"; import Link from "next/link";
const useStyles = createStyles((theme) => ({ const useStyles = createStyles((theme) => ({
root: { root: {
@ -53,7 +53,7 @@ const ErrorNotFound = () => {
className={classes.description} className={classes.description}
></Text> ></Text>
<Group position="center"> <Group position="center">
<Button component={NextLink} href="/" variant="light"> <Button component={Link} href="/" variant="light">
Bring me back Bring me back
</Button> </Button>
</Group> </Group>

View file

@ -12,9 +12,8 @@ import {
} from "@mantine/core"; } from "@mantine/core";
import { useClipboard } from "@mantine/hooks"; import { useClipboard } from "@mantine/hooks";
import { useModals } from "@mantine/modals"; import { useModals } from "@mantine/modals";
import { NextLink } from "@mantine/next";
import moment from "moment"; import moment from "moment";
import getConfig from "next/config"; import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { TbLink, TbTrash } from "react-icons/tb"; import { TbLink, TbTrash } from "react-icons/tb";
@ -24,8 +23,6 @@ import shareService from "../../services/share.service";
import { MyShare } from "../../types/share.type"; import { MyShare } from "../../types/share.type";
import toast from "../../utils/toast.util"; import toast from "../../utils/toast.util";
const { publicRuntimeConfig } = getConfig();
const MyShares = () => { const MyShares = () => {
const modals = useModals(); const modals = useModals();
const clipboard = useClipboard(); const clipboard = useClipboard();
@ -54,7 +51,7 @@ const MyShares = () => {
<Title order={3}>It's empty here 👀</Title> <Title order={3}>It's empty here 👀</Title>
<Text>You don't have any shares.</Text> <Text>You don't have any shares.</Text>
<Space h={5} /> <Space h={5} />
<Button component={NextLink} href="/upload" variant="light"> <Button component={Link} href="/upload" variant="light">
Create one Create one
</Button> </Button>
</Stack> </Stack>

View file

@ -8,9 +8,9 @@ import {
ThemeIcon, ThemeIcon,
Title, Title,
} from "@mantine/core"; } from "@mantine/core";
import { NextLink } from "@mantine/next";
import getConfig from "next/config"; import getConfig from "next/config";
import Image from "next/image"; import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { TbCheck } from "react-icons/tb"; import { TbCheck } from "react-icons/tb";
import Meta from "../components/Meta"; import Meta from "../components/Meta";
@ -126,7 +126,7 @@ export default function Home() {
<Group mt={30}> <Group mt={30}>
<Button <Button
component={NextLink} component={Link}
href="/auth/signUp" href="/auth/signUp"
radius="xl" radius="xl"
size="md" size="md"
@ -135,7 +135,7 @@ export default function Home() {
Get started Get started
</Button> </Button>
<Button <Button
component={NextLink} component={Link}
href="https://github.com/stonith404/pingvin-share" href="https://github.com/stonith404/pingvin-share"
target="_blank" target="_blank"
variant="default" variant="default"

View file

@ -3,7 +3,7 @@ import { Global } from "@mantine/core";
const GlobalStyle = () => { const GlobalStyle = () => {
return ( return (
<Global <Global
styles={(theme) => ({ styles={() => ({
a: { a: {
color: "inherit", color: "inherit",
textDecoration: "none", textDecoration: "none",