TheCodedProf | da197f2 | 2023-03-01 18:15:51 -0500 | [diff] [blame] | 1 | import Styles from "../../styles/Components/transcripts.module.css" |
| 2 | import Author from "./Author"; |
| 3 | import Image from "next/image"; |
| 4 | import Attachment from "./Attachment"; |
| 5 | import Embed from "./Embed"; |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame] | 6 | |
TheCodedProf | da197f2 | 2023-03-01 18:15:51 -0500 | [diff] [blame] | 7 | function message(props) { |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame] | 8 | |
TheCodedProf | da197f2 | 2023-03-01 18:15:51 -0500 | [diff] [blame] | 9 | return ( |
| 10 | <div className={Styles.container}> |
| 11 | <div className={Styles.verticalFlex} style={{width: "60px"}}> |
| 12 | <Image className={Styles.avatar} src={props.message.author.iconURL ?? "https://picsum.photos/50"} width={50} height={50} alt=""/> {/* TODO: Add a cync icon here as a default*/} |
| 13 | </div> |
| 14 | <div className={Styles.verticalFlex} style={{width: "calc(100vw - 60px - 40px)"}}> |
| 15 | <Author message={props.message} /> |
| 16 | <p className={Styles.messageContent}>{props.message.content}</p> |
| 17 | { |
| 18 | props.message.embeds ? props.message.embeds.map((embed, index) => { |
| 19 | return <Embed key={index.toString()} embed={embed} /> |
| 20 | }) : null |
| 21 | } |
| 22 | { |
| 23 | props.message.attachments ? props.message.attachments.map((attachment, index) => { |
| 24 | return <Attachment key={index.toString()} attachment={attachment} alt="" /> |
| 25 | }) : null |
| 26 | } |
| 27 | </div> |
| 28 | </div> |
| 29 | ) |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame] | 30 | } |
| 31 | |
TheCodedProf | da197f2 | 2023-03-01 18:15:51 -0500 | [diff] [blame] | 32 | export default message; |