Skip to content

Commit

Permalink
chore(frontend): adapt to new gql schema
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Dec 3, 2024
1 parent 3132583 commit 0952a15
Showing 1 changed file with 2 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Flex,
Group,
Indicator,
JsonInput,
Progress,
Select,
Stack,
Expand Down Expand Up @@ -86,6 +85,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
ImportSource.Imdb,
ImportSource.Goodreads,
ImportSource.OpenScale,
ImportSource.StrongApp,
() => ({
genericCsv: processSubmission(formData, genericCsvImportFormSchema),
}),
Expand All @@ -107,15 +107,6 @@ export const action = async ({ request }: ActionFunctionArgs) => {
.with(ImportSource.Myanimelist, async () => ({
mal: processSubmission(formData, malImportFormSchema),
}))
.with(ImportSource.StrongApp, async () => {
const newLocal = processSubmission(
formData,
strongAppImportFormSchema,
);
return {
strongApp: { ...newLocal, mapping: JSON.parse(newLocal.mapping) },
};
})
.with(ImportSource.GenericJson, async () => ({
genericJson: processSubmission(formData, jsonImportFormSchema),
}))
Expand Down Expand Up @@ -186,11 +177,6 @@ const movaryImportFormSchema = z.object({
watchlist: z.string(),
});

const strongAppImportFormSchema = z.object({
exportPath: z.string(),
mapping: z.string(),
});

const jsonImportFormSchema = z.object({ export: z.string() });

const malImportFormSchema = z.object({
Expand Down Expand Up @@ -283,6 +269,7 @@ export default function Page() {
ImportSource.OpenScale,
ImportSource.Goodreads,
ImportSource.Imdb,
ImportSource.StrongApp,
ImportSource.Storygraph,
() => (
<>
Expand Down Expand Up @@ -374,39 +361,6 @@ export default function Page() {
/>
</>
))
.with(ImportSource.StrongApp, () => (
<>
<FileInput
label="CSV export file"
accept=".csv"
required
name="exportPath"
/>
<JsonInput
label="Mappings"
required
name="mapping"
autosize
minRows={10}
defaultValue={JSON.stringify(
[
{
sourceName: "Bench Press (Barbell)",
targetName:
"Barbell Bench Press - Medium Grip",
},
{
sourceName: "Bicep Curl (Barbell)",
targetName: "Barbell Curl",
},
],
null,
4,
)}
description="This is an example. Every exercise must be mapped, otherwise the import will fail."
/>
</>
))
.with(ImportSource.GenericJson, () => (
<>
<FileInput
Expand Down

0 comments on commit 0952a15

Please sign in to comment.