From 1f42fad0ad8e938470166df4a7fadb8dd4966e01 Mon Sep 17 00:00:00 2001 From: Sonny Date: Sun, 19 Nov 2023 23:37:23 +0100 Subject: [PATCH] refactor: apply prettier conf --- next.config.js | 8 +++---- src/components/Links/LinkFavicon.tsx | 2 +- src/components/Links/LinkItem.tsx | 8 +++---- src/components/Navbar/Navbar.tsx | 25 +++++++++++++++++---- src/components/Navbar/navbar.module.scss | 10 +++++++++ src/lib/api/handler.ts | 4 ++-- src/lib/request.ts | 22 +++++++++++++------ src/lib/user/createUser.ts | 6 ++--- src/lib/user/getUserByProfileProvider.ts | 6 ++--- src/lib/user/updateUser.ts | 8 +++---- src/pages/api/auth/[...nextauth].ts | 28 ++++++++++++++---------- src/pages/api/favicon.ts | 27 +++++++++++++---------- src/pages/category/create.tsx | 12 +++++----- src/pages/category/edit/[cid].tsx | 14 +++++++----- src/pages/category/remove/[cid].tsx | 12 +++++----- src/pages/link/create.tsx | 18 ++++++++------- src/pages/link/edit/[lid].tsx | 20 +++++++++-------- src/pages/link/remove/[lid].tsx | 14 +++++++----- src/pages/login.tsx | 3 ++- 19 files changed, 152 insertions(+), 95 deletions(-) diff --git a/next.config.js b/next.config.js index bd3e1d9..0ecf6c9 100644 --- a/next.config.js +++ b/next.config.js @@ -6,7 +6,7 @@ const config = { webpack(config) { config.module.rules.push({ test: /\.svg$/, - use: ["@svgr/webpack"] + use: ["@svgr/webpack"], }); return config; @@ -15,12 +15,12 @@ const config = { remotePatterns: [ { hostname: "localhost" }, { hostname: "t3.gstatic.com" }, - { hostname: "lh3.googleusercontent.com" } + { hostname: "lh3.googleusercontent.com" }, ], - formats: ["image/webp"] + formats: ["image/webp"], }, reactStrictMode: false, - output: "standalone" + output: "standalone", }; module.exports = config; diff --git a/src/components/Links/LinkFavicon.tsx b/src/components/Links/LinkFavicon.tsx index 5c4765f..f1f8fa6 100644 --- a/src/components/Links/LinkFavicon.tsx +++ b/src/components/Links/LinkFavicon.tsx @@ -18,7 +18,7 @@ interface LinkFaviconProps { export default function LinkFavicon({ url, size = 32, - noMargin = false + noMargin = false, }: LinkFaviconProps) { const [isFailed, setFailed] = useState(false); const [isLoading, setLoading] = useState(true); diff --git a/src/components/Links/LinkItem.tsx b/src/components/Links/LinkItem.tsx index cfb6dd0..0f4f9ac 100644 --- a/src/components/Links/LinkItem.tsx +++ b/src/components/Links/LinkItem.tsx @@ -13,7 +13,7 @@ import { makeRequest } from "lib/request"; export default function LinkItem({ link, toggleFavorite, - index + index, }: { link: Link; toggleFavorite: (linkId: Link["id"]) => void; @@ -28,8 +28,8 @@ export default function LinkItem({ name, url, favorite: !favorite, - categoryId: link.category.id - } + categoryId: link.category.id, + }, }) .then(() => toggleFavorite(link.id)) .catch(console.error); @@ -45,7 +45,7 @@ export default function LinkItem({ type: "spring", stiffness: 260, damping: 20, - delay: index * 0.05 + delay: index * 0.05, }} > diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx index 1a960eb..e47b076 100644 --- a/src/components/Navbar/Navbar.tsx +++ b/src/components/Navbar/Navbar.tsx @@ -3,11 +3,16 @@ import { useSession } from "next-auth/react"; import PATHS from "constants/paths"; import styles from "./navbar.module.scss"; import { useTranslation } from "next-i18next"; +import Image from "next/image"; +import { TFunctionParam } from "../../types/i18next"; export default function Navbar() { - const { status } = useSession(); + const { data, status } = useSession(); const { t } = useTranslation(); + const avatarLabel = t("common:avatar", { + name: data?.user?.name, + } as TFunctionParam); return (