Skip to content

Commit

Permalink
feat: clickable banner modal links (#6552)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Mar 14, 2024
1 parent 56c3dc4 commit 2b2089f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion frontend/src/component/application/ApplicationOverview.tsx
Expand Up @@ -79,7 +79,7 @@ const ApplicationOverview = () => {
<ApplicationContainer>
<ApplicationHeader>
<ProjectContainer>
Projects using this application
Application is connected to these projects:
{data.projects.map((project) => (
<Badge
sx={{ cursor: 'pointer' }}
Expand Down
@@ -1,4 +1,4 @@
import { styled } from '@mui/material';
import { Box, styled } from '@mui/material';
import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { Markdown } from 'component/common/Markdown/Markdown';
import { ReactNode } from 'react';
Expand All @@ -22,20 +22,31 @@ export const BannerDialog = ({
title,
children,
}: IBannerDialogProps) => {
const handleClose = () => {
setOpen(false);
};

return (
<Dialogue
title={title}
open={open}
secondaryButtonText='Close'
onClose={() => {
setOpen(false);
}}
onClose={handleClose}
>
{typeof children === 'string' ? (
<StyledMarkdown>{children}</StyledMarkdown>
) : (
children
)}
<Box
onClick={(e) => {
const target = e.target as HTMLElement;
if (target.nodeName === 'A') {
handleClose();
}
}}
>
{typeof children === 'string' ? (
<StyledMarkdown>{children}</StyledMarkdown>
) : (
children
)}
</Box>
</Dialogue>
);
};
@@ -1,4 +1,4 @@
import { screen } from '@testing-library/react';
import { screen, waitFor } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { testServerRoute, testServerSetup } from 'utils/testServer';
import { OutdatedSdksSchema } from 'openapi';
Expand Down Expand Up @@ -30,7 +30,14 @@ test('Show outdated SDKs and apps using them', async () => {

link.click();

await screen.findByText('Outdated SDKs');
await screen.findByText('unleash-node-client:3.2.1');
await screen.findByText('application1');
const application = await screen.findByText('application1');
await screen.findByText('application2');

application.click(); // clicking on an application link should close the modal

await waitFor(() => {
expect(screen.queryByText('Outdated SDKs')).not.toBeInTheDocument();
});
});
1 change: 1 addition & 0 deletions src/server-dev.ts
Expand Up @@ -50,6 +50,7 @@ process.nextTick(async () => {
executiveDashboard: true,
userAccessUIEnabled: true,
sdkReporting: true,
outdatedSdksBanner: true,
globalFrontendApiCache: true,
returnGlobalFrontendApiCache: true,
},
Expand Down

0 comments on commit 2b2089f

Please sign in to comment.