From 304ccf134a2e0cb1ecef0d82491d5618ff10a477 Mon Sep 17 00:00:00 2001 From: Vishnu Date: Thu, 15 May 2025 11:06:01 +0530 Subject: [PATCH] refactor: Clean up code by removing unused imports, enhancing component props, and improving styles for better maintainability --- app/src/components/footer/Footer.tsx | 8 +- app/src/components/footer/shortcutHelper.tsx | 35 +++--- app/src/components/ui/Tools.tsx | 1 + .../visualization/widgets/panel/Panel.tsx | 25 ++--- app/src/pages/Project.tsx | 2 +- app/src/services/visulization/zone/panel.ts | 1 - app/src/styles/components/footer/footer.scss | 48 ++++---- .../components/simulation/simulation.scss | 73 +++++++++++- app/src/styles/components/tools.scss | 106 +++--------------- 9 files changed, 152 insertions(+), 147 deletions(-) diff --git a/app/src/components/footer/Footer.tsx b/app/src/components/footer/Footer.tsx index fdac078..0ee70c5 100644 --- a/app/src/components/footer/Footer.tsx +++ b/app/src/components/footer/Footer.tsx @@ -10,7 +10,6 @@ import { import ShortcutHelper from "./shortcutHelper"; import { useShortcutStore } from "../../store/builder/store"; import { usePlayButtonStore } from "../../store/usePlayButtonStore"; -import OuterClick from "../../utils/outerClick"; const Footer: React.FC = () => { const { logs, setIsLogListVisible } = useLogger(); @@ -19,11 +18,6 @@ const Footer: React.FC = () => { const { isPlaying } = usePlayButtonStore(); const { showShortcuts, setShowShortcuts } = useShortcutStore(); - OuterClick({ - contextClassName: ["shortcut-helper-overlay"], - setMenuVisible: () => setShowShortcuts(false), - }); - return (
@@ -82,7 +76,7 @@ const Footer: React.FC = () => { showShortcuts ? "visible" : "" }`} > - +
)}
diff --git a/app/src/components/footer/shortcutHelper.tsx b/app/src/components/footer/shortcutHelper.tsx index bf8ccc1..aa927c5 100644 --- a/app/src/components/footer/shortcutHelper.tsx +++ b/app/src/components/footer/shortcutHelper.tsx @@ -29,8 +29,8 @@ import { DublicateIcon, DuplicateInstanceIcon, PlayIcon, - BrowserIcon, } from "../icons/ShortcutIcons"; +import { CloseIcon } from "../icons/ExportCommonIcons"; interface ShortcutItem { keys: string[]; @@ -44,7 +44,13 @@ interface ShortcutGroup { items: ShortcutItem[]; } -const ShortcutHelper = () => { +interface ShortcutHelperProps { + setShowShortcuts: (value: boolean) => void; +} + +const ShortcutHelper: React.FC = ({ + setShowShortcuts, +}) => { const shortcuts: ShortcutGroup[] = [ { category: "Essential", @@ -256,27 +262,26 @@ const ShortcutHelper = () => { }, ], }, - { - category: "Miscellaneous", - items: [ - { - keys: ["F5", "F11", "F12", "CTRL", "+", "R"], - name: "Browser Defaults", - description: "Reserved for browser defaults", - icon: , - }, - ], - }, ]; const [activeCategory, setActiveCategory] = React.useState("Essential"); const activeShortcuts = - shortcuts.find((group) => group.category === activeCategory)?.items || []; + shortcuts.find((group) => group.category === activeCategory)?.items ?? []; return (
+
{shortcuts.map((group) => ( @@ -313,7 +318,7 @@ const ShortcutHelper = () => { {item.keys.map((key, i) => ( {key} diff --git a/app/src/components/ui/Tools.tsx b/app/src/components/ui/Tools.tsx index 5256494..bb99cc8 100644 --- a/app/src/components/ui/Tools.tsx +++ b/app/src/components/ui/Tools.tsx @@ -335,6 +335,7 @@ const Tools: React.FC = () => { {activeModule !== "visualization" && (