fix: misc

This commit is contained in:
Ibrahima G. Coulibaly
2025-07-08 18:00:30 +01:00
parent fb6dd816a1
commit 5133d0dce2
3 changed files with 160 additions and 186 deletions

303
.idea/workspace.xml generated
View File

@@ -4,11 +4,10 @@
<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="chore: add array key"> <list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix:">
<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/components/Hero.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Hero.tsx" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/time/crontab-guru/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/time/crontab-guru/index.tsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/tools-by-category/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools-by-category/index.tsx" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/pages/tools/time/crontab-guru/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/tools/time/crontab-guru/meta.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/string.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/string.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" />
@@ -41,178 +40,178 @@
&quot;state&quot;: &quot;OPEN&quot; &quot;state&quot;: &quot;OPEN&quot;
} }
}</component> }</component>
<component name="GitHubPullRequestState"><![CDATA[{ <component name="GitHubPullRequestState">{
"prStates": [ &quot;prStates&quot;: [
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts51PkS9", &quot;id&quot;: &quot;PR_kwDOMJIfts51PkS9&quot;,
"number": 22 &quot;number&quot;: 22
}, },
"lastSeen": 1741207144695 &quot;lastSeen&quot;: 1741207144695
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6NiNYl", &quot;id&quot;: &quot;PR_kwDOMJIfts6NiNYl&quot;,
"number": 32 &quot;number&quot;: 32
}, },
"lastSeen": 1741209723869 &quot;lastSeen&quot;: 1741209723869
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6Nheyd", &quot;id&quot;: &quot;PR_kwDOMJIfts6Nheyd&quot;,
"number": 31 &quot;number&quot;: 31
}, },
"lastSeen": 1741213371410 &quot;lastSeen&quot;: 1741213371410
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6NmRBs", &quot;id&quot;: &quot;PR_kwDOMJIfts6NmRBs&quot;,
"number": 33 &quot;number&quot;: 33
}, },
"lastSeen": 1741282429036 &quot;lastSeen&quot;: 1741282429036
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts5zyFTs", &quot;id&quot;: &quot;PR_kwDOMJIfts5zyFTs&quot;,
"number": 15 &quot;number&quot;: 15
}, },
"lastSeen": 1741535540953 &quot;lastSeen&quot;: 1741535540953
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6QQB3c", &quot;id&quot;: &quot;PR_kwDOMJIfts6QQB3c&quot;,
"number": 59 &quot;number&quot;: 59
}, },
"lastSeen": 1743018960900 &quot;lastSeen&quot;: 1743018960900
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6QMPEg", &quot;id&quot;: &quot;PR_kwDOMJIfts6QMPEg&quot;,
"number": 58 &quot;number&quot;: 58
}, },
"lastSeen": 1743019452983 &quot;lastSeen&quot;: 1743019452983
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6QZvRI", &quot;id&quot;: &quot;PR_kwDOMJIfts6QZvRI&quot;,
"number": 61 &quot;number&quot;: 61
}, },
"lastSeen": 1743103196866 &quot;lastSeen&quot;: 1743103196866
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6QqPrQ", &quot;id&quot;: &quot;PR_kwDOMJIfts6QqPrQ&quot;,
"number": 73 &quot;number&quot;: 73
}, },
"lastSeen": 1743265865001 &quot;lastSeen&quot;: 1743265865001
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6Qp5nI", &quot;id&quot;: &quot;PR_kwDOMJIfts6Qp5nI&quot;,
"number": 72 &quot;number&quot;: 72
}, },
"lastSeen": 1743338472110 &quot;lastSeen&quot;: 1743338472110
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6QsjlS", &quot;id&quot;: &quot;PR_kwDOMJIfts6QsjlS&quot;,
"number": 76 &quot;number&quot;: 76
}, },
"lastSeen": 1743352150953 &quot;lastSeen&quot;: 1743352150953
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6Q0JBe", &quot;id&quot;: &quot;PR_kwDOMJIfts6Q0JBe&quot;,
"number": 82 &quot;number&quot;: 82
}, },
"lastSeen": 1743470267269 &quot;lastSeen&quot;: 1743470267269
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6UE9-x", &quot;id&quot;: &quot;PR_kwDOMJIfts6UE9-x&quot;,
"number": 102 &quot;number&quot;: 102
}, },
"lastSeen": 1747171977348 &quot;lastSeen&quot;: 1747171977348
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6XPua_", &quot;id&quot;: &quot;PR_kwDOMJIfts6XPua_&quot;,
"number": 117 &quot;number&quot;: 117
}, },
"lastSeen": 1747929835864 &quot;lastSeen&quot;: 1747929835864
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6XY-mZ", &quot;id&quot;: &quot;PR_kwDOMJIfts6XY-mZ&quot;,
"number": 119 &quot;number&quot;: 119
}, },
"lastSeen": 1748028108508 &quot;lastSeen&quot;: 1748028108508
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6Xdz4n", &quot;id&quot;: &quot;PR_kwDOMJIfts6Xdz4n&quot;,
"number": 120 &quot;number&quot;: 120
}, },
"lastSeen": 1748282672214 &quot;lastSeen&quot;: 1748282672214
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6X_zxl", &quot;id&quot;: &quot;PR_kwDOMJIfts6X_zxl&quot;,
"number": 131 &quot;number&quot;: 131
}, },
"lastSeen": 1748881279494 &quot;lastSeen&quot;: 1748881279494
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6bhieT", &quot;id&quot;: &quot;PR_kwDOMJIfts6bhieT&quot;,
"number": 152 &quot;number&quot;: 152
}, },
"lastSeen": 1751848489082 &quot;lastSeen&quot;: 1751848489082
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6dOyRk", &quot;id&quot;: &quot;PR_kwDOMJIfts6dOyRk&quot;,
"number": 154 &quot;number&quot;: 154
}, },
"lastSeen": 1751849436454 &quot;lastSeen&quot;: 1751849436454
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6cHjNi", &quot;id&quot;: &quot;PR_kwDOMJIfts6cHjNi&quot;,
"number": 153 &quot;number&quot;: 153
}, },
"lastSeen": 1751849501498 &quot;lastSeen&quot;: 1751849501498
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6Zs1FN", &quot;id&quot;: &quot;PR_kwDOMJIfts6Zs1FN&quot;,
"number": 145 &quot;number&quot;: 145
}, },
"lastSeen": 1751849770308 &quot;lastSeen&quot;: 1751849770308
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6bgKi9", &quot;id&quot;: &quot;PR_kwDOMJIfts6bgKi9&quot;,
"number": 150 &quot;number&quot;: 150
}, },
"lastSeen": 1751850367300 &quot;lastSeen&quot;: 1751850367300
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6dv21R", &quot;id&quot;: &quot;PR_kwDOMJIfts6dv21R&quot;,
"number": 162 &quot;number&quot;: 162
}, },
"lastSeen": 1751893739514 &quot;lastSeen&quot;: 1751893739514
}, },
{ {
"id": { &quot;id&quot;: {
"id": "PR_kwDOMJIfts6dwQJi", &quot;id&quot;: &quot;PR_kwDOMJIfts6dwQJi&quot;,
"number": 163 &quot;number&quot;: 163
}, },
"lastSeen": 1751893861615 &quot;lastSeen&quot;: 1751893861615
} }
] ]
}]]></component> }</component>
<component name="GithubPullRequestsUISettings">{ <component name="GithubPullRequestsUISettings">{
&quot;selectedUrlAndAccountId&quot;: { &quot;selectedUrlAndAccountId&quot;: {
&quot;url&quot;: &quot;https://github.com/iib0011/omni-tools.git&quot;, &quot;url&quot;: &quot;https://github.com/iib0011/omni-tools.git&quot;,
@@ -244,56 +243,56 @@
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent">{
"keyToString": { &quot;keyToString&quot;: {
"ASKED_ADD_EXTERNAL_FILES": "true", &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true", &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
"Docker.Dockerfile build.executor": "Run", &quot;Docker.Dockerfile build.executor&quot;: &quot;Run&quot;,
"Docker.Dockerfile.executor": "Run", &quot;Docker.Dockerfile.executor&quot;: &quot;Run&quot;,
"Playwright.Create transparent PNG.should make png color transparent.executor": "Run", &quot;Playwright.Create transparent PNG.should make png color transparent.executor&quot;: &quot;Run&quot;,
"Playwright.JoinText Component.executor": "Run", &quot;Playwright.JoinText Component.executor&quot;: &quot;Run&quot;,
"Playwright.JoinText Component.should merge text pieces with specified join character.executor": "Run", &quot;Playwright.JoinText Component.should merge text pieces with specified join character.executor&quot;: &quot;Run&quot;,
"RunOnceActivity.OpenProjectViewOnStart": "true", &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.ShowReadmeOnStart": "true", &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
"RunOnceActivity.git.unshallow": "true", &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
"Vitest.compute function (1).executor": "Run", &quot;Vitest.compute function (1).executor&quot;: &quot;Run&quot;,
"Vitest.compute function.executor": "Run", &quot;Vitest.compute function.executor&quot;: &quot;Run&quot;,
"Vitest.mergeText.executor": "Run", &quot;Vitest.mergeText.executor&quot;: &quot;Run&quot;,
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run", &quot;Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor&quot;: &quot;Run&quot;,
"Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run", &quot;Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor&quot;: &quot;Run&quot;,
"Vitest.parsePageRanges.executor": "Run", &quot;Vitest.parsePageRanges.executor&quot;: &quot;Run&quot;,
"Vitest.removeDuplicateLines function.executor": "Run", &quot;Vitest.removeDuplicateLines function.executor&quot;: &quot;Run&quot;,
"Vitest.removeDuplicateLines function.newlines option.executor": "Run", &quot;Vitest.removeDuplicateLines function.newlines option.executor&quot;: &quot;Run&quot;,
"Vitest.removeDuplicateLines function.newlines option.should filter newlines when newlines is set to filter.executor": "Run", &quot;Vitest.removeDuplicateLines function.newlines option.should filter newlines when newlines is set to filter.executor&quot;: &quot;Run&quot;,
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run", &quot;Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor&quot;: &quot;Run&quot;,
"Vitest.replaceText function.executor": "Run", &quot;Vitest.replaceText function.executor&quot;: &quot;Run&quot;,
"Vitest.timeBetweenDates.executor": "Run", &quot;Vitest.timeBetweenDates.executor&quot;: &quot;Run&quot;,
"git-widget-placeholder": "#163 on fork/y1hao/grouping", &quot;git-widget-placeholder&quot;: &quot;#167 on fork/AshAnand34/crontab-guru-tool&quot;,
"ignore.virus.scanning.warn.message": "true", &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
"kotlin-language-version-configured": "true", &quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src/pages/tools/json", &quot;last_opened_file_path&quot;: &quot;C:/Users/Ibrahima/IdeaProjects/omni-tools/src/pages/tools/json&quot;,
"node.js.detected.package.eslint": "true", &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
"node.js.detected.package.tslint": "true", &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
"node.js.selected.package.eslint": "(autodetect)", &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
"node.js.selected.package.tslint": "(autodetect)", &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
"nodejs_package_manager_path": "npm", &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
"npm.build.executor": "Run", &quot;npm.build.executor&quot;: &quot;Run&quot;,
"npm.dev.executor": "Run", &quot;npm.dev.executor&quot;: &quot;Run&quot;,
"npm.lint.executor": "Run", &quot;npm.lint.executor&quot;: &quot;Run&quot;,
"npm.prebuild.executor": "Run", &quot;npm.prebuild.executor&quot;: &quot;Run&quot;,
"npm.script:create:tool.executor": "Run", &quot;npm.script:create:tool.executor&quot;: &quot;Run&quot;,
"npm.test.executor": "Run", &quot;npm.test.executor&quot;: &quot;Run&quot;,
"npm.test:e2e.executor": "Run", &quot;npm.test:e2e.executor&quot;: &quot;Run&quot;,
"npm.test:e2e:run.executor": "Run", &quot;npm.test:e2e:run.executor&quot;: &quot;Run&quot;,
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\prettier", &quot;prettierjs.PrettierConfiguration.Package&quot;: &quot;C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\prettier&quot;,
"project.structure.last.edited": "Problems", &quot;project.structure.last.edited&quot;: &quot;Problems&quot;,
"project.structure.proportion": "0.0", &quot;project.structure.proportion&quot;: &quot;0.0&quot;,
"project.structure.side.proportion": "0.2", &quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
"settings.editor.selected.configurable": "refactai_advanced_settings", &quot;settings.editor.selected.configurable&quot;: &quot;refactai_advanced_settings&quot;,
"ts.external.directory.path": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib", &quot;ts.external.directory.path&quot;: &quot;C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib&quot;,
"vue.rearranger.settings.migration": "true" &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
} }
}]]></component> }</component>
<component name="ReactDesignerToolWindowState"> <component name="ReactDesignerToolWindowState">
<option name="myId2Visible"> <option name="myId2Visible">
<map> <map>

View File

@@ -1,12 +1,11 @@
import { Box, Typography, Alert, Button, Stack } from '@mui/material'; import { Alert } from '@mui/material';
import React, { useState } from 'react'; import React, { useState } from 'react';
import ToolContent from '@components/ToolContent'; import ToolContent from '@components/ToolContent';
import { ToolComponentProps } from '@tools/defineTool'; import { ToolComponentProps } from '@tools/defineTool';
import ToolTextInput from '@components/input/ToolTextInput'; import ToolTextInput from '@components/input/ToolTextInput';
import ToolTextResult from '@components/result/ToolTextResult'; import ToolTextResult from '@components/result/ToolTextResult';
import { GetGroupsType } from '@components/options/ToolOptions';
import { CardExampleType } from '@components/examples/ToolExamples'; import { CardExampleType } from '@components/examples/ToolExamples';
import { main, validateCrontab, explainCrontab } from './service'; import { main, validateCrontab } from './service';
const initialValues = {}; const initialValues = {};
@@ -59,45 +58,21 @@ export default function CrontabGuru({
setResult(main(input, values)); setResult(main(input, values));
}; };
const handleExample = (expr: string) => {
setInput(expr);
setHasInteracted(true);
setIsValid(validateCrontab(expr));
setResult(main(expr, initialValues));
};
const handleInputChange = (val: string) => { const handleInputChange = (val: string) => {
if (!hasInteracted) setHasInteracted(true); if (!hasInteracted) setHasInteracted(true);
setInput(val); setInput(val);
}; };
const getGroups: GetGroupsType<InitialValuesType> | null = () => [];
return ( return (
<ToolContent <ToolContent
title={title} title={title}
input={input} input={input}
inputComponent={ inputComponent={
<> <ToolTextInput
<ToolTextInput value={input}
value={input} onChange={handleInputChange}
onChange={handleInputChange} placeholder="e.g. 35 16 * * 0-5"
placeholder="e.g. 35 16 * * 0-5" />
/>
<Stack direction="row" spacing={1} mt={1}>
{exampleCards.map((ex, i) => (
<Button
key={i}
size="small"
variant="outlined"
onClick={() => ex.sampleText && handleExample(ex.sampleText)}
disabled={!ex.sampleText}
>
{ex.title}
</Button>
))}
</Stack>
</>
} }
resultComponent={ resultComponent={
<div style={{ position: 'relative', minHeight: 80 }}> <div style={{ position: 'relative', minHeight: 80 }}>
@@ -144,7 +119,7 @@ export default function CrontabGuru({
} }
initialValues={initialValues} initialValues={initialValues}
exampleCards={exampleCards} exampleCards={exampleCards}
getGroups={getGroups} getGroups={null}
setInput={setInput} setInput={setInput}
compute={compute} compute={compute}
toolInfo={{ title: `What is a ${title}?`, description: longDescription }} toolInfo={{ title: `What is a ${title}?`, description: longDescription }}

View File

@@ -2,7 +2,7 @@ import { defineTool } from '@tools/defineTool';
import { lazy } from 'react'; import { lazy } from 'react';
export const tool = defineTool('time', { export const tool = defineTool('time', {
name: 'Crontab Guru', name: 'Crontab explainer',
path: 'crontab-guru', path: 'crontab-guru',
icon: 'mdi:calendar-clock', icon: 'mdi:calendar-clock',
description: description: