blob: 7ef2cedd29e453369f288431e52545141a7b33a4 [file] [log] [blame]
Samuel Shuert0e357042022-06-10 16:12:51 -04001import HCaptcha from 'react-hcaptcha';
2import Axios from 'axios';
3import Router from 'next/router';
4import React from 'react';
5import Header from '../../../Components/Header'
6import { useReward } from 'react-rewards';
7import { Card, CardRow } from '../../../Components/Card';
8
9import { AutoLayout, Panel, Title, Text, Divider } from '../../../Components/Panels';
10import { List, ListItem } from '../../../Components/Texttools';
11import { useColorMode } from 'theme-ui';
12import Styles from '../../../styles/nucleus/embed.module.css';
13
14
15function Embed(props) {
16 const [clicked, setClicked] = React.useState(false);
17 const [theme, setTheme] = useColorMode()
18
19 const { reward: reward, isAnimating: isAnimating } = useReward('confetti', 'confetti', {
20 elementSize: 10,
21 elementCount: 150,
22 startVelocity: 35,
23 lifetime: 300,
24 decay: 0.94,
25 spread: 170,
26 position: "absolute",
27 colors: ["#68D49E"]
28 });
29
30 async function submitForm(tkn) {
31 if ( clicked ) {
32 Router.push('/nucleus/verify/alreadyVerified', '/nucleus/verify/success');
33 }
34 setClicked(true);
35 reward();
36 let code = await Axios.post('/api/nucleus/verify/complete', {
37 code: props.code,
38 tkn: tkn
39 });
40 setTimeout(() => {
41 if (code.data.success === true ) return Router.push('/nucleus/verify/success','/nucleus/verify')
42 else return Router.push('/nucleus/verify/failure','/nucleus/verify')
43 }, 2500);
44 }
45
46 return <>
47 <Header
48 name="Embed Editor"
49 subtext={`Editing embed in ${props.gName}`}
50 gradient={["F27878", "D96B6B"]}
51 wave="web/waves/header/nucleus"
52 buttons={[]}
53 />
54 <AutoLayout>
55 <Panel>
56 <Title>Preview</Title>
57 <Divider name="preview"/>
58 <div className={Styles.previewEmbed}>
59 <div className={Styles.left}></div>
60 <div className={Styles.title}><input ></input></div>
61 <div className={Styles.description}><input ></input></div>
62 </div>
63 <div className={Styles.right}>
64 <div className={Styles.uploadImage} />
65 </div>
66 <>
67
68 </>
69 <div className={Styles.footer}>
70 <ImageUpload size={64} />
71 </div>
72 </Panel>
73 <Panel halfSize={false} id="invite">
74 <Title>Invite</Title>
75 <Divider />
76 <CardRow>
77 <Card
78 wave="nucleus"
79 icon="bots/nucleus/circle"
80 buttonText={"FFFFFF"} gradient={["F27878", "D96B6B"]}
81 title="Nucleus"
82 subtext="Invite Nucleus to your server"
83 buttons={[
84 {color: "424242", link: "https://discord.com/api/oauth2/authorize?client_id=715989276382462053&permissions=121295465718&scope=bot%20applications.commands", text: "Invite"}
85 ]}
86 url="https://discord.com/api/oauth2/authorize?client_id=715989276382462053&permissions=121295465718&scope=bot%20applications.commands"
87 />
88 </CardRow>
89 </Panel>
90 </AutoLayout>
91 </>
92}
93
94export default Embed;
95export async function getServerSideProps(ctx) {
96 return {
97 props: {
98 gID: code.data.gID,
99 gName: code.data.gName,
100 mID: code.data.mID,
101 cID: code.data.cID,
102 headers: headers,
103 code: ctx.query.code
104 }
105 }
106}