Skip to content

Commit

Permalink
fix types & names
Browse files Browse the repository at this point in the history
  • Loading branch information
PartyWumpus authored Oct 15, 2023
1 parent d37cdb2 commit 4b13175
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions frontend/src/components/store/Store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TextField,
findModule,
} from 'decky-frontend-lib';
import { FC, useEffect, useMemo, useState } from 'react';
import { FC, useEffect, useMemo, useState, Dispatch, SetStateAction } from 'react';
import { useTranslation } from 'react-i18next';

import logo from '../../../assets/plugin_store.png';
Expand Down Expand Up @@ -61,7 +61,7 @@ const StorePage: FC<{}> = () => {
);
};

const BrowseTab: FC<{ children: { setPluginCount: setPluginCount } }> = (data) => {
const BrowseTab: FC<{ children: { setPluginCount: Dispatch<SetStateAction<Number>> } }> = (data) => {

const { t } = useTranslation();

Expand All @@ -79,29 +79,30 @@ const BrowseTab: FC<{ children: { setPluginCount: setPluginCount } }> = (data) =
const [selectedSort, setSort] = useState<number>(dropdownSortOptions[0].data);
// const [selectedFilter, setFilter] = useState<number>(filterOptions[0].data);
const [searchFieldValue, setSearchValue] = useState<string>('');
const [data, setData] = useState<StorePlugin[] | null>(null);
const [pluginList, setPluginList] = useState<StorePlugin[] | null>(null);
const [isTesting, setIsTesting] = useState<boolean>(false);

useEffect(() => {
(async () => {
sort, direction = null, null
let sort = null
let direction = null
switch (selectedSort) {
case 1: direction=SortDirections.ascending;sort=SortOptions.name
case 1: direction=SortDirections.ascending; sort=SortOptions.name
case 2: direction=SortDirections.descending;sort=SortOptions.name
case 3: direction=SortDirections.ascending;sort=SortOptions.date
case 3: direction=SortDirections.ascending; sort=SortOptions.date
case 4: direction=SortDirections.descending;sort=SortOptions.date
}
const res = await getPluginList(sort, direction);
logger.log('got data!', res);
setData(res);
setPluginCount(res.length)
setPluginList(res);
data.children.setPluginCount(res.length)
const storeRes = await getStore();
logger.log(`store is ${storeRes}, isTesting is ${storeRes === Store.Testing}`);
setIsTesting(storeRes === Store.Testing);
})();
}, []);

return !data ? (
return !pluginList ? (
<div style={{ height: '100%' }}>
<SteamSpinner />
</div>
Expand Down Expand Up @@ -222,7 +223,7 @@ const BrowseTab: FC<{ children: { setPluginCount: setPluginCount } }> = (data) =
</div>
)}
<div>
{data
{pluginList
.filter((plugin: StorePlugin) => {
return (
plugin.name.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
Expand Down

0 comments on commit 4b13175

Please sign in to comment.