From 1030135c9b87221abe39ef198d0ab766d4591ba5 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Tue, 16 Aug 2022 12:29:39 +0300 Subject: [PATCH] Format code to make ongoing refactoring a bit easier Co-authored-by: Janne Savolainen Signed-off-by: Iku-turso --- .../components/layout/top-bar/top-bar.tsx | 172 ++++++++++-------- 1 file changed, 92 insertions(+), 80 deletions(-) diff --git a/src/renderer/components/layout/top-bar/top-bar.tsx b/src/renderer/components/layout/top-bar/top-bar.tsx index b5f79623f2..af46c5d7d0 100644 --- a/src/renderer/components/layout/top-bar/top-bar.tsx +++ b/src/renderer/components/layout/top-bar/top-bar.tsx @@ -33,98 +33,110 @@ interface Dependencies { watchHistoryState: () => () => void; } -const NonInjectedTopBar = observer(({ - items, - items2, - isWindows, - isLinux, - closeWindow, - minimizeWindow, - toggleMaximizeWindow, - watchHistoryState, -}: Dependencies) => { - const elem = useRef(null); +const NonInjectedTopBar = observer( + ({ + items, + items2, + isWindows, + isLinux, + closeWindow, + minimizeWindow, + toggleMaximizeWindow, + watchHistoryState, + }: Dependencies) => { + const elem = useRef(null); - const windowSizeToggle = (evt: React.MouseEvent) => { - if (elem.current === evt.target) { - toggleMaximizeWindow(); - } - }; + const windowSizeToggle = (evt: React.MouseEvent) => { + if (elem.current === evt.target) { + toggleMaximizeWindow(); + } + }; - useEffect(() => watchHistoryState(), []); + useEffect(() => watchHistoryState(), []); - return ( -
-
- {items2.get().map((item) => { - const Component = item.Component; + return ( +
+
+ {items2.get().map((item) => { + const Component = item.Component; - return ; - })} + return ; + })} +
+ +
+ {renderRegisteredItems(items.get())} + + {(isWindows || isLinux) && ( +
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ )} +
-
- {renderRegisteredItems(items.get())} - {(isWindows || isLinux) && ( -
-
- - - -
-
- - - -
-
- - - -
-
- )} -
-
- ); -}); + ); + }, +); -const renderRegisteredItems = (items: TopBarRegistration[]) => ( +const renderRegisteredItems = (items: TopBarRegistration[]) => items.map((registration, index) => { if (!registration?.components?.Item) { return null; } return ; - }) -); + }); export const TopBar = withInjectables(NonInjectedTopBar, { getProps: (di) => ({