From 04be5e7f123a7cf7efbb163addfce889708f3010 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 3 Jan 2025 10:24:50 +0100 Subject: [PATCH] [Glitch] Add `t` hotkey for post translations Port 79a9069debe67d099f9fc7c9725f3df01f50131f to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/components/status.jsx | 1 + .../flavours/glitch/features/keyboard_shortcuts/index.jsx | 4 ++++ app/javascript/flavours/glitch/features/status/index.jsx | 5 +++++ app/javascript/flavours/glitch/features/ui/index.jsx | 1 + 4 files changed, 11 insertions(+) diff --git a/app/javascript/flavours/glitch/components/status.jsx b/app/javascript/flavours/glitch/components/status.jsx index 8eb97ac2a3..4e24a3e288 100644 --- a/app/javascript/flavours/glitch/components/status.jsx +++ b/app/javascript/flavours/glitch/components/status.jsx @@ -473,6 +473,7 @@ class Status extends ImmutablePureComponent { bookmark: this.handleHotkeyBookmark, toggleSensitive: this.handleHotkeyToggleSensitive, openMedia: this.handleHotkeyOpenMedia, + onTranslate: this.handleTranslate, }; let prepend, rebloggedByText; diff --git a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx index 8e5b4a9ea8..81fd947abd 100644 --- a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx +++ b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.jsx @@ -70,6 +70,10 @@ class KeyboardShortcuts extends ImmutablePureComponent { enter, o + + t + + e diff --git a/app/javascript/flavours/glitch/features/status/index.jsx b/app/javascript/flavours/glitch/features/status/index.jsx index e977f02b7f..0247b67f81 100644 --- a/app/javascript/flavours/glitch/features/status/index.jsx +++ b/app/javascript/flavours/glitch/features/status/index.jsx @@ -485,6 +485,10 @@ class Status extends ImmutablePureComponent { this.props.history.push(`/@${this.props.status.getIn(['account', 'acct'])}`); }; + handleHotkeyTranslate = () => { + this.handleTranslate(this.props.status); + }; + handleMoveUp = id => { const { status, ancestorsIds, descendantsIds } = this.props; @@ -677,6 +681,7 @@ class Status extends ImmutablePureComponent { toggleHidden: this.handleToggleHidden, toggleSensitive: this.handleHotkeyToggleSensitive, openMedia: this.handleHotkeyOpenMedia, + onTranslate: this.handleHotkeyTranslate, }; return ( diff --git a/app/javascript/flavours/glitch/features/ui/index.jsx b/app/javascript/flavours/glitch/features/ui/index.jsx index ac29cee836..96a8fe89a3 100644 --- a/app/javascript/flavours/glitch/features/ui/index.jsx +++ b/app/javascript/flavours/glitch/features/ui/index.jsx @@ -136,6 +136,7 @@ const keyMap = { bookmark: 'd', toggleSensitive: 'h', openMedia: 'e', + onTranslate: 't', }; class SwitchingColumnsArea extends PureComponent {