1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-06-30 14:40:10 +02:00

refactor: run formatter

This commit is contained in:
Elias Schneider 2024-02-05 16:11:49 +01:00
parent 416eba6ae6
commit e572506d4f
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C
3 changed files with 29 additions and 23 deletions

View File

@ -139,7 +139,7 @@ export class AuthService {
async updatePassword(user: User, newPassword: string, oldPassword?: string) { async updatePassword(user: User, newPassword: string, oldPassword?: string) {
const isPasswordValid = 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"); if (!isPasswordValid) throw new ForbiddenException("Invalid password");

View File

@ -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 { modals } from "@mantine/modals";
import Link from "next/link"; import Link from "next/link";
import React, { Dispatch, SetStateAction, useEffect, useState } from "react"; import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
@ -116,41 +123,38 @@ const ImagePreview = () => {
const TextPreview = () => { const TextPreview = () => {
const { shareId, fileId } = React.useContext(FilePreviewContext); const { shareId, fileId } = React.useContext(FilePreviewContext);
const [ text, setText ] = useState<string>(""); const [text, setText] = useState<string>("");
const { colorScheme } = useMantineTheme(); const { colorScheme } = useMantineTheme();
useEffect(() => { useEffect(() => {
api api
.get(`/shares/${shareId}/files/${fileId}?download=false`) .get(`/shares/${shareId}/files/${fileId}?download=false`)
.then((res) => setText(res.data ?? "Preview couldn't be fetched.")); .then((res) => setText(res.data ?? "Preview couldn't be fetched."));
}, [ shareId, fileId ]); }, [shareId, fileId]);
const options = { const options = {
overrides: { overrides: {
pre: { pre: {
props: { props: {
style: { style: {
backgroundColor: colorScheme == "dark" backgroundColor:
? "rgba(50, 50, 50, 0.5)" colorScheme == "dark"
: "rgba(220, 220, 220, 0.5)", ? "rgba(50, 50, 50, 0.5)"
: "rgba(220, 220, 220, 0.5)",
padding: "0.75em", padding: "0.75em",
whiteSpace: "pre-wrap", whiteSpace: "pre-wrap",
} },
} },
}, },
table: { table: {
props: { props: {
className: "md" className: "md",
} },
} },
} },
}; };
return ( return <Markdown options={options}>{text}</Markdown>;
<Markdown options={options}>
{text}
</Markdown>
);
}; };
const PdfPreview = () => { const PdfPreview = () => {

View File

@ -8,11 +8,13 @@ const GlobalStyle = () => {
color: "inherit", color: "inherit",
textDecoration: "none", textDecoration: "none",
}, },
"table.md, table.md th:nth-of-type(odd), table.md td:nth-of-type(odd)": { "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)" background:
: "rgba(220, 220, 220, 0.5)", theme.colorScheme == "dark"
}, ? "rgba(50, 50, 50, 0.5)"
: "rgba(220, 220, 220, 0.5)",
},
"table.md td": { "table.md td": {
paddingLeft: "0.5em", paddingLeft: "0.5em",
paddingRight: "0.5em", paddingRight: "0.5em",