blob: dca30b2947be5c4558daedd2a3c42591b308aad3 [file] [log] [blame]
TheCodedProfda197f22023-03-01 18:15:51 -05001import Styles from "../../styles/Components/transcripts.module.css"
2import Image from "next/image";
3import JSDom from "jsdom";
TheCodedProfc86e44b2023-02-28 17:30:57 -05004
TheCodedProfda197f22023-03-01 18:15:51 -05005function embed(props) {
TheCodedProfc86e44b2023-02-28 17:30:57 -05006
TheCodedProfda197f22023-03-01 18:15:51 -05007 let description = props.embed.description;
8 if (description) {
9 description = description.split("\n");
10 }
11
12 return ( // added it
13 <div className={Styles.embed} style={{borderColor: props.color ?? "#F27878"}}>
14 {
15 props.embed.author ?
16 <div className={Styles.embedAuthor}>
17 {
18 props.embed.author.iconURL ?
19 <Image src={props.embed.author.iconURL} alt=""/> :
20 null
21 }
22 {
23 props.embed.author.url ?
24 <a href={props.embed.author.url}>
25 {props.embed.author?.name ?? ""}
26 </a> :
27 <p>{props.embed.author?.name ?? ""}</p>
28 }
29 </div> :
30 null
31 }
32 {
33 props.embed.title ?
34 <div className={Styles.embedTitle}>{props.embed.title}</div> :
35 null
36 }
37 {
38 props.embed.description ?
39 <div className={Styles.embedDescription}>
40 {
41 description.map(i => {// idk how to do make this work
42 i = i
43 .replaceAll(/<a?:.+:\D+>/g, (match, id) => {
44 return <Image src={`https://cdn.discordapp.com/emojis/${id}.png`} alt=""/>
45 })
46 .replaceAll(/\*\*.+\*\*/g, (match, text) => {
47 return <b>{text}</b>
48 })
49 .replaceAll(/\*.+\*/g, (match, text) => {
50 return <i>{text}</i>
51 })
52 return <>{new JSDom.JSDOM(i)}<br/></> // CANT FIND A DOM PARSER THAT WORKS
53 })
54 }
55 </div>
56 : null
57 }
58 </div>
59 )
TheCodedProfc86e44b2023-02-28 17:30:57 -050060}
61
TheCodedProfda197f22023-03-01 18:15:51 -050062export default embed;