mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-05-30 15:11:28 +00:00
Merge pull request #40 from Jasonzhu1207/refactor/ui-rebuild
Refactor/UI rebuild
This commit is contained in:
@@ -1001,6 +1001,8 @@ function createAgreementWindow() {
|
||||
*/
|
||||
function createSplashWindow(): BrowserWindow {
|
||||
const isDev = !!process.env.VITE_DEV_SERVER_URL
|
||||
const splashThemeId = configService?.get('themeId') || 'cloud-dancer'
|
||||
const splashThemeMode = configService?.get('theme') || 'system'
|
||||
const iconPath = isDev
|
||||
? join(__dirname, '../public/icon.ico')
|
||||
: (process.platform === 'darwin'
|
||||
@@ -1008,7 +1010,7 @@ function createSplashWindow(): BrowserWindow {
|
||||
: join(process.resourcesPath, 'icon.ico'))
|
||||
|
||||
splashWindow = new BrowserWindow({
|
||||
width: 760,
|
||||
width: 680,
|
||||
height: 460,
|
||||
resizable: false,
|
||||
frame: false,
|
||||
@@ -1027,9 +1029,17 @@ function createSplashWindow(): BrowserWindow {
|
||||
})
|
||||
|
||||
if (isDev) {
|
||||
splashWindow.loadURL(`${process.env.VITE_DEV_SERVER_URL}splash.html`)
|
||||
const splashUrl = new URL('splash.html', process.env.VITE_DEV_SERVER_URL)
|
||||
splashUrl.searchParams.set('themeId', splashThemeId)
|
||||
splashUrl.searchParams.set('themeMode', splashThemeMode)
|
||||
splashWindow.loadURL(splashUrl.toString())
|
||||
} else {
|
||||
splashWindow.loadFile(join(__dirname, '../dist/splash.html'))
|
||||
splashWindow.loadFile(join(__dirname, '../dist/splash.html'), {
|
||||
query: {
|
||||
themeId: splashThemeId,
|
||||
themeMode: splashThemeMode
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
splashWindow.once('ready-to-show', () => {
|
||||
@@ -1309,9 +1319,6 @@ function createChatHistoryRouteWindow(route: string) {
|
||||
? join(process.resourcesPath, 'icon.icns')
|
||||
: join(process.resourcesPath, 'icon.ico'))
|
||||
|
||||
// 根据系统主题设置窗口背景色
|
||||
const isDark = nativeTheme.shouldUseDarkColors
|
||||
|
||||
const win = new BrowserWindow({
|
||||
width: 600,
|
||||
height: 800,
|
||||
@@ -1326,13 +1333,31 @@ function createChatHistoryRouteWindow(route: string) {
|
||||
titleBarStyle: 'hidden',
|
||||
titleBarOverlay: false,
|
||||
show: false,
|
||||
backgroundColor: isDark ? '#1A1A1A' : '#F0F0F0',
|
||||
backgroundColor: '#FFFFFF',
|
||||
autoHideMenuBar: true
|
||||
})
|
||||
setupCustomTitleBarWindow(win)
|
||||
|
||||
win.once('ready-to-show', () => {
|
||||
let hasShown = false
|
||||
let isReadyToShow = false
|
||||
let hasLoadedRoute = false
|
||||
const showChatHistoryWindow = () => {
|
||||
if (hasShown || !isReadyToShow || !hasLoadedRoute || win.isDestroyed()) return
|
||||
hasShown = true
|
||||
win.show()
|
||||
}
|
||||
|
||||
win.webContents.once('did-finish-load', () => {
|
||||
hasLoadedRoute = true
|
||||
setTimeout(showChatHistoryWindow, 30)
|
||||
})
|
||||
win.webContents.once('did-fail-load', () => {
|
||||
hasLoadedRoute = true
|
||||
showChatHistoryWindow()
|
||||
})
|
||||
win.once('ready-to-show', () => {
|
||||
isReadyToShow = true
|
||||
showChatHistoryWindow()
|
||||
})
|
||||
|
||||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
|
||||
Reference in New Issue
Block a user