mirror of
https://github.com/harness/drone.git
synced 2025-05-19 02:20:03 +08:00
UI [CODE-1216] : Fix modal close and disable side menu on comment deletion (#913)
This commit is contained in:
parent
9ea75dd327
commit
b24729d608
@ -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>
|
||||
}
|
||||
|
@ -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]
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user