Skip to content

Commit 982763f

Browse files
committed
chore: update version to 1.22.6-beta-5 in package.json and package-lock.json; refactor PageHeader component to use AskDevtronButton
1 parent b0f32e0 commit 982763f

4 files changed

Lines changed: 12 additions & 26 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.22.6-beta-4",
3+
"version": "1.22.6-beta-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/Header/PageHeader.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import { handleAnalyticsEvent } from '@Shared/Analytics'
2222
import { ComponentSizeType } from '@Shared/constants'
2323
import { InstallationType } from '@Shared/types'
2424

25-
import { TippyCustomized, TippyTheme, Tooltip } from '../../../Common'
25+
import { TippyCustomized, TippyTheme } from '../../../Common'
2626
import { POSTHOG_EVENT_ONBOARDING } from '../../../Common/Constants'
27-
import { SidePanelTab, useMainContext, useTheme, useUserEmail } from '../../Providers'
27+
import { useMainContext, useTheme, useUserEmail } from '../../Providers'
2828
import { Button, ButtonStyleType, ButtonVariantType } from '../Button'
2929
import { Icon } from '../Icon'
3030
import { ImageWithFallback } from '../ImageWithFallback'
@@ -55,10 +55,10 @@ const PageHeader = ({
5555
const {
5656
setLoginCount,
5757
setShowGettingStartedCard,
58-
setSidePanelConfig,
5958
sidePanelConfig,
6059
tempAppWindowConfig,
6160
featureAskDevtronExpert,
61+
AskDevtronButton,
6262
} = useMainContext()
6363
const { showSwitchThemeLocationTippy, handleShowSwitchThemeLocationTippyChange } = useTheme()
6464

@@ -136,28 +136,12 @@ const PageHeader = ({
136136
</div>
137137
)
138138

139-
const onAskButtonClick = () => {
140-
handleAnalyticsEvent({
141-
category: 'AI',
142-
action: 'HELP_ASK_DEVTRON_AI',
143-
})
144-
setSidePanelConfig((prev) => ({ ...prev, state: SidePanelTab.ASK_DEVTRON }))
145-
}
146-
147139
const renderLogoutHelpSection = () => (
148140
<>
149-
{featureAskDevtronExpert && sidePanelConfig.state === 'closed' && !tempAppWindowConfig.open && (
150-
<Tooltip content="Ask Devtron AI" placement="bottom" alwaysShowTippyOnHover delay={[500, null]}>
151-
<button
152-
className="enable-svg-animation--hover flex dc__no-background p-2 dc__outline-none-imp dc__no-border"
153-
onClick={onAskButtonClick}
154-
type="button"
155-
aria-label="Ask Devtron Expert"
156-
>
157-
<Icon name="ic-devtron-ai" color={null} size={28} />
158-
</button>
159-
</Tooltip>
160-
)}
141+
{AskDevtronButton &&
142+
featureAskDevtronExpert &&
143+
sidePanelConfig.state === 'closed' &&
144+
!tempAppWindowConfig.open && <AskDevtronButton />}
161145

162146
<HelpButton
163147
serverInfo={currentServerInfo.serverInfo}

src/Shared/Providers/MainContextProvider/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export type MainContext = CommonMainContextProps &
216216
setTempAppWindowConfig: Dispatch<SetStateAction<TempAppWindowConfig>>
217217
AIRecommendations?: FunctionComponent
218218
featureAskDevtronExpert: EnvironmentDataValuesDTO['featureAskDevtronExpert']
219+
AskDevtronButton?: FunctionComponent
219220
}
220221
| {
221222
isLicenseDashboard: true
@@ -236,6 +237,7 @@ export type MainContext = CommonMainContextProps &
236237
setTempAppWindowConfig: null
237238
AIRecommendations?: null
238239
featureAskDevtronExpert?: null
240+
AskDevtronButton?: null
239241
}
240242
)
241243

0 commit comments

Comments
 (0)