mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 00:43:54 +00:00
feat: trigger welcome modal from electron
This commit is contained in:
committed by
Carlos Valente
parent
22fe65c655
commit
b4eabfae72
@@ -1,6 +1,8 @@
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { addDialog } from '../stores/dialogStore';
|
||||
|
||||
const isElectron = window.process?.type === 'renderer';
|
||||
const ipcRenderer = isElectron ? window.require('electron').ipcRenderer : null;
|
||||
|
||||
@@ -24,6 +26,12 @@ export function useElectronListener() {
|
||||
ipcRenderer.on('request-editor-location', (_event: unknown, location: string) => {
|
||||
navigate(location, { relative: 'route' });
|
||||
});
|
||||
|
||||
ipcRenderer.on('dialog', (_event: unknown, dialog: string) => {
|
||||
if (dialog === 'welcome') {
|
||||
addDialog('welcome');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Clean the listener after the component is dismounted
|
||||
|
||||
Reference in New Issue
Block a user