this repo has no description
1import { t } from '@lingui/core/macro';
2
3export default function openCompose(opts) {
4 const url = URL.parse('./compose/', window.location);
5 const { width: screenWidth, height: screenHeight } = window.screen;
6 const left = Math.max(0, (screenWidth - 600) / 2);
7 const top = Math.max(0, (screenHeight - 450) / 2);
8 const width = Math.min(screenWidth, 600);
9 const height = Math.min(screenHeight, 450);
10 const winUID = opts?.uid || Math.random();
11 const newWin = window.open(
12 url,
13 'compose' + winUID,
14 `width=${width},height=${height},left=${left},top=${top}`,
15 );
16
17 if (newWin) {
18 // if (masto) {
19 // newWin.masto = masto;
20 // }
21
22 newWin.__COMPOSE__ = opts;
23 } else {
24 alert(t`Looks like your browser is blocking popups.`);
25 }
26
27 return newWin;
28}