mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-13 03:32:13 +00:00
WIP: showing splash screen
This commit is contained in:
parent
7eee942dcb
commit
484e79dba3
10 changed files with 79 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hydra",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.1",
|
||||
"description": "Hydra",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "Los Broxas",
|
||||
|
@ -50,6 +50,7 @@
|
|||
"color.js": "^1.2.0",
|
||||
"date-fns": "^3.6.0",
|
||||
"easydl": "^1.1.1",
|
||||
"electron-log": "^5.1.4",
|
||||
"electron-updater": "^6.1.8",
|
||||
"fetch-cookie": "^3.0.1",
|
||||
"flexsearch": "^0.7.43",
|
||||
|
|
|
@ -7,7 +7,7 @@ import { resolveDatabaseUpdates, WindowManager } from "@main/services";
|
|||
import { dataSource } from "@main/data-source";
|
||||
import * as resources from "@locales";
|
||||
import { userPreferencesRepository } from "@main/repository";
|
||||
|
||||
import electronLog from "electron-log";
|
||||
const { autoUpdater } = updater;
|
||||
|
||||
autoUpdater.setFeedURL({
|
||||
|
@ -16,6 +16,9 @@ autoUpdater.setFeedURL({
|
|||
repo: "hydra",
|
||||
});
|
||||
|
||||
autoUpdater.logger = electronLog;
|
||||
autoUpdater.logger.transports.file.level = "info";
|
||||
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
if (!gotTheLock) app.quit();
|
||||
|
||||
|
@ -72,8 +75,8 @@ app.whenReady().then(() => {
|
|||
autoUpdater.checkForUpdates().then((r) => {
|
||||
console.log(r);
|
||||
|
||||
WindowManager.splashWindow?.close();
|
||||
WindowManager.createMainWindow();
|
||||
//WindowManager.splashWindow?.close();
|
||||
//WindowManager.createMainWindow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -41,42 +41,25 @@ export class WindowManager {
|
|||
// Load the remote URL for development or the local html file for production.
|
||||
if (is.dev && process.env["ELECTRON_RENDERER_URL"]) {
|
||||
this.splashWindow?.loadURL(
|
||||
`${process.env["ELECTRON_RENDERER_URL"]}#/splash`
|
||||
`${process.env["ELECTRON_RENDERER_URL"]}/splash.html`
|
||||
);
|
||||
} else {
|
||||
this.splashWindow?.loadFile(
|
||||
path.join(__dirname, "../renderer/index.html"),
|
||||
{
|
||||
hash: "splash",
|
||||
}
|
||||
path.join(__dirname, "../renderer/splash.html")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static createSplashScreen() {
|
||||
this.splashWindow = new BrowserWindow({
|
||||
width: 810,
|
||||
height: 610,
|
||||
minWidth: 810,
|
||||
minHeight: 610,
|
||||
titleBarStyle: "hidden",
|
||||
...(process.platform === "linux" ? { icon } : {}),
|
||||
transparent: true,
|
||||
frame: false,
|
||||
alwaysOnTop: true,
|
||||
trafficLightPosition: { x: 16, y: 16 },
|
||||
titleBarOverlay: {
|
||||
symbolColor: "#DADBE1",
|
||||
color: "#151515",
|
||||
height: 34,
|
||||
},
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "../preload/index.mjs"),
|
||||
sandbox: false,
|
||||
},
|
||||
width: 400,
|
||||
height: 400,
|
||||
frame: true,
|
||||
alwaysOnTop: false,
|
||||
});
|
||||
|
||||
this.loadSplashURL();
|
||||
this.splashWindow.removeMenu();
|
||||
}
|
||||
|
||||
public static createMainWindow() {
|
||||
|
|
16
src/renderer/splash.html
Normal file
16
src/renderer/splash.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Hydra</title>
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://steamcdn-a.akamaihd.net https://cdn.cloudflare.steamstatic.com https://cdn2.steamgriddb.com https://cdn.akamai.steamstatic.com; media-src 'self' data: https://steamcdn-a.akamaihd.net https://cdn.cloudflare.steamstatic.com https://cdn2.steamgriddb.com https://cdn.akamai.steamstatic.com;"
|
||||
/>
|
||||
</head>
|
||||
<body style="background-color: #1c1c1c">
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/splash.tsx"></script>
|
||||
</body>
|
||||
</html>
|
BIN
src/renderer/src/assets/icon.png
Normal file
BIN
src/renderer/src/assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 188 KiB |
|
@ -54,7 +54,6 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|||
<Route path="/game/:shop/:objectID" Component={GameDetails} />
|
||||
<Route path="/search" Component={SearchResults} />
|
||||
<Route path="/settings" Component={Settings} />
|
||||
<Route path="/splash" Component={Settings} />
|
||||
</Routes>
|
||||
</App>
|
||||
</HashRouter>
|
||||
|
|
18
src/renderer/src/pages/splash/splash.css.ts
Normal file
18
src/renderer/src/pages/splash/splash.css.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { style } from "@vanilla-extract/css";
|
||||
import { SPACING_UNIT, vars } from "../../theme.css";
|
||||
|
||||
export const main = style({
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: `${SPACING_UNIT * 3}px`,
|
||||
padding: `${SPACING_UNIT * 3}px`,
|
||||
flex: "1",
|
||||
overflowY: "auto",
|
||||
alignItems: "center",
|
||||
});
|
||||
|
||||
export const splashIcon = style({
|
||||
width: "300px",
|
||||
});
|
16
src/renderer/src/pages/splash/splash.tsx
Normal file
16
src/renderer/src/pages/splash/splash.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import icon from "@renderer/assets/icon.png";
|
||||
import * as styles from "./splash.css";
|
||||
import { themeClass } from "../../theme.css";
|
||||
|
||||
import "../../app.css";
|
||||
|
||||
document.body.classList.add(themeClass);
|
||||
|
||||
export default function Splash() {
|
||||
return (
|
||||
<main className={styles.main}>
|
||||
<img src={icon} className={styles.splashIcon} alt="" />
|
||||
<p>Procurando atualizaçoes</p>
|
||||
</main>
|
||||
);
|
||||
}
|
9
src/renderer/src/splash.tsx
Normal file
9
src/renderer/src/splash.tsx
Normal file
|
@ -0,0 +1,9 @@
|
|||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import Splash from "./pages/splash/splash";
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root")!).render(
|
||||
<React.StrictMode>
|
||||
<Splash />
|
||||
</React.StrictMode>
|
||||
);
|
|
@ -2707,6 +2707,11 @@ electron-builder@^24.9.1:
|
|||
simple-update-notifier "2.0.0"
|
||||
yargs "^17.6.2"
|
||||
|
||||
electron-log@^5.1.4:
|
||||
version "5.1.4"
|
||||
resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-5.1.4.tgz#9b7ea4ae1167475f3c9babc5c3d94d54f46dd35a"
|
||||
integrity sha512-P0RSXnwT3z+e89Z5uAcZDeN85/QjIgv764a93kqCi+wh2Jm22CCbc3AGDt4S8rsxAHWHB4Q0PGsQl3fw1AN0kQ==
|
||||
|
||||
electron-publish@24.13.1:
|
||||
version "24.13.1"
|
||||
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-24.13.1.tgz#57289b2f7af18737dc2ad134668cdd4a1b574a0c"
|
||||
|
|
Loading…
Reference in a new issue