chore(ui): Organise Onboarding imports

This commit is contained in:
LynithDev 2024-11-28 16:57:43 +01:00
parent ba1f1a2c5d
commit 5a1ed75454
4 changed files with 22 additions and 5 deletions

View file

@ -4,12 +4,12 @@ import { type JSX, splitProps } from 'solid-js';
import styles from './Link.module.scss'; import styles from './Link.module.scss';
export type LinkProps = JSX.IntrinsicElements['a'] & { export type LinkProps = JSX.IntrinsicElements['a'] & {
prompt?: boolean; skipPrompt?: boolean;
includeIcon?: boolean; includeIcon?: boolean;
}; };
function Link(props: LinkProps) { function Link(props: LinkProps) {
const [split, rest] = splitProps(props, ['prompt', 'class', 'href', 'onClick', 'children']); const [split, rest] = splitProps(props, ['skipPrompt', 'class', 'href', 'onClick', 'children']);
const open = usePromptOpener(); const open = usePromptOpener();
return ( return (
@ -25,7 +25,7 @@ function Link(props: LinkProps) {
)} )}
class={`${styles.link} ${split.class || ''}`} class={`${styles.link} ${split.class || ''}`}
onClick={(e) => { onClick={(e) => {
open(split.href, !!split.prompt); open(split.href, !!split.skipPrompt);
if (typeof split.onClick === 'function') if (typeof split.onClick === 'function')
split.onClick(e as any); split.onClick(e as any);
}} }}

View file

@ -2,6 +2,7 @@ import type { ImportType } from '@onelauncher/client/bindings';
import Illustration from '~assets/illustrations/onboarding/import_from_others.svg?component-solid'; import Illustration from '~assets/illustrations/onboarding/import_from_others.svg?component-solid';
import { bridge } from '~imports'; import { bridge } from '~imports';
import Button from '~ui/components/base/Button'; import Button from '~ui/components/base/Button';
import Link from '~ui/components/base/Link';
import SelectList from '~ui/components/base/SelectList'; import SelectList from '~ui/components/base/SelectList';
import LauncherIcon from '~ui/components/content/LauncherIcon'; import LauncherIcon from '~ui/components/content/LauncherIcon';
import Modal, { createModal, type ModalProps } from '~ui/components/overlay/Modal'; import Modal, { createModal, type ModalProps } from '~ui/components/overlay/Modal';
@ -52,6 +53,12 @@ function OnboardingImport() {
)} )}
</For> </For>
</div> </div>
<small class="pt-2 text-fg-secondary">
Want to contribute a launcher import? Click
{' '}
<Link href="https://github.com/Polyfrost/OneLauncher" skipPrompt={true}>here</Link>
.
</small>
</OverlayScrollbarsComponent> </OverlayScrollbarsComponent>
</div> </div>
</OnboardingStep> </OnboardingStep>

View file

@ -56,7 +56,7 @@ function OnboardingLanguage() {
</div> </div>
<div class="w-full flex flex-row justify-end"> <div class="w-full flex flex-row justify-end">
<Link class="text-xs" href={TRANSLATION_WEBSITE}>Help translate OneLauncher</Link> <Link class="text-xs" href={TRANSLATION_WEBSITE} skipPrompt>Help translate OneLauncher</Link>
</div> </div>
</div> </div>
</OnboardingStep> </OnboardingStep>

View file

@ -182,4 +182,14 @@ export function getPackageUrl(pkg: ManagedPackage): string {
export const LOADERS: Loader[] = ['vanilla', 'fabric', 'forge', 'neoforge', 'quilt'] as const; export const LOADERS: Loader[] = ['vanilla', 'fabric', 'forge', 'neoforge', 'quilt'] as const;
export const PROVIDERS: Providers[] = ['Modrinth', 'Curseforge'] as const; export const PROVIDERS: Providers[] = ['Modrinth', 'Curseforge'] as const;
export const PACKAGE_TYPES: PackageType[] = ['mod', 'resourcepack', 'datapack', 'shaderpack'] as const; export const PACKAGE_TYPES: PackageType[] = ['mod', 'resourcepack', 'datapack', 'shaderpack'] as const;
export const LAUNCHER_IMPORT_TYPES: ImportType[] = ['PrismLauncher', 'Curseforge', 'Modrinth', 'ATLauncher', 'GDLauncher', 'FTBLauncher', 'MultiMC', 'TLauncher', 'Technic'] as const; export const LAUNCHER_IMPORT_TYPES: ImportType[] = [
'PrismLauncher',
'Curseforge',
// 'Modrinth',
'ATLauncher',
'GDLauncher',
// 'FTBLauncher',
'MultiMC',
// 'TLauncher',
// 'Technic'
] as const;