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

@@ -43,9 +43,7 @@ const ErrorNotFound = () => {
<>
<Meta title="Not found" />
<Container className={classes.root}>
<div className={classes.label}>
404
</div>
<div className={classes.label}>404</div>
<Title align="center" order={3}>
<FormattedMessage id="404.description" />
</Title>

View File

@@ -41,7 +41,7 @@ function App({ Component, pageProps }: AppProps) {
const [route, setRoute] = useState<string>(pageProps.route);
const [configVariables, setConfigVariables] = useState<Config[]>(
pageProps.configVariables
pageProps.configVariables,
);
useEffect(() => {
@@ -165,7 +165,7 @@ App.getInitialProps = async ({ ctx }: { ctx: GetServerSidePropsContext }) => {
pageProps.route = ctx.req.url;
const requestLanguage = i18nUtil.getLanguageFromAcceptHeader(
ctx.req.headers["accept-language"]
ctx.req.headers["accept-language"],
);
pageProps.language = ctx.req.cookies["language"] ?? requestLanguage;

View File

@@ -42,7 +42,7 @@ const Account = () => {
username: yup
.string()
.min(3, t("common.error.too-short", { length: 3 })),
})
}),
),
});
@@ -61,7 +61,7 @@ const Account = () => {
.string()
.min(8, t("common.error.too-short", { length: 8 }))
.required(t("common.error.field-required")),
})
}),
),
});
@@ -75,7 +75,7 @@ const Account = () => {
.string()
.min(8, t("common.error.too-short", { length: 8 }))
.required(t("common.error.field-required")),
})
}),
),
});
@@ -92,7 +92,7 @@ const Account = () => {
.min(6, t("common.error.exact-length", { length: 6 }))
.max(6, t("common.error.exact-length", { length: 6 }))
.matches(/^[0-9]+$/, { message: t("common.error.invalid-number") }),
})
}),
),
});
@@ -115,7 +115,7 @@ const Account = () => {
email: values.email,
})
.then(() => toast.success(t("account.notify.info.success")))
.catch(toast.axiosError)
.catch(toast.axiosError),
)}
>
<Stack>
@@ -147,7 +147,7 @@ const Account = () => {
toast.success(t("account.notify.password.success"));
passwordForm.reset();
})
.catch(toast.axiosError)
.catch(toast.axiosError),
)}
>
<Stack>
@@ -199,7 +199,7 @@ const Account = () => {
<Stack>
<PasswordInput
description={t(
"account.card.security.totp.disable.description"
"account.card.security.totp.disable.description",
)}
label={t("account.card.password.title")}
{...disableTotpForm.getInputProps("password")}
@@ -241,7 +241,7 @@ const Account = () => {
<PasswordInput
label={t("account.card.password.title")}
description={t(
"account.card.security.totp.enable.description"
"account.card.security.totp.enable.description",
)}
{...enableTotpForm.getInputProps("password")}
/>

View File

@@ -77,7 +77,7 @@ const MyShares = () => {
showCreateReverseShareModal(
modals,
config.get("smtp.enabled"),
getReverseShares
getReverseShares,
)
}
leftIcon={<TbPlus size={20} />}
@@ -134,10 +134,10 @@ const MyShares = () => {
<Text size="sm">
{reverseShare.shares.length == 1
? `1 ${t(
"account.reverseShares.table.count.singular"
"account.reverseShares.table.count.singular",
)}`
: `${reverseShare.shares.length} ${t(
"account.reverseShares.table.count.plural"
"account.reverseShares.table.count.plural",
)}`}
</Text>
</Accordion.Control>
@@ -158,15 +158,13 @@ const MyShares = () => {
size={25}
onClick={() => {
if (window.isSecureContext) {
clipboard.copy(
`${appUrl}/s/${share.id}`
);
clipboard.copy(`${appUrl}/s/${share.id}`);
toast.success(t("common.notify.copied"));
} else {
showShareLinkModal(
modals,
share.id,
config.get("general.appUrl")
config.get("general.appUrl"),
);
}
}}
@@ -200,14 +198,14 @@ const MyShares = () => {
clipboard.copy(
`${config.get("general.appUrl")}/upload/${
reverseShare.token
}`
}`,
);
toast.success(t("common.notify.copied"));
} else {
showReverseShareLinkModal(
modals,
reverseShare.token,
config.get("general.appUrl")
config.get("general.appUrl"),
);
}
}}
@@ -221,7 +219,7 @@ const MyShares = () => {
onClick={() => {
modals.openConfirmModal({
title: t(
"account.reverseShares.modal.delete.title"
"account.reverseShares.modal.delete.title",
),
children: (
<Text size="sm">
@@ -239,8 +237,8 @@ const MyShares = () => {
shareService.removeReverseShare(reverseShare.id);
setReverseShares(
reverseShares.filter(
(item) => item.id !== reverseShare.id
)
(item) => item.id !== reverseShare.id,
),
);
},
});

View File

@@ -119,7 +119,7 @@ const MyShares = () => {
modals,
share,
config.get("general.appUrl"),
parseInt(config.get("share.maxSize"))
parseInt(config.get("share.maxSize")),
);
}}
>
@@ -132,16 +132,14 @@ const MyShares = () => {
onClick={() => {
if (window.isSecureContext) {
clipboard.copy(
`${config.get("general.appUrl")}/s/${
share.id
}`
`${config.get("general.appUrl")}/s/${share.id}`,
);
toast.success(t("common.notify.copied"));
} else {
showShareLinkModal(
modals,
share.id,
config.get("general.appUrl")
config.get("general.appUrl"),
);
}
}}
@@ -172,7 +170,7 @@ const MyShares = () => {
onConfirm: () => {
shareService.remove(share.id);
setShares(
shares.filter((item) => item.id !== share.id)
shares.filter((item) => item.id !== share.id),
);
},
});

View File

@@ -56,7 +56,7 @@ export default function AppShellDemo() {
.then(() => {
setLogo(null);
toast.success(
"Logo updated successfully. It may take a few minutes to update on the website."
"Logo updated successfully. It may take a few minutes to update on the website.",
);
})
.catch(toast.axiosError);
@@ -76,7 +76,7 @@ export default function AppShellDemo() {
const updateConfigVariable = (configVariable: UpdateConfig) => {
const index = updatedConfigVariables.findIndex(
(item) => item.key === configVariable.key
(item) => item.key === configVariable.key,
);
if (index > -1) {
@@ -139,7 +139,7 @@ export default function AppShellDemo() {
<Title order={6}>
<FormattedMessage
id={`admin.config.${camelToKebab(
configVariable.key
configVariable.key,
)}`}
/>
</Title>
@@ -154,7 +154,7 @@ export default function AppShellDemo() {
>
<FormattedMessage
id={`admin.config.${camelToKebab(
configVariable.key
configVariable.key,
)}.description`}
values={{ br: <br /> }}
/>

View File

@@ -39,7 +39,7 @@ const ResetPassword = () => {
.string()
.min(8, t("common.error.too-short", { length: 8 }))
.required(t("common.error.field-required")),
})
}),
),
});

View File

@@ -57,7 +57,7 @@ const ResetPassword = () => {
.string()
.email(t("common.error.invalid-email"))
.required(t("common.error.field-required")),
})
}),
),
});
@@ -79,7 +79,7 @@ const ResetPassword = () => {
toast.success(t("resetPassword.notify.success"));
router.push("/auth/signIn");
})
.catch(toast.axiosError)
.catch(toast.axiosError),
)}
>
<TextInput

View File

@@ -36,7 +36,7 @@ const Share = ({ shareId }: { shareId: string }) => {
showErrorModal(
modals,
t("share.error.visitor-limit-exceeded.title"),
t("share.error.visitor-limit-exceeded.description")
t("share.error.visitor-limit-exceeded.description"),
);
} else {
toast.axiosError(e);
@@ -57,13 +57,13 @@ const Share = ({ shareId }: { shareId: string }) => {
showErrorModal(
modals,
t("share.error.removed.title"),
e.response.data.message
e.response.data.message,
);
} else {
showErrorModal(
modals,
t("share.error.not-found.title"),
t("share.error.not-found.description")
t("share.error.not-found.description"),
);
}
} else if (error == "share_password_required") {

View File

@@ -29,7 +29,7 @@ const Share = ({ reverseShareToken }: { reverseShareToken: string }) => {
showErrorModal(
modals,
"Invalid Link",
"This link is invalid. Please check your link."
"This link is invalid. Please check your link.",
);
setIsLoading(false);
});

View File

@@ -56,7 +56,7 @@ const Upload = ({
file.uploadingProgress = progress;
}
return file;
})
}),
);
};
@@ -84,7 +84,7 @@ const Upload = ({
name: file.name,
},
chunkIndex,
chunks
chunks,
)
.then((response) => {
fileId = response.id;
@@ -114,7 +114,7 @@ const Upload = ({
}
}
}
})
}),
);
Promise.all(fileUploadPromises);
@@ -123,7 +123,7 @@ const Upload = ({
useEffect(() => {
// Check if there are any files that failed to upload
const fileErrorCount = files.filter(
(file) => file.uploadingProgress == -1
(file) => file.uploadingProgress == -1,
).length;
if (fileErrorCount > 0) {
@@ -133,7 +133,7 @@ const Upload = ({
{
withCloseButton: false,
autoClose: false,
}
},
);
}
errorToastShown = true;
@@ -174,13 +174,13 @@ const Upload = ({
isReverseShare,
appUrl: config.get("general.appUrl"),
allowUnauthenticatedShares: config.get(
"share.allowUnauthenticatedShares"
"share.allowUnauthenticatedShares",
),
enableEmailRecepients: config.get(
"email.enableShareEmailRecipients"
"email.enableShareEmailRecipients",
),
},
uploadFiles
uploadFiles,
);
}}
>