2021-05-18 17:15:53 +00:00
|
|
|
import React from "react"
|
|
|
|
import SummaryBase from "../base/summary/SummaryBase"
|
|
|
|
import SummaryLeft from "../base/summary/SummaryLeft"
|
2021-05-23 13:45:00 +00:00
|
|
|
import { faComment, faImage } from "@fortawesome/free-solid-svg-icons"
|
2021-05-18 17:15:53 +00:00
|
|
|
import SummaryText from "../base/summary/SummaryText"
|
|
|
|
import SummaryRight from "../base/summary/SummaryRight"
|
|
|
|
|
|
|
|
|
2021-05-23 03:03:41 +00:00
|
|
|
/**
|
|
|
|
* A {@link SummaryBase} representing a tweet.
|
|
|
|
*
|
|
|
|
* @param tweet - The tweet to represent.
|
|
|
|
* @param props - Additional props to pass to the summary.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2021-05-18 17:15:53 +00:00
|
|
|
export default function SummaryTweet({ tweet, ...props }) {
|
|
|
|
let icon
|
2021-05-23 13:45:00 +00:00
|
|
|
if(tweet["image_url"]) {
|
|
|
|
icon = faImage
|
2021-05-18 17:15:53 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
icon = faComment
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<SummaryBase {...props}>
|
|
|
|
<SummaryLeft
|
|
|
|
icon={icon}
|
2021-05-20 09:39:40 +00:00
|
|
|
title={`@${tweet["poster"]}`}
|
|
|
|
subtitle={new Date(tweet["insert_time"]).toLocaleString()}
|
|
|
|
onClick={() => window.open(`https://twitter.com/${tweet["poster"]}/status/${tweet["snowflake"]}`)}
|
2021-05-18 17:15:53 +00:00
|
|
|
/>
|
|
|
|
<SummaryText>
|
|
|
|
{tweet.content}
|
|
|
|
</SummaryText>
|
|
|
|
<SummaryRight/>
|
|
|
|
</SummaryBase>
|
|
|
|
)
|
|
|
|
}
|