import React, { useState, useEffect } from "react"; import { MemoryStick, Save, RefreshCcw, Info } from "lucide-react"; import { getSettings, updateSettings } from "../lib/saturn"; import { motion } from "framer-motion"; import { LauncherSettings } from "@/lib/types"; const SettingsSection: React.FC = () => { const [settings, setSettings] = useState(null); const [isSaving, setIsSaving] = useState(false); const [saveStatus, setSaveStatus] = useState(""); useEffect(() => { const loadSettings = async () => { const s = await getSettings(); setSettings(s); }; loadSettings(); }, []); const handleSave = async () => { if (!settings) return; setIsSaving(true); setSaveStatus("Saving..."); await updateSettings(settings); setTimeout(() => { setIsSaving(false); setSaveStatus("Settings saved"); setTimeout(() => setSaveStatus(""), 2000); }, 1000); }; const handleReset = async () => { // In a real app, this would reset to defaults in the service const defaultSettings: LauncherSettings = { max_memory: 4096, }; setSettings(defaultSettings); }; if (!settings) return null; return (

Settings

Configure how Saturn Launcher launches your game

{/* Memory Allocation */}

Memory Allocation

Maximum Memory (RAM) {(settings.max_memory / 1024).toFixed(1)} GB
setSettings({ ...settings, max_memory: parseInt(e.target.value), }) } className="w-full h-2 bg-saturn-border rounded-lg appearance-none cursor-pointer accent-saturn-accent" />
{[1024, 4096, 8192, 12288, 16384].map((value) => { const percent = (((value - 1024) / (16384 - 1024)) * 100 - 50) * 0.97 + 50; return ( {value / 1024} GB ); })}

Allocating too much memory can cause system instability, while too little can lead to performance issues or crashes. 4GB - 8GB is recommended for most users.

); }; export default SettingsSection;