diff --git a/src/features/dashboard/components/AppsTable/app-actions.cell.tsx b/src/features/dashboard/components/AppsTable/app-actions.cell.tsx index cefe5a156..8b1371216 100644 --- a/src/features/dashboard/components/AppsTable/app-actions.cell.tsx +++ b/src/features/dashboard/components/AppsTable/app-actions.cell.tsx @@ -1,36 +1,40 @@ -import React from 'react'; +import React, { useState } from 'react'; +import styles from './cells.module.scss'; import { LabelPairedPenSmRegularIcon, LabelPairedTrashSmRegularIcon } from '@deriv/quill-icons'; +import DeleteAppDialog from '../Dialogs/DeleteAppDialog'; +import UpdateAppDialog from '../Dialogs/UpdateAppDialog'; import CustomTooltip from '@site/src/components/CustomTooltip'; -import clsx from 'clsx'; -import styles from './cells.module.scss'; -type TAppActionsCellProps = { - openDeleteDialog: () => void; - openEditDialog: () => void; - flex_end?: boolean; -}; +const AppActionsCell = () => { + const [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false); + const [isUpdateDialogOpen, setUpdateDialogOpen] = useState(false); + + const handleDeleteClick = () => { + setDeleteDialogOpen(true); + }; + + const handleUpdateClick = () => { + setUpdateDialogOpen(true); + }; -const AppActionsCell = ({ - openDeleteDialog, - openEditDialog, - flex_end = false, -}: TAppActionsCellProps) => { return ( -
- +
+
- - - - +
+
+ - +
+ {isDeleteDialogOpen && ( + setDeleteDialogOpen(false)} appId={0} /> + )} + {isUpdateDialogOpen && ( + setUpdateDialogOpen(false)} app={undefined} /> + )}
); }; diff --git a/src/features/dashboard/components/AppsTable/cells.module.scss b/src/features/dashboard/components/AppsTable/cells.module.scss index 4e068e391..6a2468ebe 100644 --- a/src/features/dashboard/components/AppsTable/cells.module.scss +++ b/src/features/dashboard/components/AppsTable/cells.module.scss @@ -10,6 +10,10 @@ } } +.actionContainer { + margin-right: 10px; +} + .flex_end { justify-content: flex-end; } diff --git a/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx b/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx index 7f8e8297e..1a67eecfb 100644 --- a/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx +++ b/src/features/dashboard/components/Dialogs/UpdateAppDialog/index.tsx @@ -18,12 +18,14 @@ const UpdateAppDialog = ({ app, onClose }: IUpdateAppDialog) => { const { send: updateApp, data, error, clear } = useWS('app_update'); const { getApps } = useAppManager(); - const scopes = scopesArrayToObject(app.scopes); - const initialValues: Partial = { - ...app, - ...scopes, - app_markup_percentage: String(app.app_markup_percentage), - }; + const scopes = app ? scopesArrayToObject(app.scopes) : {}; + const initialValues: Partial = app + ? { + ...app, + ...scopes, + app_markup_percentage: String(app.app_markup_percentage), + } + : {}; const onOpenChange = useCallback( (open: boolean) => {