import React, { useState } from "react"; import { Pressable, ScrollView, Text, View } from "react-native"; interface Command { label: string; value: string; } const DEFAULT_COMMANDS: Command[] = [ { label: "/s", value: "/s" }, { label: "/ss", value: "/ss" }, { label: "/clear", value: "/clear" }, { label: "/help", value: "/help" }, { label: "/status", value: "/status" }, ]; interface CommandBarProps { onCommand: (command: string) => void; commands?: Command[]; } export function CommandBar({ onCommand, commands = DEFAULT_COMMANDS, }: CommandBarProps) { const [activeCommand, setActiveCommand] = useState(null); function handlePress(command: Command) { setActiveCommand(command.value); onCommand(command.value); setTimeout(() => setActiveCommand(null), 200); } return ( {commands.map((cmd) => ( handlePress(cmd)} className="rounded-full px-4 py-2" style={({ pressed }) => ({ backgroundColor: activeCommand === cmd.value || pressed ? "#4A9EFF" : "#1E1E2E", })} > {cmd.label} ))} ); }