+
{link => (
@@ -200,7 +200,7 @@ function BrowserSidebar(props: { package: ManagedPackage; authors: ManagedUser[]
-
+ 1}>
>
diff --git a/apps/frontend/src/ui/pages/browser/BrowserRoot.tsx b/apps/frontend/src/ui/pages/browser/BrowserRoot.tsx
index 55a053bc..3ef67838 100644
--- a/apps/frontend/src/ui/pages/browser/BrowserRoot.tsx
+++ b/apps/frontend/src/ui/pages/browser/BrowserRoot.tsx
@@ -8,6 +8,8 @@ import Button from '~ui/components/base/Button';
import TextField from '~ui/components/base/TextField';
import useBrowser from '~ui/hooks/useBrowser';
import { browserCategories } from '~utils/browser';
+import Dropdown from '~ui/components/base/Dropdown';
+import { PROVIDERS } from '~utils';
function BrowserRoutes() {
return (
@@ -88,23 +90,19 @@ function BrowserCategories() {
-
- {category => (
-
-
{category.name}
-
- {sub => (
- toggleCategory(sub)}
- >
- {sub}
-
- )}
-
-
- )}
-
+
+
Categories
+
+ {category => (
+ toggleCategory(category.id)}
+ >
+ {category.display}
+
+ )}
+
+
);
@@ -115,7 +113,7 @@ function BrowserSidebar() {
return (
-
+
Active Cluster
+
+
Provider
+ PROVIDERS.indexOf(controller.searchQuery().provider)}
+ onChange={index => controller.setSearchQuery(prev => ({
+ ...prev,
+ provider: PROVIDERS[index] || 'Modrinth',
+ }))}
+ >
+
+ {provider => (
+
+ {provider}
+
+ )}
+
+
+
);
diff --git a/apps/frontend/src/ui/pages/browser/BrowserSearch.tsx b/apps/frontend/src/ui/pages/browser/BrowserSearch.tsx
index 51d59a6e..96d4aa62 100644
--- a/apps/frontend/src/ui/pages/browser/BrowserSearch.tsx
+++ b/apps/frontend/src/ui/pages/browser/BrowserSearch.tsx
@@ -36,22 +36,25 @@ function BrowserSearch() {
return (
-
+
+
+
+ Results
+
+
+ )}
+ />
+
-
-
-
-
-
-
-
-
-
+
+
);
}
diff --git a/apps/frontend/src/utils/browser.ts b/apps/frontend/src/utils/browser.ts
index 3bba4a28..716ec61f 100644
--- a/apps/frontend/src/utils/browser.ts
+++ b/apps/frontend/src/utils/browser.ts
@@ -1,53 +1,86 @@
-import type { BrowserListView, PackageType } from '@onelauncher/client/bindings';
+import type { BrowserListView, PackageType, Providers } from '@onelauncher/client/bindings';
export const BROWSER_VIEWS: BrowserListView[] = ['grid', 'list', 'preview'] as const;
-export interface BrowserSidebarCategory {
- name: string;
- sub: string[];
+export interface CategoryItem {
+ display: string;
+ id: string;
+}
+
+type ModCategories = [
+ 'adventure',
+ 'library',
+ 'equipment',
+ 'decoration',
+ 'food',
+ 'magic',
+ 'performance',
+ 'storage',
+ 'technology',
+ 'utility',
+ 'worldgen',
+];
+
+const modMapping: Record
= {
+ Modrinth: {
+ adventure: {
+ display: 'Adventure',
+ id: 'adventure',
+ },
+ library: {
+ display: 'Library',
+ id: 'library',
+ },
+ decoration: {
+ display: 'Decoration',
+ id: 'decoration',
+ },
+ equipment: {
+ display: 'Equipment',
+ id: 'equipment',
+ },
+ food: {
+ display: 'Food',
+ id: 'food',
+ },
+ magic: {
+ display: 'Magic',
+ id: 'magic',
+ },
+ performance: {
+ display: 'Performance',
+ id: 'optimization',
+ },
+ storage: {
+ display: 'Storage',
+ id: 'storage',
+ },
+ technology: {
+ display: 'Technology',
+ id: 'technology',
+ },
+ utility: {
+ display: 'Utility',
+ id: 'utility',
+ },
+ worldgen: {
+ display: 'World Generation',
+ id: 'worldgen',
+ },
+ },
};
export const browserCategories = {
- byPackageType(packageType: PackageType): BrowserSidebarCategory[] {
+ byPackageType(packageType: PackageType): CategoryItem[] {
switch (packageType) {
case 'mod':
return this.mod();
- case 'datapack':
- return this.datapack();
- case 'resourcepack':
- return this.resourcepack();
- case 'shaderpack':
- return this.shaderpack();
}
return [];
},
- mod(): BrowserSidebarCategory[] {
- return [
- {
- name: 'Categories',
- sub: [
- 'adventure',
- 'magic',
- 'technology',
- 'utility',
- 'worldgen',
- 'miscellaneous',
- ],
- },
- ];
- },
-
- datapack(): BrowserSidebarCategory[] {
- return [];
- },
-
- resourcepack(): BrowserSidebarCategory[] {
- return [];
- },
-
- shaderpack(): BrowserSidebarCategory[] {
- return [];
+ mod(provider: Providers = 'Modrinth'): CategoryItem[] {
+ return Object.values(modMapping[provider]);
},
};