From 7a85ef413b445e1f0f9ee9992e708b5c7d135382 Mon Sep 17 00:00:00 2001 From: mkljczk Date: Wed, 4 Dec 2024 17:08:11 +0100 Subject: [PATCH] pl-fe: cleanup Signed-off-by: mkljczk --- .../scheduled-status-action-bar.tsx | 25 ++++++++----------- .../src/features/status/components/thread.tsx | 18 ++++++------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status-action-bar.tsx b/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status-action-bar.tsx index 3f3e20124..e656a95b1 100644 --- a/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status-action-bar.tsx +++ b/packages/pl-fe/src/features/scheduled-statuses/components/scheduled-status-action-bar.tsx @@ -29,20 +29,17 @@ const ScheduledStatusActionBar: React.FC = ({ status const { settings } = useSettingsStore(); const handleCancelClick = () => { - dispatch((_, getState) => { - - const deleteModal = settings.deleteModal; - if (!deleteModal) { - dispatch(cancelScheduledStatus(status.id)); - } else { - openModal('CONFIRM', { - heading: intl.formatMessage(messages.deleteHeading), - message: intl.formatMessage(messages.deleteMessage), - confirm: intl.formatMessage(messages.deleteConfirm), - onConfirm: () => dispatch(cancelScheduledStatus(status.id)), - }); - } - }); + const deleteModal = settings.deleteModal; + if (!deleteModal) { + dispatch(cancelScheduledStatus(status.id)); + } else { + openModal('CONFIRM', { + heading: intl.formatMessage(messages.deleteHeading), + message: intl.formatMessage(messages.deleteMessage), + confirm: intl.formatMessage(messages.deleteConfirm), + onConfirm: () => dispatch(cancelScheduledStatus(status.id)), + }); + } }; return ( diff --git a/packages/pl-fe/src/features/status/components/thread.tsx b/packages/pl-fe/src/features/status/components/thread.tsx index 8272561c6..0bd25a125 100644 --- a/packages/pl-fe/src/features/status/components/thread.tsx +++ b/packages/pl-fe/src/features/status/components/thread.tsx @@ -143,18 +143,16 @@ const Thread: React.FC = ({ const handleModalReblog = (status: Pick) => dispatch(reblog(status)); const handleReblogClick = (status: SelectedStatus, e?: React.MouseEvent) => { - dispatch((_, getState) => { - const boostModal = settings.boostModal; - if (status.reblogged) { - dispatch(unreblog(status)); + const boostModal = settings.boostModal; + if (status.reblogged) { + dispatch(unreblog(status)); + } else { + if ((e && e.shiftKey) || !boostModal) { + handleModalReblog(status); } else { - if ((e && e.shiftKey) || !boostModal) { - handleModalReblog(status); - } else { - openModal('BOOST', { statusId: status.id, onReblog: handleModalReblog }); - } + openModal('BOOST', { statusId: status.id, onReblog: handleModalReblog }); } - }); + } }; const handleMentionClick = (account: Pick) => dispatch(mentionCompose(account));