feat: add UI layer (theme, components, screens, main window)

- theme: MinecraftTheme — dark palette with green accents
- components: ServerCard, ProgressBar, PlayButton, SettingsButton, LogoutButton, AvatarImage
- screens: MainScreen (BorderLayout: sidebar + center + bottom bar), LoginScreen (modal form), SettingsScreen (RAM slider + JVM args)
- ui.Launch: wires theme, session, settings into Fyne app
- main.go: delegates to ui.Launch, loads config
- fix: nil-session guard in MainScreen username display

Co-Authored-By: OWL <noreply@anthropic.com>
This commit is contained in:
2026-05-26 11:22:41 +03:00
parent 070b5c0262
commit 1487360215
5 changed files with 436 additions and 20 deletions

View File

@@ -1,15 +1,11 @@
package main
import (
"fmt"
"log"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"gitea.mrixs.me/Mrixs/MrixsCraft-launcher/internal/auth"
"gitea.mrixs.me/Mrixs/MrixsCraft-launcher/internal/config"
"gitea.mrixs.me/Mrixs/MrixsCraft-launcher/internal/ui"
)
// version is set via -ldflags at build time.
@@ -24,7 +20,11 @@ func main() {
}
log.Printf("Data directory: %s", root)
// Try to restore an existing session.
settings, err := config.Load()
if err != nil {
log.Fatalf("Failed to load settings: %v", err)
}
client, err := auth.NewFromConfig()
if err != nil {
log.Fatalf("Failed to create auth client: %v", err)
@@ -41,15 +41,5 @@ func main() {
log.Println("No valid session — login required")
}
// Bootstrap Fyne UI.
a := app.New()
w := a.NewWindow(fmt.Sprintf("MrixsCraft %s", version))
w.Resize(fyne.NewSize(900, 600))
w.CenterOnScreen()
w.SetContent(container.NewVBox(
widget.NewLabel(fmt.Sprintf("MrixsCraft Launcher %s", version)),
))
w.ShowAndRun()
ui.Launch(client, sess, settings)
}