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

View File

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

View File

@@ -1,5 +1,5 @@
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 authService from "../../services/auth.service";
@@ -13,7 +13,7 @@ const ActionAvatar = () => {
</Menu.Target>
<Menu.Dropdown>
<Menu.Item
component={NextLink}
component={Link}
href="/account/shares"
icon={<TbLink size={14} />}
>

View File

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

View File

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