feat: add keyboard shortcut history
All checks were successful
Deploy eolas-app / deploy (push) Successful in 1m4s
All checks were successful
Deploy eolas-app / deploy (push) Successful in 1m4s
This commit is contained in:
parent
b5c23a1246
commit
fa6d935a0a
2 changed files with 13 additions and 2 deletions
|
|
@ -2,7 +2,6 @@ import { SidebarTrigger } from "./ui/sidebar"
|
||||||
import { Separator } from "./ui/separator"
|
import { Separator } from "./ui/separator"
|
||||||
import Search from "@/containers/Search"
|
import Search from "@/containers/Search"
|
||||||
import { Button } from "./ui/button"
|
import { Button } from "./ui/button"
|
||||||
import { useState } from "react"
|
|
||||||
import History from "./History"
|
import History from "./History"
|
||||||
import { HistoryIcon } from "lucide-react"
|
import { HistoryIcon } from "lucide-react"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,22 @@ import AppHeader from "@/components/AppHeader"
|
||||||
import { AppSidebar } from "@/containers/AppSidebar"
|
import { AppSidebar } from "@/containers/AppSidebar"
|
||||||
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
|
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
|
||||||
import { ThemeProvider } from "@/context/ThemeProvider"
|
import { ThemeProvider } from "@/context/ThemeProvider"
|
||||||
import { useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
|
|
||||||
export default function MainTemplate({ children, pageTitle }) {
|
export default function MainTemplate({ children, pageTitle }) {
|
||||||
const [historyOpen, setHistoryOpen] = useState(false)
|
const [historyOpen, setHistoryOpen] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleKeyDown = (e) => {
|
||||||
|
if ((e.ctrlKey || e.metaKey) && e.key === "h") {
|
||||||
|
e.preventDefault()
|
||||||
|
setHistoryOpen((prev) => !prev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener("keydown", handleKeyDown)
|
||||||
|
return () => document.removeEventListener("keydown", handleKeyDown)
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider storageKey="app-theme">
|
<ThemeProvider storageKey="app-theme">
|
||||||
<SidebarProvider variant="inset">
|
<SidebarProvider variant="inset">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue