From 2bb686baaf135b8d879e5fa859f4dca2bcc98ec6 Mon Sep 17 00:00:00 2001 From: Kr4ight Date: Mon, 6 Apr 2026 22:05:10 +0200 Subject: [PATCH] Implemented optional sync --- src-tauri/src/features/instance_sync.rs | 12 ++++++---- src/components/SettingsSection.tsx | 32 +++++++++++++++++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src-tauri/src/features/instance_sync.rs b/src-tauri/src/features/instance_sync.rs index 1949e78..68d9413 100644 --- a/src-tauri/src/features/instance_sync.rs +++ b/src-tauri/src/features/instance_sync.rs @@ -18,9 +18,11 @@ impl Feature for InstanceSync { &mut self, state: &State<'_, SharedState>, version: &GameVersion, - account: &MinecraftAccount, + _account: &MinecraftAccount, ) -> super::FeatureResult { - sync_to_instance(version).map_err(|e| e.to_string())?; + if state.lock().unwrap().settings.features.sync_options { + sync_to_instance(version).map_err(|e| e.to_string())?; + } Ok(()) } @@ -29,9 +31,11 @@ impl Feature for InstanceSync { &mut self, state: &State<'_, SharedState>, version: &GameVersion, - account: &MinecraftAccount, + _account: &MinecraftAccount, ) -> super::FeatureResult { - sync_back_from_instance(version).map_err(|e| e.to_string())?; + if state.lock().unwrap().settings.features.sync_options { + sync_back_from_instance(version).map_err(|e| e.to_string())?; + } Ok(()) } diff --git a/src/components/SettingsSection.tsx b/src/components/SettingsSection.tsx index e076293..bcf9928 100644 --- a/src/components/SettingsSection.tsx +++ b/src/components/SettingsSection.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { Save, RefreshCcw, Info } from "lucide-react"; +import { Save, RefreshCcw } from "lucide-react"; import { getSettings, updateSettings } from "../lib/saturn"; import { LauncherSettings } from "@/lib/types"; @@ -45,6 +45,7 @@ export const settingsSchema: SettingSchemaItem[] = [ max: 16384, step: 512, default: 2048, + ticks: [1024, 4096, 8192, 12288, 16384], format: (v) => `${(v / 1024).toFixed(1)} GB`, }, @@ -112,8 +113,11 @@ const SettingItem: React.FC<{ return (
{item.type === "slider" && ( - <> - {item.label} +
+
+ {item.label} + {(item.format && item.format(value)) || value} +
- + {item.ticks && ( +
+ {item.ticks.map((tick) => { + const percent = + (((tick - item.min!) / (item.max! - item.min!)) * 100 - 50) * + 0.97 + + 50; + + return ( + + {tick / 1024} GB + + ); + })} +
+ )} +
)} {item.type === "toggle" && (