Don't hide cancel if still in edit mode

This commit is contained in:
ekzyis 2024-10-25 22:02:12 +02:00
parent 18565200e6
commit 739509de4f
2 changed files with 20 additions and 3 deletions

View File

@ -180,6 +180,7 @@ export default function Comment ({
</ActionTooltip>}
</>
}
edit={edit}
onEdit={e => { setEdit(!edit) }}
editText={edit ? 'cancel' : 'edit'}
/>}

View File

@ -30,7 +30,7 @@ import classNames from 'classnames'
export default function ItemInfo ({
item, full, commentsText = 'comments',
commentTextSingular = 'comment', className, embellishUser, extraInfo, onEdit, editText,
commentTextSingular = 'comment', className, embellishUser, extraInfo, edit, onEdit, editText,
onQuoteReply, extraBadges, nested, pinnable, showActionDropdown = true, showUser = true,
setDisableRetry, disableRetry
}) {
@ -151,7 +151,7 @@ export default function ItemInfo ({
showActionDropdown &&
<>
<EditInfo
item={item} canEdit={canEdit}
item={item} edit={edit} canEdit={canEdit}
setCanEdit={setCanEdit} onEdit={onEdit} editText={editText} editThreshold={editThreshold}
/>
<PaymentInfo item={item} disableRetry={disableRetry} setDisableRetry={setDisableRetry} />
@ -311,7 +311,7 @@ function PaymentInfo ({ item, disableRetry, setDisableRetry }) {
)
}
function EditInfo ({ item, canEdit, setCanEdit, onEdit, editText, editThreshold }) {
function EditInfo ({ item, edit, canEdit, setCanEdit, onEdit, editText, editThreshold }) {
const router = useRouter()
if (canEdit) {
@ -334,5 +334,21 @@ function EditInfo ({ item, canEdit, setCanEdit, onEdit, editText, editThreshold
)
}
if (edit && !canEdit) {
// if we're still editing after timer ran out
return (
<>
<span> \ </span>
<span
className='text-reset pointer fw-bold'
onClick={() => setEdit(false)}
>
<span>cancel </span>
<span>00:00</span>
</span>
</>
)
}
return null
}