diff --git a/src/pages/tools/time/crontab-guru/index.tsx b/src/pages/tools/time/crontab-guru/index.tsx index 11246e77..22a4b1db 100644 --- a/src/pages/tools/time/crontab-guru/index.tsx +++ b/src/pages/tools/time/crontab-guru/index.tsx @@ -1,11 +1,10 @@ -import { Alert } from '@mui/material'; import React, { useState } from 'react'; import ToolContent from '@components/ToolContent'; import { ToolComponentProps } from '@tools/defineTool'; import ToolTextInput from '@components/input/ToolTextInput'; import ToolTextResult from '@components/result/ToolTextResult'; import { CardExampleType } from '@components/examples/ToolExamples'; -import { main, validateCrontab } from './service'; +import { main } from './service'; const initialValues = {}; @@ -13,28 +12,28 @@ type InitialValuesType = typeof initialValues; const exampleCards: CardExampleType[] = [ { - title: 'Every day at 16:35, Sunday to Friday', + title: 'Every day at 16:35, Sunday to Friday (English)', description: 'At 16:35 on every day-of-week from Sunday through Friday.', sampleText: '35 16 * * 0-5', sampleResult: 'At 04:35 PM, Sunday through Friday', sampleOptions: {} }, { - title: 'Every minute', + title: 'Every minute (English)', description: 'Runs every minute.', sampleText: '* * * * *', sampleResult: 'Every minute', sampleOptions: {} }, { - title: 'Every 5 minutes', + title: 'Every 5 minutes (English)', description: 'Runs every 5 minutes.', sampleText: '*/5 * * * *', sampleResult: 'Every 5 minutes', sampleOptions: {} }, { - title: 'At 12:00 PM on the 1st of every month', + title: 'At 12:00 PM on the 1st of every month (English)', description: 'Runs at noon on the first day of each month.', sampleText: '0 12 1 * *', sampleResult: 'At 12:00 PM, on day 1 of the month', @@ -48,19 +47,9 @@ export default function CrontabGuru({ }: ToolComponentProps) { const [input, setInput] = useState(''); const [result, setResult] = useState(''); - const [isValid, setIsValid] = useState(null); - const [hasInteracted, setHasInteracted] = useState(false); const compute = (values: InitialValuesType, input: string) => { - if (hasInteracted) { - setIsValid(validateCrontab(input)); - } - setResult(main(input, values)); - }; - - const handleInputChange = (val: string) => { - if (!hasInteracted) setHasInteracted(true); - setInput(val); + setResult(main(input)); }; return ( @@ -70,53 +59,11 @@ export default function CrontabGuru({ inputComponent={ } - resultComponent={ -
- {hasInteracted && isValid === false && ( -
- - Invalid crontab expression. - -
- )} -
- -
-
- } + resultComponent={} initialValues={initialValues} exampleCards={exampleCards} getGroups={null}