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>
This commit is contained in:
28
src/shared/util/openReportWindow.ts
Normal file
28
src/shared/util/openReportWindow.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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,
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user