blob: 1275e67e69eb8edc58422583d9b2997e70c4ba80 [file] [log] [blame]
pineafanf5dd1872023-02-28 17:33:16 +00001import Axios from 'axios';
2import React from 'react';
TheCodedProfc86e44b2023-02-28 17:30:57 -05003import Author from '../../../Components/Transcripts/Author';
pineafanf5dd1872023-02-28 17:33:16 +00004
5function Index(props) {
6 return <>
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",
TheCodedProfc86e44b2023-02-28 17:30:57 -050017 }}>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>
pineafanf5dd1872023-02-28 17:33:16 +000018 <div style={{
19 height: "100vw",
20 width: "100vw",
21 backgroundColor: "var(--theme-ui-colors-background)",
22 margintop: "-50px",
23 padding: "25px",
24 paddingTop: "10px",
25 transition: "all 0.3s ease-in-out"
26 }}>
TheCodedProfc86e44b2023-02-28 17:30:57 -050027 <Author author={props.data.messages[0].author} />
28 {/* {
29 props.data.messages.map((message, index) => {
30 console.log(index, message)
31 return <Author key={index.toString()} author={message.author} />
32 })
33 } */}
pineafanf5dd1872023-02-28 17:33:16 +000034 </div>
35</>
36}
37
38export default Index;
39export async function getServerSideProps(ctx) {
40 if(!ctx.query.code) {
41 return {
42 redirect: {
43 destination: '/nucleus/transcript/about',
44 permanent: true
45 }
46 }
47 }
48 let code;
49 try {
TheCodedProfc86e44b2023-02-28 17:30:57 -050050 code = (await Axios.get(`http://localhost:10000/transcript/${ctx.query.code}`))
pineafanf5dd1872023-02-28 17:33:16 +000051 } catch (e) {
52 return {
53 redirect: {
54 destination: '/nucleus/transcript/invalid',
55 permanent: true
56 }
57 }
58 }
59 return {
60 props: {
TheCodedProfc86e44b2023-02-28 17:30:57 -050061 data: code.data
pineafanf5dd1872023-02-28 17:33:16 +000062 }
63 }
64}