This commit is contained in:
2026-04-03 14:47:50 +02:00
parent 7c0fc2e746
commit 5345fd48c4
7 changed files with 0 additions and 845 deletions
-151
View File
@@ -1,151 +0,0 @@
import React, { useState, useEffect } from 'react'
import { Play, Puzzle, Settings, ChevronDown, User, LogOut, Check } from 'lucide-react'
import { launcherService, type GameVersion } from './services/LauncherService'
import { clsx, type ClassValue } from 'clsx'
import { twMerge } from 'tailwind-merge'
// Utility for merging tailwind classes
function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
// Components
import PlaySection from './components/PlaySection'
import ModsSection from './components/ModsSection'
import SettingsSection from './components/SettingsSection'
type Section = 'play' | 'mods' | 'settings'
const App: React.FC = () => {
const [activeSection, setActiveSection] = useState<Section>('play')
const [versions, setVersions] = useState<GameVersion[]>([])
const [selectedVersion, setSelectedVersion] = useState<GameVersion | null>(null)
const [isVersionDropdownOpen, setIsVersionDropdownOpen] = useState(false)
const [isAccountDropdownOpen, setIsAccountDropdownOpen] = useState(false)
useEffect(() => {
const fetchVersions = async () => {
const v = await launcherService.getVersions()
setVersions(v)
if (v.length > 0) setSelectedVersion(v[0])
}
fetchVersions()
}, [])
return (
<div className="flex h-screen w-screen bg-saturn-bg text-saturn-text-primary overflow-hidden font-sans">
{/* Sidebar */}
<aside className="w-16 border-r border-saturn-border flex flex-col items-center py-6 gap-6 bg-saturn-panel/50">
<div className="mb-4">
<div className="w-10 h-10 bg-saturn-accent rounded-xl flex items-center justify-center shadow-[0_0_20px_rgba(59,130,246,0.4)]">
<span className="font-bold text-white text-xl">S</span>
</div>
</div>
<nav className="flex flex-col gap-4">
<button
onClick={() => setActiveSection('play')}
className={cn("sidebar-icon", activeSection === 'play' && "active")}
title="Play"
>
<Play size={22} fill={activeSection === 'play' ? "currentColor" : "none"} />
</button>
<button
onClick={() => setActiveSection('mods')}
className={cn("sidebar-icon", activeSection === 'mods' && "active")}
title="Mods"
>
<Puzzle size={22} fill={activeSection === 'mods' ? "currentColor" : "none"} />
</button>
<button
onClick={() => setActiveSection('settings')}
className={cn("sidebar-icon", activeSection === 'settings' && "active")}
title="Settings"
>
<Settings size={22} fill={activeSection === 'settings' ? "currentColor" : "none"} />
</button>
</nav>
</aside>
{/* Main Content Area */}
<main className="flex-1 flex flex-col min-w-0">
{/* Top Bar */}
<header className="h-14 border-b border-saturn-border flex items-center justify-between px-6 bg-saturn-panel/30 backdrop-blur-md">
{/* Version Selector */}
<div className="relative">
<button
onClick={() => setIsVersionDropdownOpen(!isVersionDropdownOpen)}
className="flex items-center gap-2 px-3 py-1.5 rounded-md hover:bg-white/5 transition-colors text-sm font-medium border border-transparent hover:border-saturn-border"
>
<span className="text-saturn-text-secondary">Version:</span>
<span>{selectedVersion?.name || 'Loading...'}</span>
<ChevronDown size={14} className={cn("transition-transform", isVersionDropdownOpen && "rotate-180")} />
</button>
{isVersionDropdownOpen && (
<div className="absolute top-full left-0 mt-2 w-48 bg-saturn-panel border border-saturn-border rounded-lg shadow-2xl z-50 py-1 overflow-hidden">
{versions.map(v => (
<button
key={v.id}
onClick={() => {
setSelectedVersion(v)
setIsVersionDropdownOpen(false)
}}
className="w-full flex items-center justify-between px-4 py-2 text-sm hover:bg-saturn-accent/10 hover:text-saturn-accent transition-colors"
>
<span>{v.name}</span>
{selectedVersion?.id === v.id && <Check size={14} />}
</button>
))}
</div>
)}
</div>
{/* Account Display */}
<div className="relative">
<button
onClick={() => setIsAccountDropdownOpen(!isAccountDropdownOpen)}
className="flex items-center gap-3 px-2 py-1 rounded-full hover:bg-white/5 transition-colors border border-transparent hover:border-saturn-border"
>
<div className="text-right hidden sm:block">
<p className="text-xs font-bold leading-none">SaturnDev</p>
<p className="text-[10px] text-saturn-text-secondary leading-none mt-1">Microsoft Account</p>
</div>
<div className="w-8 h-8 rounded-md bg-zinc-800 border border-saturn-border overflow-hidden flex items-center justify-center">
<User size={18} className="text-saturn-text-secondary" />
</div>
</button>
{isAccountDropdownOpen && (
<div className="absolute top-full right-0 mt-2 w-48 bg-saturn-panel border border-saturn-border rounded-lg shadow-2xl z-50 py-1 overflow-hidden">
<div className="px-4 py-3 border-b border-saturn-border">
<p className="text-sm font-bold">SaturnDev</p>
<p className="text-xs text-saturn-text-secondary truncate">dev@saturnclient.com</p>
</div>
<button className="w-full flex items-center gap-2 px-4 py-2 text-sm hover:bg-white/5 transition-colors">
<User size={14} />
<span>Switch Account</span>
</button>
<button className="w-full flex items-center gap-2 px-4 py-2 text-sm hover:bg-red-500/10 text-red-400 transition-colors">
<LogOut size={14} />
<span>Logout</span>
</button>
</div>
)}
</div>
</header>
{/* Content Sections */}
<div className="flex-1 overflow-y-auto overflow-x-hidden p-8">
{activeSection === 'play' && selectedVersion && <PlaySection version={selectedVersion} />}
{activeSection === 'mods' && selectedVersion && <ModsSection version={selectedVersion} />}
{activeSection === 'settings' && <SettingsSection />}
</div>
</main>
</div>
)
}
export default App
-236
View File
@@ -1,236 +0,0 @@
import React, { useState, useEffect } from 'react'
import { Search, Download, Trash2, ExternalLink, Package, Filter, CheckCircle2, XCircle, ChevronRight, X } from 'lucide-react'
import { launcherService, type Mod, type GameVersion } from '../services/LauncherService'
import { clsx, type ClassValue } from 'clsx'
import { twMerge } from 'tailwind-merge'
import { motion, AnimatePresence } from 'framer-motion'
function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
interface ModsSectionProps {
version: GameVersion
}
const ModsSection: React.FC<ModsSectionProps> = ({ version }) => {
const [activeTab, setActiveTab] = useState<'installed' | 'discover'>('installed')
const [searchQuery, setSearchQuery] = useState('')
const [mods, setMods] = useState<Mod[]>([])
const [isInstallDialogOpen, setIsInstallDialogOpen] = useState(false)
const [selectedModForInstall, setSelectedModForInstall] = useState<Mod | null>(null)
const [selectedVersionsForInstall, setSelectedVersionsForInstall] = useState<string[]>([])
const [allVersions, setAllVersions] = useState<GameVersion[]>([])
useEffect(() => {
const loadMods = async () => {
if (activeTab === 'installed') {
const m = await launcherService.getInstalledMods(version.id)
setMods(m)
} else {
const m = await launcherService.discoverMods(searchQuery)
setMods(m)
}
}
loadMods()
}, [activeTab, version.id, searchQuery])
useEffect(() => {
const loadAllVersions = async () => {
const v = await launcherService.getVersions()
setAllVersions(v)
}
loadAllVersions()
}, [])
const handleToggleMod = async (modId: string) => {
await launcherService.toggleMod(modId)
const m = await launcherService.getInstalledMods(version.id)
setMods(m)
}
const openInstallDialog = (mod: Mod) => {
setSelectedModForInstall(mod)
setSelectedVersionsForInstall([version.id])
setIsInstallDialogOpen(true)
}
const handleInstall = async () => {
if (selectedModForInstall && selectedVersionsForInstall.length > 0) {
await launcherService.installMod(selectedModForInstall, selectedVersionsForInstall)
setIsInstallDialogOpen(false)
if (activeTab === 'installed') {
const m = await launcherService.getInstalledMods(version.id)
setMods(m)
}
}
}
const toggleVersionSelection = (versionId: string) => {
setSelectedVersionsForInstall(prev =>
prev.includes(versionId)
? prev.filter(v => v !== versionId)
: [...prev, versionId]
)
}
return (
<div className="max-w-6xl mx-auto h-full flex flex-col gap-6">
<div className="flex items-center justify-between">
<div className="flex items-center gap-1 p-1 bg-saturn-panel border border-saturn-border rounded-lg">
<button
onClick={() => setActiveTab('installed')}
className={cn("px-4 py-1.5 text-sm font-medium rounded-md transition-all", activeTab === 'installed' ? "bg-white/5 text-white" : "text-saturn-text-secondary hover:text-white")}
>
Installed Mods
</button>
<button
onClick={() => setActiveTab('discover')}
className={cn("px-4 py-1.5 text-sm font-medium rounded-md transition-all", activeTab === 'discover' ? "bg-white/5 text-white" : "text-saturn-text-secondary hover:text-white")}
>
Discover
</button>
</div>
<div className="relative group">
<Search size={16} className="absolute left-3 top-1/2 -translate-y-1/2 text-saturn-text-secondary group-focus-within:text-saturn-accent transition-colors" />
<input
type="text"
placeholder={activeTab === 'installed' ? "Search installed mods..." : "Search CurseForge/Modrinth..."}
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="bg-saturn-panel border border-saturn-border rounded-lg pl-10 pr-4 py-2 text-sm w-64 focus:outline-none focus:border-saturn-accent/50 focus:ring-1 focus:ring-saturn-accent/50 transition-all"
/>
</div>
</div>
<div className="flex-1 overflow-y-auto pr-2">
<div className="grid grid-cols-1 gap-3">
{mods.map(mod => (
<motion.div
layout
key={mod.id}
initial={{ opacity: 0, x: -10 }}
animate={{ opacity: 1, x: 0 }}
className="panel p-4 flex items-center gap-4 hover:border-white/10 transition-colors"
>
<div className="w-12 h-12 rounded-lg bg-zinc-800 border border-saturn-border flex items-center justify-center shrink-0">
<Package size={24} className="text-saturn-text-secondary" />
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<h3 className="font-bold text-sm truncate">{mod.name}</h3>
<span className="text-[10px] text-saturn-text-secondary font-medium px-1.5 py-0.5 rounded bg-white/5">v{mod.version}</span>
<span className="text-[10px] text-saturn-text-secondary">by {mod.author}</span>
</div>
<p className="text-xs text-saturn-text-secondary mt-1 truncate max-w-xl">{mod.description}</p>
</div>
<div className="flex items-center gap-3">
{activeTab === 'installed' ? (
<>
<button
onClick={() => handleToggleMod(mod.id)}
className={cn("flex items-center gap-2 px-3 py-1.5 rounded-md text-xs font-medium transition-all", mod.enabled ? "bg-green-500/10 text-green-400 border border-green-500/20" : "bg-red-500/10 text-red-400 border border-red-500/20")}
>
{mod.enabled ? <CheckCircle2 size={14} /> : <XCircle size={14} />}
{mod.enabled ? 'Enabled' : 'Disabled'}
</button>
<button className="p-2 text-saturn-text-secondary hover:text-red-400 transition-colors">
<Trash2 size={16} />
</button>
</>
) : (
<button
onClick={() => openInstallDialog(mod)}
className="flex items-center gap-2 px-4 py-1.5 bg-saturn-accent/10 text-saturn-accent hover:bg-saturn-accent hover:text-white rounded-md text-xs font-bold transition-all border border-saturn-accent/20"
>
<Download size={14} />
INSTALL
</button>
)}
</div>
</motion.div>
))}
{mods.length === 0 && (
<div className="h-64 flex flex-col items-center justify-center text-saturn-text-secondary opacity-50">
<Package size={48} className="mb-4" strokeWidth={1} />
<p>No mods found.</p>
</div>
)}
</div>
</div>
{/* Install Dialog */}
<AnimatePresence>
{isInstallDialogOpen && selectedModForInstall && (
<div className="fixed inset-0 bg-black/80 backdrop-blur-sm z-[100] flex items-center justify-center p-6">
<motion.div
initial={{ scale: 0.9, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0.9, opacity: 0 }}
className="bg-saturn-panel border border-saturn-border rounded-xl w-full max-w-md shadow-2xl overflow-hidden"
>
<div className="p-6 border-b border-saturn-border flex items-center justify-between">
<div>
<h2 className="text-lg font-bold">Install {selectedModForInstall.name}</h2>
<p className="text-xs text-saturn-text-secondary">Select versions to install this mod to.</p>
</div>
<button onClick={() => setIsInstallDialogOpen(false)} className="text-saturn-text-secondary hover:text-white">
<X size={20} />
</button>
</div>
<div className="p-6 space-y-3 max-h-64 overflow-y-auto">
{allVersions.map(v => {
const isSupported = selectedModForInstall.supportedVersions.includes(v.id)
const isSelected = selectedVersionsForInstall.includes(v.id)
return (
<div
key={v.id}
onClick={() => isSupported && toggleVersionSelection(v.id)}
className={cn(
"flex items-center justify-between p-3 rounded-lg border transition-all cursor-pointer",
isSelected ? "bg-saturn-accent/10 border-saturn-accent/50" : "bg-white/5 border-transparent hover:border-white/10",
!isSupported && "opacity-40 cursor-not-allowed grayscale"
)}
>
<div className="flex items-center gap-3">
<div className={cn("w-5 h-5 rounded border flex items-center justify-center transition-all", isSelected ? "bg-saturn-accent border-saturn-accent" : "border-saturn-border")}>
{isSelected && <CheckCircle2 size={14} className="text-white" />}
</div>
<span className="text-sm font-medium">{v.name}</span>
</div>
{!isSupported && <span className="text-[10px] text-red-400 font-bold uppercase">Unsupported</span>}
</div>
)
})}
</div>
<div className="p-6 bg-white/5 flex gap-3">
<button
onClick={() => setIsInstallDialogOpen(false)}
className="flex-1 py-2 text-sm font-medium hover:bg-white/5 rounded-lg transition-colors"
>
Cancel
</button>
<button
onClick={handleInstall}
disabled={selectedVersionsForInstall.length === 0}
className="flex-1 py-2 text-sm font-bold bg-saturn-accent hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-all shadow-lg shadow-saturn-accent/20"
>
Confirm Install
</button>
</div>
</motion.div>
</div>
)}
</AnimatePresence>
</div>
)
}
export default ModsSection
-110
View File
@@ -1,110 +0,0 @@
import React, { useState } from 'react'
import { Play, Loader2, Info, ExternalLink } from 'lucide-react'
import { launcherService, type GameVersion } from '../services/LauncherService'
import { motion } from 'framer-motion'
interface PlaySectionProps {
version: GameVersion
}
const PlaySection: React.FC<PlaySectionProps> = ({ version }) => {
const [isLaunching, setIsLaunching] = useState(false)
const [launchStatus, setLaunchStatus] = useState('')
const handleLaunch = async () => {
setIsLaunching(true)
setLaunchStatus('Preparing...')
// Simulate launch steps
setTimeout(() => setLaunchStatus('Verifying assets...'), 500)
setTimeout(() => setLaunchStatus('Applying Saturn optimizations...'), 1200)
const result = await launcherService.launchGame(version.id)
if (result.success) {
setLaunchStatus('Game running')
// In a real app, we might minimize or close the launcher here
}
setTimeout(() => {
setIsLaunching(false)
setLaunchStatus('')
}, 3000)
}
return (
<div className="h-full flex flex-col items-center justify-center max-w-4xl mx-auto text-center">
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
className="mb-12"
>
<h1 className="text-6xl font-black tracking-tighter mb-2 bg-gradient-to-b from-white to-white/40 bg-clip-text text-transparent">
SATURN
</h1>
<p className="text-saturn-text-secondary text-lg tracking-widest font-light uppercase">
Fabric-Only Optimization Client
</p>
</motion.div>
<div className="w-full grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
<div className="panel p-6 flex flex-col items-center gap-3">
<div className="w-10 h-10 rounded-full bg-white/5 flex items-center justify-center text-saturn-accent">
<Info size={20} />
</div>
<div>
<p className="text-xs text-saturn-text-secondary uppercase tracking-wider font-bold">Instance</p>
<p className="text-sm font-medium">Saturn Default</p>
</div>
</div>
<div className="panel p-6 flex flex-col items-center gap-3 border-saturn-accent/30 bg-saturn-accent/5">
<div className="w-10 h-10 rounded-full bg-saturn-accent/20 flex items-center justify-center text-saturn-accent">
<Play size={20} fill="currentColor" />
</div>
<div>
<p className="text-xs text-saturn-text-secondary uppercase tracking-wider font-bold">Current Version</p>
<p className="text-sm font-medium">{version.name}</p>
</div>
</div>
<div className="panel p-6 flex flex-col items-center gap-3">
<div className="w-10 h-10 rounded-full bg-white/5 flex items-center justify-center text-saturn-accent">
<ExternalLink size={20} />
</div>
<div>
<p className="text-xs text-saturn-text-secondary uppercase tracking-wider font-bold">Modloader</p>
<p className="text-sm font-medium">Fabric Loader</p>
</div>
</div>
</div>
<div className="relative group">
<div className="absolute -inset-1 bg-gradient-to-r from-blue-600 to-cyan-500 rounded-lg blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200"></div>
<button
onClick={handleLaunch}
disabled={isLaunching}
className="relative btn-primary px-16 py-4 text-xl flex items-center gap-3 min-w-[240px] justify-center"
>
{isLaunching ? (
<>
<Loader2 size={24} className="animate-spin" />
<span>{launchStatus}</span>
</>
) : (
<>
<Play size={24} fill="currentColor" />
<span>PLAY</span>
</>
)}
</button>
</div>
<div className="mt-12 text-saturn-text-secondary text-xs max-w-md">
<p>Saturn Client is not affiliated with Mojang AB. Use at your own risk. Performance may vary based on hardware.</p>
</div>
</div>
)
}
export default PlaySection
-156
View File
@@ -1,156 +0,0 @@
import React, { useState, useEffect } from 'react'
import { Cpu, MemoryStick, Save, RefreshCcw, Info, AlertTriangle } from 'lucide-react'
import { launcherService, type LauncherSettings } from '../services/LauncherService'
import { motion } from 'framer-motion'
const SettingsSection: React.FC = () => {
const [settings, setSettings] = useState<LauncherSettings | null>(null)
const [isSaving, setIsSaving] = useState(false)
const [saveStatus, setSaveStatus] = useState('')
useEffect(() => {
const loadSettings = async () => {
const s = await launcherService.getSettings()
setSettings(s)
}
loadSettings()
}, [])
const handleSave = async () => {
if (!settings) return
setIsSaving(true)
setSaveStatus('Saving...')
await launcherService.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 = {
jvmArguments: '-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200',
maxMemory: 4096,
}
setSettings(defaultSettings)
}
if (!settings) return null
return (
<div className="max-w-4xl mx-auto h-full flex flex-col gap-8">
<div className="flex items-center justify-between border-b border-saturn-border pb-6">
<div>
<h1 className="text-2xl font-bold">Performance Settings</h1>
<p className="text-sm text-saturn-text-secondary">Configure how Saturn Client interacts with your hardware.</p>
</div>
<div className="flex items-center gap-3">
<button
onClick={handleReset}
className="p-2 text-saturn-text-secondary hover:text-white transition-colors"
title="Reset to Defaults"
>
<RefreshCcw size={20} />
</button>
<button
onClick={handleSave}
disabled={isSaving}
className="btn-primary flex items-center gap-2 py-2 px-6 text-sm font-bold"
>
<Save size={16} />
{saveStatus || 'SAVE SETTINGS'}
</button>
</div>
</div>
<div className="grid grid-cols-1 gap-8">
{/* Memory Allocation */}
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
className="panel p-6 space-y-6"
>
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-lg bg-saturn-accent/10 flex items-center justify-center text-saturn-accent">
<MemoryStick size={18} />
</div>
<h2 className="text-lg font-bold">Memory Allocation</h2>
</div>
<div className="space-y-4">
<div className="flex justify-between items-center">
<span className="text-sm font-medium">Maximum Memory (RAM)</span>
<span className="text-lg font-bold text-saturn-accent">{(settings.maxMemory / 1024).toFixed(1)} GB</span>
</div>
<input
type="range"
min="1024"
max="16384"
step="512"
value={settings.maxMemory}
onChange={(e) => setSettings({ ...settings, maxMemory: parseInt(e.target.value) })}
className="w-full h-2 bg-saturn-border rounded-lg appearance-none cursor-pointer accent-saturn-accent"
/>
<div className="flex justify-between text-[10px] text-saturn-text-secondary font-bold uppercase tracking-widest">
<span>1 GB</span>
<span>4 GB</span>
<span>8 GB</span>
<span>12 GB</span>
<span>16 GB</span>
</div>
<div className="p-3 bg-blue-500/5 border border-blue-500/10 rounded-lg flex gap-3">
<Info size={16} className="text-blue-400 shrink-0 mt-0.5" />
<p className="text-xs text-blue-300/80 leading-relaxed">
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.
</p>
</div>
</div>
</motion.div>
{/* JVM Arguments */}
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.1 }}
className="panel p-6 space-y-6"
>
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-lg bg-saturn-accent/10 flex items-center justify-center text-saturn-accent">
<Cpu size={18} />
</div>
<h2 className="text-lg font-bold">Custom JVM Arguments</h2>
</div>
<div className="space-y-4">
<p className="text-xs text-saturn-text-secondary leading-relaxed">
Advanced flags for the Java Virtual Machine. Saturn Client includes optimized defaults, but you can override them here.
</p>
<textarea
value={settings.jvmArguments}
onChange={(e) => setSettings({ ...settings, jvmArguments: e.target.value })}
className="w-full h-32 bg-saturn-bg border border-saturn-border rounded-lg p-4 text-sm font-mono text-saturn-text-secondary focus:outline-none focus:border-saturn-accent/50 focus:ring-1 focus:ring-saturn-accent/50 transition-all resize-none"
placeholder="-XX:+UseG1GC..."
/>
<div className="p-3 bg-yellow-500/5 border border-yellow-500/10 rounded-lg flex gap-3">
<AlertTriangle size={16} className="text-yellow-500 shrink-0 mt-0.5" />
<p className="text-xs text-yellow-500/80 leading-relaxed">
Incorrect JVM arguments can prevent the game from starting. Only modify if you know what you're doing.
</p>
</div>
</div>
</motion.div>
</div>
</div>
)
}
export default SettingsSection
-55
View File
@@ -1,55 +0,0 @@
@import "tailwindcss";
@theme {
--color-saturn-bg: #0a0a0a;
--color-saturn-panel: #141414;
--color-saturn-accent: #3b82f6;
--color-saturn-accent-glow: rgba(59, 130, 246, 0.3);
--color-saturn-text-primary: #f4f4f5;
--color-saturn-text-secondary: #a1a1aa;
--color-saturn-border: #27272a;
}
@layer base {
body {
@apply bg-saturn-bg text-saturn-text-primary font-sans antialiased;
overflow: hidden;
user-select: none;
}
}
@layer components {
.btn-primary {
@apply bg-saturn-accent hover:bg-blue-600 text-white font-medium py-2 px-6 rounded-md transition-all duration-200 shadow-[0_0_15px_rgba(59,130,246,0.2)] hover:shadow-[0_0_20px_rgba(59,130,246,0.4)];
}
.sidebar-icon {
@apply w-10 h-10 flex items-center justify-center rounded-lg transition-all duration-200 text-saturn-text-secondary hover:text-white hover:bg-white/5 cursor-pointer;
}
.sidebar-icon.active {
@apply text-saturn-accent bg-saturn-accent/10;
}
.panel {
@apply bg-saturn-panel border border-saturn-border rounded-lg overflow-hidden;
}
}
/* Custom scrollbar for dense UI */
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #27272a;
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: #3f3f46;
}
-10
View File
@@ -1,10 +0,0 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
-127
View File
@@ -1,127 +0,0 @@
// Saturn Client Launcher Centralized Service Layer
// Handles all data fetching, mod management, and launch logic.
export interface Mod {
id: string;
name: string;
version: string;
author: string;
description: string;
enabled: boolean;
icon?: string;
supportedVersions: string[];
}
export interface GameVersion {
id: string;
name: string;
releaseDate: string;
type: 'release' | 'snapshot';
}
export interface LauncherSettings {
jvmArguments: string;
maxMemory: number; // in MB
}
class LauncherService {
private versions: GameVersion[] = [
{ id: '1.20.1', name: 'Fabric 1.20.1', releaseDate: '2023-06-07', type: 'release' },
{ id: '1.20.4', name: 'Fabric 1.20.4', releaseDate: '2023-12-07', type: 'release' },
{ id: '1.21', name: 'Fabric 1.21', releaseDate: '2024-06-13', type: 'release' },
];
private installedMods: Mod[] = [
{
id: 'sodium',
name: 'Sodium',
version: '0.5.8',
author: 'jellysquid3',
description: 'Modern rendering engine for Minecraft.',
enabled: true,
supportedVersions: ['1.20.1', '1.20.4', '1.21']
},
{
id: 'iris',
name: 'Iris',
version: '1.7.0',
author: 'coderbot',
description: 'A modern shaders mod for Minecraft.',
enabled: true,
supportedVersions: ['1.20.1', '1.20.4', '1.21']
},
{
id: 'lithium',
name: 'Lithium',
version: '0.11.2',
author: 'jellysquid3',
description: 'General-purpose optimization mod for Minecraft.',
enabled: false,
supportedVersions: ['1.20.1', '1.20.4']
},
];
private settings: LauncherSettings = {
jvmArguments: '-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200',
maxMemory: 4096,
};
// --- Versions ---
async getVersions(): Promise<GameVersion[]> {
return [...this.versions];
}
// --- Mods ---
async getInstalledMods(versionId: string): Promise<Mod[]> {
// Filter mods by supported version
return this.installedMods.filter(mod => mod.supportedVersions.includes(versionId));
}
async toggleMod(modId: string): Promise<void> {
const mod = this.installedMods.find(m => m.id === modId);
if (mod) {
mod.enabled = !mod.enabled;
}
}
async discoverMods(query: string): Promise<Mod[]> {
// Mock discovery results
const allDiscoverable: Mod[] = [
{ id: 'modmenu', name: 'Mod Menu', version: '7.2.2', author: 'TerraformersMC', description: 'Adds a mod menu to view the list of installed mods.', enabled: false, supportedVersions: ['1.20.1', '1.20.4', '1.21'] },
{ id: 'starlight', name: 'Starlight', version: '1.1.2', author: 'Spottedleaf', description: 'Rewrites the light engine to fix performance issues.', enabled: false, supportedVersions: ['1.20.1'] },
{ id: 'ferritecore', name: 'FerriteCore', version: '6.0.1', author: 'malte0811', description: 'Memory usage optimizations.', enabled: false, supportedVersions: ['1.20.1', '1.20.4', '1.21'] },
];
if (!query) return allDiscoverable;
return allDiscoverable.filter(m => m.name.toLowerCase().includes(query.toLowerCase()));
}
async installMod(mod: Mod, versions: string[]): Promise<void> {
console.log(`Installing ${mod.name} to versions: ${versions.join(', ')}`);
// Mock install logic: add to installedMods if not already there
if (!this.installedMods.find(m => m.id === mod.id)) {
this.installedMods.push({ ...mod, enabled: true, supportedVersions: versions });
}
}
// --- Settings ---
async getSettings(): Promise<LauncherSettings> {
return { ...this.settings };
}
async updateSettings(newSettings: Partial<LauncherSettings>): Promise<void> {
this.settings = { ...this.settings, ...newSettings };
}
// --- Launch ---
async launchGame(versionId: string): Promise<{ success: boolean; message: string }> {
console.log(`Launching Saturn Client with version ${versionId}...`);
return new Promise((resolve) => {
setTimeout(() => {
resolve({ success: true, message: 'Game launched successfully!' });
}, 2000);
});
}
}
export const launcherService = new LauncherService();