Skip to content

Commit

Permalink
Don't show 'Add source' button if we don't have any sources (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: Montse Ortega <[email protected]>
  • Loading branch information
ammont82 authored Oct 22, 2024
1 parent a98eb4d commit e3bc462
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions apps/demo/src/migration-wizard/steps/connect/ConnectStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const ConnectStep: React.FC = () => {
const toggleDiscoverySourceSetupModal = useCallback((): void => {
setShouldShowDiscoverySetupModal((lastState) => !lastState);
}, []);
const hasSources = discoverySourcesContext.sources.length > 0;

return (
<Stack hasGutter>
Expand Down Expand Up @@ -104,14 +105,16 @@ export const ConnectStep: React.FC = () => {
</Panel>
</StackItem>
<StackItem>
<Button
variant="secondary"
onClick={toggleDiscoverySourceSetupModal}
style={{ marginTop: "1rem" }}
icon={<PlusCircleIcon color={blueColor.value} />}
>
Add source
</Button>
{hasSources && (
<Button
variant="secondary"
onClick={toggleDiscoverySourceSetupModal}
style={{ marginTop: "1rem" }}
icon={<PlusCircleIcon color={blueColor.value} />}
>
Add source
</Button>
)}
{shouldShowDiscoverySourceSetupModal && (
<DiscoverySourceSetupModal
isOpen={shouldShowDiscoverySourceSetupModal}
Expand Down

0 comments on commit e3bc462

Please sign in to comment.