diff --git a/apps/onelauncher/desktop/src/api/commands.rs b/apps/onelauncher/desktop/src/api/commands.rs index 4057c433..b0e39fa3 100644 --- a/apps/onelauncher/desktop/src/api/commands.rs +++ b/apps/onelauncher/desktop/src/api/commands.rs @@ -19,6 +19,7 @@ macro_rules! collect_commands { cluster::create_cluster, cluster::get_clusters, + cluster::get_cluster_by_id, settings::get_global_profile, diff --git a/apps/onelauncher/desktop/src/api/commands/cluster.rs b/apps/onelauncher/desktop/src/api/commands/cluster.rs index 0f3c80bd..a7b6c03f 100644 --- a/apps/onelauncher/desktop/src/api/commands/cluster.rs +++ b/apps/onelauncher/desktop/src/api/commands/cluster.rs @@ -216,7 +216,9 @@ // Ok(()) // } -use onelauncher_core::{api::cluster, entity::{clusters::Model, icon::Icon, loader::GameLoader}}; +use std::ops::Deref; + +use onelauncher_core::{api::cluster, entity::{clusters::Model, icon::Icon, loader::GameLoader}, error::LauncherResult}; use serde::{Deserialize, Serialize}; use specta::Type; use crate::api::error::SerializableResult; @@ -235,6 +237,8 @@ pub struct CreateCluster { pub async fn create_cluster(options: CreateCluster) -> SerializableResult { let thing = cluster::create_cluster(&options.name, &options.mc_version, options.mc_loader, options.mc_loader_version.as_deref(), options.icon_url).await?; + cluster::prepare_cluster(&mut thing.clone(), Some(false)); + Ok(thing) } @@ -242,4 +246,10 @@ pub async fn create_cluster(options: CreateCluster) -> SerializableResult #[tauri::command] pub async fn get_clusters() -> SerializableResult> { Ok(cluster::dao::get_all_clusters().await?) +} + +#[specta::specta] +#[tauri::command] +pub async fn get_cluster_by_id(id: i64) -> SerializableResult> { + Ok(cluster::dao::get_cluster_by_id(id).await?) } \ No newline at end of file diff --git a/apps/onelauncher/frontend/index.html b/apps/onelauncher/frontend/index.html index d7a70b74..a91f8b3a 100644 --- a/apps/onelauncher/frontend/index.html +++ b/apps/onelauncher/frontend/index.html @@ -11,7 +11,7 @@ /> - OneClient + OneLauncher
diff --git a/apps/onelauncher/frontend/src/components/ScrollableContainer.tsx b/apps/onelauncher/frontend/src/components/ScrollableContainer.tsx index 03080156..1354c32c 100644 --- a/apps/onelauncher/frontend/src/components/ScrollableContainer.tsx +++ b/apps/onelauncher/frontend/src/components/ScrollableContainer.tsx @@ -16,4 +16,4 @@ function ScrollableContainer(props: ScrollableContainerProps) { ); } -export default ScrollableContainer; +export default ScrollableContainer; \ No newline at end of file diff --git a/apps/onelauncher/frontend/src/main.tsx b/apps/onelauncher/frontend/src/main.tsx index d9fbfc59..6684973d 100644 --- a/apps/onelauncher/frontend/src/main.tsx +++ b/apps/onelauncher/frontend/src/main.tsx @@ -8,6 +8,7 @@ import { routeTree } from './routeTree.gen'; import './fonts'; import './utils/nativeExperience'; import './utils/devExperience'; +import 'overlayscrollbars/overlayscrollbars.css'; import './styles/global.css'; export * as bindings from './bindings.gen'; diff --git a/apps/onelauncher/frontend/src/routes/__root.tsx b/apps/onelauncher/frontend/src/routes/__root.tsx index 28af9009..47d6806a 100644 --- a/apps/onelauncher/frontend/src/routes/__root.tsx +++ b/apps/onelauncher/frontend/src/routes/__root.tsx @@ -29,13 +29,13 @@ function RootRoute() { navigate={(to, options) => router.navigate({ to, ...options })} useHref={to => router.buildLocation({ to }).href} > -
+
-
+ ); diff --git a/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx b/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx new file mode 100644 index 00000000..a1fc23e4 --- /dev/null +++ b/apps/onelauncher/frontend/src/routes/app/cluster/index.tsx @@ -0,0 +1,23 @@ +import useCommand from '@/hooks/useCommand' +import { bindings } from '@/main' +import { createFileRoute } from '@tanstack/react-router' +import Sidebar from '../settings/route' + +export const Route = createFileRoute('/app/cluster/')({ + component: RouteComponent +}) + +function RouteComponent() { + const { id } = Route.useSearch() + + // dumbass fix ik + const cluster = useCommand("getClusterById", () => bindings.commands.getClusterById(Number(id.toString()) as unknown as bigint)) + + return ( + +
+
{JSON.stringify(cluster, null, 2)}
+
+
+ ) +} diff --git a/apps/onelauncher/frontend/src/routes/app/cluster/route.tsx b/apps/onelauncher/frontend/src/routes/app/cluster/route.tsx new file mode 100644 index 00000000..3908ae5f --- /dev/null +++ b/apps/onelauncher/frontend/src/routes/app/cluster/route.tsx @@ -0,0 +1,43 @@ +import { createFileRoute, Outlet } from '@tanstack/react-router' +import Sidebar from '../settings/route' +import { EyeIcon, File06Icon, Globe04Icon, Image03Icon, PackagePlusIcon, Settings04Icon } from '@untitled-theme/icons-react' + +type ClusterSearch = { + id: bigint +} + +export const Route = createFileRoute('/app/cluster')({ + component: RouteComponent, + validateSearch: (search: Record): ClusterSearch => { + return { + id: BigInt(search.id as string), + } + }, +}) + +function RouteComponent() { + return ( +
+
+ , 'Overview', '/'], + [, 'Mods', '/mods'], + [, 'Screenshots', '/screenshots'], + [, 'Worlds', '/worlds'], + [, 'Logs', '/logs'], + [, 'Game Settings', '/settings'], + ], + }} + /> + {/* */} +
+ +
+ +
+
+ ) +} diff --git a/apps/onelauncher/frontend/src/routes/app/index.tsx b/apps/onelauncher/frontend/src/routes/app/index.tsx index e033708f..474d0140 100644 --- a/apps/onelauncher/frontend/src/routes/app/index.tsx +++ b/apps/onelauncher/frontend/src/routes/app/index.tsx @@ -4,7 +4,7 @@ import Button from '@/components/base/Button'; import useCommand from '@/hooks/useCommand'; import { bindings } from '@/main'; import { useIsFetching, useQueryClient } from '@tanstack/react-query'; -import { createFileRoute, useNavigate } from '@tanstack/react-router'; +import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'; import DefaultInstancePhoto from "@/assets/images/default_instance_cover.jpg" @@ -176,33 +176,37 @@ function ClusterGroup(props: ClusterGroupProps) { function ClusterCard(props: Model) { return ( -
-
-
- + +
+
+
+ +
-
-
-
-

{props.name}

-

- {props.mc_loader} - {' '} - {props.mc_version} - {/* {' '} +

+
+

{props.name}

+

+ {props.mc_loader} + {' '} + {props.mc_version} + {/* {' '} {props.packages.mods && `• ${props.mods} mods`} */} -

-
+

+
- {/* */} + {/* */} +
-
+ ); } \ No newline at end of file diff --git a/apps/onelauncher/frontend/src/routes/app/route.tsx b/apps/onelauncher/frontend/src/routes/app/route.tsx index 40775b9b..615af06d 100644 --- a/apps/onelauncher/frontend/src/routes/app/route.tsx +++ b/apps/onelauncher/frontend/src/routes/app/route.tsx @@ -9,33 +9,33 @@ export const Route = createFileRoute('/app')({ function RouteComponent() { return ( -
+ <>
-
-
- -
+
+ +
- + -
-
-
+
+
-
+ ); } diff --git a/apps/onelauncher/frontend/src/routes/app/settings/index.tsx b/apps/onelauncher/frontend/src/routes/app/settings/index.tsx index 022fc241..5710f8e3 100644 --- a/apps/onelauncher/frontend/src/routes/app/settings/index.tsx +++ b/apps/onelauncher/frontend/src/routes/app/settings/index.tsx @@ -16,7 +16,7 @@ function RouteComponent() { return ( -
+

General Settings

-
+

Minecraft Settings

Game diff --git a/apps/onelauncher/frontend/src/routes/app/settings/route.tsx b/apps/onelauncher/frontend/src/routes/app/settings/route.tsx index f54dac05..7a715179 100644 --- a/apps/onelauncher/frontend/src/routes/app/settings/route.tsx +++ b/apps/onelauncher/frontend/src/routes/app/settings/route.tsx @@ -75,11 +75,11 @@ function Sidebar(props: SidebarProps) { return (
{Object.keys(props.links).map((section, i) => ( -
-
+
+

{section.toUpperCase()}

- {props.links[section].map((link) => { + {props.links[section].map((link, i) => { if (!link) return; @@ -88,6 +88,7 @@ function Sidebar(props: SidebarProps) { className={ `px-3 py-1 rounded-md text-md border border-component-bg hover:bg-component-bg-hover active:bg-component-bg-pressed ${isActive(link[2], link[3]) ? 'bg-component-bg border-border/05' : 'border-transparent'}` } + key={i} onClick={() => goto(link[2], link[3])} > @@ -113,7 +114,7 @@ interface SidebarPageProps { Sidebar.Page = function (props: SidebarPageProps) { return ( -
+
{props.children}
); diff --git a/apps/onelauncher/frontend/src/styles/global.css b/apps/onelauncher/frontend/src/styles/global.css index edf42600..c6e975e6 100644 --- a/apps/onelauncher/frontend/src/styles/global.css +++ b/apps/onelauncher/frontend/src/styles/global.css @@ -60,6 +60,10 @@ --color-ghost-overlay: rgba(255, 255, 255, 0.05); --color-ghost-overlay-hover: rgba(255, 255, 255, 0.10); + --color-scrollbar-bg: rgba(255, 255, 255, 0.05); + --color-scrollbar-bg-hover: rgba(255, 255, 255, 0.10); + --color-scrollbar-bg-pressed: rgba(255, 255, 255, 0.15); + /* other */ --font-sans: "Poppins", sans-serif; --text-xs: 0.688rem; @@ -83,3 +87,21 @@ body { @apply bg-page text-fg-primary text-base; } +.os-scrollbar { + --os-size: 10px; + --os-track-border-radius: var(--border-radius-lg); + --os-handle-bg: var(--color-scrollbar-bg); + --os-handle-bg-hover: var(--color-scrollbar-bg-hover); + --os-handle-bg-active: var(--color-scrollbar-bg-pressed); + --os-handle-perpendicular-size-hover: 140%; + --os-handle-perpendicular-size-active: 140%; + --os-handle-interactive-area-offset: 4px; +} + +.os-scrollbar-offset-right { + --os-padding-axis: 10; +} + +.os-hide-horizontal-scrollbar > .os-scrollbar-horizontal { + display: none; +}