Skip to content

Commit

Permalink
fix delete functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Agrim Jain authored and Agrim Jain committed May 8, 2024
1 parent ab7c2e5 commit 887d616
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
44 changes: 27 additions & 17 deletions src/features/dashboard/components/AppsTable/app-actions.cell.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
import React, { useState } from 'react';
import styles from './cells.module.scss';
import { LabelPairedTrashSmRegularIcon } from '@deriv/quill-icons';
import DeleteAppDialog from '../Dialogs/DeleteAppDialog';
import React from 'react';
import { LabelPairedPenSmRegularIcon, LabelPairedTrashSmRegularIcon } from '@deriv/quill-icons';
import CustomTooltip from '@site/src/components/CustomTooltip';
import clsx from 'clsx';
import styles from './cells.module.scss';

const AppActionsCell = () => {
const [isDeleteDialogOpen, setDeleteDialogOpen] = useState(false);

const handleDeleteClick = () => {
setDeleteDialogOpen(true);
};
type TAppActionsCellProps = {
openDeleteDialog: () => void;
openEditDialog: () => void;
flex_end?: boolean;
};

const AppActionsCell = ({
openDeleteDialog,
openEditDialog,
flex_end = false,
}: TAppActionsCellProps) => {
return (
<div className={styles.appActions} data-testid={'app-action-cell'}>
<div onClick={handleDeleteClick} data-testid={'delete-app-button'}>
<CustomTooltip text='Delete application details'>
<div
className={clsx(styles.appActions, { [styles.flex_end]: flex_end })}
data-testid={'app-action-cell'}
>
<span onClick={openEditDialog} data-testid={'update-app-button'}>
<CustomTooltip text='Edit application details'>
<LabelPairedPenSmRegularIcon />
</CustomTooltip>
</span>

<span onClick={openDeleteDialog} data-testid={'delete-app-button'}>
<CustomTooltip text='Delete application'>
<LabelPairedTrashSmRegularIcon />
</CustomTooltip>
</div>
{isDeleteDialogOpen && (
<DeleteAppDialog onClose={() => setDeleteDialogOpen(false)} appId={0} />
)}
</span>
</div>
);
};
Expand Down
4 changes: 0 additions & 4 deletions src/features/dashboard/components/AppsTable/cells.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
}
}

.actionContainer {
margin-right: 10px;
}

.flex_end {
justify-content: flex-end;
}
2 changes: 1 addition & 1 deletion src/features/dashboard/components/AppsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const AppsTable = ({ apps }: AppsTableProps) => {
return {
openDeleteDialog: () => {
setActionRow(item);
// setIsDeleteOpen(true);
setIsDeleteOpen(true);
},

openEditDialog: () => {
Expand Down

0 comments on commit 887d616

Please sign in to comment.