-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Help menu + Daggy U call out in OSS (#19784)
## Summary & Motivation https://linear.app/dagster-labs/issue/FE-176 ## How I Tested These Changes locally: Product tour: <img width="303" alt="Screenshot 2024-02-13 at 4 12 32 PM" src="https://github.com/dagster-io/dagster/assets/2286579/c09c8e39-6acf-4465-9778-9ba8c5ec9e78"> Help menu: <img width="270" alt="Screenshot 2024-02-14 at 2 36 43 PM" src="https://github.com/dagster-io/dagster/assets/2286579/80ee93df-6f81-44bf-9b25-ba9519b03911">
- Loading branch information
Showing
7 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
js_modules/dagster-ui/packages/ui-components/src/icon-svgs/graduation_cap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 134 additions & 0 deletions
134
js_modules/dagster-ui/packages/ui-core/src/app/HelpMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import { | ||
Colors, | ||
ExternalAnchorButton, | ||
Icon, | ||
IconWrapper, | ||
Menu, | ||
MenuDivider, | ||
MenuExternalLink, | ||
Popover, | ||
ProductTour, | ||
ProductTourPosition, | ||
Tooltip, | ||
} from '@dagster-io/ui-components'; | ||
import {useCallback, useState} from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import {ShortcutHandler} from './ShortcutHandler'; | ||
import DagsterUniversityImage from './dagster_university.svg'; | ||
import {useStateWithStorage} from '../hooks/useStateWithStorage'; | ||
|
||
export const HelpMenu = ({showContactSales = true}: {showContactSales?: boolean}) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const onInteraction = useCallback((open: boolean) => setIsOpen(open), []); | ||
|
||
const [didDismissDaggyU, setDidDismissDaggyU] = useStateWithStorage<boolean>( | ||
'daggy_u_pt', | ||
(json) => !!json, | ||
); | ||
|
||
return ( | ||
<ShortcutHandler | ||
onShortcut={() => setIsOpen(!isOpen)} | ||
shortcutLabel="?" | ||
shortcutFilter={(e) => e.key === '?'} | ||
> | ||
<ProductTour | ||
title="Master the Dagster basics" | ||
description="Learn the basics of Dagster with the free Dagster Essentials course from Dagster University" | ||
position={ProductTourPosition.BOTTOM_LEFT} | ||
canShow={!isOpen && !didDismissDaggyU} | ||
img={DagsterUniversityImage.src} | ||
actions={{ | ||
custom: ( | ||
<ExternalAnchorButton href="https://courses.dagster.io/courses/dagster-essentials"> | ||
Learn more | ||
</ExternalAnchorButton> | ||
), | ||
dismiss: () => { | ||
setDidDismissDaggyU(true); | ||
}, | ||
}} | ||
> | ||
<Popover | ||
isOpen={isOpen} | ||
placement="bottom-end" | ||
canEscapeKeyClose | ||
onInteraction={onInteraction} | ||
modifiers={{offset: {enabled: true, options: {offset: [0, 16]}}}} | ||
content={ | ||
<Menu> | ||
<MenuDivider title="What's new" /> | ||
<MenuExternalLink | ||
href="https://docs.dagster.io/changelog" | ||
icon="concept_book" | ||
text="View changelog" | ||
/> | ||
<MenuDivider title="Help" /> | ||
<MenuExternalLink | ||
href="https://dagster.io/slack" | ||
icon="slack" | ||
text="Join our Slack" | ||
/> | ||
<MenuExternalLink | ||
href="https://github.com/dagster-io/dagster/discussions" | ||
icon="github" | ||
text="Discuss on GitHub" | ||
/> | ||
<MenuExternalLink | ||
href="https://docs.dagster.io" | ||
icon="concept_book" | ||
text="Read the docs" | ||
/> | ||
<div | ||
onClick={() => { | ||
setDidDismissDaggyU(true); | ||
}} | ||
> | ||
<MenuExternalLink | ||
href="https://courses.dagster.io/" | ||
icon="graduation_cap" | ||
text="Dagster University" | ||
/> | ||
</div> | ||
{showContactSales ? ( | ||
<MenuExternalLink | ||
href="https://dagster.io/contact" | ||
icon="open_in_new" | ||
text="Contact sales" | ||
/> | ||
) : null} | ||
</Menu> | ||
} | ||
> | ||
<Tooltip content="Help"> | ||
<HelpButton> | ||
<Icon name="chat_support" size={20} /> | ||
</HelpButton> | ||
</Tooltip> | ||
</Popover> | ||
</ProductTour> | ||
</ShortcutHandler> | ||
); | ||
}; | ||
|
||
const HelpButton = styled.button` | ||
background: transparent; | ||
border: none; | ||
cursor: pointer; | ||
padding: 8px; | ||
:focus { | ||
outline: none; | ||
} | ||
${IconWrapper} { | ||
background-color: ${Colors.navTextSelected()}; | ||
transition: background-color 100ms linear; | ||
} | ||
:focus ${IconWrapper}, :hover ${IconWrapper} { | ||
background-color: ${Colors.navTextHover()}; | ||
} | ||
`; |
26 changes: 26 additions & 0 deletions
26
js_modules/dagster-ui/packages/ui-core/src/app/__stories__/HelpMenu.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {Box, Colors} from '@dagster-io/ui-components'; | ||
import {Meta} from '@storybook/react'; | ||
|
||
import {StorybookProvider} from '../../testing/StorybookProvider'; | ||
import {HelpMenu} from '../HelpMenu'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default { | ||
title: 'HelpMenu', | ||
component: HelpMenu, | ||
} as Meta; | ||
|
||
export const Default = () => { | ||
return ( | ||
<StorybookProvider> | ||
<Box | ||
background={Colors.navBackground()} | ||
padding={{horizontal: 48}} | ||
flex={{alignItems: 'center', justifyContent: 'flex-end'}} | ||
style={{height: '64px'}} | ||
> | ||
<HelpMenu /> | ||
</Box> | ||
</StorybookProvider> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
js_modules/dagster-ui/packages/ui-core/src/app/dagster_university.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41cd16b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for dagit-storybook ready!
✅ Preview
https://dagit-storybook-rl57ac2rs-elementl.vercel.app
Built with commit 41cd16b.
This pull request is being automatically deployed with vercel-action
41cd16b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for dagit-core-storybook ready!
✅ Preview
https://dagit-core-storybook-hynjyrjkp-elementl.vercel.app
Built with commit 41cd16b.
This pull request is being automatically deployed with vercel-action