-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
111 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import { dialog, OpenDialogOptions, SaveDialogOptions, MessageBoxOptions } from "electron" | ||
import { dialog } from "electron" | ||
|
||
export async function showOpenDialog (options: OpenDialogOptions) { | ||
export async function showOpenDialog (options: Electron.OpenDialogOptions) { | ||
return dialog.showOpenDialog(options) | ||
} | ||
|
||
export async function showSaveDialog (options: SaveDialogOptions) { | ||
export async function showSaveDialog (options: Electron.SaveDialogOptions) { | ||
return dialog.showSaveDialog(options) | ||
} | ||
|
||
export async function showMessageBox (options: MessageBoxOptions) { | ||
export async function showMessageBox (options: Electron.MessageBoxOptions) { | ||
return dialog.showMessageBox(options) | ||
} | ||
|
||
export async function showErrorBox (title: string, content: string) { | ||
return dialog.showErrorBox(title, content) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { shell, OpenExternalOptions } from 'electron' | ||
import { shell } from 'electron' | ||
|
||
export function openExternal (url: string, options?: OpenExternalOptions | undefined) { | ||
export function openExternal (url: string, options?: Electron.OpenExternalOptions | undefined) { | ||
return shell.openExternal(url, options) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
import { ipcMain, IpcMainInvokeEvent } from 'electron' | ||
import { showOpenDialog, showSaveDialog, showMessageBox } from '../handles/dialog' | ||
import { ipcMain } from 'electron' | ||
import { showOpenDialog, showSaveDialog, showMessageBox, showErrorBox } from '../handles/dialog' | ||
|
||
export default function addIpcMainHandleFn () { | ||
ipcMain.handle('showOpenDialog', (event: IpcMainInvokeEvent, options: Electron.OpenDialogOptions) => { | ||
ipcMain.handle('showOpenDialog', (event: Electron.IpcMainInvokeEvent, options: Electron.OpenDialogOptions) => { | ||
console.log(event) | ||
return showOpenDialog(options) | ||
}) | ||
|
||
ipcMain.handle('showSaveDialog', (event: IpcMainInvokeEvent, options: Electron.SaveDialogOptions) => { | ||
ipcMain.handle('showSaveDialog', (event: Electron.IpcMainInvokeEvent, options: Electron.SaveDialogOptions) => { | ||
console.log(event) | ||
return showSaveDialog(options) | ||
}) | ||
|
||
ipcMain.handle('showMessageBox', (event: IpcMainInvokeEvent, options: Electron.MessageBoxOptions) => { | ||
ipcMain.handle('showMessageBox', (event: Electron.IpcMainInvokeEvent, options: Electron.MessageBoxOptions) => { | ||
console.log(event) | ||
return showMessageBox(options) | ||
}) | ||
|
||
ipcMain.handle('showErrorBox', (event: Electron.IpcMainInvokeEvent, title: string, content: string) => { | ||
console.log(event) | ||
return showErrorBox(title, content) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
interface localeFile { | ||
[key: string]: string | ||
} | ||
|
||
const modules = import.meta.glob<localeFile>(['./pages/**/*.ts', './en-US.ts', './zh-CN.ts'], { | ||
import: 'default', | ||
eager: true | ||
}) | ||
|
||
const locales = { | ||
'en-US': {}, | ||
'zh-CN': {} | ||
} | ||
|
||
for (const path in modules) { | ||
if (path.includes('en-US')) { | ||
Object.assign(locales['en-US'], modules[path]) | ||
} else if (path.includes('zh-CN')) { | ||
Object.assign(locales['zh-CN'], modules[path]) | ||
} | ||
} | ||
|
||
export default locales |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters