Skip to content

Commit fc6acf5

Browse files
committed
chore: comment cleanup
1 parent eded197 commit fc6acf5

2 files changed

Lines changed: 39 additions & 39 deletions

File tree

frontend/apps/web/electron/config.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
align-items: center;
2121
min-height: 100vh;
2222
padding: 20px;
23-
padding-top: 60px; /* macOS 窗口控制按钮区域 */
24-
-webkit-app-region: drag; /* 允许拖拽窗口 */
23+
padding-top: 60px; /* macOS window control button area */
24+
-webkit-app-region: drag; /* Allow window dragging */
2525
}
2626

27-
/* 禁用交互元素的拖拽 */
27+
/* Disable dragging for interactive elements */
2828
input, button, a {
2929
-webkit-app-region: no-drag;
3030
}
@@ -239,7 +239,7 @@
239239
animation: slideUp 300ms ease-out 100ms backwards;
240240
}
241241

242-
/* 按钮悬停动画 */
242+
/* Button hover animation */
243243
.btn-primary {
244244
position: relative;
245245
overflow: hidden;
@@ -268,7 +268,7 @@
268268
z-index: 1;
269269
}
270270

271-
/* 状态消息动画 */
271+
/* Status message animation */
272272
.status {
273273
animation: slideUp 300ms ease-out;
274274
}

frontend/apps/web/electron/main.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ let configWindow: BrowserWindow | null = null
3636

3737
const isDev = process.env.NODE_ENV === 'development' || !app.isPackaged
3838

39-
// 创建应用菜单
39+
// Create application menu
4040
function createApplicationMenu() {
4141
const isMac = process.platform === 'darwin'
4242

4343
const template: Electron.MenuItemConstructorOptions[] = [
44-
// macOS 专用的应用菜单
44+
// macOS-specific app menu
4545
...(isMac
4646
? [
4747
{
@@ -66,7 +66,7 @@ function createApplicationMenu() {
6666
}
6767
]
6868
: []),
69-
// 文件菜单
69+
// File menu
7070
{
7171
label: 'File',
7272
submenu: [
@@ -83,7 +83,7 @@ function createApplicationMenu() {
8383
isMac ? { role: 'close' as const } : { role: 'quit' as const }
8484
]
8585
},
86-
// 编辑菜单
86+
// Edit menu
8787
{
8888
label: 'Edit',
8989
submenu: [
@@ -102,7 +102,7 @@ function createApplicationMenu() {
102102
: [{ role: 'delete' as const }, { type: 'separator' as const }, { role: 'selectAll' as const }])
103103
]
104104
},
105-
// 视图菜单
105+
// View menu
106106
{
107107
label: 'View',
108108
submenu: [
@@ -117,7 +117,7 @@ function createApplicationMenu() {
117117
{ role: 'togglefullscreen' as const }
118118
]
119119
},
120-
// 窗口菜单
120+
// Window menu
121121
{
122122
label: 'Window',
123123
submenu: [
@@ -134,7 +134,7 @@ function createApplicationMenu() {
134134
Menu.setApplicationMenu(menu)
135135
}
136136

137-
// 检查后端连接
137+
// Check backend connection
138138
async function checkBackendConnection(apiUrl: string): Promise<boolean> {
139139
try {
140140
const controller = new AbortController()
@@ -152,11 +152,11 @@ async function checkBackendConnection(apiUrl: string): Promise<boolean> {
152152
}
153153
}
154154

155-
// 创建配置窗口
155+
// Create configuration window
156156
function createConfigWindow() {
157157
console.log('[Main] Creating config window...')
158158

159-
// 如果配置窗口已经打开,则聚焦它
159+
// If config window is already open, focus it
160160
if (configWindow) {
161161
configWindow.focus()
162162
return
@@ -179,21 +179,21 @@ function createConfigWindow() {
179179
},
180180
title: 'Glean - Backend Configuration',
181181
backgroundColor: '#1a1a1a',
182-
show: false, // 先不显示,等加载完后再显示以实现淡入效果
182+
show: false, // Don't show initially, wait for fade-in animation after loading
183183
center: true,
184-
opacity: 0 // 初始透明度为 0
184+
opacity: 0 // Initial opacity is 0
185185
})
186186

187-
// 加载配置页面
187+
// Load configuration page
188188
configWindow.loadFile(path.join(__dirname, '../electron/config.html'))
189189

190-
// 页面加载完成后,使用淡入动画显示窗口
190+
// Show window with fade-in animation after page loads
191191
configWindow.once('ready-to-show', () => {
192192
if (!configWindow) return
193193

194194
configWindow.show()
195195

196-
// 淡入动画 (从 0 到 1,持续 300ms)
196+
// Fade-in animation (from 0 to 1, lasting 300ms)
197197
let opacity = 0
198198
const fadeIn = setInterval(() => {
199199
opacity += 0.05
@@ -238,57 +238,57 @@ function createWindow() {
238238
backgroundColor: '#1a1a1a'
239239
})
240240

241-
// 添加超时保护:如果 5 秒后窗口还没显示,强制显示
241+
// Add timeout protection: force show window if not shown after 5 seconds
242242
const showTimeout = setTimeout(() => {
243243
if (mainWindow && !mainWindow.isVisible()) {
244244
console.warn('[Main] Window did not show after 5s, forcing show...')
245245
mainWindow.show()
246246
}
247247
}, 5000)
248248

249-
// 窗口准备好后显示,避免闪烁
249+
// Show window when ready to avoid flickering
250250
mainWindow.once('ready-to-show', () => {
251251
console.log('[Main] Window ready to show')
252252
clearTimeout(showTimeout)
253253
mainWindow?.show()
254254
})
255255

256-
// 监听加载失败
256+
// Listen for load failures
257257
mainWindow.webContents.on('did-fail-load', (_event, errorCode, errorDescription, validatedURL) => {
258258
console.error('[Main] Failed to load:', validatedURL)
259259
console.error('[Main] Error:', errorCode, errorDescription)
260-
// 即使加载失败也显示窗口,这样用户可以看到错误
260+
// Show window even on load failure so user can see the error
261261
if (mainWindow && !mainWindow.isVisible()) {
262262
mainWindow.show()
263263
}
264264
})
265265

266-
// 监听加载成功
266+
// Listen for load success
267267
mainWindow.webContents.on('did-finish-load', () => {
268268
console.log('[Main] Page loaded successfully')
269269
})
270270

271-
// 加载应用
271+
// Load application
272272
const loadUrl = isDev ? 'http://localhost:3000' : path.join(__dirname, '../dist/index.html')
273273
console.log('[Main] Loading URL:', loadUrl)
274274

275275
if (isDev) {
276-
// 开发模式:加载 Vite 开发服务器
276+
// Development mode: load Vite dev server
277277
mainWindow.loadURL('http://localhost:3000').catch(err => {
278278
console.error('[Main] Failed to load dev server:', err)
279-
// 显示错误信息给用户
279+
// Show error to user
280280
mainWindow?.show()
281281
})
282282
mainWindow.webContents.openDevTools()
283283
} else {
284-
// 生产模式:加载打包后的文件
284+
// Production mode: load built files
285285
mainWindow.loadFile(path.join(__dirname, '../dist/index.html')).catch(err => {
286286
console.error('[Main] Failed to load file:', err)
287287
mainWindow?.show()
288288
})
289289
}
290290

291-
// 在外部浏览器打开链接
291+
// Open links in external browser
292292
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
293293
if (url.startsWith('http://') || url.startsWith('https://')) {
294294
shell.openExternal(url)
@@ -302,18 +302,18 @@ function createWindow() {
302302
})
303303
}
304304

305-
// 应用准备就绪
305+
// App ready
306306
app.whenReady().then(async () => {
307307
console.log('[Main] App ready, checking backend connection...')
308308

309-
// 创建应用菜单
309+
// Create application menu
310310
createApplicationMenu()
311311

312-
// 获取配置的 API URL
312+
// Get configured API URL
313313
const apiUrl = store.get('apiUrl')
314314
console.log('[Main] Configured API URL:', apiUrl)
315315

316-
// 检查后端连接
316+
// Check backend connection
317317
const isConnected = await checkBackendConnection(apiUrl)
318318

319319
if (isConnected) {
@@ -325,15 +325,15 @@ app.whenReady().then(async () => {
325325
}
326326

327327
app.on('activate', () => {
328-
// macOS: 点击 dock 图标时重新创建窗口
328+
// macOS: Recreate window when dock icon is clicked
329329
const windows = BrowserWindow.getAllWindows()
330330
if (windows.length === 0) {
331331
createWindow()
332332
}
333333
})
334334
})
335335

336-
// 所有窗口关闭时退出(macOS 除外)
336+
// Exit when all windows are closed (except on macOS)
337337
app.on('window-all-closed', () => {
338338
if (process.platform !== 'darwin') {
339339
app.quit()
@@ -366,23 +366,23 @@ ipcMain.handle('get-platform', () => {
366366
}
367367
})
368368

369-
// IPC 通信处理:打开主窗口(从配置窗口调用)
369+
// IPC handler: open main window (called from config window)
370370
ipcMain.on('open-main-window', () => {
371371
console.log('[Main] Received request to open main window')
372372

373-
// 关闭配置窗口
373+
// Close config window
374374
if (configWindow) {
375375
configWindow.close()
376376
configWindow = null
377377
}
378378

379-
// 打开主窗口
379+
// Open main window
380380
if (!mainWindow) {
381381
createWindow()
382382
}
383383
})
384384

385-
// IPC 通信处理:打开配置窗口(从主窗口或菜单调用)
385+
// IPC handler: open config window (called from main window or menu)
386386
ipcMain.on('open-config-window', () => {
387387
console.log('[Main] Received request to open config window')
388388
createConfigWindow()

0 commit comments

Comments
 (0)