Exam generation rework, batch user tables, fastapi endpoint switch
This commit is contained in:
20
src/utils/popout.ts
Normal file
20
src/utils/popout.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { NextRouter } from "next/router";
|
||||
|
||||
const openDetachedTab = (uri: string, router: NextRouter, name = 'ExamPreview', width = 1000, height = 600) => {
|
||||
const left = (window.screen.width - width) / 2;
|
||||
const top = (window.screen.height - height) / 2;
|
||||
|
||||
const features = `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes,status=yes`;
|
||||
const url = router.basePath + `/${uri}`;
|
||||
const newWindow = window.open(url, name, features);
|
||||
|
||||
if (newWindow) {
|
||||
newWindow.focus();
|
||||
} else {
|
||||
alert('Pop-up blocker may have prevented opening the new window. Please check your browser settings.');
|
||||
}
|
||||
|
||||
return newWindow;
|
||||
}
|
||||
|
||||
export default openDetachedTab;
|
||||
Reference in New Issue
Block a user