Skip to content

Commit

Permalink
[ui] Show alert for users in experimental nav flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hellendag committed Apr 24, 2024
1 parent 4983f9e commit fa2eb66
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
31 changes: 31 additions & 0 deletions js_modules/dagster-ui/packages/ui-core/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import {Alert, Box} from '@dagster-io/ui-components';
import * as React from 'react';
import styled from 'styled-components';

import {useFeatureFlags} from './Flags';
import {LayoutContext} from './LayoutProvider';
import {useStateWithStorage} from '../hooks/useStateWithStorage';
import {LEFT_NAV_WIDTH, LeftNav} from '../nav/LeftNav';

interface Props {
Expand All @@ -12,7 +14,13 @@ interface Props {

export const App = ({banner, children}: Props) => {
const {nav} = React.useContext(LayoutContext);

// todo dish: Remove flag and alert once this change has shipped.
const {flagSettingsPage} = useFeatureFlags();
const [didDismissNavAlert, setDidDismissNavAlert] = useStateWithStorage<boolean>(
'new_navigation_alert',
(json) => !!json,
);

const onClickMain = React.useCallback(() => {
if (nav.isSmallScreen) {
Expand All @@ -29,6 +37,29 @@ export const App = ({banner, children}: Props) => {
onClick={onClickMain}
>
<div>{banner}</div>
{flagSettingsPage && !didDismissNavAlert ? (
<Box padding={8} border="top-and-bottom">
<Alert
title={
<>
<span>Experimental navigation is enabled.</span>
<span style={{fontWeight: 'normal'}}>
{' '}
We&apos;re testing some changes to the navigation to make it easier to explore.{' '}
<a
href="https://github.com/dagster-io/dagster/discussions/21370"
target="_blank"
rel="noreferrer"
>
Learn more and share feedback
</a>
</span>
</>
}
onClose={() => setDidDismissNavAlert(true)}
/>
</Box>
) : null}
<ChildContainer>{children}</ChildContainer>
</Main>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ export const getVisibleFeatureFlagRows = () => [
flagType: FeatureFlag.flagUseNewOverviewPage,
},
{
key: 'New navigation (experimental)',
key: 'New navigation',
label: (
<>
Experimental navigation (
<a
href="https://github.com/dagster-io/dagster/discussions/21370"
target="_blank"
rel="noreferrer"
>
Learn more
</a>
)
</>
),
flagType: FeatureFlag.flagSettingsPage,
},
];

0 comments on commit fa2eb66

Please sign in to comment.