Files
UT-Registration-Plus/src/shared/util/openReportWindow.ts
Sriram Hariharan 65ff6bfbbf feat: report issue popup (#261)
* feat: report issue popup

* style: modified styles in feedback form

* chore: minor UI fixes

* chore: update useEffect

* chore: change width to 400px

---------

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
Co-authored-by: Isaiah David Rodriguez <51803892+IsaDavRod@users.noreply.github.com>
2024-10-12 20:31:26 -05:00

29 lines
918 B
TypeScript

/**
* Open the report window relative centered to the current window.
*/
export function openReportWindow() {
chrome.windows.getCurrent({ populate: false }, currentWindow => {
const width = 400;
const height = 600;
// Calculate the new window's position to center it relative to the current window
const left =
currentWindow.left && currentWindow.width
? Math.round(currentWindow.left + (currentWindow.width - width) / 2)
: undefined;
const top =
currentWindow.top && currentWindow.height
? Math.round(currentWindow.top + (currentWindow.height - height) / 2)
: undefined;
chrome.windows.create({
url: chrome.runtime.getURL(`report.html`),
type: 'popup',
width,
height,
left,
top,
});
});
}