import { Dropdown, DropdownOption, Focusable, PanelSectionRow, SteamSpinner, Tabs, TextField, findModule, } from 'decky-frontend-lib'; import { FC, useEffect, useMemo, useState } from 'react'; import logo from '../../../assets/plugin_store.png'; import Logger from '../../logger'; import { StorePlugin, getPluginList } from '../../store'; import PluginCard from './PluginCard'; const logger = new Logger('Store'); const StorePage: FC<{}> = () => { const [currentTabRoute, setCurrentTabRoute] = useState('browse'); const [data, setData] = useState(null); const { TabCount } = findModule((m) => { if (m?.TabCount && m?.TabTitle) return true; return false; }); useEffect(() => { (async () => { const res = await getPluginList(); logger.log('got data!', res); setData(res); })(); }, []); return ( <>
{!data ? (
) : ( { setCurrentTabRoute(tabId); }} tabs={[ { title: 'Browse', content: , id: 'browse', renderTabAddon: () => {data.length}, }, { title: 'About', content: , id: 'about', }, ]} /> )}
); }; const BrowseTab: FC<{ children: { data: StorePlugin[] } }> = (data) => { const sortOptions = useMemo( (): DropdownOption[] => [ { data: 1, label: 'Alphabetical (A to Z)' }, { data: 2, label: 'Alphabetical (Z to A)' }, ], [], ); // const filterOptions = useMemo((): DropdownOption[] => [{ data: 1, label: 'All' }], []); const [selectedSort, setSort] = useState(sortOptions[0].data); // const [selectedFilter, setFilter] = useState(filterOptions[0].data); const [searchFieldValue, setSearchValue] = useState(''); return ( <> {/* This should be used once filtering is added
Sort setSort(e.data)} />
Filter setFilter(e.data)} />
setSearchValue(e.target.value)} />
*/}
Sort setSort(e.data)} />
setSearchValue(e.target.value)} />
{data.children.data .filter((plugin: StorePlugin) => { return ( plugin.name.toLowerCase().includes(searchFieldValue.toLowerCase()) || plugin.description.toLowerCase().includes(searchFieldValue.toLowerCase()) || plugin.author.toLowerCase().includes(searchFieldValue.toLowerCase()) || plugin.tags.some((tag: string) => tag.toLowerCase().includes(searchFieldValue.toLowerCase())) ); }) .sort((a, b) => { if (selectedSort % 2 === 1) return a.name.localeCompare(b.name); else return b.name.localeCompare(a.name); }) .map((plugin: StorePlugin) => ( ))}
); }; const AboutTab: FC<{}> = () => { return (
Testing Please consider testing new plugins to help the Decky Loader team!{' '} deckbrew.xyz/testing Contributing If you would like to contribute to the Decky Plugin Store, check the SteamDeckHomebrew/decky-plugin-template repository on GitHub. Information on development and distribution is available in the README. Source Code All plugin source code is available on SteamDeckHomebrew/decky-plugin-database repository on GitHub.
); }; export default StorePage;