From 12a9b60cc54992f6bfb928754be59588316e8434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor?= <68869379+JoaoVictor6@users.noreply.github.com> Date: Thu, 5 Jan 2023 22:35:03 -0300 Subject: [PATCH] refactor: use DeleteActionButton component and improve types --- frontend/components/dashboard/SideBar.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/components/dashboard/SideBar.tsx b/frontend/components/dashboard/SideBar.tsx index 41ac9c144..937e85a08 100644 --- a/frontend/components/dashboard/SideBar.tsx +++ b/frontend/components/dashboard/SideBar.tsx @@ -9,6 +9,7 @@ import Button from '../basic/buttons/Button'; import Toggle from '../basic/Toggle'; import CommentField from './CommentField'; import DashboardInputField from './DashboardInputField'; +import { DeleteActionButton } from './DeleteActionButton'; import GenerateSecretMenu from './GenerateSecretMenu'; @@ -28,6 +29,10 @@ interface OverrideProps { pos: number; comment: string; } +export interface DeleteRowFunctionProps { + ids: string[]; + secretName: string; +} interface SideBarProps { toggleSidebar: (value: string) => void; @@ -41,7 +46,7 @@ interface SideBarProps { savePush: () => void; sharedToHide: string[]; setSharedToHide: (values: string[]) => void; - deleteRow: any; + deleteRow: (props: DeleteRowFunctionProps) => void; } /** @@ -170,14 +175,9 @@ const SideBar = ({ active={buttonReady} textDisabled="Saved" /> -
-
+ deleteRow({ ids: overrideEnabled ? data.map(secret => secret.id) : [data.filter(secret => secret.type == "shared")[0]?.id], secretName: data[0]?.key })} + /> };