pineafan | f5dd187 | 2023-02-28 17:33:16 +0000 | [diff] [blame] | 1 | import Axios from 'axios'; |
| 2 | import React from 'react'; |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame^] | 3 | import Author from '../../../Components/Transcripts/Author'; |
pineafan | f5dd187 | 2023-02-28 17:33:16 +0000 | [diff] [blame] | 4 | |
| 5 | function 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", |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame^] | 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> |
pineafan | f5dd187 | 2023-02-28 17:33:16 +0000 | [diff] [blame] | 18 | <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 | }}> |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame^] | 27 | <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 | } */} |
pineafan | f5dd187 | 2023-02-28 17:33:16 +0000 | [diff] [blame] | 34 | </div> |
| 35 | </> |
| 36 | } |
| 37 | |
| 38 | export default Index; |
| 39 | export 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 { |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame^] | 50 | code = (await Axios.get(`http://localhost:10000/transcript/${ctx.query.code}`)) |
pineafan | f5dd187 | 2023-02-28 17:33:16 +0000 | [diff] [blame] | 51 | } catch (e) { |
| 52 | return { |
| 53 | redirect: { |
| 54 | destination: '/nucleus/transcript/invalid', |
| 55 | permanent: true |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | return { |
| 60 | props: { |
TheCodedProf | c86e44b | 2023-02-28 17:30:57 -0500 | [diff] [blame^] | 61 | data: code.data |
pineafan | f5dd187 | 2023-02-28 17:33:16 +0000 | [diff] [blame] | 62 | } |
| 63 | } |
| 64 | } |