internal/gui: Wails app with Classic React variant + theme toggle
- app.go: App struct with stub bindings (RunCheck/StartEngine/
StopEngine/GetStatus/Version) — emits check:result, check:done,
engine:status, stats:update events. Real backend lands in Phase 1.
- run.go: wails.Run() with frameless 480x640 fixed window, Classic
dark bg matching theme.
- embed.go: //go:embed all:frontend/dist for the Vite build output.
- frontend/: Vite + React project derived from `wails init -t react`.
Removed default template assets and wired Classic variant from
docs/design/v2/.
- components/Classic.jsx: variant 1 with custom title bar
(drag region, sun/moon theme toggle, min/close hooked to
Wails WindowMinimise/Quit).
- components/shared.jsx: useDrover hook adapted to call Wails
bindings and listen on backend events instead of mock SCENARIOS.
Added IconSun + IconMoon for the title-bar toggle.
- App.jsx: owns mode state, wraps setMode in
document.startViewTransition so the title-bar toggle gives a
circle-reveal sweep from the cursor.
- style.css: clean reset (overflow hidden, no scrollbars, brand
background) — replaces the wails-react-template defaults.
- wailsjs/go/gui/App.js: hand-written bindings since our App
struct lives in package gui rather than the standard top-level
main; `wails generate module` would have written package main
bindings here.
- build/: standard wails artifacts (icon, manifest); will be
consumed by `wails build` once we wire it through CI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
// Run launches the Wails GUI. It blocks until the window is closed.
|
||||
//
|
||||
// Window size matches the React design (480×640) but is resizable so
|
||||
// users on smaller displays can shrink it. Title shows the version.
|
||||
func Run(version string) error {
|
||||
app := NewApp(version)
|
||||
|
||||
// Frameless = no native Windows chrome; the React Classic component
|
||||
// renders its own title bar (brand mark, version, theme toggle,
|
||||
// min/close icons) so we deliberately suppress the OS chrome to
|
||||
// avoid stacking two title bars.
|
||||
// The Classic React component renders a fixed 480×640 surface, so we
|
||||
// pin the host window to exactly the same. Allowing resize would
|
||||
// expose the bare Wails background colour around the React canvas
|
||||
// (the "blue strip on the side" issue from early testing).
|
||||
const w, h = 480, 640
|
||||
return wails.Run(&options.App{
|
||||
Title: "Drover-Go " + version,
|
||||
Width: w,
|
||||
Height: h,
|
||||
MinWidth: w,
|
||||
MinHeight: h,
|
||||
MaxWidth: w,
|
||||
MaxHeight: h,
|
||||
DisableResize: true,
|
||||
Frameless: true,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: Assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 28, G: 29, B: 32, A: 1}, // matches Classic dark bg
|
||||
OnStartup: app.Startup,
|
||||
Windows: &windows.Options{
|
||||
WebviewIsTransparent: false,
|
||||
WindowIsTranslucent: false,
|
||||
DisableFramelessWindowDecorations: false,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user