Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/modules/integration-picker/IntegrationPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Card } from '@stackone/malachite';
import { useCallback, useMemo, useState } from 'react';
import useFeatureFlags from '../../shared/hooks/useFeatureFlags';
import { isEmbeddedInAuthLink } from '../../shared/utils/utils';
import { IntegrationPickerContent } from './components/IntegrationPickerContent';
import { IntegrationPickerTitle } from './components/IntegrationPickerTitle';
import CardFooter from './components/cardFooter';
Expand Down Expand Up @@ -81,6 +82,9 @@ export const IntegrationPicker: React.FC<IntegrationPickerProps> = ({
return activeIntegrations.length === 1;
}, [hubData]);

// Hide close button when Hub is embedded in the auth link page
const hideCloseButton = useMemo(() => isEmbeddedInAuthLink(), []);

const onBack = () => {
setSelectedIntegration(null);
resetConnectionState();
Expand All @@ -96,6 +100,7 @@ export const IntegrationPicker: React.FC<IntegrationPickerProps> = ({
<SuccessCardFooter
onClose={() => onClose?.()}
showFooterLinks={showFooterLinks}
hideCloseButton={hideCloseButton}
/>
) : (
<CardFooter
Expand Down
17 changes: 16 additions & 1 deletion src/modules/integration-picker/components/successCardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,24 @@ import {
interface CardFooterProps {
onClose: () => void;
showFooterLinks?: boolean;
hideCloseButton?: boolean;
}

const SuccessCardFooter: React.FC<CardFooterProps> = ({ showFooterLinks = true, onClose }) => {
const SuccessCardFooter: React.FC<CardFooterProps> = ({
showFooterLinks = true,
onClose,
hideCloseButton = false,
}) => {
// When both footer links and close button are hidden, render nothing
if (!showFooterLinks && hideCloseButton) {
return null;
}

// When only footer links are shown (no close button)
if (hideCloseButton) {
return <FooterLinks fullWidth />;
}

return (
<Spacer direction="horizontal" size={4} justifyContent="space-between">
{showFooterLinks && <FooterLinks fullWidth />}
Expand Down
10 changes: 10 additions & 0 deletions src/shared/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
export const isFalconVersion = (version: string) => {
return version != null && version != '1' && version != '2';
};

/**
* Detects if the Hub is embedded in the auth link page (e.g., /hub/embedded).
* When embedded in this context, certain UI elements like the Close button
* should be hidden since they don't function properly.
*/
export const isEmbeddedInAuthLink = (): boolean => {
if (typeof window === 'undefined') return false;
return window.location.pathname.includes('/hub/embedded');
};
Loading