add platform class into main div

This commit is contained in:
sawka 2023-10-18 13:32:23 -07:00
parent 4e98db9745
commit b01472a917
5 changed files with 24 additions and 7 deletions

View File

@ -81,10 +81,10 @@ rm -rf build/
node_modules/.bin/webpack --config webpack.prod.js node_modules/.bin/webpack --config webpack.prod.js
node_modules/.bin/webpack --config webpack.electron.prod.js node_modules/.bin/webpack --config webpack.electron.prod.js
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')" GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
(cd ../apishell; GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../prompt-client/bin/mshell/mshell-v0.3-darwin.amd64 main-mshell.go) (cd waveshell; GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-darwin.amd64 main-waveshell.go)
(cd ../apishell; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../prompt-client/bin/mshell/mshell-v0.3-darwin.arm64 main-mshell.go) (cd waveshell; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-darwin.arm64 main-waveshell.go)
(cd ../apishell; GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../prompt-client/bin/mshell/mshell-v0.3-linux.amd64 main-mshell.go) (cd waveshell; GOOS=linux GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-linux.amd64 main-waveshell.go)
(cd ../apishell; GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../prompt-client/bin/mshell/mshell-v0.3-linux.arm64 main-mshell.go) (cd waveshell; GOOS=linux GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-linux.arm64 main-waveshell.go)
(cd wavesrv; GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../build/wavesrv.amd64 ./cmd) (cd wavesrv; GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../build/wavesrv.amd64 ./cmd)
(cd wavesrv; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../build/wavesrv.arm64 ./cmd) (cd wavesrv; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../build/wavesrv.arm64 ./cmd)
lipo -create -output bin/wavesrv build/wavesrv.amd64 build/wavesrv.arm64 lipo -create -output bin/wavesrv build/wavesrv.amd64 build/wavesrv.arm64

View File

@ -78,12 +78,13 @@ class App extends React.Component<{}, {}> {
let disconnected = !GlobalModel.ws.open.get() || !GlobalModel.waveSrvRunning.get(); let disconnected = !GlobalModel.ws.open.get() || !GlobalModel.waveSrvRunning.get();
let hasClientStop = GlobalModel.getHasClientStop(); let hasClientStop = GlobalModel.getHasClientStop();
let dcWait = this.dcWait.get(); let dcWait = this.dcWait.get();
let platform = GlobalModel.getPlatform();
if (disconnected || hasClientStop) { if (disconnected || hasClientStop) {
if (!dcWait) { if (!dcWait) {
setTimeout(() => this.updateDcWait(true), 1500); setTimeout(() => this.updateDcWait(true), 1500);
} }
return ( return (
<div id="main" onContextMenu={this.handleContextMenu}> <div id="main" className={"platform-" + platform} onContextMenu={this.handleContextMenu}>
<div className="main-content"> <div className="main-content">
<MainSideBar /> <MainSideBar />
<div className="session-view" /> <div className="session-view" />
@ -103,7 +104,7 @@ class App extends React.Component<{}, {}> {
setTimeout(() => this.updateDcWait(false), 0); setTimeout(() => this.updateDcWait(false), 0);
} }
return ( return (
<div id="main" onContextMenu={this.handleContextMenu}> <div id="main" className={"platform-" + platform} onContextMenu={this.handleContextMenu}>
<div className="main-content"> <div className="main-content">
<MainSideBar /> <MainSideBar />
<WorkspaceView /> <WorkspaceView />

View File

@ -388,7 +388,7 @@ function calcBounds(clientData) {
} }
app.on("window-all-closed", () => { app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit(); if (unamePlatform !== "darwin") app.quit();
}); });
electron.ipcMain.on("get-id", (event) => { electron.ipcMain.on("get-id", (event) => {
@ -396,6 +396,11 @@ electron.ipcMain.on("get-id", (event) => {
return; return;
}); });
electron.ipcMain.on("get-platform", (event) => {
event.returnValue = unamePlatform;
return;
});
electron.ipcMain.on("get-isdev", (event) => { electron.ipcMain.on("get-isdev", (event) => {
event.returnValue = isDev; event.returnValue = isDev;
return; return;

View File

@ -2,6 +2,7 @@ let { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("api", { contextBridge.exposeInMainWorld("api", {
getId: () => ipcRenderer.sendSync("get-id"), getId: () => ipcRenderer.sendSync("get-id"),
getPlatform: () => ipcRenderer.sendSync("get-platform"),
getIsDev: () => ipcRenderer.sendSync("get-isdev"), getIsDev: () => ipcRenderer.sendSync("get-isdev"),
getAuthKey: () => ipcRenderer.sendSync("get-authkey"), getAuthKey: () => ipcRenderer.sendSync("get-authkey"),
getWaveSrvStatus: () => ipcRenderer.sendSync("wavesrv-status"), getWaveSrvStatus: () => ipcRenderer.sendSync("wavesrv-status"),

View File

@ -165,6 +165,7 @@ type KeyModsType = {
type ElectronApi = { type ElectronApi = {
getId: () => string; getId: () => string;
getIsDev: () => boolean; getIsDev: () => boolean;
getPlatform: () => string;
getAuthKey: () => string; getAuthKey: () => string;
getWaveSrvStatus: () => boolean; getWaveSrvStatus: () => boolean;
restartWaveSrv: () => boolean; restartWaveSrv: () => boolean;
@ -2640,6 +2641,7 @@ class Model {
waveSrvRunning: OV<boolean>; waveSrvRunning: OV<boolean>;
authKey: string; authKey: string;
isDev: boolean; isDev: boolean;
platform: string;
activeMainView: OV<"session" | "history" | "bookmarks" | "webshare"> = mobx.observable.box("session", { activeMainView: OV<"session" | "history" | "bookmarks" | "webshare"> = mobx.observable.box("session", {
name: "activeMainView", name: "activeMainView",
}); });
@ -2721,6 +2723,14 @@ class Model {
setTimeout(() => this.getClientDataLoop(1), 10); setTimeout(() => this.getClientDataLoop(1), 10);
} }
getPlatform(): string {
if (this.platform != null) {
return this.platform;
}
this.platform = getApi().getPlatform();
return this.platform;
}
needsTos(): boolean { needsTos(): boolean {
let cdata = this.clientData.get(); let cdata = this.clientData.get();
if (cdata == null) { if (cdata == null) {