Skip to content

Commit d2eb703

Browse files
committed
feat: json pretty
1 parent 18c305a commit d2eb703

File tree

12 files changed

+78
-49
lines changed

12 files changed

+78
-49
lines changed

.idea/workspace.xml

Lines changed: 40 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
"dependencies": {
2828
"@emotion/react": "^11.11.4",
2929
"@emotion/styled": "^11.11.5",
30-
"@hugeicons/core-free-icons": "^1.0.10",
31-
"@hugeicons/react": "^1.0.3",
3230
"@mui/icons-material": "^5.15.20",
3331
"@mui/material": "^5.15.20",
3432
"@playwright/test": "^1.45.0",

scripts/create-tool.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import React from 'react';
7979
import * as Yup from 'yup';
8080
8181
const initialValues = {};
82+
type InitialValuesType = typeof initialValues;
8283
const validationSchema = Yup.object({
8384
// splitSeparator: Yup.string().required('The separator is required')
8485
});

src/components/examples/ExampleCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface ExampleCardProps<T> {
1717
sampleText: string;
1818
sampleResult: string;
1919
sampleOptions: T;
20-
changeInputResult: (newOptions: T) => void;
20+
changeInputResult: (newInput: string, newOptions: T) => void;
2121
getGroups: GetGroupsType<T>;
2222
}
2323

@@ -35,7 +35,7 @@ export default function ExampleCard<T>({
3535
<Card
3636
raised
3737
onClick={() => {
38-
changeInputResult(sampleOptions);
38+
changeInputResult(sampleText, sampleOptions);
3939
}}
4040
sx={{
4141
bgcolor: theme.palette.background.default,

src/components/examples/ToolExamples.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ export interface ExampleProps<T> {
1515
exampleCards: CardExampleType<T>[];
1616
getGroups: GetGroupsType<T>;
1717
formRef: React.RefObject<FormikProps<T>>;
18+
setInput: React.Dispatch<React.SetStateAction<string>>;
1819
}
1920

2021
export default function ToolExamples<T>({
2122
title,
2223
subtitle,
2324
exampleCards,
2425
getGroups,
25-
formRef
26+
formRef,
27+
setInput
2628
}: ExampleProps<T>) {
27-
function changeInputResult(newOptions: T) {
29+
function changeInputResult(newInput: string, newOptions: T) {
30+
setInput(newInput);
2831
formRef.current?.setValues(newOptions);
2932
const toolsElement = document.getElementById('tool');
3033
if (toolsElement) {

src/pages/home/Categories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { getToolsByCategory } from '@tools/index';
22
import Grid from '@mui/material/Grid';
33
import { Card, CardContent, Stack } from '@mui/material';
4-
import { HugeiconsIcon } from '@hugeicons/react';
54
import { Link, useNavigate } from 'react-router-dom';
65
import Typography from '@mui/material/Typography';
76
import Button from '@mui/material/Button';
87
import { useState } from 'react';
98
import { categoriesColors } from 'config/uiConfig';
9+
import { Icon } from '@iconify/react';
1010

1111
type ArrayElement<ArrayType extends readonly unknown[]> =
1212
ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
@@ -20,7 +20,6 @@ const SingleCategory = function ({
2020
}) {
2121
const navigate = useNavigate();
2222
const [hovered, setHovered] = useState<boolean>(false);
23-
const Icon = category.icon;
2423
const toggleHover = () => setHovered((prevState) => !prevState);
2524
return (
2625
<Grid
@@ -38,8 +37,9 @@ const SingleCategory = function ({
3837
>
3938
<CardContent>
4039
<Stack direction={'row'} spacing={2} alignItems={'center'}>
41-
<HugeiconsIcon
42-
icon={Icon}
40+
<Icon
41+
icon={category.icon}
42+
fontSize={'60px'}
4343
style={{
4444
transform: `scale(${hovered ? 1.1 : 1}`
4545
}}

src/pages/tools/string/join/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export default function JoinText({ title }: ToolComponentProps) {
179179
exampleCards={exampleCards}
180180
getGroups={getGroups}
181181
formRef={formRef}
182+
setInput={setInput}
182183
/>
183184
</Box>
184185
);

src/pages/tools/string/split/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export default function SplitText({ title }: ToolComponentProps) {
211211
exampleCards={exampleCards}
212212
getGroups={getGroups}
213213
formRef={formRef}
214+
setInput={setInput}
214215
/>
215216
</Box>
216217
);

src/tools/defineTool.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ interface ToolOptions {
1212
shortDescription: string;
1313
}
1414

15-
export type ToolCategory = 'string' | 'png' | 'number' | 'gif' | 'list';
15+
export type ToolCategory =
16+
| 'string'
17+
| 'png'
18+
| 'number'
19+
| 'gif'
20+
| 'list'
21+
| 'json';
1622

1723
export interface DefinedTool {
1824
type: ToolCategory;

0 commit comments

Comments
 (0)