refactor: remove validation schema

This commit is contained in:
Ibrahima G. Coulibaly
2024-07-14 00:48:10 +01:00
parent 31f0ad9f32
commit 424436d07a
18 changed files with 30 additions and 65 deletions

41
.idea/workspace.xml generated
View File

@@ -4,10 +4,25 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: rotate ui">
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="feat: shuffle ui">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/options/ToolOptions.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/options/ToolOptions.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/image/png/change-colors-in-png/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/image/png/change-colors-in-png/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/image/png/convert-jgp-to-png/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/image/png/convert-jgp-to-png/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/image/png/create-transparent/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/image/png/create-transparent/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/find-most-popular/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/find-most-popular/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/find-unique/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/find-unique/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/group/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/group/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/reverse/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/reverse/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/rotate/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/rotate/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/shuffle/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/shuffle/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/list/sort/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/sort/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/number/generate/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/number/sum/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/sum/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/string/join/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/string/join/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/string/split/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/string/split/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/string/to-morse/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/string/to-morse/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/video/gif/change-speed/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/video/gif/change-speed/index.tsx" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -245,15 +260,7 @@
<workItem from="1720661825389" duration="4305000" />
<workItem from="1720729165596" duration="3258000" />
<workItem from="1720911748039" duration="331000" />
<workItem from="1720912096050" duration="1586000" />
</task>
<task id="LOCAL-00049" summary="feat: change color in png finished">
<option name="closed" value="true" />
<created>1719275214988</created>
<option name="number" value="00049" />
<option name="presentableId" value="LOCAL-00049" />
<option name="project" value="LOCAL" />
<updated>1719275214988</updated>
<workItem from="1720912096050" duration="2231000" />
</task>
<task id="LOCAL-00050" summary="feat: string to morse">
<option name="closed" value="true" />
@@ -639,7 +646,15 @@
<option name="project" value="LOCAL" />
<updated>1720913013183</updated>
</task>
<option name="localTasksCounter" value="98" />
<task id="LOCAL-00098" summary="feat: shuffle ui">
<option name="closed" value="true" />
<created>1720913810733</created>
<option name="number" value="00098" />
<option name="presentableId" value="LOCAL-00098" />
<option name="project" value="LOCAL" />
<updated>1720913810733</updated>
</task>
<option name="localTasksCounter" value="99" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -683,7 +698,6 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="chore: shuffle tools search" />
<MESSAGE value="refactor: toolOptions" />
<MESSAGE value="feat: playwright" />
<MESSAGE value="refactor: optimize imports" />
@@ -708,7 +722,8 @@
<MESSAGE value="feat: self host" />
<MESSAGE value="chore: format number" />
<MESSAGE value="feat: rotate ui" />
<option name="LAST_COMMIT_MESSAGE" value="feat: rotate ui" />
<MESSAGE value="feat: shuffle ui" />
<option name="LAST_COMMIT_MESSAGE" value="feat: shuffle ui" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@@ -5,6 +5,7 @@ import React, { ReactNode, RefObject, useContext, useEffect } from 'react';
import { Formik, FormikProps, FormikValues, useFormikContext } from 'formik';
import ToolOptionGroups, { ToolOptionGroup } from './ToolOptionGroups';
import { CustomSnackBarContext } from '../../contexts/CustomSnackBarContext';
import * as Yup from 'yup';
type UpdateField<T> = <Y extends keyof T>(field: Y, value: T[Y]) => void;
@@ -78,7 +79,7 @@ export default function ToolOptions<T extends FormikValues>({
}: {
children?: ReactNode;
initialValues: T;
validationSchema: any | (() => any);
validationSchema?: any | (() => any);
compute: (optionsValues: T, input: any) => void;
input?: any;
getGroups: (

View File

@@ -134,7 +134,6 @@ export default function ChangeColorsInPng() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -148,7 +148,6 @@ export default function ConvertJgpToPng() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -121,7 +121,6 @@ export default function ChangeColorsInPng() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -69,9 +69,6 @@ export default function FindMostPopular() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -165,7 +162,6 @@ export default function FindMostPopular() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -63,9 +63,6 @@ export default function FindUnique() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -156,7 +153,6 @@ export default function FindUnique() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -73,9 +73,6 @@ export default function FindUnique() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -181,7 +178,6 @@ export default function FindUnique() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -41,9 +41,6 @@ export default function Reverse() {
reverseList(splitOperatorType, splitSeparator, joinSeparator, input)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -103,7 +100,6 @@ export default function Reverse() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -71,9 +71,6 @@ export default function Rotate() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -151,7 +148,6 @@ export default function Rotate() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -51,9 +51,6 @@ export default function Shuffle() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -118,7 +115,6 @@ export default function Shuffle() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -64,9 +64,6 @@ export default function SplitText() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -163,7 +160,6 @@ export default function SplitText() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -16,10 +16,6 @@ const initialValues = {
export default function SplitText() {
const [result, setResult] = useState<string>('');
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
<ToolInputAndResult
@@ -78,7 +74,6 @@ export default function SplitText() {
);
}}
initialValues={initialValues}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -42,10 +42,6 @@ export default function SplitText() {
const [input, setInput] = useState<string>('');
const [result, setResult] = useState<string>('');
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
<ToolInputAndResult
@@ -112,7 +108,6 @@ export default function SplitText() {
}}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -171,7 +171,6 @@ export default function JoinText() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
<ToolInfo
title="What Is a Text Joiner?"

View File

@@ -104,9 +104,6 @@ export default function SplitText() {
)
);
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -146,7 +143,6 @@ export default function SplitText() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -21,9 +21,6 @@ export default function ToMorse() {
const { dotSymbol, dashSymbol } = optionsValues;
setResult(compute(input, dotSymbol, dashSymbol));
};
const validationSchema = Yup.object({
// splitSeparator: Yup.string().required('The separator is required')
});
return (
<Box>
@@ -61,7 +58,6 @@ export default function ToMorse() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);

View File

@@ -142,7 +142,6 @@ export default function ChangeSpeed() {
]}
initialValues={initialValues}
input={input}
validationSchema={validationSchema}
/>
</Box>
);