refactor: run formatter

This commit is contained in:
Elias Schneider
2023-08-17 14:47:58 +02:00
parent 7b34cb14cb
commit f02e2979c4
48 changed files with 1018 additions and 573 deletions

View File

@@ -7,7 +7,7 @@ import { LOCALES } from "../../i18n/locales";
const LanguagePicker = () => {
const t = useTranslate();
const [selectedLanguage, setSelectedLanguage] = useState(
getCookie("language")?.toString()
getCookie("language")?.toString(),
);
const languages = Object.values(LOCALES).map((locale) => ({
@@ -23,7 +23,7 @@ const LanguagePicker = () => {
setCookie("language", value, {
sameSite: "lax",
expires: new Date(
new Date().setFullYear(new Date().getFullYear() + 1)
new Date().setFullYear(new Date().getFullYear() + 1),
),
});
location.reload();

View File

@@ -14,7 +14,7 @@ import userPreferences from "../../utils/userPreferences.util";
const ThemeSwitcher = () => {
const [colorScheme, setColorScheme] = useState(
userPreferences.get("colorScheme")
userPreferences.get("colorScheme"),
);
const { toggleColorScheme } = useMantineColorScheme();
const systemColorScheme = useColorScheme();
@@ -26,7 +26,7 @@ const ThemeSwitcher = () => {
userPreferences.set("colorScheme", value);
setColorScheme(value);
toggleColorScheme(
value == "system" ? systemColorScheme : (value as ColorScheme)
value == "system" ? systemColorScheme : (value as ColorScheme),
);
}}
data={[

View File

@@ -26,7 +26,7 @@ const showEnableTotpModal = (
qrCode: string;
secret: string;
password: string;
}
},
) => {
const t = translateOutsideContext();
return modals.openModal({

View File

@@ -5,7 +5,7 @@ import { translateOutsideContext } from "../../hooks/useTranslate.hook";
const showReverseShareLinkModal = (
modals: ModalsContextProps,
reverseShareToken: string,
appUrl: string
appUrl: string,
) => {
const t = translateOutsideContext();
const link = `${appUrl}/upload/${reverseShareToken}`;

View File

@@ -12,7 +12,7 @@ const showShareInformationsModal = (
modals: ModalsContextProps,
share: MyShare,
appUrl: string,
maxShareSize: number
maxShareSize: number,
) => {
const t = translateOutsideContext();
const link = `${appUrl}/s/${share.id}`;

View File

@@ -5,7 +5,7 @@ import { translateOutsideContext } from "../../hooks/useTranslate.hook";
const showShareLinkModal = (
modals: ModalsContextProps,
shareId: string,
appUrl: string
appUrl: string,
) => {
const t = translateOutsideContext();
const link = `${appUrl}/s/${shareId}`;

View File

@@ -21,7 +21,7 @@ const AdminConfigInput = ({
stringValue: configVariable.value ?? configVariable.defaultValue,
textValue: configVariable.value ?? configVariable.defaultValue,
numberValue: parseInt(
configVariable.value ?? configVariable.defaultValue
configVariable.value ?? configVariable.defaultValue,
),
booleanValue:
(configVariable.value ?? configVariable.defaultValue) == "true",

View File

@@ -33,7 +33,7 @@ const TestEmailButton = ({
<Textarea minRows={4} readOnly value={e.response.data.message} />
</Stack>
),
})
}),
);
};

View File

@@ -17,7 +17,7 @@ import toast from "../../../utils/toast.util";
const showCreateUserModal = (
modals: ModalsContextProps,
smtpEnabled: boolean,
getUsers: () => void
getUsers: () => void,
) => {
return modals.openModal({
title: "Create user",
@@ -55,7 +55,7 @@ const Body = ({
.string()
.min(8, t("common.error.too-short", { length: 8 }))
.optional(),
})
}),
),
});
@@ -87,7 +87,7 @@ const Body = ({
labelPosition="left"
label={t("admin.users.modal.create.manual-password")}
description={t(
"admin.users.modal.create.manual-password.description"
"admin.users.modal.create.manual-password.description",
)}
{...form.getInputProps("setPasswordManually", {
type: "checkbox",

View File

@@ -21,7 +21,7 @@ import toast from "../../../utils/toast.util";
const showUpdateUserModal = (
modals: ModalsContextProps,
user: User,
getUsers: () => void
getUsers: () => void,
) => {
const t = translateOutsideContext();
return modals.openModal({
@@ -53,7 +53,7 @@ const Body = ({
username: yup
.string()
.min(3, t("common.error.too-short", { length: 3 })),
})
}),
),
});
@@ -66,7 +66,7 @@ const Body = ({
password: yup
.string()
.min(8, t("common.error.too-short", { length: 8 })),
})
}),
),
});
@@ -115,8 +115,8 @@ const Body = ({
})
.then(() =>
toast.success(
t("admin.users.edit.update.notify.password.success")
)
t("admin.users.edit.update.notify.password.success"),
),
)
.catch(toast.axiosError);
})}

View File

@@ -76,7 +76,7 @@ const SignUpForm = () => {
<Paper withBorder shadow="md" p={30} mt={30} radius="md">
<form
onSubmit={form.onSubmit((values) =>
signUp(values.email, values.username, values.password)
signUp(values.email, values.username, values.password),
)}
>
<TextInput

View File

@@ -8,7 +8,7 @@ import CopyTextField from "../../upload/CopyTextField";
const showCompletedReverseShareModal = (
modals: ModalsContextProps,
link: string,
getReverseShares: () => void
getReverseShares: () => void,
) => {
const t = translateOutsideContext();
return modals.openModal({

View File

@@ -23,7 +23,7 @@ import showCompletedReverseShareModal from "./showCompletedReverseShareModal";
const showCreateReverseShareModal = (
modals: ModalsContextProps,
showSendEmailNotificationOption: boolean,
getReverseShares: () => void
getReverseShares: () => void,
) => {
return modals.openModal({
title: "Create reverse share",
@@ -64,7 +64,7 @@ const Body = ({
values.expiration_num + values.expiration_unit,
values.maxShareSize,
values.maxUseCount,
values.sendEmailNotification
values.sendEmailNotification,
)
.then(({ link }) => {
modals.closeAll();
@@ -150,7 +150,7 @@ const Body = ({
expiresOn: t("account.reverseShare.expires-on"),
neverExpires: t("account.reverseShare.never-expires"),
},
form
form,
)}
</Text>
</div>
@@ -174,7 +174,7 @@ const Body = ({
labelPosition="left"
label={t("account.reverseShares.modal.send-email")}
description={t(
"account.reverseShares.modal.send-email.description"
"account.reverseShares.modal.send-email.description",
)}
{...form.getInputProps("sendEmailNotification", {
type: "checkbox",

View File

@@ -6,7 +6,7 @@ import FilePreview from "../FilePreview";
const showFilePreviewModal = (
shareId: string,
file: FileMetaData,
modals: ModalsContextProps
modals: ModalsContextProps,
) => {
const mimeType = (mime.contentType(file.name) || "").split(";")[0];
return modals.openModal({

View File

@@ -8,7 +8,7 @@ import useTranslate, {
const showEnterPasswordModal = (
modals: ModalsContextProps,
submitCallback: (password: string) => Promise<void>
submitCallback: (password: string) => Promise<void>,
) => {
const t = translateOutsideContext();
return modals.openModal({

View File

@@ -7,7 +7,7 @@ import { FormattedMessage } from "react-intl";
const showErrorModal = (
modals: ModalsContextProps,
title: string,
text: string
text: string,
) => {
return modals.openModal({
closeOnClickOutside: false,

View File

@@ -12,7 +12,7 @@ function CopyTextField(props: { link: string }) {
const [checkState, setCheckState] = useState(false);
const [textClicked, setTextClicked] = useState(false);
const timerRef = useRef<number | ReturnType<typeof setTimeout> | undefined>(
undefined
undefined,
);
const copyLink = () => {

View File

@@ -58,14 +58,14 @@ const Dropzone = ({
onDrop={(newFiles: FileUpload[]) => {
const fileSizeSum = [...newFiles, ...files].reduce(
(n, { size }) => n + size,
0
0,
);
if (fileSizeSum > maxShareSize) {
toast.error(
t("upload.dropzone.notify.file-too-big", {
maxSize: byteToHumanSizeString(maxShareSize),
})
}),
);
} else {
newFiles = newFiles.map((newFile) => {

View File

@@ -13,7 +13,7 @@ import CopyTextField from "../CopyTextField";
const showCompletedUploadModal = (
modals: ModalsContextProps,
share: Share,
appUrl: string
appUrl: string,
) => {
const t = translateOutsideContext();
return modals.openModal({

View File

@@ -38,7 +38,7 @@ const showCreateUploadModal = (
allowUnauthenticatedShares: boolean;
enableEmailRecepients: boolean;
},
uploadCallback: (createShare: CreateShare) => void
uploadCallback: (createShare: CreateShare) => void,
) => {
const t = translateOutsideContext();
@@ -152,7 +152,7 @@ const CreateUploadModalBody = ({
"link",
Buffer.from(Math.random().toString(), "utf8")
.toString("base64")
.substr(10, 7)
.substr(10, 7),
)
}
>
@@ -251,7 +251,7 @@ const CreateUploadModalBody = ({
neverExpires: t("upload.modal.completed.never-expires"),
expiresOn: t("upload.modal.completed.expires-on"),
},
form
form,
)}
</Text>
</>
@@ -266,7 +266,7 @@ const CreateUploadModalBody = ({
<Textarea
variant="filled"
placeholder={t(
"upload.modal.accordion.description.placeholder"
"upload.modal.accordion.description.placeholder",
)}
{...form.getInputProps("description")}
/>
@@ -290,7 +290,7 @@ const CreateUploadModalBody = ({
if (!query.match(/^\S+@\S+\.\S+$/)) {
form.setFieldError(
"recipients",
t("upload.modal.accordion.email.invalid-email")
t("upload.modal.accordion.email.invalid-email"),
);
} else {
form.setFieldError("recipients", null);
@@ -315,7 +315,7 @@ const CreateUploadModalBody = ({
<PasswordInput
variant="filled"
placeholder={t(
"upload.modal.accordion.security.password.placeholder"
"upload.modal.accordion.security.password.placeholder",
)}
label={t("upload.modal.accordion.security.password.label")}
{...form.getInputProps("password")}
@@ -325,7 +325,7 @@ const CreateUploadModalBody = ({
type="number"
variant="filled"
placeholder={t(
"upload.modal.accordion.security.max-views.placeholder"
"upload.modal.accordion.security.max-views.placeholder",
)}
label={t("upload.modal.accordion.security.max-views.label")}
{...form.getInputProps("maxViews")}