From 6d086fb5d52a690c6e07c49ba065f1d83a8ab1db Mon Sep 17 00:00:00 2001 From: EMERALD Date: Wed, 12 Jul 2023 18:52:32 -0500 Subject: Add testing store info to browse tab (#504) --- frontend/src/components/store/Store.tsx | 44 +++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'frontend/src/components/store') diff --git a/frontend/src/components/store/Store.tsx b/frontend/src/components/store/Store.tsx index f2d941cd..1afbb22b 100644 --- a/frontend/src/components/store/Store.tsx +++ b/frontend/src/components/store/Store.tsx @@ -13,7 +13,7 @@ import { useTranslation } from 'react-i18next'; import logo from '../../../assets/plugin_store.png'; import Logger from '../../logger'; -import { StorePlugin, getPluginList } from '../../store'; +import { Store, StorePlugin, getPluginList, getStore } from '../../store'; import PluginCard from './PluginCard'; const logger = new Logger('Store'); @@ -21,6 +21,7 @@ const logger = new Logger('Store'); const StorePage: FC<{}> = () => { const [currentTabRoute, setCurrentTabRoute] = useState('browse'); const [data, setData] = useState(null); + const [isTesting, setIsTesting] = useState(false); const { TabCount } = findModule((m) => { if (m?.TabCount && m?.TabTitle) return true; return false; @@ -33,6 +34,9 @@ const StorePage: FC<{}> = () => { const res = await getPluginList(); logger.log('got data!', res); setData(res); + const storeRes = await getStore(); + logger.log(`store is ${storeRes}, isTesting is ${storeRes === Store.Testing}`); + setIsTesting(storeRes === Store.Testing); })(); }, []); @@ -58,7 +62,7 @@ const StorePage: FC<{}> = () => { tabs={[ { title: t('Store.store_tabs.title'), - content: , + content: , id: 'browse', renderTabAddon: () => {data.length}, }, @@ -75,7 +79,7 @@ const StorePage: FC<{}> = () => { ); }; -const BrowseTab: FC<{ children: { data: StorePlugin[] } }> = (data) => { +const BrowseTab: FC<{ children: { data: StorePlugin[]; isTesting: boolean } }> = (data) => { const { t } = useTranslation(); const sortOptions = useMemo( @@ -178,6 +182,36 @@ const BrowseTab: FC<{ children: { data: StorePlugin[] } }> = (data) => { + {data.children.isTesting && ( +
+

{t('Store.store_testing_warning.label')}

+ + {`${t('Store.store_testing_warning.desc')} `} + + decky.xyz/testing + + +
+ )}
{data.children.data .filter((plugin: StorePlugin) => { @@ -229,13 +263,13 @@ const AboutTab: FC<{}> = () => { {t('Store.store_testing_cta')}{' '} - deckbrew.xyz/testing + decky.xyz/testing {t('Store.store_contrib.label')} -- cgit v1.2.3