-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): update help menu (#2689)
- Loading branch information
1 parent
5a1ede1
commit 09ff862
Showing
5 changed files
with
104 additions
and
96 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import {BulbOutlined, GithubOutlined, ReadOutlined} from '@ant-design/icons'; | ||
import {Dropdown, Menu, MenuProps, Space} from 'antd'; | ||
import {useMemo} from 'react'; | ||
import {useLocation} from 'react-router-dom'; | ||
|
||
import discordIcon from 'assets/discord.svg'; | ||
import {DISCORD_URL, DOCUMENTATION_URL, GITHUB_URL} from 'constants/Common.constants'; | ||
import {useGuidedTour} from 'providers/GuidedTour/GuidedTour.provider'; | ||
import GuidedTourService from 'services/GuidedTour.service'; | ||
import Env from 'utils/Env'; | ||
import * as S from './Header.styled'; | ||
|
||
const appVersion = Env.get('appVersion'); | ||
|
||
function getMenuItems({ | ||
isOnboardingActive, | ||
onClickOnboarding, | ||
}: { | ||
isOnboardingActive: boolean; | ||
onClickOnboarding: () => void; | ||
}) { | ||
const items: MenuProps['items'] = [ | ||
{ | ||
key: '1', | ||
label: ( | ||
<a target="_blank" href={GITHUB_URL}> | ||
GitHub | ||
</a> | ||
), | ||
icon: <GithubOutlined />, | ||
}, | ||
{ | ||
key: '2', | ||
label: ( | ||
<a target="_blank" href={DOCUMENTATION_URL}> | ||
Documentation | ||
</a> | ||
), | ||
icon: <ReadOutlined />, | ||
}, | ||
{ | ||
key: '3', | ||
label: ( | ||
<a target="_blank" href={DISCORD_URL}> | ||
Join our Discord community | ||
</a> | ||
), | ||
icon: <img src={discordIcon} width={12} />, | ||
}, | ||
{ | ||
key: '4', | ||
label: <a onClick={onClickOnboarding}>Show Onboarding</a>, | ||
icon: <BulbOutlined />, | ||
disabled: !isOnboardingActive, | ||
}, | ||
{ | ||
type: 'divider', | ||
}, | ||
{ | ||
key: '5', | ||
label: <S.AppVersion>App version: {appVersion}</S.AppVersion>, | ||
disabled: true, | ||
}, | ||
]; | ||
|
||
return items; | ||
} | ||
|
||
const HelpMenu = () => { | ||
const pathname = useLocation().pathname; | ||
const tourByPathname = GuidedTourService.getByPathName(pathname); | ||
const isOnboardingActive = !!tourByPathname; | ||
const {onStart} = useGuidedTour(); | ||
const items = useMemo( | ||
() => getMenuItems({isOnboardingActive, onClickOnboarding: onStart}), | ||
[isOnboardingActive, onStart] | ||
); | ||
|
||
return ( | ||
<Dropdown overlay={<Menu items={items} />}> | ||
<a onClick={e => e.preventDefault()}> | ||
<Space> | ||
<S.QuestionIcon data-cy="menu-link" /> | ||
</Space> | ||
</a> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default HelpMenu; |
This file was deleted.
Oops, something went wrong.