mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-26 21:25:18 +01:00
Remove showOpen
This commit is contained in:
parent
dcb5531038
commit
8914809775
1 changed files with 5 additions and 11 deletions
|
@ -126,30 +126,24 @@ const Messaging = (props) => {
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const [dialogKey, setDialogKey] = useState(0);
|
const [dialogKey, setDialogKey] = useState(0);
|
||||||
const [dialogOpenMode, setDialogOpenMode] = useState("");
|
const [dialogOpenMode, setDialogOpenMode] = useState("");
|
||||||
const [showDialog, setShowDialog] = useState(false);
|
|
||||||
const [showDropZone, setShowDropZone] = useState(false);
|
const [showDropZone, setShowDropZone] = useState(false);
|
||||||
|
|
||||||
const subscription = props.selected;
|
const subscription = props.selected;
|
||||||
const selectedTopicUrl = (subscription) ? topicUrl(subscription.baseUrl, subscription.topic) : "";
|
const selectedTopicUrl = (subscription) ? topicUrl(subscription.baseUrl, subscription.topic) : "";
|
||||||
|
|
||||||
const handleWindowDragEnter = () => {
|
|
||||||
setDialogOpenMode(prev => (prev) ? prev : SendDialog.OPEN_MODE_DRAG); // Only update if not already open
|
|
||||||
setShowDialog(true);
|
|
||||||
setShowDropZone(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener('dragenter', handleWindowDragEnter);
|
window.addEventListener('dragenter', () => {
|
||||||
|
setDialogOpenMode(prev => (prev) ? prev : SendDialog.OPEN_MODE_DRAG); // Only update if not already open
|
||||||
|
setShowDropZone(true);
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleOpenDialogClick = () => {
|
const handleOpenDialogClick = () => {
|
||||||
setDialogOpenMode(SendDialog.OPEN_MODE_DEFAULT);
|
setDialogOpenMode(SendDialog.OPEN_MODE_DEFAULT);
|
||||||
setShowDialog(true);
|
|
||||||
setShowDropZone(false);
|
setShowDropZone(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSendDialogClose = () => {
|
const handleSendDialogClose = () => {
|
||||||
setShowDialog(false);
|
|
||||||
setShowDropZone(false);
|
setShowDropZone(false);
|
||||||
setDialogOpenMode("");
|
setDialogOpenMode("");
|
||||||
setDialogKey(prev => prev+1);
|
setDialogKey(prev => prev+1);
|
||||||
|
@ -167,7 +161,7 @@ const Messaging = (props) => {
|
||||||
key={`sendDialog${dialogKey}`} // Resets dialog when canceled/closed
|
key={`sendDialog${dialogKey}`} // Resets dialog when canceled/closed
|
||||||
topicUrl={selectedTopicUrl}
|
topicUrl={selectedTopicUrl}
|
||||||
message={message}
|
message={message}
|
||||||
open={showDialog}
|
open={!!dialogOpenMode}
|
||||||
openMode={dialogOpenMode}
|
openMode={dialogOpenMode}
|
||||||
dropZone={showDropZone}
|
dropZone={showDropZone}
|
||||||
onClose={handleSendDialogClose}
|
onClose={handleSendDialogClose}
|
||||||
|
|
Loading…
Reference in a new issue