โ– humdrum codex / soft
483 B raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
"use client";

// useAction โ€” register a page-level action with the global shortcut registry.
// Action shows up in the command palette and (if combo provided) shortcuts help.

import { useEffect } from "react";
import { shortcuts, type Action } from "@/lib/shortcuts";

export function useAction(action: Action, deps: React.DependencyList = []) {
  useEffect(() => {
    return shortcuts.register(action);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, deps);
}