import Link from "next/link"; import { Spotlight } from "@mantine/spotlight"; import type { TranslationObject } from "@homarr/translation"; import type { SearchGroup } from "../../../lib/group"; import type { inferSearchInteractionOptions } from "../../../lib/interaction"; import classes from "./action-item.module.css"; interface SpotlightGroupActionItemProps> { option: TOption; query: string; setMode: (mode: keyof TranslationObject["search"]["mode"]) => void; setChildrenOptions: (options: inferSearchInteractionOptions<"children">) => void; group: SearchGroup; } export const SpotlightGroupActionItem = >({ group, query, setMode, setChildrenOptions, option, }: SpotlightGroupActionItemProps) => { const interaction = group.useInteraction(option, query); const renderRoot = interaction.type === "link" ? (props: Record) => { return ; } : undefined; const handleClickAsync = async () => { if (interaction.type === "javaScript") { await interaction.onSelect(); } else if (interaction.type === "mode") { setMode(interaction.mode); } else if (interaction.type === "children") { setChildrenOptions(interaction); } }; return ( ); };