diff --git a/app/soapbox/features/ui/components/compare_history_modal.tsx b/app/soapbox/features/ui/components/compare_history_modal.tsx index bb80eb63ba..92bfe8b232 100644 --- a/app/soapbox/features/ui/components/compare_history_modal.tsx +++ b/app/soapbox/features/ui/components/compare_history_modal.tsx @@ -1,10 +1,15 @@ +import classNames from 'classnames'; +import { List as ImmutableList } from 'immutable'; import React, { useEffect } from 'react'; import { FormattedDate, FormattedMessage } from 'react-intl'; import { fetchHistory } from 'soapbox/actions/history'; -import { Modal, Spinner, Text } from 'soapbox/components/ui'; +import AttachmentThumbs from 'soapbox/components/attachment_thumbs'; +import { HStack, Modal, Spinner, Stack, Text } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; +import type { StatusEdit as StatusEditEntity } from 'soapbox/types/entities'; + interface ICompareHistoryModal { onClose: (string: string) => void, statusId: string, @@ -14,7 +19,8 @@ const CompareHistoryModal: React.FC = ({ onClose, statusId const dispatch = useAppDispatch(); const loading = useAppSelector(state => state.history.getIn([statusId, 'loading'])); - const versions = useAppSelector(state => state.history.getIn([statusId, 'items'])); + // @ts-ignore + const versions = useAppSelector>(state => state.history.getIn([statusId, 'items'])); const onClickClose = () => { onClose('COMPARE_HISTORY'); @@ -31,10 +37,14 @@ const CompareHistoryModal: React.FC = ({ onClose, statusId } else { body = (
- {versions?.map((version: any) => { + {versions?.map((version) => { const content = { __html: version.contentHtml }; const spoilerContent = { __html: version.spoilerHtml }; + const poll = typeof version.poll !== 'string' && version.poll; + + console.log(version.toJS()); + return (
{version.spoiler_text?.length > 0 && ( @@ -43,7 +53,36 @@ const CompareHistoryModal: React.FC = ({ onClose, statusId
)} +
+ + {poll && ( +
+ + {version.poll.options.map((option: any) => ( + + + + + + ))} + +
+ )} + + {version.media_attachments.size > 0 && ( + + )} + diff --git a/app/soapbox/normalizers/status_edit.ts b/app/soapbox/normalizers/status_edit.ts index 18ba697df4..7bf38adc18 100644 --- a/app/soapbox/normalizers/status_edit.ts +++ b/app/soapbox/normalizers/status_edit.ts @@ -17,7 +17,7 @@ import { stripCompatibilityFeatures } from 'soapbox/utils/html'; import { makeEmojiMap } from 'soapbox/utils/normalizers'; import type { ReducerAccount } from 'soapbox/reducers/accounts'; -import type { Account, Attachment, Emoji, EmbeddedEntity } from 'soapbox/types/entities'; +import type { Account, Attachment, Emoji, EmbeddedEntity, Poll } from 'soapbox/types/entities'; export const StatusEditRecord = ImmutableRecord({ account: null as EmbeddedEntity, @@ -26,6 +26,7 @@ export const StatusEditRecord = ImmutableRecord({ emojis: ImmutableList(), favourited: false, media_attachments: ImmutableList(), + poll: null as EmbeddedEntity, sensitive: false, spoiler_text: '', diff --git a/app/soapbox/types/entities.ts b/app/soapbox/types/entities.ts index 80caf1ea16..d01698e46b 100644 --- a/app/soapbox/types/entities.ts +++ b/app/soapbox/types/entities.ts @@ -11,6 +11,7 @@ import { NotificationRecord, PollRecord, PollOptionRecord, + StatusEditRecord, StatusRecord, } from 'soapbox/normalizers'; @@ -27,6 +28,7 @@ type Mention = ReturnType; type Notification = ReturnType; type Poll = ReturnType; type PollOption = ReturnType; +type StatusEdit = ReturnType; interface Account extends ReturnType { // HACK: we can't do a circular reference in the Record definition itself, @@ -58,6 +60,7 @@ export { Poll, PollOption, Status, + StatusEdit, // Utility types APIEntity,