Skip to content

Commit 43b8bf2

Browse files
authored
Merge pull request #2771 from devtron-labs/fix/ai
chore: add check to conditionally show side panel documentation open in new tab button
2 parents bef5387 + d2899c1 commit 43b8bf2

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/components/common/SidePanel/SidePanelDocumentation.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
getUniqueId,
1111
Icon,
1212
ProgressBar,
13+
SidePanelTab,
1314
useMainContext,
1415
useTheme,
1516
} from '@devtron-labs/devtron-fe-common-lib'
@@ -20,7 +21,7 @@ export const SidePanelDocumentation = ({ SidePanelHeaderActions }: SidePanelCont
2021
// HOOKS
2122
const { appTheme } = useTheme()
2223
const {
23-
sidePanelConfig: { docLink: sidePanelDocLink, reinitialize },
24+
sidePanelConfig: { state, docLink: sidePanelDocLink, reinitialize },
2425
setSidePanelConfig,
2526
} = useMainContext()
2627

@@ -53,20 +54,22 @@ export const SidePanelDocumentation = ({ SidePanelHeaderActions }: SidePanelCont
5354

5455
return (
5556
<>
56-
<SidePanelHeaderActions>
57-
<Button
58-
dataTestId="open-in-new-tab-button"
59-
ariaLabel="Open in new tab"
60-
icon={<Icon name="ic-arrow-square-out" color={null} />}
61-
variant={ButtonVariantType.borderLess}
62-
style={ButtonStyleType.neutral}
63-
size={ComponentSizeType.xs}
64-
component={ButtonComponentType.anchor}
65-
anchorProps={{
66-
href: docLink,
67-
}}
68-
/>
69-
</SidePanelHeaderActions>
57+
{state === SidePanelTab.DOCUMENTATION && (
58+
<SidePanelHeaderActions>
59+
<Button
60+
dataTestId="open-in-new-tab-button"
61+
ariaLabel="Open in new tab"
62+
icon={<Icon name="ic-arrow-square-out" color={null} />}
63+
variant={ButtonVariantType.borderLess}
64+
style={ButtonStyleType.neutral}
65+
size={ComponentSizeType.xs}
66+
component={ButtonComponentType.anchor}
67+
anchorProps={{
68+
href: docLink,
69+
}}
70+
/>
71+
</SidePanelHeaderActions>
72+
)}
7073

7174
<div className="flex-grow-1 dc__position-rel">
7275
<ProgressBar isLoading={isLoading} />

0 commit comments

Comments
 (0)