mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-22 18:30:09 +00:00
refactor: share directory picker options type
This commit is contained in:
parent
9600ca906c
commit
ebec42ca2a
4 changed files with 12 additions and 13 deletions
6
electron/directory-dialog-options.ts
Normal file
6
electron/directory-dialog-options.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { OpenDialogOptions } from 'electron';
|
||||
|
||||
export type DirectoryDialogOptions = Pick<
|
||||
OpenDialogOptions,
|
||||
'defaultPath' | 'title' | 'message' | 'buttonLabel'
|
||||
>;
|
||||
8
electron/electronAPI.d.ts
vendored
8
electron/electronAPI.d.ts
vendored
|
|
@ -14,6 +14,7 @@ import {
|
|||
PluginNodeScriptResult,
|
||||
PluginManifest,
|
||||
} from '../packages/plugin-api/src/types';
|
||||
import type { DirectoryDialogOptions } from './directory-dialog-options';
|
||||
|
||||
export interface ElectronAPI {
|
||||
on(
|
||||
|
|
@ -153,9 +154,4 @@ export interface ElectronAPI {
|
|||
): Promise<PluginNodeScriptResult>;
|
||||
}
|
||||
|
||||
export interface DirectoryDialogOptions {
|
||||
defaultPath?: string | null;
|
||||
title?: string;
|
||||
message?: string;
|
||||
buttonLabel?: string;
|
||||
}
|
||||
export type { DirectoryDialogOptions } from './directory-dialog-options';
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@ import { IPC } from './shared-with-frontend/ipc-events.const';
|
|||
import { SyncGetRevResult } from '../src/app/imex/sync/sync.model';
|
||||
import { readdirSync, readFileSync, statSync, writeFileSync, unlinkSync } from 'fs';
|
||||
import { error, log } from 'electron-log/main';
|
||||
import { dialog, ipcMain, OpenDialogOptions } from 'electron';
|
||||
import { dialog, ipcMain } from 'electron';
|
||||
import { getWin } from './main-window';
|
||||
|
||||
type DirectoryDialogOptions = Pick<
|
||||
OpenDialogOptions,
|
||||
'defaultPath' | 'title' | 'message' | 'buttonLabel'
|
||||
>;
|
||||
import type { DirectoryDialogOptions } from './directory-dialog-options';
|
||||
|
||||
export const initLocalFileSyncAdapter = (): void => {
|
||||
ipcMain.handle(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ipcRenderer, IpcRendererEvent, webFrame, contextBridge } from 'electron';
|
||||
import { DirectoryDialogOptions, ElectronAPI } from './electronAPI.d';
|
||||
import type { ElectronAPI } from './electronAPI.d';
|
||||
import type { DirectoryDialogOptions } from './directory-dialog-options';
|
||||
import { IPCEventValue } from './shared-with-frontend/ipc-events.const';
|
||||
import { LocalBackupMeta } from '../src/app/imex/local-backup/local-backup.model';
|
||||
import { SyncGetRevResult } from '../src/app/imex/sync/sync.model';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue