···11+import openOSK from './open-osk';
22+import showToast from './show-toast';
33+import states from './states';
44+55+const TOAST_DURATION = 5_000; // 5 seconds
66+77+export default function showCompose(opts) {
88+ if (!opts) opts = true;
99+1010+ if (states.showCompose) {
1111+ if (states.composerState.minimized) {
1212+ showToast({
1313+ duration: TOAST_DURATION,
1414+ text: `A draft post is currently minimized. Post or discard it before creating a new one.`,
1515+ });
1616+ } else {
1717+ showToast({
1818+ duration: TOAST_DURATION,
1919+ text: `A post is currently open. Post or discard it before creating a new one.`,
2020+ });
2121+ }
2222+ return;
2323+ }
2424+2525+ openOSK();
2626+ states.showCompose = opts;
2727+}