Skip to content

Commit

Permalink
chore: Merge main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
LynithDev committed Aug 14, 2024
2 parents 6808c97 + d8cfb11 commit 7185361
Show file tree
Hide file tree
Showing 49 changed files with 892 additions and 1,104 deletions.
129 changes: 103 additions & 26 deletions .vscode/settings.json

Large diffs are not rendered by default.

220 changes: 98 additions & 122 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ rand = { version = "0.8.5" }
byteorder = { version = "1.5.0" }
base64 = { version = "0.22" }
p256 = { version = "0.13.2", features = [ "ecdsa" ] }

uuid = { version = "1.8", features = [
"serde",
"v4"
Expand Down Expand Up @@ -164,10 +163,9 @@ tokio = { version = "1.38", features = [ "full" ] }
tokio-stream = { version = "0.1.15", features = [ "fs" ] }
notify = { version = "6.1", default-features = false }
notify-debouncer-mini = { version = "0.4", default-features = false }

tempfile = { version = "3.10" }
dunce = { version = "1.0.4" }
zip = { version = "0.6" }
zip = { version = "2.1.6" }
dirs = { version = "5.0" }
async_zip = { version = "0.0.17", features = [ "full" ] }
async-compression = { version = "0.4.12", features = [
Expand Down
4 changes: 1 addition & 3 deletions apps/desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ tauri-build = { workspace = true, features = [ "isolation" ] }
[dependencies]
onelauncher = { workspace = true, features = [ "tauri" ] }
onelauncher_macros = { workspace = true }

tauri-plugin-shell = { workspace = true }
tauri-plugin-window-state = { workspace = true }
tauri-plugin-single-instance = { workspace = true }
tauri-plugin-updater = { workspace = true }
tauri-plugin-clipboard-manager = { workspace = true }
tauri-plugin-dialog = { workspace = true }

tauri-specta = { workspace = true }
specta = { workspace = true }
specta-typescript = { workspace = true }
Expand All @@ -48,7 +46,6 @@ thiserror = { workspace = true }
anyhow = { workspace = true }
chrono = { workspace = true }
uuid = { workspace = true }

tracing = { workspace = true }
tracing-error = { workspace = true }

Expand All @@ -69,6 +66,7 @@ features = [ "test" ]

[target.'cfg(target_os = "macos")'.dependencies]
cocoa.workspace = true

objc.workspace = true

[target.'cfg(target_os = "linux")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"@onelauncher/frontend": "workspace:*"
},
"devDependencies": {
"@tauri-apps/cli": "2.0.0-rc.0"
"@tauri-apps/cli": "2.0.0-rc.3"
}
}
7 changes: 3 additions & 4 deletions apps/desktop/src/api/commands/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ pub async fn get_screenshots(uuid: Uuid) -> Result<Vec<String>, String> {
.await?
.ok_or("cluster not found")?;

let screenshots = cluster::content::screenshots::get_screenshots(&cluster.cluster_path())
.await?;
let screenshots =
cluster::content::screenshots::get_screenshots(&cluster.cluster_path()).await?;

Ok(screenshots)
}
Expand All @@ -207,8 +207,7 @@ pub async fn get_worlds(uuid: Uuid) -> Result<Vec<String>, String> {
.await?
.ok_or("cluster not found")?;

let screenshots = cluster::content::worlds::get_worlds(&cluster.cluster_path())
.await?;
let screenshots = cluster::content::worlds::get_worlds(&cluster.cluster_path()).await?;

Ok(screenshots)
}
22 changes: 14 additions & 8 deletions apps/desktop/src/api/commands/users.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use onelauncher::{data::MinecraftCredentials, store::MinecraftLogin};
use onelauncher::data::MinecraftCredentials;
use onelauncher::minecraft;
use onelauncher::store::MinecraftLogin;
use tauri::{AppHandle, Manager};
use uuid::Uuid;

Expand All @@ -23,7 +24,9 @@ pub async fn remove_user(uuid: Uuid) -> Result<(), String> {

#[specta::specta]
#[tauri::command]
pub async fn get_default_user(fallback: Option<bool>) -> Result<Option<MinecraftCredentials>, String> {
pub async fn get_default_user(
fallback: Option<bool>,
) -> Result<Option<MinecraftCredentials>, String> {
let uuid = minecraft::get_default_user().await?;

if let Some(fallback) = fallback {
Expand Down Expand Up @@ -54,7 +57,10 @@ pub async fn auth_login(handle: AppHandle) -> Result<Option<MinecraftCredentials
Ok(result)
}

async fn spawn_webview(handle: AppHandle, flow: MinecraftLogin) -> Result<Option<MinecraftCredentials>, String> {
async fn spawn_webview(
handle: AppHandle,
flow: MinecraftLogin,
) -> Result<Option<MinecraftCredentials>, String> {
let now = chrono::Utc::now();

if let Some(win) = handle.get_webview_window("login") {
Expand All @@ -71,11 +77,11 @@ async fn spawn_webview(handle: AppHandle, flow: MinecraftLogin) -> Result<Option
.map_err(|err| err.to_string())?,
),
)
.title("Log into OneLauncher")
.always_on_top(true)
.center()
.build()
.map_err(|err| err.to_string())?;
.title("Log into OneLauncher")
.always_on_top(true)
.center()
.build()
.map_err(|err| err.to_string())?;

win.request_user_attention(Some(tauri::UserAttentionType::Critical))
.map_err(|err| err.to_string())?;
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@
"overlayscrollbars": "^2.10.0",
"overlayscrollbars-solid": "^0.5.5",
"pathe": "^1.1.2",
"solid-js": "^1.8.19",
"solid-js": "^1.8.20",
"solid-transition-group": "^0.2.3",
"uuid": "^10.0.0"
},
"devDependencies": {
"@solidjs/testing-library": "^0.8.9",
"@tauri-apps/cli": "2.0.0-rc.0",
"@tauri-apps/cli": "2.0.0-rc.3",
"@testing-library/jest-dom": "^6.4.8",
"@types/uuid": "^10.0.0",
"jsdom": "^24.1.1",
"sass": "^1.77.8",
"unocss": "^0.61.9",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid-svg": "^0.8.1",
"vite-tsconfig-paths": "^4.3.2"
"vite-tsconfig-paths": "^5.0.1"
}
}
6 changes: 3 additions & 3 deletions apps/frontend/src/ui/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ function App(props: ParentProps) {

return (
<GlobalContexts>
<main class="flex flex-col bg-primary w-full min-h-screen overflow-hidden h-screen max-h-screen text-fg-primary">
<main class="h-screen max-h-screen min-h-screen w-full flex flex-col overflow-hidden bg-primary text-fg-primary">
<WindowFrame />
<div class="flex flex-col px-8">
<Navbar />
</div>

<div class="relative h-full w-full overflow-hidden">
<div class="absolute top-0 left-0 flex flex-col h-full w-full overflow-x-hidden">
<div class="absolute left-0 top-0 h-full w-full flex flex-col overflow-x-hidden">
<ErrorBoundary>
<OverlayScrollbarsComponent class="os-hide-horizontal-scrollbar absolute top-0 left-0 flex flex-col h-full w-full overflow-x-hidden overflow-y-auto px-8 pb-8">
<OverlayScrollbarsComponent class="os-hide-horizontal-scrollbar absolute left-0 top-0 h-full w-full flex flex-col overflow-x-hidden overflow-y-auto px-8 pb-8">
<AnimatedRoutes>
{props.children}
</AnimatedRoutes>
Expand Down
12 changes: 6 additions & 6 deletions apps/frontend/src/ui/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function NavbarLink(props: NavbarLinkProps) {
return (
<A
href={props.path}
class="text-lg px-4 py-2 hover:bg-component-bg-hover rounded-lg hover:text-fg-primary-hover"
class="rounded-lg px-4 py-2 text-lg hover:bg-component-bg-hover hover:text-fg-primary-hover"
inactiveClass="text-fg-secondary"
activeClass="text-fg-primary"
end
Expand All @@ -41,9 +41,9 @@ function Navbar() {
let notificationButton!: HTMLButtonElement;

return (
<div class="flex flex-row *:flex-1 items-center min-h-[60px] h-15">
<div class="h-15 min-h-[60px] flex flex-row items-center *:flex-1">
<div>
<div onClick={() => open(WEBSITE)} class="flex items-center justify-center active:scale-90 transition-transform w-min">
<div onClick={() => open(WEBSITE)} class="w-min flex items-center justify-center transition-transform active:scale-90">
<PolyfrostFull />
</div>
</div>
Expand All @@ -52,7 +52,7 @@ function Navbar() {
<NavbarLink path="/browser" label="Browser" />
<NavbarLink path="/updates" label="Updates" />
</div>
<div class="flex flex-row justify-end items-center gap-x-2 relative">
<div class="relative flex flex-row items-center justify-end gap-x-2">
<Button buttonStyle="icon">
<TerminalBrowserIcon />
</Button>
Expand All @@ -65,7 +65,7 @@ function Navbar() {
<Button
buttonStyle="icon"
ref={notificationButton}
class="[&>div]:absolute relative"
class="relative [&>div]:absolute"
onClick={() => setNotificationMenuOpen(!notificationMenuOpen())}
>
<Bell01Icon />
Expand All @@ -82,7 +82,7 @@ function Navbar() {
onClick={() => setProfileMenuOpen(!profileMenuOpen())}
class="hover:opacity-70"
>
<PlayerHead class="min-w-8 min-h-8 w-8 h-8 max-w-8 max-h-8 rounded-md" uuid={controller.defaultAccount()?.id} />
<PlayerHead class="h-8 max-h-8 max-w-8 min-h-8 min-w-8 w-8 rounded-md" uuid={controller.defaultAccount()?.id} />
</button>
</div>

Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/ui/components/ScrollableContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { ParentProps } from 'solid-js';

function ScrollableContainer(props: ParentProps) {
return (
<div class="flex flex-col flex-1 overflow-hidden w-[calc(100%+14px)]">
<div class="w-[calc(100%+14px)] flex flex-1 flex-col overflow-hidden">
<OverlayScrollbarsComponent class="os-hide-horizontal-scrollbar relative flex-1">
<div class="flex flex-col absolute w-[calc(100%-14px)] h-full gap-1">
<div class="absolute h-full w-[calc(100%-14px)] flex flex-col gap-1">
{props.children}
</div>
</OverlayScrollbarsComponent>
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/ui/components/SettingsRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ export type SettingsRowProps = ParentProps & {
function SettingsRow(props: SettingsRowProps) {
return (
<div
class="flex flex-row bg-component-bg rounded-xl gap-3.5 p-4 items-center"
class="flex flex-row items-center gap-3.5 rounded-xl bg-component-bg p-4"
classList={{
'bg-component-bg-disabled': props.disabled,
'text-fg-primary-disabled': props.disabled,
}}
>
<div class="flex justify-center items-center h-8 w-8">
<div class="h-8 w-8 flex items-center justify-center">
{props.icon}
</div>

<div class="flex flex-col gap-2 flex-1">
<div class="flex flex-1 flex-col gap-2">
<h3 class="text-lg">{props.title}</h3>
<p class="text-wrap text-sm">{props.description}</p>
</div>

<div class="flex h-9 flex-row justify-center items-center gap-2">
<div class="h-9 flex flex-row items-center justify-center gap-2">
{props.children}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/ui/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ function Sidebar(props: SidebarProps) {
}

return (
<div class="flex flex-col w-52">
<div class="w-52 flex flex-col">
<For each={Object.keys(props.links)}>
{section => (
<div class="flex flex-col gap-y-2">
<div>
<h3 class="text-fg-secondary text-xs font-medium m-1.5 mt-5">{section.toUpperCase()}</h3>
<h3 class="m-1.5 mt-5 text-xs text-fg-secondary font-medium">{section.toUpperCase()}</h3>
<div class="flex flex-col gap-y-1 fill-fg-primary text-fg-primary font-medium">
<For each={props.links[section]}>
{(link) => {
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/ui/components/WindowFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ interface TitlebarButtonProps {

function TitlebarButton(props: TitlebarButtonProps) {
return (
<button class="flex items-center justify-center w-8 h-8 group" onClick={e => props.onClick(e)}>
<div class="rounded-lg group-hover:bg-primary p-1">
<button class="group h-8 w-8 flex items-center justify-center" onClick={e => props.onClick(e)}>
<div class="rounded-lg p-1 group-hover:bg-primary">
<props.icon class={`w-[18px] h-[18px] stroke-slate ${props.danger ? 'group-hover:stroke-danger' : 'group-hover:stroke-white'}`} />
</div>
</button>
Expand Down Expand Up @@ -51,7 +51,7 @@ function WindowFrame() {
});

return (
<div data-tauri-drag-region class="z-[99999] flex flex-row justify-between items-center w-screen h-8 bg-secondary gap-0.5 pr-0.5">
<div data-tauri-drag-region class="z-[99999] h-8 w-screen flex flex-row items-center justify-between gap-0.5 bg-secondary pr-0.5">
<div class="flex flex-row items-center">
<TitlebarButton icon={ChevronLeftIcon} onClick={() => history.back()} />
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/ui/components/base/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Dropdown(props: DropdownProps) {
iconRight={<ChevronDownIcon />}
>
<div
class="flex-1 flex flex-row items-center text-nowrap gap-1 h-full overflow-hidden"
class="h-full flex flex-1 flex-row items-center gap-1 overflow-hidden text-nowrap"
>
<span>{split.text}</span>
{items()[selected()]}
Expand Down Expand Up @@ -79,7 +79,7 @@ function Dropdown(props: DropdownProps) {
<Index each={items()}>
{(item, index) => (
<div onClick={() => select(index)}>
<div class="hover:bg-gray-05 p-2 rounded-lg flex flex-row gap-2 justify-between items-center">
<div class="flex flex-row items-center justify-between gap-2 rounded-lg p-2 hover:bg-gray-05">
{item()}
<div class={styles.selected! + (selected() === index ? ` ${styles.visible}` : '')} />
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/ui/components/content/FormattedLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ function FormattedLog(props: FormattedLogProps) {
const lines = createMemo(() => props.log.split('\n'));

return (
<div class="bg-component-bg flex flex-1 h-full font-mono font-medium overflow-auto p-2 rounded-md mt-2">
<OverlayScrollbarsComponent class="flex-1 h-full relative">
<div class="mt-2 h-full flex flex-1 overflow-auto rounded-md bg-component-bg p-2 font-medium font-mono">
<OverlayScrollbarsComponent class="relative h-full flex-1">
<code class={styles.log}>
<For each={lines()}>
{line => <Line line={line} />}
Expand Down
20 changes: 10 additions & 10 deletions apps/frontend/src/ui/components/content/ModCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ function ModCard(props: ManagedPackage) {
}

return (
<div onClick={redirect} class="flex flex-col overflow-hidden rounded-lg bg-component-bg max-w-53 min-w-53 w-full max-h-68 min-h-68 h-full">
<div class="relative h-28 overflow-hidden flex justify-center items-center">
<img class="absolute filter-blur-xl z-0 max-w-none w-7/6" src={props.icon_url || ''} alt={`Icon for ${props.title}`} />
<img class="relative w-2/5 aspect-ratio-square z-1 rounded-md image-render-auto" src={props.icon_url || ''} alt={`Icon for ${props.title}`} />
<div onClick={redirect} class="h-full max-h-68 max-w-53 min-h-68 min-w-53 w-full flex flex-col overflow-hidden rounded-lg bg-component-bg">
<div class="relative h-28 flex items-center justify-center overflow-hidden">
<img class="absolute z-0 max-w-none w-7/6 filter-blur-xl" src={props.icon_url || ''} alt={`Icon for ${props.title}`} />
<img class="relative z-1 aspect-ratio-square w-2/5 rounded-md image-render-auto" src={props.icon_url || ''} alt={`Icon for ${props.title}`} />
</div>
<div class="flex flex-col flex-1 p-3 gap-4">
<div class="flex flex-1 flex-col gap-4 p-3">
<div class="flex flex-col gap-2">
<h5 class="font-medium text-fg-primary">{props.title}</h5>
<p class="text-fg-secondary text-xs">
<h5 class="text-fg-primary font-medium">{props.title}</h5>
<p class="text-xs text-fg-secondary">
By
{' '}
<span class="text-fg-primary">Author TODO</span>
Expand All @@ -42,16 +42,16 @@ function ModCard(props: ManagedPackage) {
</p>
</div>

<p class="text-fg-secondary text-sm flex-1 max-h-13 overflow-hidden line-height-snug">{props.description}</p>
<p class="max-h-13 flex-1 overflow-hidden text-sm text-fg-secondary line-height-snug">{props.description}</p>

<div class="flex flex-row gap-4 text-xs">
<div class="flex flex-row items-center gap-2">
<Download01Icon class="w-4 h-4" />
<Download01Icon class="h-4 w-4" />
{abbreviateNumber(props.downloads)}
</div>

<div class="flex flex-row items-center gap-2">
<HeartIcon class="w-4 h-4" />
<HeartIcon class="h-4 w-4" />
{abbreviateNumber(props.followers)}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/ui/components/overlay/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function ContextMenu(props: ContextMenuProps) {
visible={props.visible}
setVisible={props.setVisible}
>
<div ref={setRef} class="bg-secondary rounded-xl border border-gray-05 p-1 shadow-md shadow-black/30">
<div ref={setRef} class="border border-gray-05 rounded-xl bg-secondary p-1 shadow-black/30 shadow-md">
<div class="flex flex-col gap-y-1 text-fg-primary">
{props.children}
</div>
Expand All @@ -46,7 +46,7 @@ function ContextMenu(props: ContextMenuProps) {
}

ContextMenu.Seperator = function () {
return <div class="border-b mx-1 border-gray-05" />;
return <div class="mx-1 border-b border-gray-05" />;
};

interface ContextMenuRowProps {
Expand All @@ -59,7 +59,7 @@ ContextMenu.Row = function (props: ContextMenuRowProps) {
return (
<div
onClick={e => props.onClick?.(e)}
class="flex items-center gap-x-2 m-px px-1.5 py-0.5 rounded-lg hover:bg-gray-05 active:bg-gray-10 [&>svg]:w-[18px]"
class="m-px flex items-center gap-x-2 rounded-lg px-1.5 py-0.5 [&>svg]:w-[18px] active:bg-gray-10 hover:bg-gray-05"
>
{props.icon}
{props.text}
Expand Down
Loading

0 comments on commit 7185361

Please sign in to comment.