import { useState, useEffect } from "react"; import { PanelSection, PanelSectionRow, Dropdown, DropdownOption } from "@decky/ui"; import { callable, definePlugin } from "@decky/api"; import { FaShip } from "react-icons/fa"; const fetchInstalledGames = callable<[], string>("get_installed_games"); function Content() { const [games, setGames] = useState([]); const [selectedGame, setSelectedGame] = useState(null); useEffect(() => { const loadGames = async () => { const result = await fetchInstalledGames(); const gameList = JSON.parse(result) as { appid: string; name: string }[]; setGames(gameList.map(game => ({ data: game.appid, label: game.name }))); }; loadGames(); }, []); return ( setSelectedGame(option)} strDefaultLabel="Select a game" // Placeholder equivalent /> {selectedGame && (
You selected: {selectedGame.label}
)}
); } export default definePlugin(() => ({ name: "Game Selector Plugin", titleView:
Game Selector Plugin
, content: , icon: , onDismount() { console.log("Plugin unmounted"); }, }));