From 747a92f7eb6b1a6a2e36d5d49c7330b81e43e020 Mon Sep 17 00:00:00 2001 From: lecepin <383810086@qq.com> Date: Fri, 20 May 2022 20:23:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/index.js | 13 ++--- package.json | 4 +- src/App.css | 38 -------------- src/App.jsx | 33 +++--------- src/App.less | 2 + src/fsm.js | 126 ++++++++++++++++++++++++++++++++++++++++++++++ src/index.css | 11 ---- src/index.js | 1 - 8 files changed, 142 insertions(+), 86 deletions(-) delete mode 100644 src/App.css create mode 100644 src/App.less create mode 100644 src/fsm.js delete mode 100644 src/index.css diff --git a/electron/index.js b/electron/index.js index 8e38b8c..eac6844 100644 --- a/electron/index.js +++ b/electron/index.js @@ -1,4 +1,4 @@ -import { app, BrowserWindow } from 'electron'; +import { app, BrowserWindow, Menu } from 'electron'; import log from 'electron-log'; import CONFIG from './const'; import { checkUpdate } from './utils'; @@ -8,7 +8,7 @@ import { installCert } from './cert'; app.commandLine.appendSwitch('--no-proxy-server'); function createWindow() { - // electron.Menu.setApplicationMenu(null); + Menu.setApplicationMenu(null); checkUpdate( 'https://cdn.jsdelivr.net/gh/lecepin/electron-react-tpl/package.json', 'https://github.com/lecepin/electron-react-tpl/releases', @@ -26,15 +26,8 @@ function createWindow() { }, }); - mainWindow.loadURL('https://baidu.com' ?? CONFIG.APP_START_URL); + mainWindow.loadURL(CONFIG.APP_START_URL); CONFIG.IS_DEV && mainWindow.webContents.openDevTools(); - installCert() - .then(data => { - console.log('install cert success', data); - }) - .catch(err => { - log.error('err', err); - }); } app.whenReady().then(() => { diff --git a/package.json b/package.json index 5accc21..f8af5ed 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "webpack-cli": "^4.9.2" }, "dependencies": { + "@xstate/react": "^3.0.0", "axios": "^0.27.2", "electron-is-dev": "^2.0.0", "electron-log": "^4.4.7", @@ -57,7 +58,8 @@ "react-dom": "^18.1.0", "regedit": "^5.1.1", "semver": "^7.3.7", - "sudo-prompt": "^9.2.1" + "sudo-prompt": "^9.2.1", + "xstate": "^4.32.1" }, "author": "lecepin", "license": "ISC", diff --git a/src/App.css b/src/App.css deleted file mode 100644 index 74b5e05..0000000 --- a/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/src/App.jsx b/src/App.jsx index c74eb8d..4819a8c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,30 +1,13 @@ -import logo from './logo.png'; -import { shell } from 'electron'; -import './App.css'; +import { useMachine } from '@xstate/react'; +import fsm from './fsm'; + +import './App.less'; function App() { - return ( -
- Edit src/App.js
and save to reload.
-