From f81f2b05230cb9038d24a1303edccda84b74b533 Mon Sep 17 00:00:00 2001 From: enes Date: Thu, 19 Sep 2024 13:15:54 +0200 Subject: [PATCH] refactor: better variable names --- src/pages/create/index.tsx | 51 ++++++----- src/types/drawing.ts | 5 +- src/utils/mark.ts | 175 ++++++++++++++++++++----------------- 3 files changed, 126 insertions(+), 105 deletions(-) diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index dd17450..5c207fc 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -108,7 +108,6 @@ export const CreatePage = () => { const [drawnFiles, setDrawnFiles] = useState([]) const [selectedTool, setSelectedTool] = useState() - const [toolbox] = useState(DEFAULT_TOOLBOX) /** * Changes the drawing tool @@ -833,28 +832,36 @@ export const CreatePage = () => {
- {toolbox.map((drawTool: DrawTool, index: number) => { - return ( -
handleToolSelect(drawTool) - })} - className={`${styles.toolItem} ${selectedTool?.identifier === drawTool.identifier ? styles.selected : ''} ${!drawTool.active ? styles.comingSoon : ''} + {DEFAULT_TOOLBOX.filter((drawTool) => !drawTool.isHidden).map( + (drawTool: DrawTool, index: number) => { + return ( +
handleToolSelect(drawTool) + })} + className={`${styles.toolItem} ${selectedTool?.identifier === drawTool.identifier ? styles.selected : ''} ${drawTool.isComingSoon ? styles.comingSoon : ''} `} - > - - {drawTool.label} - {drawTool.active ? ( - - ) : ( - - Coming soon - - )} -
- ) - })} + > + + {drawTool.label} + {!drawTool.isComingSoon ? ( + + ) : ( + + Coming soon + + )} +
+ ) + } + )}