diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b094988..5d8fccb 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,12 +4,11 @@
-
+
-
-
-
-
+
+
+
@@ -23,7 +22,7 @@
@@ -197,6 +196,20 @@
"number": 150
},
"lastSeen": 1751850367300
+ },
+ {
+ "id": {
+ "id": "PR_kwDOMJIfts6dv21R",
+ "number": 162
+ },
+ "lastSeen": 1751893739514
+ },
+ {
+ "id": {
+ "id": "PR_kwDOMJIfts6dwQJi",
+ "number": 163
+ },
+ "lastSeen": 1751893861615
}
]
}]]>
@@ -255,7 +268,7 @@
"Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
"Vitest.replaceText function.executor": "Run",
"Vitest.timeBetweenDates.executor": "Run",
- "git-widget-placeholder": "#150 on fork/omenmn/pdftopng",
+ "git-widget-placeholder": "#163 on fork/y1hao/grouping",
"ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src/pages/tools/json",
@@ -495,22 +508,8 @@
-
-
-
- 1741543593426
-
-
-
- 1741543593427
-
-
-
- 1741543732607
-
-
-
- 1741543732607
+
+
@@ -888,7 +887,23 @@
1751850152784
-
+
+
+ 1751852942341
+
+
+
+ 1751852942341
+
+
+
+ 1751893722720
+
+
+
+ 1751893722720
+
+
@@ -935,8 +950,6 @@
-
-
@@ -960,7 +973,9 @@
-
+
+
+
false
diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx
index 9a453ce..c1c6487 100644
--- a/src/components/Hero.tsx
+++ b/src/components/Hero.tsx
@@ -1,4 +1,13 @@
-import { Autocomplete, Box, Stack, TextField, useTheme } from '@mui/material';
+import {
+ Autocomplete,
+ Box,
+ darken,
+ lighten,
+ Stack,
+ styled,
+ TextField,
+ useTheme
+} from '@mui/material';
import Typography from '@mui/material/Typography';
import SearchIcon from '@mui/icons-material/Search';
import Grid from '@mui/material/Grid';
@@ -8,7 +17,22 @@ import { filterTools, tools } from '@tools/index';
import { useNavigate } from 'react-router-dom';
import _ from 'lodash';
import { Icon } from '@iconify/react';
+import { getToolCategoryTitle } from '@utils/string';
+const GroupHeader = styled('div')(({ theme }) => ({
+ position: 'sticky',
+ top: '-8px',
+ padding: '4px 10px',
+ color: theme.palette.primary.main,
+ backgroundColor: lighten(theme.palette.primary.light, 0.85),
+ ...theme.applyStyles('dark', {
+ backgroundColor: darken(theme.palette.primary.main, 0.8)
+ })
+}));
+
+const GroupItems = styled('ul')({
+ padding: 0
+});
const exampleTools: { label: string; url: string }[] = [
{
label: 'Create a transparent image',
@@ -65,6 +89,14 @@ export default function Hero() {
autoHighlight
options={filteredTools}
groupBy={(option) => option.type}
+ renderGroup={(params) => {
+ return (
+
+ {getToolCategoryTitle(params.group)}
+ {params.children}
+
+ );
+ }}
inputValue={inputValue}
getOptionLabel={(option) => option.name}
renderInput={(params) => (
diff --git a/src/pages/tools-by-category/index.tsx b/src/pages/tools-by-category/index.tsx
index 1370eb0..519ead8 100644
--- a/src/pages/tools-by-category/index.tsx
+++ b/src/pages/tools-by-category/index.tsx
@@ -4,7 +4,7 @@ import Typography from '@mui/material/Typography';
import { Link, useNavigate, useParams } from 'react-router-dom';
import { filterTools, getToolsByCategory } from '../../tools';
import Hero from 'components/Hero';
-import { capitalizeFirstLetter } from '@utils/string';
+import { capitalizeFirstLetter, getToolCategoryTitle } from '@utils/string';
import { Icon } from '@iconify/react';
import { categoriesColors } from 'config/uiConfig';
import React, { useEffect } from 'react';
@@ -21,9 +21,7 @@ export default function ToolsByCategory() {
const mainContentRef = React.useRef(null);
const { categoryName } = useParams();
const [searchTerm, setSearchTerm] = React.useState('');
- const rawTitle = getToolsByCategory().find(
- (category) => category.type === categoryName
- )!.rawTitle;
+ const rawTitle = getToolCategoryTitle(categoryName as string);
useEffect(() => {
if (mainContentRef.current) {
diff --git a/src/utils/string.ts b/src/utils/string.ts
index 17088f9..4e7899e 100644
--- a/src/utils/string.ts
+++ b/src/utils/string.ts
@@ -1,4 +1,5 @@
import { UpdateField } from '@components/options/ToolOptions';
+import { getToolsByCategory } from '@tools/index';
// Here starting the shared values for string manipulation.
@@ -105,3 +106,7 @@ export function itemCounter(
}
return dict;
}
+
+export const getToolCategoryTitle = (categoryName: string): string =>
+ getToolsByCategory().find((category) => category.type === categoryName)!
+ .rawTitle;