From ed0da9604077b4976d826ab5661500b7eb39de32 Mon Sep 17 00:00:00 2001 From: emirsassan Date: Sat, 14 Jun 2025 12:32:55 +0300 Subject: [PATCH 01/32] something i dont know --- .../frontend/src/routes/app/index.tsx | 45 ------------------- packages/core/src/api/tauri/commands.rs | 4 -- packages/web_common/package.json | 3 ++ packages/web_common/vite.config.ts | 8 ++-- 4 files changed, 7 insertions(+), 53 deletions(-) diff --git a/apps/onelauncher/frontend/src/routes/app/index.tsx b/apps/onelauncher/frontend/src/routes/app/index.tsx index 21c9528b..292a5cd4 100644 --- a/apps/onelauncher/frontend/src/routes/app/index.tsx +++ b/apps/onelauncher/frontend/src/routes/app/index.tsx @@ -2,7 +2,6 @@ import type { Model } from '@/bindings.gen'; import DefaultBanner from '@/assets/images/default_banner.png'; import DefaultInstancePhoto from '@/assets/images/default_instance_cover.jpg'; import { NewClusterCreate } from '@/components/launcher/cluster/ClusterCreation'; -import { NewClusterCreate } from '@/components/launcher/cluster/ClusterCreation'; import Modal from '@/components/overlay/Modal'; import useRecentCluster from '@/hooks/useCluster'; import { bindings } from '@/main'; @@ -11,7 +10,6 @@ import { useCommand } from '@onelauncher/common'; import { Button, Show, TextField } from '@onelauncher/common/components'; import { createFileRoute, Link } from '@tanstack/react-router'; import { PlayIcon, Server01Icon } from '@untitled-theme/icons-react'; -import { PlayIcon, Server01Icon } from '@untitled-theme/icons-react'; import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'; export const Route = createFileRoute('/app/')({ @@ -165,18 +163,6 @@ function ClusterCard({ console.error(launch.error.message); }; - const launch = useCommand('launchCluster', () => bindings.core.launchCluster(id, null), { - enabled: false, - subscribed: false, - }); - - const handleLaunch = () => { - launch.refetch(); - - if (launch.error) - console.error(launch.error.message); - }; - return ( <> - -
-
-
- -
-
-
-
-

{name}

-

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

-

diff --git a/packages/core/src/api/tauri/commands.rs b/packages/core/src/api/tauri/commands.rs index e7444efe..24c3a1fa 100644 --- a/packages/core/src/api/tauri/commands.rs +++ b/packages/core/src/api/tauri/commands.rs @@ -122,10 +122,6 @@ impl TauriLauncherApi for TauriLauncherApiImpl { async fn update_cluster_by_id(id: ClusterId, request: clusters::ActiveModel) -> LauncherResult<()> { let updated_cluster = api::cluster::dao::update_cluster_by_id(id, |mut active_model| async move { - if let Some(name) = request.name { - active_model.name = Set(name); - } - active_model.updated_at = Set(chrono::Utc::now().naive_utc()); Ok(active_model) diff --git a/packages/web_common/package.json b/packages/web_common/package.json index 52c8abd4..b263ae17 100644 --- a/packages/web_common/package.json +++ b/packages/web_common/package.json @@ -41,5 +41,8 @@ "vite": "^6.1.0", "vite-plugin-dts": "^4.5.4", "vite-plugin-static-copy": "^3.0.0" + }, + "dependencies": { + "@untitled-theme/icons-react": "^0.14.0" } } diff --git a/packages/web_common/vite.config.ts b/packages/web_common/vite.config.ts index 926b3f73..e4826260 100644 --- a/packages/web_common/vite.config.ts +++ b/packages/web_common/vite.config.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import tailwindcss from '@tailwindcss/vite'; import react from '@vitejs/plugin-react'; -import { defineConfig } from 'vite'; +import { defineConfig, normalizePath } from 'vite'; import dts from 'vite-plugin-dts'; import { viteStaticCopy } from 'vite-plugin-static-copy'; @@ -12,7 +12,7 @@ export default defineConfig({ viteStaticCopy({ targets: [ { - src: path.resolve(__dirname, 'src/theme.css'), + src: normalizePath(path.resolve(__dirname, 'src/theme.css')), dest: './', }, ], @@ -25,8 +25,8 @@ export default defineConfig({ minify: false, lib: { entry: { - 'index': path.resolve(__dirname, 'src/index.ts'), - 'components': path.resolve(__dirname, 'src/components/index.ts'), + index: path.resolve(__dirname, 'src/index.ts'), + components: path.resolve(__dirname, 'src/components/index.ts'), }, formats: ['es'], fileName: (_, entryName) => `${entryName}.js`, From b47aa875de1b42917fd9d838370750b6fea1c587 Mon Sep 17 00:00:00 2001 From: emirsassan Date: Wed, 18 Jun 2025 09:38:10 +0300 Subject: [PATCH 02/32] chore: cluster logic --- .../launcher/cluster/ClusterCreation.tsx | 2 +- .../frontend/src/routes/app/cluster/index.tsx | 30 +++++++++++++++---- .../frontend/src/routes/app/index.tsx | 7 ++--- packages/core/src/api/tauri/commands.rs | 26 ++++++++++++---- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx b/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx index 7eb4cb06..67b33ae1 100644 --- a/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx +++ b/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx @@ -258,7 +258,7 @@ function ClusterInformation({
diff --git a/apps/onelauncher/frontend/src/routes/app/settings/index.tsx b/apps/onelauncher/frontend/src/routes/app/settings/index.tsx index 4d720b45..6b754f2c 100644 --- a/apps/onelauncher/frontend/src/routes/app/settings/index.tsx +++ b/apps/onelauncher/frontend/src/routes/app/settings/index.tsx @@ -4,6 +4,8 @@ import { bindings } from '@/main'; import { useCommand } from '@onelauncher/common'; import { Button, Switch } from '@onelauncher/common/components'; import { createFileRoute } from '@tanstack/react-router'; +import { dataDir } from '@tauri-apps/api/path'; +import { openPath as open } from '@tauri-apps/plugin-opener'; import { FolderIcon, LinkExternal01Icon, XIcon } from '@untitled-theme/icons-react'; import Sidebar from './route'; @@ -14,6 +16,12 @@ export const Route = createFileRoute('/app/settings/')({ function RouteComponent() { const _result = useCommand('getGlobalProfile', bindings.core.getGlobalProfile); + const openLauncherDir = async () => { + const dir = await dataDir(); + + open(`${dir}/OneLauncher`); + }; + return (
@@ -52,7 +60,7 @@ function RouteComponent() { icon={} title="Launcher Folder" > - - - Hello World - + - - {/* el.classList.add('right-0')} - setVisible={setNotificationMenuOpen} - visible={notificationMenuOpen} - /> */}
diff --git a/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx b/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx index 6d6cfa78..512ee0db 100644 --- a/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx +++ b/apps/onelauncher/frontend/src/components/launcher/cluster/ClusterCreation.tsx @@ -262,9 +262,9 @@ function ClusterInformation({