Skip to content

Commit bd5daf2

Browse files
authored
feat(Help Bar): Add sub nav items to Help & Support (#4323)
* feat: add sub menu items to support * chore: clean up * feat: update sub menu css depending on nav status * chore: return early inside useEffect * feat: use two effect hooks for nav bar conditions * fix: prettier * chore: clean up * chore: clean up * chore: remove Unnecessary curly braces?? * chore: move useEffect to the top * chore: moved conditions inside effect hook * chore: remove more Unnecessary curlt braces * fix: prettier
1 parent 7dd435a commit bd5daf2

File tree

2 files changed

+67
-12
lines changed

2 files changed

+67
-12
lines changed

src/pageLayout/constants/navigationHierarchy.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,6 @@ export const generateNavItems = (): NavItem[] => {
202202
link: `/operator`,
203203
activeKeywords: ['operator'],
204204
},
205-
{
206-
id: 'support',
207-
testID: 'nav-item-support',
208-
icon: IconFont.QuestionMark_New,
209-
label: 'Help & Support',
210-
shortLabel: 'Support',
211-
link: '',
212-
activeKeywords: [''],
213-
enabled: () => isFlagEnabled('helpBar'),
214-
},
215205
]
216206

217207
navItems = navItems.filter(item => {

src/pageLayout/containers/TreeNav.tsx

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Libraries
2-
import React, {FC, useContext} from 'react'
2+
import React, {FC, useContext, useEffect} from 'react'
33
import {Link} from 'react-router-dom'
44
import {useSelector} from 'react-redux'
55

66
// Components
7-
import {Icon, TreeNav} from '@influxdata/clockface'
7+
import {Icon, IconFont, TreeNav} from '@influxdata/clockface'
88
import UserWidget from 'src/pageLayout/components/UserWidget'
99
import NavHeader from 'src/pageLayout/components/NavHeader'
1010
import OrgSettings from 'src/cloud/components/OrgSettings'
@@ -17,6 +17,7 @@ import {getNavItemActivation} from 'src/pageLayout/utils'
1717
import {getOrg} from 'src/organizations/selectors'
1818
import {AppSettingContext} from 'src/shared/contexts/app'
1919
import {event} from 'src/cloud/utils/reporting'
20+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
2021

2122
// Types
2223
import {NavItem, NavSubItem} from 'src/pageLayout/constants/navigationHierarchy'
@@ -26,6 +27,19 @@ const TreeSidebar: FC = () => {
2627
const {presentationMode, navbarMode, setNavbarMode} = useContext(
2728
AppSettingContext
2829
)
30+
useEffect(() => {
31+
if (isFlagEnabled('helpBar')) {
32+
const helpBarMenu = document.querySelectorAll<HTMLElement>(
33+
'.cf-tree-nav--sub-menu-trigger'
34+
)[3]
35+
if (navbarMode === 'expanded') {
36+
helpBarMenu.style.display = 'block'
37+
helpBarMenu.style.width = '243px'
38+
} else {
39+
helpBarMenu.style.width = '44px'
40+
}
41+
}
42+
}, [setNavbarMode, navbarMode])
2943

3044
if (presentationMode || !org) {
3145
return null
@@ -106,6 +120,57 @@ const TreeSidebar: FC = () => {
106120
</TreeNav.Item>
107121
)
108122
})}
123+
{isFlagEnabled('helpBar') ? (
124+
<TreeNav.Item
125+
id="support"
126+
testID="nav-item-support"
127+
icon={<Icon glyph={IconFont.QuestionMark_New} />}
128+
label="Help & Support"
129+
shortLabel="Support"
130+
>
131+
<TreeNav.SubMenu>
132+
<TreeNav.SubHeading label="Support" />
133+
<TreeNav.SubItem
134+
id="documentation"
135+
label="Documentation"
136+
testID="nav-subitem-documentation"
137+
linkElement={className => <Link className={className} to="" />}
138+
/>
139+
<TreeNav.SubItem
140+
id="faqs"
141+
label="FAQs"
142+
testID="nav-subitem-faqs"
143+
linkElement={className => <Link className={className} to="" />}
144+
/>
145+
<TreeNav.SubItem
146+
id="contactSupport"
147+
label="Contact Support"
148+
testID="nav-subitem-contact-support"
149+
linkElement={className => <Link className={className} to="" />}
150+
/>
151+
<TreeNav.SubHeading label="Community" />
152+
<TreeNav.SubItem
153+
id="offcialForum"
154+
label="Official Forum"
155+
testID="nav-subitem-forum"
156+
linkElement={className => <Link className={className} to="" />}
157+
/>
158+
<TreeNav.SubItem
159+
id="influxdbSlack"
160+
label="InfluxDB Slack"
161+
testID="nav-subitem-influxdb-slack"
162+
linkElement={className => <Link className={className} to="" />}
163+
/>
164+
<TreeNav.SubHeading label="Feedback" />
165+
<TreeNav.SubItem
166+
id="feedback"
167+
label="Feedback & Questions"
168+
testID="nav-subitem-feedback-questions"
169+
linkElement={className => <Link className={className} to="" />}
170+
/>
171+
</TreeNav.SubMenu>
172+
</TreeNav.Item>
173+
) : null}
109174
</TreeNav>
110175
</OrgSettings>
111176
)

0 commit comments

Comments
 (0)