diff --git a/app/soapbox/containers/soapbox.tsx b/app/soapbox/containers/soapbox.tsx index 16f977289..ec63d966d 100644 --- a/app/soapbox/containers/soapbox.tsx +++ b/app/soapbox/containers/soapbox.tsx @@ -29,7 +29,6 @@ import { OnboardingWizard, WaitlistPage, } from 'soapbox/features/ui/util/async-components'; -import GlobalHotkeys from 'soapbox/features/ui/util/global-hotkeys'; import { createGlobals } from 'soapbox/globals'; import { useAppSelector, @@ -176,33 +175,31 @@ const SoapboxMount = () => { - - - } - /> - + + } + /> + - - {renderBody()} + + {renderBody()} - - {Component => } - + + {Component => } + - + -
- -
-
-
-
+
+ +
+ +
diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index 040f6c677..ec3231688 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -135,6 +135,7 @@ import { EditGroup, FollowedTags, } from './util/async-components'; +import GlobalHotkeys from './util/global-hotkeys'; import { WrappedRoute } from './util/react-router-helpers'; // Dummy import, to make sure that ends up in the application bundle. @@ -511,60 +512,62 @@ const UI: React.FC = ({ children }) => { }; return ( -
-
+ +
+
- + -
- +
+ - - - {!standalone && } - + + + {!standalone && } + - - {children} - - + + {children} + + - {(me && !shouldHideFAB()) && ( -
- -
- )} + {(me && !shouldHideFAB()) && ( +
+ +
+ )} - {me && ( - + {me && ( + + {Component => } + + )} + + {me && features.chats && ( + + {Component => ( +
+ +
+ )} +
+ )} + + + {Component => } - )} - {me && features.chats && ( - - {Component => ( -
- -
- )} + + {Component => } - )} - - - - {Component => } - - - - {Component => } - +
-
+ ); }; diff --git a/app/soapbox/features/ui/util/global-hotkeys.tsx b/app/soapbox/features/ui/util/global-hotkeys.tsx index aeb4d42fb..e54528a58 100644 --- a/app/soapbox/features/ui/util/global-hotkeys.tsx +++ b/app/soapbox/features/ui/util/global-hotkeys.tsx @@ -36,9 +36,10 @@ const keyMap = { interface IGlobalHotkeys { children: React.ReactNode + node: React.MutableRefObject } -const GlobalHotkeys: React.FC = ({ children }) => { +const GlobalHotkeys: React.FC = ({ children, node }) => { const hotkeys = useRef(null); const history = useHistory(); @@ -48,9 +49,9 @@ const GlobalHotkeys: React.FC = ({ children }) => { const handleHotkeyNew = (e?: KeyboardEvent) => { e?.preventDefault(); - if (!hotkeys.current) return; + if (!node.current) return; - const element = hotkeys.current.querySelector('textarea#compose-textarea') as HTMLTextAreaElement; + const element = node.current.querySelector('textarea#compose-textarea') as HTMLTextAreaElement; if (element) { element.focus(); @@ -59,9 +60,9 @@ const GlobalHotkeys: React.FC = ({ children }) => { const handleHotkeySearch = (e?: KeyboardEvent) => { e?.preventDefault(); - if (!hotkeys.current) return; + if (!node.current) return; - const element = hotkeys.current.querySelector('input#search') as HTMLInputElement; + const element = node.current.querySelector('input#search') as HTMLInputElement; if (element) { element.focus();