Skip to content

Commit 47e7495

Browse files
pedroignacio13yannikmesserli
authored andcommitted
Updating home namespace list, enhancing the UI.
Signed-off-by: Pedro Ignacio <[email protected]>
1 parent dbb85e0 commit 47e7495

File tree

3 files changed

+21
-36
lines changed

3 files changed

+21
-36
lines changed

src/components/ServiceMapApp/WelcomeScreen.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
@use 'sass:color';
22

33
.wrapper {
4+
display: flex;
5+
justify-content: center;
46
flex-grow: 1;
57
width: 100%;
68
overflow: auto;
79
}
810

911
.content {
10-
margin: 124px;
12+
margin-top: 130px;
13+
display: flex;
14+
flex-direction: column;
15+
align-items: center;
1116
}
1217

1318
.logo {
@@ -24,7 +29,7 @@
2429
}
2530

2631
.description {
27-
margin: 25px 0 0;
32+
margin: 25px 0 20px;
2833
font-size: 14px;
2934
line-height: 20px;
3035
font-weight: 500;
Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import React, { useCallback } from 'react';
1+
import React from 'react';
22
import { Spinner } from '@blueprintjs/core';
33
import { observer } from 'mobx-react';
44

55
import { NamespaceDescriptor } from '~/domain/namespaces';
6+
import { NamespaceSelectorDropdown } from '../TopBar/NamespaceSelectorDropdown';
67

78
import css from './WelcomeScreen.scss';
89
import hubbleLogo from '~/assets/images/hubble-logo.png';
@@ -22,11 +23,11 @@ export const WelcomeScreen = observer(function WelcomeScreen(props: Props) {
2223
<h1 className={css.title}>Welcome!</h1>
2324
<p className={css.description}>To begin select one of the namespaces:</p>
2425
{someNamespacesLoaded ? (
25-
<ul className={css.namespacesList}>
26-
{props.namespaces.map(ns => (
27-
<NamespaceItem key={ns.namespace} namespace={ns} onClick={props.onNamespaceChange} />
28-
))}
29-
</ul>
26+
<NamespaceSelectorDropdown
27+
namespaces={props.namespaces}
28+
currentNamespace={null}
29+
onChange={props.onNamespaceChange}
30+
/>
3031
) : (
3132
<div className={css.spinnerWrapper}>
3233
<Spinner size={48} intent="primary" />
@@ -36,26 +37,3 @@ export const WelcomeScreen = observer(function WelcomeScreen(props: Props) {
3637
</div>
3738
);
3839
});
39-
40-
interface NamespaceItemProps {
41-
namespace: NamespaceDescriptor;
42-
onClick: (ns: NamespaceDescriptor) => void;
43-
}
44-
45-
const NamespaceItem = observer(function NamespaceItem(props: NamespaceItemProps) {
46-
const onClick = useCallback(
47-
(event: React.MouseEvent<HTMLAnchorElement>) => {
48-
event.preventDefault();
49-
props.onClick(props.namespace);
50-
},
51-
[props.onClick],
52-
);
53-
54-
return (
55-
<li>
56-
<a href={`/${props.namespace.namespace}`} onClick={onClick}>
57-
{props.namespace.namespace}
58-
</a>
59-
</li>
60-
);
61-
});

src/components/TopBar/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ export const TopBar = observer(function TopBar(props: Props) {
6262
return (
6363
<div className={css.topbar}>
6464
<div className={css.left}>
65-
<NamespaceSelectorDropdown
66-
namespaces={props.namespaces}
67-
currentNamespace={props.currentNamespace}
68-
onChange={props.onNamespaceChange}
69-
/>
65+
{props.currentNamespace === null ? null : (
66+
<NamespaceSelectorDropdown
67+
namespaces={props.namespaces}
68+
currentNamespace={props.currentNamespace}
69+
onChange={props.onNamespaceChange}
70+
/>
71+
)}
7072
{props.currentNamespace && RenderedFilters}
7173
</div>
7274
<div className={css.right}>

0 commit comments

Comments
 (0)