Improved Top Bar design

This commit is contained in:
2022-06-23 01:21:29 +02:00
parent 790f27d7d6
commit 3607233df6
4 changed files with 99 additions and 35 deletions

View File

@@ -1,7 +1,24 @@
import React, {useState} from "react"; import React, {useState} from "react";
import { openSide, Side } from "../../renderer"; import { openSide, Side } from "../../renderer";
import {blender, blenderCmd} from "../blender-controller";
import { platform, Platform } from "../platform"; import { platform, Platform } from "../platform";
import { ipcRenderer } from "electron";
const WinButtons = () => (
<>
<div className="winMenuButtons" id="winMinimize" onClick={() => ipcRenderer.send('minimize')}>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
{/* <!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --> */}
<path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"/>
</svg>
</div>
<div className="winMenuButtons" id="winClose" onClick={() => ipcRenderer.send('closeApp')}>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
{/* <!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --> */}
<path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/>
</svg>
</div>
</>
)
const MainSideButtonsWin = () => ( const MainSideButtonsWin = () => (
<div id="settings-button-win" onClick={() => openSide(Side.Settings)}> <div id="settings-button-win" onClick={() => openSide(Side.Settings)}>
@@ -23,18 +40,17 @@ const MainSideButtonsLinux = () => (
) )
const SettingsSideButtonsWin = () => ( const SettingsSideButtonsWin = () => (
<button className="back-button-win" onClick={() => openSide(Side.Main)}>Back</button> <div id="backButton-win" onClick={() => openSide(Side.Main)}>
) <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
const RenderingSideButtonWin = () => ( {/* <!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --> */}
<button className="back-button-win" id="stopRender-win" onClick={() => blender(blenderCmd.stopRendering)}>Stop</button> <path d="M256 0C114.6 0 0 114.6 0 256c0 141.4 114.6 256 256 256s256-114.6 256-256C512 114.6 397.4 0 256 0zM310.6 345.4c12.5 12.5 12.5 32.75 0 45.25s-32.75 12.5-45.25 0l-112-112C147.1 272.4 144 264.2 144 256s3.125-16.38 9.375-22.62l112-112c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25L221.3 256L310.6 345.4z"/>
</svg>
</div>
) )
const SettingsSideButtonsLinux = () => ( const SettingsSideButtonsLinux = () => (
<button className="back-button-linux" onClick={() => openSide(Side.Main)}>Back</button> <button className="back-button-linux" onClick={() => openSide(Side.Main)}>Back</button>
) )
const RenderingSideButtonLinux = () => (
<button className="back-button-linux" id="stopRender-linux" onClick={() => blender(blenderCmd.stopRendering)}>Stop</button>
)
const BlenderLoadingSVG = () => ( const BlenderLoadingSVG = () => (
<svg id="blender-loading-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> <svg id="blender-loading-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -52,16 +68,20 @@ const BlenderReadySVG = () => (
function WindowsMenu({side, blenderLoading, blenderStatus}:{side:Side, blenderLoading:boolean, blenderStatus:string}) { function WindowsMenu({side, blenderLoading, blenderStatus}:{side:Side, blenderLoading:boolean, blenderStatus:string}) {
return ( return (
<header id="winHeader"> <header id="winHeader">
<h4>{(side == Side.Main)? "StickExporterTX" : "Settings"}</h4> <h4>
{(side == Side.Main)? "StickExporterTX" : null}
{(side == Side.Settings)? "Settings" : null}
{(side == Side.Rendering)? "Rendering" : null}
</h4>
<div id="blender-info-win"> <div id="blender-info-win">
<div id="blender-icon-linux"> <div id="blender-icon-win">
{blenderLoading? <BlenderLoadingSVG/> : <BlenderReadySVG/>} {blenderLoading? <BlenderLoadingSVG/> : <BlenderReadySVG/>}
</div> </div>
<p>{blenderStatus}</p> <p>{blenderStatus}</p>
</div> </div>
{(side == Side.Main)? <MainSideButtonsWin/> : null} {(side == Side.Main)? <MainSideButtonsWin/> : null}
{(side == Side.Settings)? <SettingsSideButtonsWin/> : null} {(side == Side.Settings)? <SettingsSideButtonsWin/> : null}
{(side == Side.Rendering)? <RenderingSideButtonWin/> : null} <WinButtons/>
</header> </header>
) )
} }
@@ -78,7 +98,6 @@ function LinuxMenu({side, blenderLoading, blenderStatus}:{side:Side, blenderLoad
</div> </div>
{(side == Side.Main)? <MainSideButtonsLinux/> : null} {(side == Side.Main)? <MainSideButtonsLinux/> : null}
{(side == Side.Settings)? <SettingsSideButtonsLinux/> : null} {(side == Side.Settings)? <SettingsSideButtonsLinux/> : null}
{(side == Side.Rendering)? <RenderingSideButtonLinux/> : null}
</header> </header>
) )
} }

View File

@@ -1,6 +1,7 @@
import React, {useState} from "react"; import React, {useState} from "react";
import { settingList } from "../settings"; import { settingList } from "../settings";
import openFolder from "../openFolder"; import openFolder from "../openFolder";
import { blenderCmd, blender } from "../blender-controller";
let setLogNumber:React.Dispatch<React.SetStateAction<string>>; let setLogNumber:React.Dispatch<React.SetStateAction<string>>;
let setStatus:React.Dispatch<React.SetStateAction<string>>; let setStatus:React.Dispatch<React.SetStateAction<string>>;
@@ -15,6 +16,7 @@ function RenderingSide() {
<div id="content"> <div id="content">
<p>{"Log " + logNumber + "/" + String(settingList.log.split("\"\"").length)}</p> <p>{"Log " + logNumber + "/" + String(settingList.log.split("\"\"").length)}</p>
<p>{status}</p> <p>{status}</p>
<button id="stopRenderButton" onClick={() => blender(blenderCmd.stopRendering)}>Stop</button>
<button onClick={() => openFolder(settingList.output)}>Open Output Folder</button> <button onClick={() => openFolder(settingList.output)}>Open Output Folder</button>
</div> </div>
) )

View File

@@ -25,8 +25,8 @@ header {
margin-bottom: 25px; margin-bottom: 25px;
} }
#winHeader { #winHeader {
padding: 0px 5px; padding: 0px 8px;
padding-right: 142px; padding-right: 0px;
height: 31px; height: 31px;
-webkit-app-region: drag; -webkit-app-region: drag;
} }
@@ -77,14 +77,30 @@ header h1 {
text-decoration: none; text-decoration: none;
} }
#stopRender-win { #backButton-win {
background-color: #e1334e; cursor: pointer;
-webkit-app-region: no-drag;
border-radius: 50%;
width: 24px;
height: 24px;
display: flex;
justify-content: center;
align-items: center;
border: none;
outline: none;
} }
#stopRender-linux { #backButton-win svg {
background-color: #e1334e; height: 18px;
fill: #9DA8B9;
} }
#stopRender-win:hover { #backButton-win:hover {
background-color: red; background-color: #2d323c;
transform: scale(1);
}
#stopRenderButton {
background-color: #e1334e;
margin-right: 10px;
} }
#content { #content {
@@ -95,22 +111,21 @@ header h1 {
#settings-button-win { #settings-button-win {
cursor: pointer; cursor: pointer;
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
background-color: #2196F3;
border-radius: 50%; border-radius: 50%;
width: 30px; width: 24px;
height: 30px; height: 24px;
display: flex;
justify-content: center;
align-items: center; align-items: center;
border: none; border: none;
outline: none; outline: none;
} }
#settings-button-win svg { #settings-button-win svg {
height: 24px; height: 18px;
fill: white; fill: #9DA8B9;
margin-left: 3px;
margin-top: 3px;
} }
#settings-button-win:hover { #settings-button-win:hover {
background-color: #0b6ab9; background-color: #2d323c;
transform: scale(1); transform: scale(1);
} }
@@ -334,3 +349,28 @@ button:hover {
cursor: pointer; cursor: pointer;
text-decoration: underline; text-decoration: underline;
} }
.winMenuButtons {
fill: #9DA8B9;
height: 100%;
width: 47px;
align-items: center;
display: flex;
justify-content: center;
-webkit-app-region: no-drag;
}
.winMenuButtons:hover {
background-color: #2d323c;
}
.winMenuButtons svg {
height: 17px;
width: 17px;
}
#winClose:hover {
background-color: red;
}
#winMinimize {
margin-left: 5px;
}

View File

@@ -1,10 +1,9 @@
import {app, BrowserWindow, dialog} from 'electron'; import {app, BrowserWindow, dialog, ipcMain} from 'electron';
import {initialize as remoteInitialize, enable as remoteEnable} from '@electron/remote/main'; import {initialize as remoteInitialize, enable as remoteEnable} from '@electron/remote/main';
import path from 'path'; import path from 'path';
import { autoUpdater } from "electron-updater"; import { autoUpdater } from "electron-updater";
import logger from 'electron-log'; import logger from 'electron-log';
import { Platform, platform } from './components/platform'; import { Platform, platform } from './components/platform';
logger.transports.console.format = "{h}:{i}:{s} {text}"; logger.transports.console.format = "{h}:{i}:{s} {text}";
logger.transports.file.getFile(); logger.transports.file.getFile();
logger.transports.file.resolvePath = () => path.join(app.getPath('userData'), "logs", "start.log"); logger.transports.file.resolvePath = () => path.join(app.getPath('userData'), "logs", "start.log");
@@ -65,11 +64,7 @@ const createWindow = () => {
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false, contextIsolation: false,
}, },
titleBarStyle: 'hidden', titleBarStyle: 'hidden'
titleBarOverlay: {
color: '#0d131e',
symbolColor: '#74b1be'
}
}); });
mainWindow.setMenu(null); mainWindow.setMenu(null);
@@ -79,6 +74,14 @@ const createWindow = () => {
// load the index.html of the app. // load the index.html of the app.
mainWindow.loadFile(path.join(__dirname, 'index.html')); mainWindow.loadFile(path.join(__dirname, 'index.html'));
ipcMain.on('closeApp', () => {
app.quit();
});
ipcMain.on('minimize', () => {
mainWindow.minimize();
});
}; };
// This method will be called when Electron has finished // This method will be called when Electron has finished