mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-17 04:59:34 +02:00
feat: generate Numbers
This commit is contained in:
32
.idea/workspace.xml
generated
32
.idea/workspace.xml
generated
@@ -4,10 +4,12 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: misc">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="style: lint">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/list/sort/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/sort/service.ts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/components/ToolInputAndResult.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/ToolInputAndResult.tsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/pages/list/sort/sort.service.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/list/sort/sort.service.test.ts" 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/number/generate/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/index.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/number/generate/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/service.ts" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -202,15 +204,7 @@
|
|||||||
<workItem from="1719464673797" duration="38000" />
|
<workItem from="1719464673797" duration="38000" />
|
||||||
<workItem from="1719475764139" duration="14903000" />
|
<workItem from="1719475764139" duration="14903000" />
|
||||||
<workItem from="1719492452780" duration="8000" />
|
<workItem from="1719492452780" duration="8000" />
|
||||||
<workItem from="1719496624579" duration="2920000" />
|
<workItem from="1719496624579" duration="6148000" />
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00023" summary="feat: tools normalized">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1719090379202</created>
|
|
||||||
<option name="number" value="00023" />
|
|
||||||
<option name="presentableId" value="LOCAL-00023" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1719090379202</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00024" summary="feat: search tools">
|
<task id="LOCAL-00024" summary="feat: search tools">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -596,7 +590,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1719491470485</updated>
|
<updated>1719491470485</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="72" />
|
<task id="LOCAL-00072" summary="style: lint">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1719499895862</created>
|
||||||
|
<option name="number" value="00072" />
|
||||||
|
<option name="presentableId" value="LOCAL-00072" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1719499895862</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="73" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -617,7 +619,6 @@
|
|||||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
<option name="CHECK_NEW_TODO" value="false" />
|
<option name="CHECK_NEW_TODO" value="false" />
|
||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
<MESSAGE value="feat: change colors in png" />
|
|
||||||
<MESSAGE value="chore: ResultFooter" />
|
<MESSAGE value="chore: ResultFooter" />
|
||||||
<MESSAGE value="feat: change color in png finished" />
|
<MESSAGE value="feat: change color in png finished" />
|
||||||
<MESSAGE value="feat: string to morse" />
|
<MESSAGE value="feat: string to morse" />
|
||||||
@@ -642,7 +643,8 @@
|
|||||||
<MESSAGE value="feat: change gif speed" />
|
<MESSAGE value="feat: change gif speed" />
|
||||||
<MESSAGE value="chore: remove unused deps" />
|
<MESSAGE value="chore: remove unused deps" />
|
||||||
<MESSAGE value="fix: misc" />
|
<MESSAGE value="fix: misc" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="fix: misc" />
|
<MESSAGE value="style: lint" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="style: lint" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
|
@@ -5,15 +5,17 @@ export default function ToolInputAndResult({
|
|||||||
input,
|
input,
|
||||||
result
|
result
|
||||||
}: {
|
}: {
|
||||||
input: ReactNode;
|
input?: ReactNode;
|
||||||
result: ReactNode;
|
result: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Grid id="tool" container spacing={2}>
|
<Grid id="tool" container spacing={2}>
|
||||||
|
{input && (
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
{input}
|
{input}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
)}
|
||||||
|
<Grid item xs={12} md={input ? 6 : 12}>
|
||||||
{result}
|
{result}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@@ -20,7 +20,7 @@ const FormikListenerComponent = <T,>({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
try {
|
try {
|
||||||
if (values && input) compute(values, input);
|
compute(values, input);
|
||||||
} catch (exception: unknown) {
|
} catch (exception: unknown) {
|
||||||
if (exception instanceof Error) showSnackBar(exception.message, 'error');
|
if (exception instanceof Error) showSnackBar(exception.message, 'error');
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ export default function ToolOptions<T extends FormikValues>({
|
|||||||
initialValues: T;
|
initialValues: T;
|
||||||
validationSchema: any | (() => any);
|
validationSchema: any | (() => any);
|
||||||
compute: (optionsValues: T, input: any) => void;
|
compute: (optionsValues: T, input: any) => void;
|
||||||
input: any;
|
input?: any;
|
||||||
getGroups: (formikProps: FormikProps<T>) => ToolOptionGroup[];
|
getGroups: (formikProps: FormikProps<T>) => ToolOptionGroup[];
|
||||||
formRef?: RefObject<FormikProps<T>>;
|
formRef?: RefObject<FormikProps<T>>;
|
||||||
}) {
|
}) {
|
||||||
|
@@ -1,11 +1,85 @@
|
|||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import ToolTextResult from '../../../components/result/ToolTextResult';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
import ToolOptions from '../../../components/options/ToolOptions';
|
||||||
|
import { listOfIntegers } from './service';
|
||||||
|
import ToolInputAndResult from '../../../components/ToolInputAndResult';
|
||||||
|
import TextFieldWithDesc from '../../../components/options/TextFieldWithDesc';
|
||||||
|
|
||||||
const initialValues = {};
|
const initialValues = {
|
||||||
const validationSchema = Yup.object({
|
firstValue: '1',
|
||||||
|
numberOfNumbers: '10',
|
||||||
|
step: '1',
|
||||||
|
separator: '\\n'
|
||||||
|
};
|
||||||
|
export default function SplitText() {
|
||||||
|
const [result, setResult] = useState<string>('');
|
||||||
|
|
||||||
|
const validationSchema = Yup.object({
|
||||||
// splitSeparator: Yup.string().required('The separator is required')
|
// splitSeparator: Yup.string().required('The separator is required')
|
||||||
});
|
});
|
||||||
export default function Generate() {
|
|
||||||
return <Box>Lorem ipsum</Box>;
|
return (
|
||||||
|
<Box>
|
||||||
|
<ToolInputAndResult
|
||||||
|
result={<ToolTextResult title={'Total'} value={result} />}
|
||||||
|
/>
|
||||||
|
<ToolOptions
|
||||||
|
getGroups={({ values, setFieldValue }) => [
|
||||||
|
{
|
||||||
|
title: 'Arithmetic sequence option',
|
||||||
|
component: (
|
||||||
|
<Box>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
description={'Start sequence from this number.'}
|
||||||
|
value={values.firstValue}
|
||||||
|
onChange={(val) => setFieldValue('firstValue', val)}
|
||||||
|
type={'number'}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
description={'Increase each element by this amount'}
|
||||||
|
value={values.step}
|
||||||
|
onChange={(val) => setFieldValue('step', val)}
|
||||||
|
type={'number'}
|
||||||
|
/>
|
||||||
|
<TextFieldWithDesc
|
||||||
|
description={'Number of elements in sequence.'}
|
||||||
|
value={values.numberOfNumbers}
|
||||||
|
onChange={(val) => setFieldValue('numberOfNumbers', val)}
|
||||||
|
type={'number'}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Separator',
|
||||||
|
component: (
|
||||||
|
<TextFieldWithDesc
|
||||||
|
description={
|
||||||
|
'Separate elements in the arithmetic sequence by this character.'
|
||||||
|
}
|
||||||
|
value={values.separator}
|
||||||
|
onChange={(val) => setFieldValue('separator', val)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
compute={(optionsValues) => {
|
||||||
|
const { firstValue, numberOfNumbers, separator, step } =
|
||||||
|
optionsValues;
|
||||||
|
setResult(
|
||||||
|
listOfIntegers(
|
||||||
|
Number(firstValue),
|
||||||
|
Number(numberOfNumbers),
|
||||||
|
Number(step),
|
||||||
|
separator
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
initialValues={initialValues}
|
||||||
|
validationSchema={validationSchema}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user