Splits up current message from edited messages in modal

This commit is contained in:
Josh Perez 2023-05-10 15:01:03 -04:00 committed by GitHub
parent 22e1ff9b50
commit 1ec9bce79d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 2 deletions

View file

@ -2,6 +2,14 @@
// SPDX-License-Identifier: AGPL-3.0-only
.EditHistoryMessagesModal {
&__divider {
margin-block: 24px;
}
&__title {
@include font-body-1-bold;
}
.module-message {
padding-inline: 0;

View file

@ -95,6 +95,9 @@ export function EditHistoryMessagesModal({
Record<string, number | undefined>
>({});
const [currentMessage, ...pastEdits] = editHistoryMessages;
const currentMessageId = `${currentMessage.id}.${currentMessage.timestamp}`;
return (
<Modal
hasXButton
@ -102,11 +105,46 @@ export function EditHistoryMessagesModal({
modalName="EditHistoryMessagesModal"
moduleClassName="EditHistoryMessagesModal"
onClose={closeEditHistoryModal}
title={i18n('icu:EditHistoryMessagesModal__title')}
noTransform
>
<div ref={containerElementRef}>
{editHistoryMessages.map(messageAttributes => {
<Message
{...MESSAGE_DEFAULT_PROPS}
{...currentMessage}
id={currentMessageId}
containerElementRef={containerElementRef}
displayLimit={displayLimitById[currentMessageId]}
getPreferredBadge={getPreferredBadge}
i18n={i18n}
isSpoilerExpanded={revealedSpoilersById[currentMessageId] || {}}
key={currentMessage.timestamp}
kickOffAttachmentDownload={kickOffAttachmentDownload}
messageExpanded={(messageId, displayLimit) => {
const update = {
...displayLimitById,
[messageId]: displayLimit,
};
setDisplayLimitById(update);
}}
platform={platform}
showLightbox={closeAndShowLightbox}
showSpoiler={(messageId, data) => {
const update = {
...revealedSpoilersById,
[messageId]: data,
};
setRevealedSpoilersById(update);
}}
theme={theme}
/>
<hr className="EditHistoryMessagesModal__divider" />
<h3 className="EditHistoryMessagesModal__title">
{i18n('icu:EditHistoryMessagesModal__title')}
</h3>
{pastEdits.map(messageAttributes => {
const syntheticId = `${messageAttributes.id}.${messageAttributes.timestamp}`;
return (