blob: eab02219821ed46950ef03aa2f5ae1605cb599eb [file] [log] [blame]
pineafanf5dd1872023-02-28 17:33:16 +00001import Axios from 'axios';
2import React from 'react';
TheCodedProfda197f22023-03-01 18:15:51 -05003import Message from '../../../Components/Transcripts/Message';
pineafanf5dd1872023-02-28 17:33:16 +00004
5function Index(props) {
TheCodedProfda197f22023-03-01 18:15:51 -05006 return <div style={{overflowY: "scroll", overflowX: "hidden"}}>
7 <div style={{
8 width: "100vw",
9 height: "40px",
10 backgroundColor: "#F27878",
11 display: "flex",
12 justifyContent: "left",
13 alignItems: "center",
14 paddingLeft: "25px",
15 color: "white",
16 fontSize: "1.5em",
17 }}>Transcript for: {props.data.for.username}#{props.data.for.discriminator} | In {<a href={`https://discord.com/channels/${props.data.guild}/${props.data.channel}`}>ChannelName</a>} | Type: {props.data.type}</div>
18 <div style={{
19 width: "100vw",
20 backgroundColor: "var(--theme-ui-colors-background)", //Can we change this to be not black please. it's too contrast heavy
21 margintop: "-50px",
22 padding: "25px",
23 paddingTop: "10px",
24 transition: "all 0.3s ease-in-out"
25 }}>
26 {
27 props.data.messages.map((message, index) => {
28 return <Message key={index.toString()} message={message} />
29 })
30 }
31 </div>
pineafanf5dd1872023-02-28 17:33:16 +000032 </div>
pineafanf5dd1872023-02-28 17:33:16 +000033}
34
35export default Index;
36export async function getServerSideProps(ctx) {
37 if(!ctx.query.code) {
38 return {
39 redirect: {
40 destination: '/nucleus/transcript/about',
41 permanent: true
42 }
43 }
44 }
45 let code;
46 try {
TheCodedProfc86e44b2023-02-28 17:30:57 -050047 code = (await Axios.get(`http://localhost:10000/transcript/${ctx.query.code}`))
pineafanf5dd1872023-02-28 17:33:16 +000048 } catch (e) {
49 return {
50 redirect: {
51 destination: '/nucleus/transcript/invalid',
52 permanent: true
53 }
54 }
55 }
56 return {
57 props: {
TheCodedProfc86e44b2023-02-28 17:30:57 -050058 data: code.data
pineafanf5dd1872023-02-28 17:33:16 +000059 }
60 }
61}