From 6345e21db96dd27bb9fe7d628a1486fe0e93e41e Mon Sep 17 00:00:00 2001
From: Elias Schneider
Date: Mon, 13 Mar 2023 08:50:54 +0100
Subject: [PATCH] refactor: globalize modal title style
---
backend/src/share/share.service.ts | 2 +-
.../account/showEnableTotpModal.tsx | 3 +-
.../admin/users/showCreateUserModal.tsx | 3 +-
.../admin/users/showUpdateUserModal.tsx | 3 +-
.../modals/showCompletedReverseShareModal.tsx | 8 +--
.../modals/showCreateReverseShareModal.tsx | 3 +-
.../share/showEnterPasswordModal.tsx | 69 +++++++++----------
.../src/components/share/showErrorModal.tsx | 4 +-
.../modals/showCompletedUploadModal.tsx | 15 +---
.../upload/modals/showCreateUploadModal.tsx | 2 +-
frontend/src/pages/share/[shareId]/index.tsx | 6 +-
frontend/src/styles/mantine.style.ts | 10 +++
12 files changed, 59 insertions(+), 69 deletions(-)
diff --git a/backend/src/share/share.service.ts b/backend/src/share/share.service.ts
index 321e1559..4a46c280 100644
--- a/backend/src/share/share.service.ts
+++ b/backend/src/share/share.service.ts
@@ -278,7 +278,7 @@ export class ShareService {
share?.security?.password &&
!(await argon.verify(share.security.password, password))
) {
- throw new ForbiddenException("Wrong password");
+ throw new ForbiddenException("Wrong password", "wrong_password");
}
if (share.security?.maxViews && share.security.maxViews <= share.views) {
diff --git a/frontend/src/components/account/showEnableTotpModal.tsx b/frontend/src/components/account/showEnableTotpModal.tsx
index 4bacaa59..2073236e 100644
--- a/frontend/src/components/account/showEnableTotpModal.tsx
+++ b/frontend/src/components/account/showEnableTotpModal.tsx
@@ -7,7 +7,6 @@ import {
Stack,
Text,
TextInput,
- Title,
Tooltip,
} from "@mantine/core";
import { useForm, yupResolver } from "@mantine/form";
@@ -27,7 +26,7 @@ const showEnableTotpModal = (
}
) => {
return modals.openModal({
- title: Enable TOTP,
+ title: "Enable TOTP",
children: (
),
diff --git a/frontend/src/components/admin/users/showCreateUserModal.tsx b/frontend/src/components/admin/users/showCreateUserModal.tsx
index 727b0a35..cf6a094b 100644
--- a/frontend/src/components/admin/users/showCreateUserModal.tsx
+++ b/frontend/src/components/admin/users/showCreateUserModal.tsx
@@ -5,7 +5,6 @@ import {
Stack,
Switch,
TextInput,
- Title,
} from "@mantine/core";
import { useForm, yupResolver } from "@mantine/form";
import { ModalsContextProps } from "@mantine/modals/lib/context";
@@ -19,7 +18,7 @@ const showCreateUserModal = (
getUsers: () => void
) => {
return modals.openModal({
- title: Create user,
+ title: "Create user",
children: (
),
diff --git a/frontend/src/components/admin/users/showUpdateUserModal.tsx b/frontend/src/components/admin/users/showUpdateUserModal.tsx
index c15338e1..c3a24324 100644
--- a/frontend/src/components/admin/users/showUpdateUserModal.tsx
+++ b/frontend/src/components/admin/users/showUpdateUserModal.tsx
@@ -6,7 +6,6 @@ import {
Stack,
Switch,
TextInput,
- Title,
} from "@mantine/core";
import { useForm, yupResolver } from "@mantine/form";
import { ModalsContextProps } from "@mantine/modals/lib/context";
@@ -21,7 +20,7 @@ const showUpdateUserModal = (
getUsers: () => void
) => {
return modals.openModal({
- title:
Update {user.username},
+ title: `Update ${user.username}`,
children: Promise
) => {
return modals.openModal({
closeOnClickOutside: false,
withCloseButton: false,
closeOnEscape: false,
- title: (
- <>
- Password required
-
- This access this share please enter the password for the share.
-
- >
- ),
+ title: "Password required",
children: ,
});
};
-const Body = ({ submitCallback }: { submitCallback: any }) => {
+const Body = ({
+ submitCallback,
+}: {
+ submitCallback: (password: string) => Promise;
+}) => {
const [password, setPassword] = useState("");
const [passwordWrong, setPasswordWrong] = useState(false);
return (
- <>
-
- setPasswordWrong(false)}
- onChange={(e) => setPassword(e.target.value)}
- value={password}
- />
-
-
- >
+
+
+ This access this share please enter the password for the share.
+
+
+
+
);
};
diff --git a/frontend/src/components/share/showErrorModal.tsx b/frontend/src/components/share/showErrorModal.tsx
index c0c27831..72f01719 100644
--- a/frontend/src/components/share/showErrorModal.tsx
+++ b/frontend/src/components/share/showErrorModal.tsx
@@ -1,4 +1,4 @@
-import { Button, Stack, Text, Title } from "@mantine/core";
+import { Button, Stack, Text } from "@mantine/core";
import { useModals } from "@mantine/modals";
import { ModalsContextProps } from "@mantine/modals/lib/context";
import { useRouter } from "next/router";
@@ -12,7 +12,7 @@ const showErrorModal = (
closeOnClickOutside: false,
withCloseButton: false,
closeOnEscape: false,
- title: {title},
+ title: title,
children: ,
});
diff --git a/frontend/src/components/upload/modals/showCompletedUploadModal.tsx b/frontend/src/components/upload/modals/showCompletedUploadModal.tsx
index a03ed9ea..43c5fd18 100644
--- a/frontend/src/components/upload/modals/showCompletedUploadModal.tsx
+++ b/frontend/src/components/upload/modals/showCompletedUploadModal.tsx
@@ -1,11 +1,4 @@
-import {
- ActionIcon,
- Button,
- Stack,
- Text,
- TextInput,
- Title,
-} from "@mantine/core";
+import { ActionIcon, Button, Stack, Text, TextInput } from "@mantine/core";
import { useClipboard } from "@mantine/hooks";
import { useModals } from "@mantine/modals";
import { ModalsContextProps } from "@mantine/modals/lib/context";
@@ -24,11 +17,7 @@ const showCompletedUploadModal = (
closeOnClickOutside: false,
withCloseButton: false,
closeOnEscape: false,
- title: (
-
- Share ready
-
- ),
+ title: "Share ready",
children: