Skip to content

Commit

Permalink
chore: small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebofill committed Jan 8, 2024
1 parent 2ffe928 commit 8de096a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/components/CustomTabContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export class CustomTabContainer implements TabContainer {
this.checkMicroSDeckDependency();
}

getActualTab(TabContentComponent: TabContentComponent, sortingProps: Omit<TabContentProps, 'collection'>, footer: SteamTab['footer'], collectionAppFilter: any): SteamTab {
getActualTab(TabContentComponent: TabContentComponent, sortingProps: Omit<TabContentProps, 'collection'>, footer: SteamTab['footer'], collectionAppFilter: any, isMicroSDeckInstalled: boolean): SteamTab | null {
if (!isMicroSDeckInstalled && this.dependsOnMicroSDeck) return null;
if (this.autoHide && this.collection.visibleApps.length === 0) return null;

return {
title: this.title,
id: this.id,
Expand Down
6 changes: 1 addition & 5 deletions src/patches/LibraryPatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ export const patchLibrary = (serverAPI: ServerAPI, tabMasterManager: TabMasterMa
pacthedTabs = tablist.flatMap((tabContainer) => {
if (tabContainer.filters) {
const footer = { ...(tabTemplate!.footer ?? {}), onMenuButton: getShowMenu(tabContainer.id, tabMasterManager), onMenuActionDescription: 'Tab Master' };

//if MicroSDeck isn't installed don't display any tabs that depend on it; return empty array for flat map
if (!isMicroSDeckInstalled && (tabContainer as CustomTabContainer).dependsOnMicroSDeck) return [];
if ((tabContainer as CustomTabContainer).autoHide && (tabContainer as CustomTabContainer).collection.visibleApps.length === 0) return [];
return (tabContainer as CustomTabContainer).getActualTab(tabContentComponent, sortingProps, footer, collectionsAppFilterGamepad);
return (tabContainer as CustomTabContainer).getActualTab(tabContentComponent, sortingProps, footer, collectionsAppFilterGamepad, isMicroSDeckInstalled) || [];
} else {
return tabs.find(actualTab => {
if (actualTab.id === tabContainer.id) {
Expand Down

0 comments on commit 8de096a

Please sign in to comment.