fix layout

This commit is contained in:
HorizonCode 2022-10-16 18:41:53 +02:00
parent bd7f3ddefd
commit 14201fb9cd
2 changed files with 29 additions and 8 deletions

26
app.js
View File

@ -2,6 +2,10 @@ const { app, BrowserWindow, ipcMain, dialog } = require('electron');
const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-titlebar/main'); const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-titlebar/main');
const windowManager = require('./ui/windowManager'); const windowManager = require('./ui/windowManager');
const osuUtil = require('./osuUtil'); const osuUtil = require('./osuUtil');
const config = require('./config');
const fs = require('fs');
let tempOsuPath;
const run = () => { const run = () => {
const gotTheLock = app.requestSingleInstanceLock() const gotTheLock = app.requestSingleInstanceLock()
@ -9,12 +13,24 @@ const run = () => {
app.quit(); app.quit();
return; return;
} }
setupTitlebar(); setupTitlebar();
let mainWindow; let mainWindow;
app.whenReady().then(() => { app.whenReady().then(() => {
mainWindow = createWindow() mainWindow = createWindow();
mainWindow.on('show', async () => {
const osuPath = await config.get("osuPath", "");
if(fs.existsSync(osuPath)){
tempOsuPath = osuPath;
const osuConfig = await osuUtil.getLatestConfig(tempOsuPath);
console.log(osuConfig);
const lastVersion = await osuConfig.get("LastVersion");
console.log(lastVersion);
//Do update check
}
})
app.on('activate', function () { app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow(); if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
}) })
@ -28,14 +44,18 @@ const run = () => {
if (yes.filePaths.length <= 0) if (yes.filePaths.length <= 0)
return undefined; return undefined;
const folderPath = yes.filePaths[0]; const folderPath = yes.filePaths[0];
return osuUtil.isValidOsuFolder(folderPath); const validOsuDir = osuUtil.isValidOsuFolder(folderPath);
if (validOsuDir) await config.set("osuPath", folderPath);
return validOsuDir;
}) })
}) })
} }
function createWindow() { function createWindow() {
// Create the browser window. // Create the browser window.
const win = windowManager.createWindow(480, 420); const win = windowManager.createWindow(480, 350);
win.loadFile('./html/index.html'); win.loadFile('./html/index.html');

View File

@ -17,7 +17,7 @@
<body class="fixed-sn mdb-skin-custom" data-spy="scroll" data-target="#scrollspy" data-offset="15" <body class="fixed-sn mdb-skin-custom" data-spy="scroll" data-target="#scrollspy" data-offset="15"
oncontextmenu="return false;"> oncontextmenu="return false;">
<main style="margin-top: 2rem;"> <main style="">
<div class="noselect"> <div class="noselect">
<div class="position-relative overflow-hidden p-3 p-md-5 m-md-3 text-center text-lg-end d-flex align-items-center justify-content-center" <div class="position-relative overflow-hidden p-3 p-md-5 m-md-3 text-center text-lg-end d-flex align-items-center justify-content-center"
style="border-radius: 0.5em;"> style="border-radius: 0.5em;">
@ -28,18 +28,19 @@
<div class="card" style="border-radius: 1rem;"> <div class="card" style="border-radius: 1rem;">
<div class="row g-0"> <div class="row g-0">
<div class="card-body p-4 p-lg-5 text-black"> <div class="card-body p-4 p-lg-5 text-black">
<div class="d-flex align-items-center mb-3 pb-1 text-white"> <div class="d-flex align-items-center mb-2 pb-1 text-white">
<span class="h1 fw-bold mb-0">EZPPLauncher</span> <span class="h1 fw-bold mb-0">EZPPLauncher</span>
</div> </div>
<h5 class="fw-normal mb-3 pb-3 text-white text-start" <h5 class="fw-lighter fs-5 mb-3 pb-3 text-white text-start"
style="letter-spacing: 1px;"> style="letter-spacing: 1px;">
Launch osu! with connection to the EZPPFarm server Launch osu! with connection to the EZPPFarm server
</h5> </h5>
<div class="pt-1 mb-4"> <div class="pt-1 mb-4">
<button id="launch-btn" class="btn btn-primary btn-lg btn-block" <button id="launch-btn" class="btn btn-primary btn-lg btn-block"
type="button" style="background-color:#d6016f" disabled>Launch</button> type="button" style="background-color:#d6016f"
disabled>Launch</button>
</div> </div>
<button class="btn btn-dark btn-sm float-start" id="folder-btn"> <button class="btn btn-dark btn-sm float-end" id="folder-btn">
set osu! directory set osu! directory
</button> </button>
</div> </div>