Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LocatorPopup to find signals #1949

Merged
merged 1 commit into from
Sep 8, 2023
Merged
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
3 changes: 3 additions & 0 deletions src/Frontend/Components/GlobalPopup/GlobalPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { AttributionWizardPopup } from '../AttributionWizardPopup/AttributionWiz
import { FileSupportPopup } from '../FileSupportPopup/FileSupportPopup';
import { FileSupportDotOpossumAlreadyExistsPopup } from '../FileSupportDotOpossumAlreadyExistsPopup/FileSupportDotOpossumAlreadyExistsPopup';
import { UpdateAppPopup } from '../UpdateAppPopup/UpdateAppPopup';
import { LocatorPopup } from '../LocatorPopup/LocatorPopup';

function getPopupComponent(popupType: PopupType | null): ReactElement | null {
switch (popupType) {
Expand Down Expand Up @@ -61,6 +62,8 @@ function getPopupComponent(popupType: PopupType | null): ReactElement | null {
return <FileSupportDotOpossumAlreadyExistsPopup />;
case PopupType.UpdateAppPopup:
return <UpdateAppPopup />;
case PopupType.LocatorPopup:
return <LocatorPopup />;
default:
return null;
}
Expand Down
42 changes: 42 additions & 0 deletions src/Frontend/Components/LocatorPopup/LocatorPopup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
//
// SPDX-License-Identifier: Apache-2.0

import React, { ReactElement } from 'react';
import { NotificationPopup } from '../NotificationPopup/NotificationPopup';
import { closePopup } from '../../state/actions/view-actions/view-actions';
import { ButtonText } from '../../enums/enums';
import { useAppDispatch } from '../../state/hooks';

export function LocatorPopup(): ReactElement {
const dispatch = useAppDispatch();
function close(): void {
dispatch(closePopup());
}

const content = <></>;

return (
<NotificationPopup
content={content}
header={'Locate Signals'}
isOpen={true}
fullWidth={true}
leftButtonConfig={{
onClick: (): void => {},
buttonText: ButtonText.Clear,
}}
centerLeftButtonConfig={{
onClick: (): void => {},
buttonText: ButtonText.Apply,
}}
rightButtonConfig={{
onClick: close,
buttonText: ButtonText.Cancel,
}}
onBackdropClick={close}
onEscapeKeyDown={close}
/>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
//
// SPDX-License-Identifier: Apache-2.0

import { renderComponentWithStore } from '../../../test-helpers/render-component-with-store';
import { screen } from '@testing-library/react';
import React from 'react';
import { LocatorPopup } from '../LocatorPopup';

describe('Locator popup ', () => {
jest.useFakeTimers();

it('renders', () => {
renderComponentWithStore(<LocatorPopup />);
expect(
screen.getByText('Locate Signals', { exact: true }),
).toBeInTheDocument();
});
});
2 changes: 2 additions & 0 deletions src/Frontend/enums/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export enum PopupType {
FileSupportPopup = 'FileSupportPopup',
FileSupportDotOpossumAlreadyExistsPopup = 'FileSupportDotOpossumAlreadyExistsPopup',
UpdateAppPopup = 'UpdateAppPopup',
LocatorPopup = 'LocatorPopup',
}

export enum SavePackageInfoOperation {
Expand All @@ -51,6 +52,7 @@ export enum ButtonText {
Back = 'Back',
Close = 'Close',
Cancel = 'Cancel',
Clear = 'Clear',
Confirm = 'Confirm',
ConfirmGlobally = 'Confirm globally',
ConfirmSelectedGlobally = 'Confirm selected globally',
Expand Down