feat: implement command context and provider for command handling; add search button component; enhance network chart with packet loss calculation and display; update translations for new features

This commit is contained in:
hamster1963
2025-10-09 11:26:45 +08:00
parent 48704b1135
commit 1fda5ada9f
17 changed files with 403 additions and 123 deletions
+24
View File
@@ -0,0 +1,24 @@
import { ReactNode, useCallback, useState } from "react"
import { CommandContext } from "./command-context"
export function CommandProvider({ children }: { children: ReactNode }) {
const [isOpen, setIsOpen] = useState(false)
const openCommand = useCallback(() => setIsOpen(true), [])
const closeCommand = useCallback(() => setIsOpen(false), [])
const toggleCommand = useCallback(() => setIsOpen((prev) => !prev), [])
return (
<CommandContext.Provider
value={{
isOpen,
openCommand,
closeCommand,
toggleCommand,
}}
>
{children}
</CommandContext.Provider>
)
}