diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index a3b171f..3427278 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,23 +1,25 @@ import { - Alert, + Alert, AspectRatio, Button, Card, DialogActions, DialogTitle, Divider, Drawer, IconButton, List, ListItem, - ListItemButton, - ModalClose, Tooltip, + ListItemButton, Modal, + ModalClose, ModalDialog, Tooltip, Typography, } from "@mui/joy"; import {ThemeSwitcher} from "./components/ThemeSwitcher"; import {HomeButton} from "./components/HomeButton"; import { ServerList } from "./components/ServerList"; -import {useEffect, useState} from "react"; +import React, {useEffect, useState} from "react"; import {Server} from "./pages/Server"; -import {IconArrowLeft, IconExternalLink, IconPlus, IconRefresh} from "@tabler/icons-react"; +import {IconArrowLeft, IconExternalLink, IconHome, IconInfoCircle, IconPlus, IconRefresh} from "@tabler/icons-react"; import {CreateServer, GetAllServers, GetAllServersFromDir, GetServerDir} from "../wailsjs/go/server/ServerController"; import {server} from "../wailsjs/go/models"; import {BrowserOpenURL, EventsOff, EventsOn, LogDebug} from "../wailsjs/runtime"; import {AlertProvider} from "./components/AlertProvider"; +import banner from "./assets/AASM_V3_banner2.png" +import {GetVersion} from "../wailsjs/go/helpers/HelpersController"; enum ServerListType { CARD, @@ -28,7 +30,8 @@ function App() { const [activeServer, setActiveServer] = useState(undefined) const [drawerOpen, setDrawerOpen] = useState(false); const [servers, setServers] = useState<{[key: number]: server.Server}|null>(null); - + const [infoModalOpen, setInfoModalOpen] = useState(false); + const [appVersion, setAppVersion] = useState(""); @@ -67,6 +70,7 @@ function App() { useEffect(() => { getServers() + GetVersion().then(version => setAppVersion(version)) }, []); @@ -96,6 +100,7 @@ function App() { + {getServersFromDir(); setActiveServer(undefined)}}> {getServers(); setActiveServer(undefined)}}> {GetServerDir().then((dir: string) => BrowserOpenURL("file:///" + dir))}}> @@ -147,6 +152,41 @@ function App() {
+ setInfoModalOpen(true)} + > + + + setInfoModalOpen(false)}> + + + + + + +
+ + Info: + + + Version: {appVersion} + +
+ + + + + +
+
+
{mainUi} diff --git a/frontend/src/assets/AASM_V3_banner2.png b/frontend/src/assets/AASM_V3_banner2.png new file mode 100644 index 0000000..060533f Binary files /dev/null and b/frontend/src/assets/AASM_V3_banner2.png differ diff --git a/helpers/helpers.go b/helpers/helpers.go index 072f834..3e3eb49 100644 --- a/helpers/helpers.go +++ b/helpers/helpers.go @@ -2,21 +2,34 @@ package helpers import ( "context" + "encoding/json" + "fmt" "github.com/wailsapp/wails/v2/pkg/runtime" ) type HelpersController struct { - ctx context.Context + ctx context.Context + WailsCfg *Env } func NewHelpersController() *HelpersController { return &HelpersController{} } -func (c *HelpersController) Startup(ctx context.Context) { +func (c *HelpersController) Startup(ctx context.Context, wailsCfgFile []byte) { c.ctx = ctx + err := json.Unmarshal(wailsCfgFile, &c.WailsCfg) + if err != nil { + fmt.Printf("Error: Could not parse wails.json: %s\n", err) + println("Skipping update check") + return + } } func (c *HelpersController) OpenDirectoryDialog() (string, error) { return runtime.OpenDirectoryDialog(c.ctx, runtime.OpenDialogOptions{}) } + +func (c *HelpersController) GetVersion() string { + return c.WailsCfg.Version +} diff --git a/main.go b/main.go index 9c23273..4985d27 100644 --- a/main.go +++ b/main.go @@ -62,7 +62,7 @@ func main() { c.Startup(ctx) s.Startup(ctx) i.Startup(ctx) - h.Startup(ctx) + h.Startup(ctx, WailsConfigFile) }, Logger: l, LogLevel: wailsLogger.TRACE,