From e572506d4f3d2b4daeba4ee9ac237f04616fd9e3 Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Mon, 5 Feb 2024 16:11:49 +0100 Subject: [PATCH] refactor: run formatter --- backend/src/auth/auth.service.ts | 2 +- frontend/src/components/share/FilePreview.tsx | 38 ++++++++++--------- frontend/src/styles/global.style.tsx | 12 +++--- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/backend/src/auth/auth.service.ts b/backend/src/auth/auth.service.ts index 35453f7..0be08af 100644 --- a/backend/src/auth/auth.service.ts +++ b/backend/src/auth/auth.service.ts @@ -139,7 +139,7 @@ export class AuthService { async updatePassword(user: User, newPassword: string, oldPassword?: string) { const isPasswordValid = - !user.password || await argon.verify(user.password, oldPassword); + !user.password || (await argon.verify(user.password, oldPassword)); if (!isPasswordValid) throw new ForbiddenException("Invalid password"); diff --git a/frontend/src/components/share/FilePreview.tsx b/frontend/src/components/share/FilePreview.tsx index 0ff32bc..71606ff 100644 --- a/frontend/src/components/share/FilePreview.tsx +++ b/frontend/src/components/share/FilePreview.tsx @@ -1,4 +1,11 @@ -import { Button, Center, Stack, Text, Title, useMantineTheme } from "@mantine/core"; +import { + Button, + Center, + Stack, + Text, + Title, + useMantineTheme, +} from "@mantine/core"; import { modals } from "@mantine/modals"; import Link from "next/link"; import React, { Dispatch, SetStateAction, useEffect, useState } from "react"; @@ -116,41 +123,38 @@ const ImagePreview = () => { const TextPreview = () => { const { shareId, fileId } = React.useContext(FilePreviewContext); - const [ text, setText ] = useState(""); + const [text, setText] = useState(""); const { colorScheme } = useMantineTheme(); useEffect(() => { api .get(`/shares/${shareId}/files/${fileId}?download=false`) .then((res) => setText(res.data ?? "Preview couldn't be fetched.")); - }, [ shareId, fileId ]); + }, [shareId, fileId]); const options = { overrides: { pre: { props: { style: { - backgroundColor: colorScheme == "dark" - ? "rgba(50, 50, 50, 0.5)" - : "rgba(220, 220, 220, 0.5)", + backgroundColor: + colorScheme == "dark" + ? "rgba(50, 50, 50, 0.5)" + : "rgba(220, 220, 220, 0.5)", padding: "0.75em", whiteSpace: "pre-wrap", - } - } + }, + }, }, table: { props: { - className: "md" - } - } - } + className: "md", + }, + }, + }, }; - return ( - - {text} - - ); + return {text}; }; const PdfPreview = () => { diff --git a/frontend/src/styles/global.style.tsx b/frontend/src/styles/global.style.tsx index ef284de..7fb3d0f 100644 --- a/frontend/src/styles/global.style.tsx +++ b/frontend/src/styles/global.style.tsx @@ -8,11 +8,13 @@ const GlobalStyle = () => { color: "inherit", textDecoration: "none", }, - "table.md, table.md th:nth-of-type(odd), table.md td:nth-of-type(odd)": { - background: theme.colorScheme == "dark" - ? "rgba(50, 50, 50, 0.5)" - : "rgba(220, 220, 220, 0.5)", - }, + "table.md, table.md th:nth-of-type(odd), table.md td:nth-of-type(odd)": + { + background: + theme.colorScheme == "dark" + ? "rgba(50, 50, 50, 0.5)" + : "rgba(220, 220, 220, 0.5)", + }, "table.md td": { paddingLeft: "0.5em", paddingRight: "0.5em",