1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2025-03-28 16:41:35 +01:00
phanpy/src/utils/show-compose.js
Lim Chee Aun acb7084d18 All the updates for Lingui v5
Possibly might break if I accidentally miss something
2024-12-21 15:26:28 +08:00

29 lines
725 B
JavaScript

import { t } from '@lingui/core/macro';
import openOSK from './open-osk';
import showToast from './show-toast';
import states from './states';
const TOAST_DURATION = 5_000; // 5 seconds
export default function showCompose(opts) {
if (!opts) opts = true;
if (states.showCompose) {
if (states.composerState.minimized) {
showToast({
duration: TOAST_DURATION,
text: t`A draft post is currently minimized. Post or discard it before creating a new one.`,
});
} else {
showToast({
duration: TOAST_DURATION,
text: t`A post is currently open. Post or discard it before creating a new one.`,
});
}
return;
}
openOSK();
states.showCompose = opts;
}