|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
|
|
|
|
|
import { PopupWindow, Titlebar, Spinner } from '@vizality/components';
|
|
|
|
|
import React, { memo, useState, useEffect } from 'react';
|
|
|
|
|
import { getModule } from '@vizality/webpack';
|
|
|
|
|
import { getModule, FluxDispatcher } from '@vizality/webpack';
|
|
|
|
|
import { Events } from '@vizality/constants';
|
|
|
|
|
import { API } from '@vizality/entities';
|
|
|
|
|
|
|
|
|
@ -56,9 +56,11 @@ export default class Popups extends API {
|
|
|
|
|
options.top = options.top || y;
|
|
|
|
|
options.left = options.left || x;
|
|
|
|
|
|
|
|
|
|
if (window.popouts.has(popup.popupId)) {
|
|
|
|
|
throw new Error(`Popup with ID "${popup.popupId}" already active!`);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* if (window.popouts.has(popup.popupId)) {
|
|
|
|
|
* throw new Error(`Popup with ID "${popup.popupId}" already active!`);
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const PopupContent = memo(props => {
|
|
|
|
|
const [ loading, setLoading ] = useState(true);
|
|
|
|
@ -86,22 +88,25 @@ export default class Popups extends API {
|
|
|
|
|
allowtransparency={true}
|
|
|
|
|
sandbox={sandbox}
|
|
|
|
|
/>
|
|
|
|
|
: children
|
|
|
|
|
: (
|
|
|
|
|
<div className='vz-popup-content'>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new Promise(() => {
|
|
|
|
|
const popupModule = getModule('setAlwaysOnTop', 'open');
|
|
|
|
|
popupModule.open(`DISCORD_${popup.popupId}`, key => {
|
|
|
|
|
return (
|
|
|
|
|
<PopupWindow windowKey={key} {...popup}>
|
|
|
|
|
<PopupContent windowKey={key} {...popup}>
|
|
|
|
|
{popup.render && !popup.url && <Render {...popup} />}
|
|
|
|
|
</PopupContent>
|
|
|
|
|
</PopupWindow>
|
|
|
|
|
<PopupContent windowKey={key} {...popup}>
|
|
|
|
|
{popup.render && !popup.url && <Render {...popup} />}
|
|
|
|
|
</PopupContent>
|
|
|
|
|
);
|
|
|
|
|
}, options);
|
|
|
|
|
});
|
|
|
|
@ -141,10 +146,4 @@ export default class Popups extends API {
|
|
|
|
|
return this.error(err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stop () {
|
|
|
|
|
this.closeAllPopups();
|
|
|
|
|
this.removeAllListeners();
|
|
|
|
|
delete vizality.api.popups;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|