Skip to content

Commit e392a9e

Browse files
feat: dashboard banner (#547)
1 parent aa1461e commit e392a9e

File tree

5 files changed

+97
-20
lines changed

5 files changed

+97
-20
lines changed

src/ui/layouts/common/layouts/AuthenticatedLayout/AuthenticatedHeader.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { WorkspacePopup } from './workspacePopup';
4040
import ReactTooltip from 'react-tooltip';
4141
import { Breadcrumbs } from '../../Breadcrumbs';
4242
import DeploymentBanner from './DeploymentBanner';
43+
import DashboardBanner from './DashboardBanner';
4344

4445
export const AuthenticatedHeader: React.FC<{
4546
breadcrumb?: Array<any>;
@@ -55,6 +56,8 @@ export const AuthenticatedHeader: React.FC<{
5556
const [popupOpen, setPopupOpen] = useState<boolean>(false);
5657
const [createPopupOpen, setCreatePopupOpen] = useState<boolean>(false);
5758

59+
const authScheme = useSelector(serverInfoSelectors.getAuthScheme);
60+
5861
const dispatch = useDispatch();
5962

6063
const { push } = usePushRoute();
@@ -144,7 +147,8 @@ export const AuthenticatedHeader: React.FC<{
144147

145148
return (
146149
<>
147-
{deploymentType === 'local' && <DeploymentBanner />}
150+
{deploymentType === 'local' && <DeploymentBanner />}{' '}
151+
{authScheme !== 'EXTERNAL' && <DashboardBanner />}
148152
{createPopupOpen && <WorkspacePopup setPopupOpen={setCreatePopupOpen} />}
149153
<FlexBox
150154
paddingHorizontal="lg"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React, { useState } from 'react';
2+
import styles from './styles.module.scss';
3+
import { dashboardKey } from './service';
4+
import { icons } from '../../../../../components';
5+
6+
function DashboardBanner() {
7+
const [isDashboardBannerDismissed, setDashboardDismissed] = useState(
8+
!!sessionStorage.getItem(dashboardKey),
9+
);
10+
11+
if (isDashboardBannerDismissed) return null;
12+
return (
13+
<aside className={styles.deploymentBanner}>
14+
<p className={styles.deploymentBanner__paragraph}>
15+
This dashboard interface will soon be updated. Click{' '}
16+
<a
17+
target="_blank"
18+
rel="noopener noreferrer"
19+
href="https://www.zenml.io/cloud"
20+
>
21+
here
22+
</a>{' '}
23+
for a preview!
24+
</p>
25+
<button
26+
className={styles.deploymentBanner__close}
27+
onClick={() => {
28+
sessionStorage.setItem(dashboardKey, 'true');
29+
setDashboardDismissed(true);
30+
}}
31+
>
32+
<icons.close />
33+
</button>
34+
</aside>
35+
);
36+
}
37+
38+
export default DashboardBanner;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const dashboardKey = 'dashboard-banner-dismissed';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@import '../../../../../globalStyles';
2+
3+
.deploymentBanner {
4+
width: 100%;
5+
background-color: #f1ebfe;
6+
font-size: 16px;
7+
display: flex;
8+
color: #0d061d;
9+
font-family: Rubik;
10+
padding: 0.5rem 16px;
11+
justify-content: space-between;
12+
align-items: center;
13+
14+
&__paragraph {
15+
text-align: center;
16+
margin: 0;
17+
flex: 1;
18+
}
19+
&__close {
20+
padding: 0;
21+
margin: 0;
22+
border: none;
23+
background: none;
24+
font: inherit;
25+
color: inherit;
26+
cursor: pointer;
27+
outline: none;
28+
}
29+
}
30+
31+
@media (max-width: $md-breakpoint) {
32+
.deploymentBanner {
33+
padding: 0.5rem 1rem;
34+
font-size: 14px;
35+
}
36+
}
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
@import '../../../../../globalStyles';
22

33
.deploymentBanner {
4-
width: 100%;
5-
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
6-
background-color: #FEFACB;
7-
font-size: 16px;
8-
display: flex;
9-
font-family: Rubik;
10-
padding: .5rem 0;
11-
justify-content: center;
12-
align-items: center;
13-
flex-direction: column;
14-
15-
&__paragraph {
16-
text-align: center;
17-
margin: 0
18-
}
4+
width: 100%;
5+
background-color: #fefacb;
6+
font-size: 16px;
7+
display: flex;
8+
font-family: Rubik;
9+
padding: 0.5rem 0;
10+
justify-content: center;
11+
align-items: center;
12+
flex-direction: column;
1913

14+
&__paragraph {
15+
text-align: center;
16+
margin: 0;
17+
}
2018
}
2119

2220
@media (max-width: $md-breakpoint) {
23-
.deploymentBanner {
24-
padding: .5rem 1rem;
25-
font-size: 14px;
26-
}
21+
.deploymentBanner {
22+
padding: 0.5rem 1rem;
23+
font-size: 14px;
24+
}
2725
}

0 commit comments

Comments
 (0)