aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/components/forms
diff options
context:
space:
mode:
authorJayZed <[email protected]>2024-03-13 23:14:00 -0400
committerJayZed <[email protected]>2024-03-13 23:14:00 -0400
commitd875dc7733c901246881325ee3a84fe5d44b10b9 (patch)
tree503593f05ce7034c011a6cd401d2acd7648837e3 /frontend/src/components/forms
parent6c6cf0716f2e413262a46d14adca4ec1d4174bc5 (diff)
parent1c25d125d3db6b5ce2b38076d179dbfddf7cc2df (diff)
downloadbazarr-d875dc7733c901246881325ee3a84fe5d44b10b9.tar.gz
bazarr-d875dc7733c901246881325ee3a84fe5d44b10b9.zip
Merge branch 'development' of https://github.com/morpheus65535/bazarr into development
Diffstat (limited to 'frontend/src/components/forms')
-rw-r--r--frontend/src/components/forms/ColorToolForm.tsx4
-rw-r--r--frontend/src/components/forms/FrameRateForm.tsx6
-rw-r--r--frontend/src/components/forms/ItemEditForm.tsx8
-rw-r--r--frontend/src/components/forms/MovieUploadForm.tsx14
-rw-r--r--frontend/src/components/forms/ProfileEditForm.tsx22
-rw-r--r--frontend/src/components/forms/SeriesUploadForm.tsx20
-rw-r--r--frontend/src/components/forms/SyncSubtitleForm.tsx8
-rw-r--r--frontend/src/components/forms/TimeOffsetForm.tsx4
-rw-r--r--frontend/src/components/forms/TranslationForm.tsx6
9 files changed, 46 insertions, 46 deletions
diff --git a/frontend/src/components/forms/ColorToolForm.tsx b/frontend/src/components/forms/ColorToolForm.tsx
index af4d2b6e5..a37819bee 100644
--- a/frontend/src/components/forms/ColorToolForm.tsx
+++ b/frontend/src/components/forms/ColorToolForm.tsx
@@ -96,7 +96,7 @@ const ColorToolForm: FunctionComponent<Props> = ({ selections, onSubmit }) => {
validate: {
color: FormUtils.validation(
(value) => colorOptions.find((op) => op.value === value) !== undefined,
- "Must select a color"
+ "Must select a color",
),
},
});
@@ -110,7 +110,7 @@ const ColorToolForm: FunctionComponent<Props> = ({ selections, onSubmit }) => {
task.create(s.path, TaskName, mutateAsync, {
action,
form: s,
- })
+ }),
);
onSubmit?.();
diff --git a/frontend/src/components/forms/FrameRateForm.tsx b/frontend/src/components/forms/FrameRateForm.tsx
index c8694ae37..7e7eca24c 100644
--- a/frontend/src/components/forms/FrameRateForm.tsx
+++ b/frontend/src/components/forms/FrameRateForm.tsx
@@ -29,11 +29,11 @@ const FrameRateForm: FunctionComponent<Props> = ({ selections, onSubmit }) => {
validate: {
from: FormUtils.validation(
(value) => value > 0,
- "The From value must be larger than 0"
+ "The From value must be larger than 0",
),
to: FormUtils.validation(
(value) => value > 0,
- "The To value must be larger than 0"
+ "The To value must be larger than 0",
),
},
});
@@ -47,7 +47,7 @@ const FrameRateForm: FunctionComponent<Props> = ({ selections, onSubmit }) => {
task.create(s.path, TaskName, mutateAsync, {
action,
form: s,
- })
+ }),
);
onSubmit?.();
diff --git a/frontend/src/components/forms/ItemEditForm.tsx b/frontend/src/components/forms/ItemEditForm.tsx
index 31d00bfec..9f3856d54 100644
--- a/frontend/src/components/forms/ItemEditForm.tsx
+++ b/frontend/src/components/forms/ItemEditForm.tsx
@@ -27,12 +27,12 @@ const ItemEditForm: FunctionComponent<Props> = ({
const profileOptions = useSelectorOptions(
data ?? [],
(v) => v.name ?? "Unknown",
- (v) => v.profileId.toString() ?? "-1"
+ (v) => v.profileId.toString() ?? "-1",
);
const profile = useMemo(
() => data?.find((v) => v.profileId === item?.profileId) ?? null,
- [data, item?.profileId]
+ [data, item?.profileId],
);
const form = useForm({
@@ -44,7 +44,7 @@ const ItemEditForm: FunctionComponent<Props> = ({
const options = useSelectorOptions(
item?.audio_language ?? [],
(v) => v.name,
- (v) => v.code2
+ (v) => v.code2,
);
const isOverlayVisible = isLoading || isFetching || item === null;
@@ -77,7 +77,7 @@ const ItemEditForm: FunctionComponent<Props> = ({
{...profileOptions}
{...form.getInputProps("profile")}
clearable
- label="Languages Profiles"
+ label="Languages Profile"
></Selector>
<Divider></Divider>
<Group position="right">
diff --git a/frontend/src/components/forms/MovieUploadForm.tsx b/frontend/src/components/forms/MovieUploadForm.tsx
index 46b592081..fbcb0b04f 100644
--- a/frontend/src/components/forms/MovieUploadForm.tsx
+++ b/frontend/src/components/forms/MovieUploadForm.tsx
@@ -47,7 +47,7 @@ type SubtitleValidateResult = {
const validator = (
movie: Item.Movie,
- file: SubtitleFile
+ file: SubtitleFile,
): SubtitleValidateResult => {
if (file.language === null) {
return {
@@ -57,7 +57,7 @@ const validator = (
} else {
const { subtitles } = movie;
const existing = subtitles.find(
- (v) => v.code2 === file.language?.code2 && isString(v.path)
+ (v) => v.code2 === file.language?.code2 && isString(v.path),
);
if (existing !== undefined) {
return {
@@ -91,12 +91,12 @@ const MovieUploadForm: FunctionComponent<Props> = ({
const languageOptions = useSelectorOptions(
languages,
(v) => v.name,
- (v) => v.code2
+ (v) => v.code2,
);
const defaultLanguage = useMemo(
() => (languages.length > 0 ? languages[0] : null),
- [languages]
+ [languages],
);
const form = useForm({
@@ -120,7 +120,7 @@ const MovieUploadForm: FunctionComponent<Props> = ({
(v) =>
v.language === null ||
v.validateResult === undefined ||
- v.validateResult.state === "error"
+ v.validateResult.state === "error",
) === undefined
);
}, "Some files cannot be uploaded, please check"),
@@ -254,7 +254,7 @@ const MovieUploadForm: FunctionComponent<Props> = ({
},
},
],
- [action, languageOptions]
+ [action, languageOptions],
);
const { upload } = useMovieSubtitleModification();
@@ -294,7 +294,7 @@ export const MovieUploadModal = withModal(
{
title: "Upload Subtitles",
size: "xl",
- }
+ },
);
export default MovieUploadForm;
diff --git a/frontend/src/components/forms/ProfileEditForm.tsx b/frontend/src/components/forms/ProfileEditForm.tsx
index d31a0e338..874f5b8a6 100644
--- a/frontend/src/components/forms/ProfileEditForm.tsx
+++ b/frontend/src/components/forms/ProfileEditForm.tsx
@@ -69,11 +69,11 @@ const ProfileEditForm: FunctionComponent<Props> = ({
validate: {
name: FormUtils.validation(
(value) => value.length > 0,
- "Must have a name"
+ "Must have a name",
),
items: FormUtils.validation(
(value) => value.length > 0,
- "Must contain at lease 1 language"
+ "Must contain at lease 1 language",
),
},
});
@@ -83,7 +83,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
const itemCutoffOptions = useSelectorOptions(
form.values.items,
(v) => v.language,
- (v) => String(v.id)
+ (v) => String(v.id),
);
const cutoffOptions = useMemo(
@@ -91,24 +91,24 @@ const ProfileEditForm: FunctionComponent<Props> = ({
...itemCutoffOptions,
options: [...itemCutoffOptions.options, ...defaultCutoffOptions],
}),
- [itemCutoffOptions]
+ [itemCutoffOptions],
);
const selectedCutoff = useMemo(
() =>
cutoffOptions.options.find((v) => v.value.id === form.values.cutoff)
?.value ?? null,
- [cutoffOptions, form.values.cutoff]
+ [cutoffOptions, form.values.cutoff],
);
const mustContainOptions = useSelectorOptions(
form.values.mustContain,
- (v) => v
+ (v) => v,
);
const mustNotContainOptions = useSelectorOptions(
form.values.mustNotContain,
- (v) => v
+ (v) => v,
);
const action = useArrayAction<Language.ProfileItem>((fn) => {
@@ -120,7 +120,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
1 +
form.values.items.reduce<number>(
(val, item) => Math.max(item.id, val),
- 0
+ 0,
);
if (languages.length > 0) {
@@ -154,7 +154,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
() =>
languageOptions.options.find((l) => l.value.code2 === code)
?.value ?? null,
- [code]
+ [code],
);
const { classes } = useTableStyles();
@@ -238,7 +238,7 @@ const ProfileEditForm: FunctionComponent<Props> = ({
},
},
],
- [action, languageOptions]
+ [action, languageOptions],
);
return (
@@ -332,5 +332,5 @@ export const ProfileEditModal = withModal(
{
title: "Edit Languages Profile",
size: "xl",
- }
+ },
);
diff --git a/frontend/src/components/forms/SeriesUploadForm.tsx b/frontend/src/components/forms/SeriesUploadForm.tsx
index 3c8b036a4..784baf8a5 100644
--- a/frontend/src/components/forms/SeriesUploadForm.tsx
+++ b/frontend/src/components/forms/SeriesUploadForm.tsx
@@ -64,7 +64,7 @@ const validator = (file: SubtitleFile): SubtitleValidateResult => {
} else {
const { subtitles } = file.episode;
const existing = subtitles.find(
- (v) => v.code2 === file.language?.code2 && isString(v.path)
+ (v) => v.code2 === file.language?.code2 && isString(v.path),
);
if (existing !== undefined) {
return {
@@ -95,7 +95,7 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
const episodeOptions = useSelectorOptions(
episodes.data ?? [],
(v) => `(${v.season}x${v.episode}) ${v.title}`,
- (v) => v.sonarrEpisodeId.toString()
+ (v) => v.sonarrEpisodeId.toString(),
);
const profile = useLanguageProfileBy(series.profileId);
@@ -103,12 +103,12 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
const languageOptions = useSelectorOptions(
languages,
(v) => v.name,
- (v) => v.code2
+ (v) => v.code2,
);
const defaultLanguage = useMemo(
() => (languages.length > 0 ? languages[0] : null),
- [languages]
+ [languages],
);
const form = useForm({
@@ -134,9 +134,9 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
v.language === null ||
v.episode === null ||
v.validateResult === undefined ||
- v.validateResult.state === "error"
+ v.validateResult.state === "error",
) === undefined,
- "Some files cannot be uploaded, please check"
+ "Some files cannot be uploaded, please check",
),
},
});
@@ -162,7 +162,7 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
if (info) {
item.episode =
episodes.data?.find(
- (v) => v.season === info.season && v.episode === info.episode
+ (v) => v.season === info.season && v.episode === info.episode,
) ?? item.episode;
}
return item;
@@ -320,7 +320,7 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
},
},
],
- [action, episodeOptions, languageOptions]
+ [action, episodeOptions, languageOptions],
);
const { upload } = useEpisodeSubtitleModification();
@@ -335,7 +335,7 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
if (language === null || episode === null) {
throw new Error(
- "Invalid language or episode. This shouldn't happen, please report this bug."
+ "Invalid language or episode. This shouldn't happen, please report this bug.",
);
}
@@ -370,7 +370,7 @@ const SeriesUploadForm: FunctionComponent<Props> = ({
export const SeriesUploadModal = withModal(
SeriesUploadForm,
"upload-series-subtitles",
- { title: "Upload Subtitles", size: "xl" }
+ { title: "Upload Subtitles", size: "xl" },
);
export default SeriesUploadForm;
diff --git a/frontend/src/components/forms/SyncSubtitleForm.tsx b/frontend/src/components/forms/SyncSubtitleForm.tsx
index 349058f63..b5136fc85 100644
--- a/frontend/src/components/forms/SyncSubtitleForm.tsx
+++ b/frontend/src/components/forms/SyncSubtitleForm.tsx
@@ -21,18 +21,18 @@ const TaskName = "Syncing Subtitle";
function useReferencedSubtitles(
mediaType: "episode" | "movie",
mediaId: number,
- subtitlesPath: string
+ subtitlesPath: string,
) {
// We cannot call hooks conditionally, we rely on useQuery "enabled" option to do only the required API call
const episodeData = useRefTracksByEpisodeId(
subtitlesPath,
mediaId,
- mediaType === "episode"
+ mediaType === "episode",
);
const movieData = useRefTracksByMovieId(
subtitlesPath,
mediaId,
- mediaType === "movie"
+ mediaType === "movie",
);
const mediaData = mediaType === "episode" ? episodeData : movieData;
@@ -108,7 +108,7 @@ const SyncSubtitleForm: FunctionComponent<Props> = ({
const subtitles: SelectorOption<string>[] = useReferencedSubtitles(
mediaType,
mediaId,
- subtitlesPath
+ subtitlesPath,
);
const form = useForm<FormValues>({
diff --git a/frontend/src/components/forms/TimeOffsetForm.tsx b/frontend/src/components/forms/TimeOffsetForm.tsx
index 6d213b359..2792d64d8 100644
--- a/frontend/src/components/forms/TimeOffsetForm.tsx
+++ b/frontend/src/components/forms/TimeOffsetForm.tsx
@@ -37,7 +37,7 @@ const TimeOffsetForm: FunctionComponent<Props> = ({ selections, onSubmit }) => {
sec: FormUtils.validation((v) => v >= 0, "Second must be larger than 0"),
ms: FormUtils.validation(
(v) => v >= 0,
- "Millisecond must be larger than 0"
+ "Millisecond must be larger than 0",
),
},
});
@@ -62,7 +62,7 @@ const TimeOffsetForm: FunctionComponent<Props> = ({ selections, onSubmit }) => {
task.create(s.path, TaskName, mutateAsync, {
action,
form: s,
- })
+ }),
);
onSubmit?.();
diff --git a/frontend/src/components/forms/TranslationForm.tsx b/frontend/src/components/forms/TranslationForm.tsx
index 260d9b198..976b2f72f 100644
--- a/frontend/src/components/forms/TranslationForm.tsx
+++ b/frontend/src/components/forms/TranslationForm.tsx
@@ -146,13 +146,13 @@ const TranslationForm: FunctionComponent<Props> = ({
const available = useMemo(
() => languages.filter((v) => v.code2 in translations),
- [languages]
+ [languages],
);
const options = useSelectorOptions(
available,
(v) => v.name,
- (v) => v.code2
+ (v) => v.code2,
);
return (
@@ -166,7 +166,7 @@ const TranslationForm: FunctionComponent<Props> = ({
...s,
language: language.code2,
},
- })
+ }),
);
onSubmit?.();