🐛 fix: d
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
parent
30b2de6129
commit
885da4f798
25 changed files with 44 additions and 55 deletions
|
|
@ -1,8 +1,7 @@
|
|||
use interpulse::api::minecraft::Version;
|
||||
use onelauncher::data::Settings;
|
||||
use onelauncher::settings;
|
||||
use tauri::AppHandle;
|
||||
use tauri::Manager;
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
mod cluster;
|
||||
pub use crate::api::commands::cluster::*;
|
||||
|
|
@ -109,6 +108,5 @@ pub async fn set_settings(settings: Settings) -> Result<(), String> {
|
|||
#[tauri::command]
|
||||
pub fn set_window_style(handle: AppHandle, custom: bool) -> Result<(), String> {
|
||||
let window = handle.get_webview_window("main").unwrap();
|
||||
onelauncher::utils::window::set_window_styling(&window, custom)
|
||||
.map_err(|e| e.to_string())
|
||||
onelauncher::utils::window::set_window_styling(&window, custom).map_err(|e| e.to_string())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,16 +9,18 @@ use uuid::Uuid;
|
|||
|
||||
#[specta::specta]
|
||||
#[tauri::command]
|
||||
pub async fn import_launcher_instances(launcher: ImportType, path: Option<PathBuf>) -> Result<(), String> {
|
||||
pub async fn import_launcher_instances(
|
||||
launcher: ImportType,
|
||||
path: Option<PathBuf>,
|
||||
) -> Result<(), String> {
|
||||
onelauncher::api::package::import::import_instances(
|
||||
launcher,
|
||||
path.unwrap_or(
|
||||
default_launcher_path(launcher)
|
||||
.ok_or(
|
||||
"couldn't get a default path for this launcher"
|
||||
)?
|
||||
)
|
||||
).await?;
|
||||
.ok_or("couldn't get a default path for this launcher")?,
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import type { ComponentProps, JSX } from 'solid-js';
|
||||
import { Window } from '@tauri-apps/api/window';
|
||||
import { ChevronLeftIcon, Maximize02Icon, MinusIcon, XCloseIcon } from '@untitled-theme/icons-solid';
|
||||
import useSettings from '~ui/hooks/useSettings';
|
||||
import { onMount, Show } from 'solid-js';
|
||||
import type { JSX } from 'solid-js';
|
||||
import Button from './base/Button';
|
||||
import Modal, { createModal } from './overlay/Modal';
|
||||
|
||||
interface TitlebarButtonProps {
|
||||
icon: (any: any) => JSX.Element;
|
||||
icon: (props: ComponentProps<'svg'>) => JSX.Element;
|
||||
onClick: (event: MouseEvent) => void;
|
||||
danger?: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { createEffect, createSignal, mergeProps, on, splitProps, untrack } from 'solid-js';
|
||||
import type { Accessor, JSX, ParentProps } from 'solid-js';
|
||||
import { createEffect, createSignal, mergeProps, on, splitProps, untrack } from 'solid-js';
|
||||
import styles from './Button.module.scss';
|
||||
|
||||
type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & ParentProps & {
|
||||
|
|
@ -24,7 +24,7 @@ function Button(props: ButtonProps) {
|
|||
|
||||
type ButtonToggleProps = ButtonProps & {
|
||||
checked?: Accessor<boolean>;
|
||||
onChecked?: (checked: boolean) => any;
|
||||
onChecked?: (checked: boolean) => void;
|
||||
};
|
||||
|
||||
Button.Toggle = (props: ButtonToggleProps) => {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import Button from './Button';
|
|||
import styles from './Dropdown.module.scss';
|
||||
|
||||
export type DropdownProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChange'> & {
|
||||
onChange?: (selected: number) => any;
|
||||
onChange?: (selected: number) => void;
|
||||
text?: string;
|
||||
selected?: Accessor<number>;
|
||||
dropdownClass?: string;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ type SelectListContextHelpers = Signal<number | undefined>;
|
|||
const SelectListContext = createContext<SelectListContextHelpers>() as Context<SelectListContextHelpers>;
|
||||
|
||||
function SelectListContextProvider(props: ParentProps & {
|
||||
onChanged?: ((index: number | undefined) => any) | undefined;
|
||||
onChanged?: ((index: number | undefined) => void) | undefined;
|
||||
}) {
|
||||
const [selected, setSelected] = createSignal<number | undefined>();
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ function useSelectListContext() {
|
|||
}
|
||||
|
||||
export type SelectListProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'onChange'> & {
|
||||
onChange?: (index: number | undefined) => any;
|
||||
onChange?: (index: number | undefined) => void;
|
||||
};
|
||||
|
||||
function SelectList(props: SelectListProps) {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ type TextFieldProps = {
|
|||
iconLeft?: JSX.Element;
|
||||
iconRight?: JSX.Element;
|
||||
inputFilter?: (value: string) => boolean;
|
||||
onValidInput?: (value: string) => any;
|
||||
onValidSubmit?: (value: string) => any;
|
||||
onValidInput?: (value: string) => void;
|
||||
onValidSubmit?: (value: string) => void;
|
||||
labelClass?: string;
|
||||
} & JSX.InputHTMLAttributes<HTMLInputElement>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { ManagedPackage, Providers } from '@onelauncher/client/bindings';
|
||||
import ModrinthImage from '~assets/logos/modrinth.svg?component-solid';
|
||||
import { type Component, type JSX, Match, Show, splitProps, Switch } from 'solid-js';
|
||||
import type { ManagedPackage, Providers } from '@onelauncher/client/bindings';
|
||||
|
||||
export function getProviderLogoElement(provider: ManagedPackage | Providers): string | Component {
|
||||
const providerName = (typeof provider === 'string' ? provider : provider.provider)?.toLowerCase() as Lowercase<Providers>;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import type { Cluster, Loader } from '@onelauncher/client/bindings';
|
||||
import FabricImage from '~assets/logos/fabric.png';
|
||||
import ForgeImage from '~assets/logos/forge.png';
|
||||
import QuiltImage from '~assets/logos/quilt.png';
|
||||
import VanillaImage from '~assets/logos/vanilla.png';
|
||||
import { type JSX, splitProps } from 'solid-js';
|
||||
import type { Cluster, Loader } from '@onelauncher/client/bindings';
|
||||
|
||||
export function getLoaderLogoSrc(loader: Cluster | Loader): string {
|
||||
const loaderName = (typeof loader === 'string' ? loader : loader.meta.loader)?.toLowerCase() as Loader;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import steveSrc from '../../../assets/images/steve.png';
|
|||
|
||||
type PlayerHeadProps = JSX.IntrinsicElements['img'] & {
|
||||
uuid: string | null | undefined;
|
||||
onError?: () => any;
|
||||
onError?: () => void;
|
||||
};
|
||||
|
||||
function headSrc(uuid: string) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ ContextMenu.Seperator = function () {
|
|||
interface ContextMenuRowProps {
|
||||
icon: JSX.Element;
|
||||
text: string;
|
||||
onClick?: (e: MouseEvent) => any;
|
||||
onClick?: (e: MouseEvent) => void;
|
||||
}
|
||||
|
||||
ContextMenu.Row = function (props: ContextMenuRowProps) {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ enum ModalStage {
|
|||
}
|
||||
|
||||
interface AddAccountModalProps extends ModalProps {
|
||||
refetch: () => any;
|
||||
refetch: () => void;
|
||||
}
|
||||
|
||||
function AddAccountModal(p: AddAccountModalProps) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export enum CreationStage {
|
|||
}
|
||||
|
||||
type PartialCluster = Partial<CreateCluster>;
|
||||
type PartialClusterUpdateFunc = <K extends keyof PartialCluster>(key: K, value: PartialCluster[K]) => any;
|
||||
type PartialClusterUpdateFunc = <K extends keyof PartialCluster>(key: K, value: PartialCluster[K]) => void;
|
||||
|
||||
interface ClusterModalController {
|
||||
step: Accessor<CreationStage | undefined>;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ type VersionReleaseFilters = {
|
|||
[key in VersionType]: boolean;
|
||||
};
|
||||
|
||||
function VersionSelector(props: { setVersion: (version: string) => any }) {
|
||||
function VersionSelector(props: { setVersion: (version: string) => void }) {
|
||||
const [versions] = useCommand(() => bridge.commands.getMinecraftVersions());
|
||||
const [filteredVersions, setFilteredVersions] = createSignal<bridge.Version[]>([]);
|
||||
const [filters, setFilters] = createSignal<VersionReleaseFilters>({
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ function ClusterProviderSelection(props: ClusterStepProps) {
|
|||
interface ProviderCardProps {
|
||||
icon: JSX.Element;
|
||||
name: string;
|
||||
setSelected: () => any;
|
||||
setSelected: () => void;
|
||||
selected: boolean;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import type { ManagedPackage } from '@onelauncher/client/bindings';
|
||||
import { ChevronRightIcon } from '@untitled-theme/icons-solid';
|
||||
import OneConfigLogo from '~assets/logos/oneconfig.svg?component-solid';
|
||||
import Button from '~ui/components/base/Button';
|
||||
import SearchResultsContainer from '~ui/components/content/SearchResults';
|
||||
import useBrowser from '~ui/hooks/useBrowser';
|
||||
import { onMount, Show } from 'solid-js';
|
||||
import type { ManagedPackage } from '@onelauncher/client/bindings';
|
||||
import { BrowserContent } from './BrowserRoot';
|
||||
|
||||
function BrowserMain() {
|
||||
|
|
|
|||
|
|
@ -201,8 +201,8 @@ function ClusterOverview() {
|
|||
}
|
||||
|
||||
interface SaveModalProps extends ModalProps {
|
||||
save: () => any;
|
||||
dontSave: () => any;
|
||||
save: () => void;
|
||||
dontSave: () => void;
|
||||
}
|
||||
|
||||
function SaveModal(p: SaveModalProps) {
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ interface AccountRowProps {
|
|||
username: string;
|
||||
uuid: string;
|
||||
current?: boolean;
|
||||
onClick: (uuid: string) => any;
|
||||
onDelete: (uuid: string) => any;
|
||||
onClick: (uuid: string) => void;
|
||||
onDelete: (uuid: string) => void;
|
||||
};
|
||||
|
||||
function AccountRow(props: AccountRowProps) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ interface CreateSetting<T> {
|
|||
getRaw: () => T;
|
||||
set: Setter<T>;
|
||||
isGlobal: Accessor<boolean | null>;
|
||||
resetToFallback: (raw?: any) => void;
|
||||
resetToFallback: (raw?: T) => void;
|
||||
};
|
||||
|
||||
export function createSetting<T>(initial: T | undefined | null, fallback?: T): CreateSetting<T> {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import type { Cluster, ImportType, License, Loader, PackageType, Providers, VersionType } from '@onelauncher/client/bindings';
|
||||
import { DurationFormat } from '@formatjs/intl-durationformat';
|
||||
import { open } from '@tauri-apps/plugin-shell';
|
||||
import type { Cluster, ImportType, License, Loader, PackageType, Providers, VersionType } from '@onelauncher/client/bindings';
|
||||
|
||||
export function setAsyncTimeout(ms: number): Promise<void>;
|
||||
export function setAsyncTimeout(callback: () => any, ms: number): Promise<void>;
|
||||
export function setAsyncTimeout(callback: () => void, ms: number): Promise<void>;
|
||||
|
||||
export function setAsyncTimeout(
|
||||
callback: (() => any) | number,
|
||||
callback: (() => void) | number,
|
||||
ms?: number,
|
||||
): Promise<void> {
|
||||
const _ms = typeof callback === 'number' ? callback : ms;
|
||||
|
|
|
|||
|
|
@ -1,17 +1,4 @@
|
|||
import type { PROGRAM_INFO } from '../bindings';
|
||||
|
||||
export type ProgramInfo = typeof PROGRAM_INFO;
|
||||
|
||||
export type WithIndex<T> = T & { index: number };
|
||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
|
||||
type GrowToSize<T, N extends number, A extends T[]> = A['length'] extends N ? A : GrowToSize<T, N, [...A, T]>;
|
||||
export type FixedArray<T, N extends number> = GrowToSize<T, N, []>;
|
||||
|
||||
// Get size of enum as a type - https://stackoverflow.com/a/68317984/23592613
|
||||
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
type UnionToOvlds<U> = UnionToIntersection<U extends any ? (f: U) => void : never>;
|
||||
type PopUnion<U> = UnionToOvlds<U> extends (a: infer A) => void ? A : never;
|
||||
|
||||
export type IsUnion<T> = [T] extends [UnionToIntersection<T>] ? false : true;
|
||||
export type UnionToArray<T, A extends unknown[] = []> = IsUnion<T> extends true ? UnionToArray<Exclude<T, PopUnion<T>>, [PopUnion<T>, ...A]> : [T, ...A];
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ interface CreateSortable<T, S extends Sortables<T> = Sortables<T>> {
|
|||
list: Accessor<T[]>;
|
||||
key: Accessor<keyof S>;
|
||||
setList: Setter<T[]>;
|
||||
setKey: (val: keyof S | number) => any;
|
||||
setKey: (val: keyof S | number) => void;
|
||||
sortables: S;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ impl Providers {
|
|||
}
|
||||
|
||||
if let Some(package_types) = package_types {
|
||||
if package_types.contains(&PackageType::Mod) || package_types.contains(&PackageType::ModPack) {
|
||||
if package_types.contains(&PackageType::Mod)
|
||||
|| package_types.contains(&PackageType::ModPack)
|
||||
{
|
||||
if let Some(loaders) = loaders {
|
||||
for loader in loaders {
|
||||
builder.and(Facet(
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ pub fn set_window_styling(
|
|||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
if custom {
|
||||
win.set_title_bar_style(tauri_utils::TitleBarStyle::Overlay)?;
|
||||
win.set_title_bar_style(tauri::TitleBarStyle::Overlay)?;
|
||||
} else {
|
||||
win.set_title_bar_style(tauri_utils::TitleBarStyle::Visible)?;
|
||||
win.set_title_bar_style(tauri::TitleBarStyle::Visible)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ try {
|
|||
await execa(pathe.join(env.__dirname, 'fix-deb.sh'), [], { cwd: env.__dirname });
|
||||
}
|
||||
}
|
||||
catch (error: any) {
|
||||
catch (error) {
|
||||
consola.error(`tauri ${args[0]} failed with exit code ${typeof error === 'number' ? error : 1}`);
|
||||
consola.warn(`to fix some errors, run ${process.platform === 'win32' ? './packages/scripts/setup.ps1' : './packages/scripts/setup.sh'}`);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue