From a98a69563484b991e5eefcd8ae2cbb7a0a252e6d Mon Sep 17 00:00:00 2001 From: Shivanand Sonnad Date: Mon, 14 Oct 2024 07:59:08 +0000 Subject: [PATCH] fix: [AH-483]: delete and Setup Client Popup is not going even after the user clicks on delete/Set Up Client button (#2802) * fix: [AH-483]: delete and Setup Client Popup is not going even after the user clicks on delete/Set Up Client button --- .../ActionButton/ActionButton.module.scss | 19 ++++++++ .../ActionButton.module.scss.d.ts | 19 ++++++++ .../ActionButton/ActionButton.tsx} | 19 ++++---- .../components/Actions/DeleteRepository.tsx | 3 +- .../components/Actions/RepositoryActions.tsx | 19 +++++--- .../components/Actions/SetupClient.tsx | 5 ++- .../components/Actions/types.ts | 1 + .../useSetupClientModal.tsx | 44 +++++++++++++------ 8 files changed, 98 insertions(+), 31 deletions(-) create mode 100644 web/src/ar/components/ActionButton/ActionButton.module.scss create mode 100644 web/src/ar/components/ActionButton/ActionButton.module.scss.d.ts rename web/src/ar/{pages/repository-details/components/Actions/RepositoryActionsWrapper.tsx => components/ActionButton/ActionButton.tsx} (74%) diff --git a/web/src/ar/components/ActionButton/ActionButton.module.scss b/web/src/ar/components/ActionButton/ActionButton.module.scss new file mode 100644 index 000000000..8f3fe057c --- /dev/null +++ b/web/src/ar/components/ActionButton/ActionButton.module.scss @@ -0,0 +1,19 @@ +/* + * Copyright 2024 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.optionsMenu { + min-width: unset; +} diff --git a/web/src/ar/components/ActionButton/ActionButton.module.scss.d.ts b/web/src/ar/components/ActionButton/ActionButton.module.scss.d.ts new file mode 100644 index 000000000..851246897 --- /dev/null +++ b/web/src/ar/components/ActionButton/ActionButton.module.scss.d.ts @@ -0,0 +1,19 @@ +/* + * Copyright 2023 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* eslint-disable */ +// This is an auto-generated file +export declare const optionsMenu: string diff --git a/web/src/ar/pages/repository-details/components/Actions/RepositoryActionsWrapper.tsx b/web/src/ar/components/ActionButton/ActionButton.tsx similarity index 74% rename from web/src/ar/pages/repository-details/components/Actions/RepositoryActionsWrapper.tsx rename to web/src/ar/components/ActionButton/ActionButton.tsx index 2433baac4..abd112c37 100644 --- a/web/src/ar/pages/repository-details/components/Actions/RepositoryActionsWrapper.tsx +++ b/web/src/ar/components/ActionButton/ActionButton.tsx @@ -14,15 +14,18 @@ * limitations under the License. */ -import React, { PropsWithChildren, useState } from 'react' +import React, { PropsWithChildren } from 'react' import { Button, ButtonVariation } from '@harnessio/uicore' import { Menu, Position } from '@blueprintjs/core' -import type { RepositoryActionsProps } from './types' -import css from './Actions.module.scss' +import css from './ActionButton.module.scss' -export default function RepositoryActionsWrapper({ children }: PropsWithChildren): JSX.Element { - const [menuOpen, setMenuOpen] = useState(false) +interface ActionButtonProps { + isOpen: boolean + setOpen: (val: boolean) => void +} + +export default function ActionButton({ children, isOpen, setOpen }: PropsWithChildren): JSX.Element { return (