/* * Vencord, a Discord client mod * Copyright (c) 2026 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import { classNameFactory } from "@utils/css"; import { useEffect, useRef } from "@webpack/common"; import type { PaletteAction } from "../api/types"; import { PaletteIcon } from "./PaletteIcon"; const cl = classNameFactory("vc-cmdpal-"); interface ActionsPanelProps { actions: PaletteAction[]; selectedIndex: number; onSelect(index: number): void; onRun(action: PaletteAction): void; } function PanelRow({ action, selected, index, onSelect, onRun }: { action: PaletteAction; selected: boolean; index: number; onSelect(index: number): void; onRun(action: PaletteAction): void; }) { const ref = useRef(null); useEffect(() => { if (selected) ref.current?.scrollIntoView({ block: "nearest" }); }, [selected]); return (
{ if (!selected) onSelect(index); }} onClick={() => onRun(action)} >
{action.label}
); } export function ActionsPanel({ actions, selectedIndex, onSelect, onRun }: ActionsPanelProps) { return (
Actions
{actions.map((action, i) => ( ))}
); }