/* * Vencord, a Discord client mod * Copyright (c) 2024 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import { classNameFactory } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Margins } from "@utils/margins"; import { classes } from "@utils/misc"; import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { findByPropsLazy } from "@webpack"; import { TabBar, Text, Timestamp, TooltipContainer, useState } from "@webpack/common"; import { parseEditContent } from "."; const CodeContainerClasses = findByPropsLazy("markup", "codeContainer"); const MiscClasses = findByPropsLazy("messageContent", "markupRtl"); const cl = classNameFactory("vc-ml-modal-"); export function openHistoryModal(message: any) { openModal(props => ); } export function HistoryModal({ modalProps, message }: { modalProps: ModalProps; message: any; }) { const [currentTab, setCurrentTab] = useState(message.editHistory.length); const timestamps = [message.firstEditTimestamp, ...message.editHistory.map(m => m.timestamp)]; const contents = [...message.editHistory.map(m => m.content), message.content]; return ( Message Edit History {message.firstEditTimestamp.getTime() !== message.timestamp.getTime() && ( )} {timestamps.map((timestamp, index) => ( ))}
{parseEditContent(contents[currentTab], message)}
); }