From 766cb90dd49a09a45109fb4aa859ca6558a530cf Mon Sep 17 00:00:00 2001 From: Szedann <65607498+Szedann@users.noreply.github.com> Date: Fri, 1 Aug 2025 20:18:54 +0200 Subject: [PATCH] fix: mod browser UI QC issues pt 1 --- .../src/components/content/PackageItem.tsx | 8 +- .../components/launcher/FlatLoaderIcon.tsx | 152 ++++++++++++++++++ .../frontend/src/hooks/usePagination.tsx | 2 +- 3 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 apps/onelauncher/frontend/src/components/launcher/FlatLoaderIcon.tsx diff --git a/apps/onelauncher/frontend/src/components/content/PackageItem.tsx b/apps/onelauncher/frontend/src/components/content/PackageItem.tsx index 24c62ec4..b9386b87 100644 --- a/apps/onelauncher/frontend/src/components/content/PackageItem.tsx +++ b/apps/onelauncher/frontend/src/components/content/PackageItem.tsx @@ -5,7 +5,7 @@ import { Link } from '@tanstack/react-router'; import { Download01Icon } from '@untitled-theme/icons-react'; import { useMemo } from 'react'; import { Focusable } from 'react-aria-components'; -import LoaderIcon from '../launcher/LoaderIcon'; +import { FlatLoaderIcon } from '../launcher/FlatLoaderIcon'; function includes(list: { includes: (arg0: TArray) => boolean }, element: T): element is TArray { return list.includes(element as unknown as TArray); @@ -51,10 +51,10 @@ export function PackageItem({ provider, ...item }: SearchResult & { provider: Pr -
- {loaders.toSpliced(loaders.length > 3 ? 2 : 3).map(loader => )} +
+ {loaders.toSpliced(loaders.length > 3 ? 2 : 3).map(loader => )} {loaders.length > 3 && ( -
+
+ {loaders.length - 2} diff --git a/apps/onelauncher/frontend/src/components/launcher/FlatLoaderIcon.tsx b/apps/onelauncher/frontend/src/components/launcher/FlatLoaderIcon.tsx new file mode 100644 index 00000000..c6d4b10c --- /dev/null +++ b/apps/onelauncher/frontend/src/components/launcher/FlatLoaderIcon.tsx @@ -0,0 +1,152 @@ +import type { GameLoader } from '@/bindings.gen'; +import type { HTMLAttributes, RefAttributes } from 'react'; + +function IconSvg({ loader }: { loader: GameLoader }) { + switch (loader) { + case 'vanilla': return ( + + + + + ); + case 'forge': return ( + + + + + + ); + case 'neoforge': return ( + + + + + + + + + + + + + + ); + case 'quilt': return ( + + + + + + + + + + + + + ); + case 'fabric': return ( + + + + + + ); + case 'legacyfabric': return ( + + + + + + ); + } +} + +export function FlatLoaderIcon({ loader, className }: { loader: GameLoader } & HTMLAttributes) { + return ( +
+ +
+ ); +} diff --git a/apps/onelauncher/frontend/src/hooks/usePagination.tsx b/apps/onelauncher/frontend/src/hooks/usePagination.tsx index 02c384bb..8590989f 100644 --- a/apps/onelauncher/frontend/src/hooks/usePagination.tsx +++ b/apps/onelauncher/frontend/src/hooks/usePagination.tsx @@ -49,7 +49,7 @@ function usePagination(options: PaginationOptions) { function PaginationBtn({ page: pageIndex }: { page: number }) { return (