diff --git a/src/App.tsx b/src/App.tsx index c07ca4e..2087680 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,122 +1,8 @@ -import { useState, useEffect } from "react"; -import { MantineProvider, Tabs, Button } from "@mantine/core"; -import { - HotkeysProvider, - useHotkeys, - useHotkeysContext, -} from "react-hotkeys-hook"; +import { MantineProvider } from "@mantine/core"; + import "@mantine/core/styles.css"; -import { Spotlight, spotlight } from "@mantine/spotlight"; -import type { SpotlightActionData } from "@mantine/spotlight"; import "@mantine/spotlight/styles.css"; -function TabContent({ title, scopeName }: any) { - const [text, setText] = useState(`${title} panel `); - const [used, setUsed] = useState(false); - - useHotkeys( - "ctrl+b", - () => { - if (used) return; - setText((prev) => prev + `${title} `); - setUsed(true); - }, - { - scopes: [scopeName], - preventDefault: true, - }, - ); - - return <>{text}; -} - -function TabsPage() { - const { enableScope, disableScope } = useHotkeysContext(); - const [activeTab, setActiveTab] = useState("1"); - const actions: SpotlightActionData[] = [ - { - id: "first", - label: "First", - description: "First panel", - onClick: () => { - setActiveTab("1"); - }, - }, - { - id: "second", - label: "Second", - description: "Second panel", - onClick: () => { - setActiveTab("2"); - }, - }, - { - id: "third", - label: "Third", - description: "Third panel", - onClick: () => { - setActiveTab("3"); - }, - }, - ]; - - useEffect(() => { - const currentScope = `tab${activeTab}`; - enableScope(currentScope); - - return () => { - disableScope(currentScope); - }; - }, [activeTab, enableScope, disableScope]); - - useHotkeys("ctrl+1", () => setActiveTab("1"), { preventDefault: true }); - useHotkeys("ctrl+2", () => setActiveTab("2"), { preventDefault: true }); - useHotkeys("ctrl+3", () => setActiveTab("3"), { preventDefault: true }); - - return ( - <> - - - value && setActiveTab(value)} - > - - First - Second - Third - - - - - - - - - - - - - - - - ); -} export default function App() { - return ( - - - - - - ); + return ; }