UI [CODE-1216] : Fix modal close and disable side menu on comment deletion (#913)

This commit is contained in:
Ritik Kapoor 2023-12-18 07:15:57 +00:00 committed by Harness
parent 9ea75dd327
commit b24729d608
2 changed files with 38 additions and 36 deletions

View File

@ -380,43 +380,44 @@ const CommentsThread = <T = unknown,>({
{outlets[CommentBoxOutletPosition.LEFT_OF_OPTIONS_MENU]}
</Container>
</Render>
<OptionsMenuButton
isDark={true}
icon="Options"
iconProps={{ size: 14 }}
style={{ padding: '5px' }}
disabled={!!commentItem?.deleted}
width="100px"
items={[
{
hasIcon: true,
className: css.optionMenuIcon,
iconName: 'Edit',
text: getString('edit'),
onClick: () => setEditIndexes({ ...editIndexes, ...{ [index]: true } })
},
{
hasIcon: true,
className: css.optionMenuIcon,
iconName: 'code-quote',
text: getString('quote'),
onClick: () => onQuote(commentItem?.content)
},
'-',
{
className: css.deleteIcon,
hasIcon: true,
iconName: 'main-trash',
isDanger: true,
text: getString('delete'),
onClick: async () => {
if (await handleAction(CommentAction.DELETE, '', commentItem)) {
resetStateAtIndex(index)
<Render when={!commentItem?.deleted}>
<OptionsMenuButton
isDark={true}
icon="Options"
iconProps={{ size: 14 }}
style={{ padding: '5px' }}
width="100px"
items={[
{
hasIcon: true,
className: css.optionMenuIcon,
iconName: 'Edit',
text: getString('edit'),
onClick: () => setEditIndexes({ ...editIndexes, ...{ [index]: true } })
},
{
hasIcon: true,
className: css.optionMenuIcon,
iconName: 'code-quote',
text: getString('quote'),
onClick: () => onQuote(commentItem?.content)
},
'-',
{
className: css.deleteIcon,
hasIcon: true,
iconName: 'main-trash',
isDanger: true,
text: getString('delete'),
onClick: async () => {
if (await handleAction(CommentAction.DELETE, '', commentItem)) {
resetStateAtIndex(index)
}
}
}
}
]}
/>
]}
/>
</Render>
</Layout.Horizontal>
</Layout.Horizontal>
}

View File

@ -83,8 +83,9 @@ export const useConfirmationDialog = (props: UseConfirmationDialogProps): UseCon
const onClose = React.useCallback(
(isConfirmed: boolean): void => {
onCloseDialog?.(isConfirmed)
hideModal()
if (persistDialog) showModal()
if (!isConfirmed) hideModal()
else if (persistDialog) showModal()
},
[hideModal, onCloseDialog, persistDialog]
)