diff --git a/apps/onelauncher/frontend/src/components/content/LauncherIcon.tsx b/apps/onelauncher/frontend/src/components/content/LauncherIcon.tsx new file mode 100644 index 00000000..1acae0c1 --- /dev/null +++ b/apps/onelauncher/frontend/src/components/content/LauncherIcon.tsx @@ -0,0 +1,62 @@ +import type { ImgHTMLAttributes, JSX } from 'react'; +import CurseforgeIcon from '../../assets/logos/curseforge.svg'; +import AtLauncherIcon from '../../assets/logos/launchers/atlauncher.svg'; +import FTBIcon from '../../assets/logos/launchers/ftb.svg'; +import GDLauncherImage from '../../assets/logos/launchers/gdlauncher.png'; +import MultiMCImage from '../../assets/logos/launchers/multimc.png'; +import PrismIcon from '../../assets/logos/launchers/prismlauncher.svg'; +import TechnicImage from '../../assets/logos/launchers/technic.png'; +import TLauncherImage from '../../assets/logos/launchers/tlauncher.png'; +import UnknownImage from '../../assets/logos/minecraft.png'; +import ModrinthIcon from '../../assets/logos/modrinth.svg'; +import { Show } from '../base/Show'; + +type ElementType = (props: any) => JSX.Element; + +// i dont know what ImportType is so i assume it is a string +export function getLauncherLogoElement(launcher: string): ElementType { + const providerName = launcher.toLowerCase() as Lowercase; + + const image = (src: string, props: any) => {providerName}; + + // [provider logo, is svg] + const mapping: Record, ElementType | string> = { + modrinth: ModrinthIcon, + curseforge: CurseforgeIcon, + prismlauncher: PrismIcon, + atlauncher: AtLauncherIcon, + gdlauncher: GDLauncherImage, + ftblauncher: FTBIcon, + multimc: MultiMCImage, + tlauncher: TLauncherImage, + technic: TechnicImage, + unknown: UnknownImage, + }; + + const logo = mapping[providerName] || UnknownImage; + if (typeof logo === 'function') + return logo; + + return props => image(logo, props); +} + +type LauncherIconProps = ImgHTMLAttributes & { + launcher: string | undefined; +}; + +function LauncherIcon({ + launcher, + ...props +}: LauncherIconProps) { + return ( + + )} + when={launcher !== undefined} + /> + ); +} + +export default LauncherIcon; diff --git a/apps/onelauncher/frontend/src/routes/onboarding/import.tsx b/apps/onelauncher/frontend/src/routes/onboarding/import.tsx index c5c0e174..d6e8e2b2 100644 --- a/apps/onelauncher/frontend/src/routes/onboarding/import.tsx +++ b/apps/onelauncher/frontend/src/routes/onboarding/import.tsx @@ -1,9 +1,37 @@ import { createFileRoute } from '@tanstack/react-router' +import { OnboardingStep } from './route' +import Illustration from '../../assets/illustrations/onboarding/import_from_others.svg'; +import { LAUNCHER_IMPORT_TYPES } from '@/utils'; +import LauncherIcon from '@/components/content/LauncherIcon'; export const Route = createFileRoute('/onboarding/import')({ component: RouteComponent, }) function RouteComponent() { - return
Hello "/onboarding/import"!
+ return ( + <> + } paragraph="Import your profiles from other launchers." + title="Import"> +
+
+ {LAUNCHER_IMPORT_TYPES.map((x) => ( + + ))} +
+ + Want to contribute a launcher import? Click + {' '} + here + . + +
+
+ + ) } diff --git a/apps/onelauncher/frontend/src/utils/index.ts b/apps/onelauncher/frontend/src/utils/index.ts new file mode 100644 index 00000000..11b8e068 --- /dev/null +++ b/apps/onelauncher/frontend/src/utils/index.ts @@ -0,0 +1,11 @@ +export const LAUNCHER_IMPORT_TYPES: string[] = [ + 'PrismLauncher', + 'Curseforge', + // 'Modrinth', + 'ATLauncher', + 'GDLauncher', + // 'FTBLauncher', + 'MultiMC', + // 'TLauncher', + // 'Technic' +] as const; \ No newline at end of file