forked from Mirrors/gomuks
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
// gomuks - A Matrix client written in Go.
|
|
// Copyright (C) 2024 Tulir Asokan
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
import { RoomViewProps } from "./RoomView.tsx"
|
|
import "./TimelineEvent.css"
|
|
|
|
export interface TimelineEventProps extends RoomViewProps {
|
|
eventRowID: number
|
|
}
|
|
|
|
const TimelineEvent = ({ room, eventRowID }: TimelineEventProps) => {
|
|
const evt = room.eventsByRowID.get(eventRowID)
|
|
if (!evt) {
|
|
return null
|
|
}
|
|
// @ts-expect-error TODO add content types
|
|
const body = (evt.decrypted ?? evt.content).body
|
|
return <div className="timeline-event">
|
|
<code>{evt.decrypted_type ?? evt.type}</code>
|
|
|
|
<code>{evt.sender}</code>
|
|
|
|
{body ?? <code>{JSON.stringify(evt.decrypted ?? evt.content, null, " ")}</code>}
|
|
</div>
|
|
}
|
|
|
|
export default TimelineEvent
|