import './index.css'; import './app.css'; import '@github/time-elements'; import { render } from 'preact'; import { useEffect, useState } from 'preact/hooks'; import Compose from './components/compose'; if (window.opener) { console = window.opener.console; } function App() { const [uiState, setUIState] = useState('default'); const { editStatus, replyToStatus, draftStatus } = window.__COMPOSE__ || {}; useEffect(() => { if (uiState === 'closed') { window.close(); } }, [uiState]); if (uiState === 'closed') { return (

You may close this page now.

); } return ( { const { newStatus, fn = () => {} } = results || {}; try { if (newStatus) { window.opener.__STATES__.reloadStatusPage++; } fn(); setUIState('closed'); } catch (e) {} }} /> ); } render(, document.getElementById('app-standalone'));