feat: add curriculum management admin dashboard with AI generation and draft approval workflows

This commit is contained in:
RaymondVerhoef
2026-05-24 23:09:58 +02:00
parent b07c4808a6
commit 967c68d27d
6 changed files with 186 additions and 6 deletions

View File

@@ -0,0 +1,22 @@
import { useEffect } from 'react';
/**
* Prevent accidental tab/window closure while a long-running operation
* is in progress. Shows the browser's native "Leave site?" confirmation.
*
* @param {boolean} active — true while the operation is running
*/
export function useBeforeUnload(active) {
useEffect(() => {
if (!active) return;
const handler = (e) => {
e.preventDefault();
// Legacy browsers require returnValue to be set
e.returnValue = '';
};
window.addEventListener('beforeunload', handler);
return () => window.removeEventListener('beforeunload', handler);
}, [active]);
}