pl-fe: why this was a function

Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
mkljczk
2025-03-02 17:52:43 +01:00
parent c3c35c7517
commit 2a5106fb1f

View File

@ -217,18 +217,6 @@ const Notification: React.FC<INotification> = (props) => {
const { accounts } = notification;
const account = accounts[0];
const getHandlers = () => ({
reply: handleReply,
favourite: handleHotkeyFavourite,
boost: handleHotkeyBoost,
mention: handleMention,
open: handleOpen,
openProfile: handleOpenProfile,
moveUp: handleMoveUp,
moveDown: handleMoveDown,
toggleSensitive: handleHotkeyToggleSensitive,
});
const handleOpen = () => {
if (status && typeof status === 'object' && account && typeof account === 'object') {
history.push(`/@${account.acct}/posts/${status.id}`);
@ -307,6 +295,18 @@ const Notification: React.FC<INotification> = (props) => {
}
};
const handlers = {
reply: handleReply,
favourite: handleHotkeyFavourite,
boost: handleHotkeyBoost,
mention: handleMention,
open: handleOpen,
openProfile: handleOpenProfile,
moveUp: handleMoveUp,
moveDown: handleMoveDown,
toggleSensitive: handleHotkeyToggleSensitive,
};
const displayedType = notification.type === 'mention' && (notification.subtype === 'reply' || status?.in_reply_to_account_id === me) ? 'reply' : notification.type;
const renderIcon = (): React.ReactNode => {
@ -402,7 +402,7 @@ const Notification: React.FC<INotification> = (props) => {
);
return (
<HotKeys handlers={getHandlers()} data-testid='notification'>
<HotKeys handlers={handlers} data-testid='notification'>
<div
className='notification focusable'
tabIndex={0}