diff --git a/client/src/components/Apps/AppGrid/AppGrid.tsx b/client/src/components/Apps/AppGrid/AppGrid.tsx index 288b727..42913e0 100644 --- a/client/src/components/Apps/AppGrid/AppGrid.tsx +++ b/client/src/components/Apps/AppGrid/AppGrid.tsx @@ -26,15 +26,19 @@ export const AppGrid = (props: Props): JSX.Element => { config: { config } } = useSelector((state: State) => state); + const shouldBeShown = (category: Category) => { + return !config.hideEmptyCategories || category.apps.length > 0 || !fromHomepage + } + let apps: JSX.Element; - if (categories.length) { + if (categories.length && categories.some(shouldBeShown)) { if (searching && !categories[0].apps.length) { apps = No apps match your search criteria; } else { apps = (
- {categories.filter((category : Category) => !config.hideEmptyCategories || category.apps.length > 0).map( + {categories.filter(shouldBeShown).map( (category: Category): JSX.Element => ( { ); } } else { - if (totalCategories) { + if (totalCategories && !config.hideEmptyCategories) { apps = ( There are no pinned categories. You can pin them from the{' '} diff --git a/client/src/components/Bookmarks/BookmarkGrid/BookmarkGrid.tsx b/client/src/components/Bookmarks/BookmarkGrid/BookmarkGrid.tsx index 5ab2f88..f93bd97 100644 --- a/client/src/components/Bookmarks/BookmarkGrid/BookmarkGrid.tsx +++ b/client/src/components/Bookmarks/BookmarkGrid/BookmarkGrid.tsx @@ -26,15 +26,19 @@ export const BookmarkGrid = (props: Props): JSX.Element => { config: { config } } = useSelector((state: State) => state); + const shouldBeShown = (category: Category) => { + return !config.hideEmptyCategories || category.bookmarks.length > 0 || !fromHomepage + } + let bookmarks: JSX.Element; - if (categories.length) { + if (categories.length && categories.some(shouldBeShown)) { if (searching && !categories[0].bookmarks.length) { bookmarks = No bookmarks match your search criteria; } else { bookmarks = (
- {categories.filter((category : Category) => !config.hideEmptyCategories || category.apps.length > 0).map( + {categories.filter(shouldBeShown).map( (category: Category): JSX.Element => ( { ); } } else { - if (totalCategories) { + if (totalCategories && !config.hideEmptyCategories) { bookmarks = ( There are no pinned categories. You can pin them from the{' '} diff --git a/client/src/components/Home/Home.tsx b/client/src/components/Home/Home.tsx index a6ed1ba..f92a8b7 100644 --- a/client/src/components/Home/Home.tsx +++ b/client/src/components/Home/Home.tsx @@ -36,7 +36,7 @@ export const Home = (): JSX.Element => { null | Category[] >(null); - // Load apps + // Load apps and bookmarks useEffect(() => { if (!appCategories.length && !bookmarkCategories.length) { getCategories(); @@ -59,11 +59,12 @@ export const Home = (): JSX.Element => { appCategory.apps = appCategories .map(({ apps }) => apps) .flat() - .filter(({ name }) => - new RegExp(escapeRegex(localSearch), 'i').test(name) + .filter(({ name, url }) => + new RegExp(escapeRegex(localSearch), 'i').test(name) || + new RegExp(escapeRegex(localSearch), 'i').test(url) ); - setBookmarkSearchResult([appCategory]); + setAppSearchResult([appCategory]); // Search through bookmarks const bookmarkCategory = { ...bookmarkCategories[0] }; @@ -72,8 +73,9 @@ export const Home = (): JSX.Element => { bookmarkCategory.bookmarks = bookmarkCategories .map(({ bookmarks }) => bookmarks) .flat() - .filter(({ name }) => - new RegExp(escapeRegex(localSearch), 'i').test(name) + .filter(({ name, url }) => + new RegExp(escapeRegex(localSearch), 'i').test(name) || + new RegExp(escapeRegex(localSearch), 'i').test(url) ); setBookmarkSearchResult([bookmarkCategory]); @@ -122,6 +124,7 @@ export const Home = (): JSX.Element => { } totalCategories={appCategories.length} searching={!!localSearch} + fromHomepage={true} /> )}
@@ -130,8 +133,7 @@ export const Home = (): JSX.Element => { <> )} - {!config.hideBookmarks && - (isAuthenticated || bookmarkCategories.some((c) => c.isPinned)) ? ( + {!config.hideBookmarks && (isAuthenticated || bookmarkCategories.some((c) => c.isPinned)) ? ( {bookmarksLoading ? (