+
- )
+ );
}
-export default FuseLoading
+export default FuseLoading;
diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx
index 15e8c97..f7c480c 100644
--- a/src/components/Navbar/index.tsx
+++ b/src/components/Navbar/index.tsx
@@ -4,22 +4,41 @@ import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import Button from '@mui/material/Button';
import IconButton from '@mui/material/IconButton';
-import {Link, useNavigate} from 'react-router-dom';
+import { Link, useNavigate } from 'react-router-dom';
import githubIcon from '../../assets/github-mark.png'; // Adjust the path to your GitHub icon
const Navbar: React.FC = () => {
const navigate = useNavigate();
return (
-
+
- navigate('/')} fontSize={20}
- sx={{flexGrow: 1, cursor: 'pointer'}} color={'primary'}>OmniTools
+ navigate('/')}
+ fontSize={20}
+ sx={{ flexGrow: 1, cursor: 'pointer' }}
+ color={'primary'}
+ >
+ OmniTools
+
{
target="_blank"
rel="noopener noreferrer"
>
-
+
Star us
diff --git a/src/components/ToolHeader.tsx b/src/components/ToolHeader.tsx
index 09cbf94..71edc9e 100644
--- a/src/components/ToolHeader.tsx
+++ b/src/components/ToolHeader.tsx
@@ -1,18 +1,22 @@
-import {Box, Stack} from "@mui/material";
-import Typography from "@mui/material/Typography";
-import textImage from '../assets/text.png'
+import { Box, Stack } from '@mui/material';
+import Typography from '@mui/material/Typography';
+import textImage from '../assets/text.png';
interface ToolHeaderProps {
title: string;
description: string;
}
-export default function ToolHeader({title, description}: ToolHeaderProps) {
- return (
-
- {title}
- {description}
-
-
- )
+export default function ToolHeader({ title, description }: ToolHeaderProps) {
+ return (
+
+
+
+ {title}
+
+ {description}
+
+
+
+ );
}
diff --git a/src/components/input/ToolTextInput.tsx b/src/components/input/ToolTextInput.tsx
index 7920e61..171c49c 100644
--- a/src/components/input/ToolTextInput.tsx
+++ b/src/components/input/ToolTextInput.tsx
@@ -1,14 +1,18 @@
-import { Box, Stack, TextField } from '@mui/material'
-import Typography from '@mui/material/Typography'
-import Button from '@mui/material/Button'
-import PublishIcon from '@mui/icons-material/Publish'
-import ContentPasteIcon from '@mui/icons-material/ContentPaste'
-import React from 'react'
+import { Box, Stack, TextField } from '@mui/material';
+import Typography from '@mui/material/Typography';
+import Button from '@mui/material/Button';
+import PublishIcon from '@mui/icons-material/Publish';
+import ContentPasteIcon from '@mui/icons-material/ContentPaste';
+import React from 'react';
-export default function ToolTextInput({ value, onChange, title = 'Input text' }: {
+export default function ToolTextInput({
+ value,
+ onChange,
+ title = 'Input text'
+}: {
title?: string;
- value: string
- onChange: (value: string) => void
+ value: string;
+ onChange: (value: string) => void;
}) {
return (
@@ -27,5 +31,5 @@ export default function ToolTextInput({ value, onChange, title = 'Input text' }:
}>Copy to clipboard
- )
+ );
}
diff --git a/src/config/routesConfig.tsx b/src/config/routesConfig.tsx
index f62024a..54f2445 100644
--- a/src/config/routesConfig.tsx
+++ b/src/config/routesConfig.tsx
@@ -1,29 +1,18 @@
-import {RouteObject} from "react-router-dom";
-import {Navigate} from "react-router-dom";
-import {ImagesConfig} from "../pages/images/ImagesConfig";
-import {lazy} from "react";
-import {StringConfig} from "../pages/string/StringConfig";
+import { RouteObject } from 'react-router-dom';
+import { Navigate } from 'react-router-dom';
+import { lazy } from 'react';
-const Home = lazy(() => import("../pages/home"));
+const Home = lazy(() => import('../pages/home'));
const routes: RouteObject[] = [
{
- path: "/",
- element: ,
+ path: '/',
+ element:
},
{
- path: "images",
- children: ImagesConfig
- },
- {
- path: "string",
- children: StringConfig
- },
- {
- path: "*",
- element: ,
- },
+ path: '*',
+ element:
+ }
];
export default routes;
-
diff --git a/src/hooks/useDebounce.ts b/src/hooks/useDebounce.ts
index 4bb06ad..6bb4e1d 100644
--- a/src/hooks/useDebounce.ts
+++ b/src/hooks/useDebounce.ts
@@ -1,5 +1,5 @@
-import {useCallback, useEffect, useRef} from "react";
-import _ from "lodash";
+import { useCallback, useEffect, useRef } from 'react';
+import _ from 'lodash';
/**
* Debounce hook.
@@ -9,7 +9,7 @@ import _ from "lodash";
*/
function useDebounce void>(
callback: T,
- delay: number,
+ delay: number
): T {
const callbackRef = useRef(callback);
@@ -22,7 +22,7 @@ function useDebounce void>(
_.debounce((...args: never[]) => {
callbackRef.current(...args);
}, delay),
- [delay],
+ [delay]
);
useEffect(() => {
diff --git a/src/hooks/usePrevious.ts b/src/hooks/usePrevious.ts
index 1fec16f..d1d8e95 100644
--- a/src/hooks/usePrevious.ts
+++ b/src/hooks/usePrevious.ts
@@ -1,4 +1,4 @@
-import { useEffect, useRef } from "react";
+import { useEffect, useRef } from 'react';
/**
* The usePrevious function is a custom hook that returns the previous value of a variable.
diff --git a/src/hooks/useTimeout.ts b/src/hooks/useTimeout.ts
index bb2ffd2..cd6ad8e 100644
--- a/src/hooks/useTimeout.ts
+++ b/src/hooks/useTimeout.ts
@@ -1,4 +1,4 @@
-import { useEffect, useRef } from "react";
+import { useEffect, useRef } from 'react';
/**
* The useTimeout function is a custom hook that sets a timeout for a given callback function.
@@ -15,7 +15,7 @@ function useTimeout(callback: () => void, delay: number) {
useEffect(() => {
let timer: NodeJS.Timeout | undefined;
- if (delay !== null && callback && typeof callback === "function") {
+ if (delay !== null && callback && typeof callback === 'function') {
timer = setTimeout(callbackRef.current, delay);
}
diff --git a/src/hooks/useUpdateEffect.ts b/src/hooks/useUpdateEffect.ts
index d172f8a..e97827d 100644
--- a/src/hooks/useUpdateEffect.ts
+++ b/src/hooks/useUpdateEffect.ts
@@ -1,4 +1,4 @@
-import { DependencyList, EffectCallback, useEffect, useRef } from "react";
+import { DependencyList, EffectCallback, useEffect, useRef } from 'react';
/**
* The useUpdateEffect function is a custom hook that behaves like useEffect, but only runs on updates and not on initial mount.
diff --git a/src/index.tsx b/src/index.tsx
index c52ebc4..5e897af 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,8 +1,8 @@
-import { createRoot } from 'react-dom/client'
-import 'tailwindcss/tailwind.css'
-import App from 'components/App'
+import { createRoot } from 'react-dom/client';
+import 'tailwindcss/tailwind.css';
+import App from 'components/App';
-const container = document.getElementById('root') as HTMLDivElement
-const root = createRoot(container)
+const container = document.getElementById('root') as HTMLDivElement;
+const root = createRoot(container);
-root.render()
+root.render();
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 07f74c4..0c16d10 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -1,62 +1,83 @@
-import {Box, Icon, Input, Stack, TextField} from "@mui/material";
-import Grid from "@mui/material/Grid";
-import Typography from "@mui/material/Typography";
+import { Box, Stack, TextField } from '@mui/material';
+import Grid from '@mui/material/Grid';
+import Typography from '@mui/material/Typography';
import SearchIcon from '@mui/icons-material/Search';
-import {useNavigate} from "react-router-dom";
+import { useNavigate } from 'react-router-dom';
-const exampleTools: { label: string; url: string }[] = [{
- label: 'Create a transparent image',
- url: ''
-},
- {label: 'Convert text to morse code', url: ''},
- {label: 'Change GIF speed', url: ''},
- {label: 'Pick a random item', url: ''},
- {label: 'Find and replace text', url: ''},
- {label: 'Convert emoji to image', url: ''},
- {label: 'Split a string', url: '/string/split'},
- {label: 'Calculate number sum', url: ''},
- {label: 'Pixelate an image', url: ''},
-]
+const exampleTools: { label: string; url: string }[] = [
+ {
+ label: 'Create a transparent image',
+ url: ''
+ },
+ { label: 'Convert text to morse code', url: '' },
+ { label: 'Change GIF speed', url: '' },
+ { label: 'Pick a random item', url: '' },
+ { label: 'Find and replace text', url: '' },
+ { label: 'Convert emoji to image', url: '' },
+ { label: 'Split a string', url: '/string/split' },
+ { label: 'Calculate number sum', url: '' },
+ { label: 'Pixelate an image', url: '' }
+];
export default function Home() {
- const navigate = useNavigate()
+ const navigate = useNavigate();
- return (
-
- Transform Your Workflow
- with Omni
- Tools
-
- Boost your productivity with Omni Tools, the ultimate toolkit for getting things done quickly! Access thousands
- of
- user-friendly utilities for editing images, text, lists, and data, all directly from your browser.
-
+ return (
+
+
+
+ {' '}
+ Transform Your Workflow with
+
+ Omni Tools
+
+
+
+ Boost your productivity with Omni Tools, the ultimate toolkit for
+ getting things done quickly! Access thousands of user-friendly
+ utilities for editing images, text, lists, and data, all directly from
+ your browser.
+
-
- ),
- }}/>
-
- {exampleTools.map((tool) => (
- navigate(tool.url)}
- item
- xs={4}
- key={tool.label}
- display="flex"
- flexDirection="row"
- justifyContent="center"
- alignItems="center"
- padding={2}
- sx={{borderWidth: 1, borderRadius: 3, borderColor: 'grey', borderStyle: 'solid', cursor: 'pointer'}}
- >
- {tool.label}
-
- ))}
-
+
+ }}
+ />
+
+ {exampleTools.map((tool) => (
+ navigate(tool.url)}
+ item
+ xs={4}
+ key={tool.label}
+ display="flex"
+ flexDirection="row"
+ justifyContent="center"
+ alignItems="center"
+ padding={2}
+ sx={{
+ borderWidth: 1,
+ borderRadius: 3,
+ borderColor: 'grey',
+ borderStyle: 'solid',
+ cursor: 'pointer'
+ }}
+ >
+ {tool.label}
+
+ ))}
+
+
- )
+ );
}
diff --git a/src/pages/images/ImagesConfig.tsx b/src/pages/images/ImagesConfig.tsx
deleted file mode 100644
index fa328ae..0000000
--- a/src/pages/images/ImagesConfig.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import {RouteObject} from "react-router-dom";
-import {lazy} from "react";
-import {PngConfig} from "./png/PngConfig";
-
-const PngHome = lazy(() => import("./index"));
-
-export const ImagesConfig: RouteObject[] = [
- {path: '', element: },
- {path: 'png', children: PngConfig},
-]
diff --git a/src/pages/images/imageTools.ts b/src/pages/images/imageTools.ts
new file mode 100644
index 0000000..fd68239
--- /dev/null
+++ b/src/pages/images/imageTools.ts
@@ -0,0 +1,3 @@
+import { pngTools } from './png/pngTools';
+
+export const imageTools = [...pngTools];
diff --git a/src/pages/images/index.tsx b/src/pages/images/index.tsx
index 450d835..c816087 100644
--- a/src/pages/images/index.tsx
+++ b/src/pages/images/index.tsx
@@ -1,5 +1,5 @@
-import {Box} from "@mui/material";
+import { Box } from '@mui/material';
export default function ImageHome() {
- return ()
+ return ;
}
diff --git a/src/pages/images/png/PngConfig.tsx b/src/pages/images/png/PngConfig.tsx
deleted file mode 100644
index b9243c4..0000000
--- a/src/pages/images/png/PngConfig.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import {RouteObject} from "react-router-dom";
-import {lazy} from "react";
-
-const ChangeColorsInPng = lazy(() => import("./change-colors-in-png"));
-const PngHome = lazy(() => import("./"));
-
-export const PngConfig: RouteObject[] = [
- {path: '', element: },
- {path: 'change-colors-in-png', element: }
-]
diff --git a/src/pages/images/png/change-colors-in-png/index.tsx b/src/pages/images/png/change-colors-in-png/index.tsx
index 1229f9f..666797a 100644
--- a/src/pages/images/png/change-colors-in-png/index.tsx
+++ b/src/pages/images/png/change-colors-in-png/index.tsx
@@ -1,4 +1,4 @@
-import { Box } from "@mui/material";
+import { Box } from '@mui/material';
export default function ChangeColorsInPng() {
return ;
diff --git a/src/pages/images/png/change-colors-in-png/meta.ts b/src/pages/images/png/change-colors-in-png/meta.ts
new file mode 100644
index 0000000..8e9e2ea
--- /dev/null
+++ b/src/pages/images/png/change-colors-in-png/meta.ts
@@ -0,0 +1,11 @@
+import { defineTool } from '../../../../tools/defineTool';
+import { lazy } from 'react';
+
+export const tool = defineTool('png', {
+ path: 'change-colors',
+ name: 'Change colors in PNG',
+ description:
+ "World's simplest browser-based utility for splitting text. Load your text in the input form on the left and you'll automatically get pieces of this text on the right. Powerful, free, and fast. Load text – get chunks.",
+ keywords: ['png', 'split'],
+ component: lazy(() => import('./index'))
+});
diff --git a/src/pages/images/png/index.tsx b/src/pages/images/png/index.tsx
index 002fcec..779e4f5 100644
--- a/src/pages/images/png/index.tsx
+++ b/src/pages/images/png/index.tsx
@@ -1,5 +1,5 @@
-import {Box} from "@mui/material";
+import { Box } from '@mui/material';
export default function PngHome() {
- return ()
+ return ;
}
diff --git a/src/pages/images/png/pngTools.ts b/src/pages/images/png/pngTools.ts
new file mode 100644
index 0000000..1f59860
--- /dev/null
+++ b/src/pages/images/png/pngTools.ts
@@ -0,0 +1,3 @@
+import { tool as changeColorsInPng } from './change-colors-in-png/meta';
+
+export const pngTools = [changeColorsInPng];
diff --git a/src/pages/string/StringConfig.tsx b/src/pages/string/StringConfig.tsx
deleted file mode 100644
index dc70628..0000000
--- a/src/pages/string/StringConfig.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import {RouteObject} from "react-router-dom";
-import {lazy} from "react";
-
-const StringHome = lazy(() => import("./index"));
-const StringSplit = lazy(() => import("./split"));
-
-export const StringConfig: RouteObject[] = [
- {path: '', element: },
- {path: 'split', element: },
-]
diff --git a/src/pages/string/index.tsx b/src/pages/string/index.tsx
index bf9ff71..5e32bda 100644
--- a/src/pages/string/index.tsx
+++ b/src/pages/string/index.tsx
@@ -1,5 +1,5 @@
-import {Box} from "@mui/material";
+import { Box } from '@mui/material';
export default function StringHome() {
- return ()
+ return ;
}
diff --git a/src/pages/string/split/index.tsx b/src/pages/string/split/index.tsx
index 269db75..2f9ac85 100644
--- a/src/pages/string/split/index.tsx
+++ b/src/pages/string/split/index.tsx
@@ -186,12 +186,7 @@ export default function SplitText() {
});
return (
-
+
@@ -242,6 +237,6 @@ export default function SplitText() {
)}
-
+
);
}
diff --git a/src/pages/string/split/meta.ts b/src/pages/string/split/meta.ts
new file mode 100644
index 0000000..26e0110
--- /dev/null
+++ b/src/pages/string/split/meta.ts
@@ -0,0 +1,11 @@
+import { defineTool } from '../../../tools/defineTool';
+import { lazy } from 'react';
+
+export const tool = defineTool('string', {
+ path: 'split',
+ name: 'Text splitter',
+ description:
+ "World's simplest browser-based utility for splitting text. Load your text in the input form on the left and you'll automatically get pieces of this text on the right. Powerful, free, and fast. Load text – get chunks.",
+ keywords: ['text', 'split'],
+ component: lazy(() => import('./index'))
+});
diff --git a/src/pages/string/stringTools.ts b/src/pages/string/stringTools.ts
new file mode 100644
index 0000000..a89fc70
--- /dev/null
+++ b/src/pages/string/stringTools.ts
@@ -0,0 +1,3 @@
+import { tool as stringSplit } from './split/meta';
+
+export const stringTools = [stringSplit];
diff --git a/src/tools/defineTool.tsx b/src/tools/defineTool.tsx
new file mode 100644
index 0000000..6930a42
--- /dev/null
+++ b/src/tools/defineTool.tsx
@@ -0,0 +1,39 @@
+import ToolLayout from '../components/ToolLayout';
+import React, { LazyExoticComponent, JSXElementConstructor } from 'react';
+
+interface ToolOptions {
+ path: string;
+ component: LazyExoticComponent>>;
+ keywords: string[];
+ name: string;
+ description: string;
+}
+
+interface DefinedTool {
+ path: string;
+ name: string;
+ description: string;
+ keywords: string[];
+ component: () => JSX.Element;
+}
+
+export const defineTool = (
+ basePath: string,
+ options: ToolOptions
+): DefinedTool => {
+ const { path, name, description, keywords, component } = options;
+ const Component = component;
+ return {
+ path: `${basePath}/${path}`,
+ name,
+ description,
+ keywords,
+ component: () => {
+ return (
+
+
+
+ );
+ }
+ };
+};
diff --git a/src/tools/index.ts b/src/tools/index.ts
new file mode 100644
index 0000000..a3fe811
--- /dev/null
+++ b/src/tools/index.ts
@@ -0,0 +1,4 @@
+import { stringTools } from '../pages/string/stringTools';
+import { imageTools } from '../pages/images/imageTools';
+
+export const tools = [...stringTools, ...imageTools];
diff --git a/src/utils/index.ts b/src/utils/index.ts
index 90d2105..2cebd20 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -1,3 +1,3 @@
export function classNames(...classes: unknown[]): string {
- return classes.filter(Boolean).join(' ')
+ return classes.filter(Boolean).join(' ');
}
diff --git a/tailwind.config.mjs b/tailwind.config.mjs
index 2aa3f96..e59b9be 100644
--- a/tailwind.config.mjs
+++ b/tailwind.config.mjs
@@ -6,4 +6,4 @@ export default {
extend: {}
},
plugins: []
-}
+};