add: background, custom topbar

This commit is contained in:
2025-07-07 04:41:17 +05:00
parent 261b9ac253
commit 76917e3f90
11 changed files with 291 additions and 28 deletions

View File

@ -61,21 +61,25 @@ const LaunchPage = ({ launchOptions }: LaunchPageProps) => {
setDownloadProgress(progress);
setBuffer(Math.min(progress + 10, 100));
};
const statusListener = (...args: unknown[]) => {
const status = args[0] as { step: string; message: string };
setInstallStep(status.step);
setInstallMessage(status.message);
};
window.electron.ipcRenderer.on('download-progress', progressListener);
window.electron.ipcRenderer.on(
'installation-status',
(...args: unknown[]) => {
const status = args[0] as { step: string; message: string };
setInstallStep(status.step);
setInstallMessage(status.message);
},
);
window.electron.ipcRenderer.on('installation-status', statusListener);
return () => {
window.electron.ipcRenderer.removeAllListeners('download-progress');
window.electron.ipcRenderer.removeAllListeners('installation-progress');
window.electron.ipcRenderer.removeAllListeners('installation-status');
// Удаляем только конкретных слушателей, а не всех
// Это безопаснее, чем removeAllListeners
const cleanup = window.electron.ipcRenderer.on;
if (typeof cleanup === 'function') {
cleanup('download-progress', progressListener);
cleanup('installation-status', statusListener);
}
// Удаляем использование removeAllListeners
};
}, [navigate]);