securityos/components/apps/FileExplorer/useAddressBarContextMenu.ts

21 lines
548 B
TypeScript

import { useMenu } from "contexts/menu";
import type { ContextMenuCapture } from "contexts/menu/useMenuContextState";
import { useMemo } from "react";
const useAddressBarContextMenu = (address: string): ContextMenuCapture => {
const { contextMenu } = useMenu();
return useMemo(
() =>
contextMenu?.(() => [
{
action: () => navigator.clipboard?.writeText(address),
label: "Copy address",
},
]),
[address, contextMenu]
);
};
export default useAddressBarContextMenu;