1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Format code to make ongoing refactoring a bit easier

Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
Iku-turso 2022-08-16 12:29:39 +03:00 committed by Janne Savolainen
parent b14400dd65
commit 1030135c9b
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A

View File

@ -33,7 +33,8 @@ interface Dependencies {
watchHistoryState: () => () => void; watchHistoryState: () => () => void;
} }
const NonInjectedTopBar = observer(({ const NonInjectedTopBar = observer(
({
items, items,
items2, items2,
isWindows, isWindows,
@ -57,7 +58,8 @@ const NonInjectedTopBar = observer(({
<div <div
className={styles.topBar} className={styles.topBar}
onDoubleClick={windowSizeToggle} onDoubleClick={windowSizeToggle}
ref={elem}> ref={elem}
>
<div className={styles.items}> <div className={styles.items}>
{items2.get().map((item) => { {items2.get().map((item) => {
const Component = item.Component; const Component = item.Component;
@ -65,10 +67,16 @@ const NonInjectedTopBar = observer(({
return <Component key={item.id} />; return <Component key={item.id} />;
})} })}
</div> </div>
<div className={styles.items}> <div className={styles.items}>
{renderRegisteredItems(items.get())} {renderRegisteredItems(items.get())}
{(isWindows || isLinux) && ( {(isWindows || isLinux) && (
<div className={cssNames(styles.windowButtons, { [styles.linuxButtons]: isLinux })}> <div
className={cssNames(styles.windowButtons, {
[styles.linuxButtons]: isLinux,
})}
>
<div <div
className={styles.minimize} className={styles.minimize}
data-testid="window-minimize" data-testid="window-minimize"
@ -80,10 +88,10 @@ const NonInjectedTopBar = observer(({
width="10" width="10"
height="1" height="1"
x="1" x="1"
y="9" y="9" />
/>
</svg> </svg>
</div> </div>
<div <div
className={styles.maximize} className={styles.maximize}
data-testid="window-maximize" data-testid="window-maximize"
@ -100,13 +108,17 @@ const NonInjectedTopBar = observer(({
/> />
</svg> </svg>
</div> </div>
<div <div
className={styles.close} className={styles.close}
data-testid="window-close" data-testid="window-close"
onClick={closeWindow} onClick={closeWindow}
> >
<svg shapeRendering="crispEdges" viewBox="0 0 12 12"> <svg shapeRendering="crispEdges" viewBox="0 0 12 12">
<polygon fill="currentColor" points="11 1.576 6.583 6 11 10.424 10.424 11 6 6.583 1.576 11 1 10.424 5.417 6 1 1.576 1.576 1 6 5.417 10.424 1" /> <polygon
fill="currentColor"
points="11 1.576 6.583 6 11 10.424 10.424 11 6 6.583 1.576 11 1 10.424 5.417 6 1 1.576 1.576 1 6 5.417 10.424 1"
/>
</svg> </svg>
</div> </div>
</div> </div>
@ -114,17 +126,17 @@ const NonInjectedTopBar = observer(({
</div> </div>
</div> </div>
); );
}); },
);
const renderRegisteredItems = (items: TopBarRegistration[]) => ( const renderRegisteredItems = (items: TopBarRegistration[]) =>
items.map((registration, index) => { items.map((registration, index) => {
if (!registration?.components?.Item) { if (!registration?.components?.Item) {
return null; return null;
} }
return <registration.components.Item key={index} />; return <registration.components.Item key={index} />;
}) });
);
export const TopBar = withInjectables<Dependencies>(NonInjectedTopBar, { export const TopBar = withInjectables<Dependencies>(NonInjectedTopBar, {
getProps: (di) => ({ getProps: (di) => ({