pineafan | fd93e6e | 2022-05-06 20:30:09 +0100 | [diff] [blame] | 1 | import HCaptcha from 'react-hcaptcha'; |
| 2 | import Axios from 'axios'; |
| 3 | import Router from 'next/router'; |
| 4 | import React from 'react'; |
| 5 | import Header from '../../../Components/Header' |
| 6 | import { useReward } from 'react-rewards'; |
| 7 | import { Card, CardRow } from '../../../Components/Card' |
| 8 | |
| 9 | import { AutoLayout, Panel, Title, Text, Divider } from '../../../Components/Panels'; |
| 10 | import { List, ListItem } from '../../../Components/Texttools'; |
| 11 | import { useColorMode } from 'theme-ui'; |
pineafan | fd93e6e | 2022-05-06 20:30:09 +0100 | [diff] [blame] | 12 | |
| 13 | function Verify(props) { |
| 14 | const [clicked, setClicked] = React.useState(false); |
| 15 | const [theme, setTheme] = useColorMode() |
| 16 | |
| 17 | const { reward: reward, isAnimating: isAnimating } = useReward('confetti', 'confetti', { |
| 18 | elementSize: 10, |
| 19 | elementCount: 150, |
| 20 | startVelocity: 35, |
| 21 | lifetime: 300, |
| 22 | decay: 0.94, |
| 23 | spread: 170, |
| 24 | position: "absolute", |
| 25 | colors: ["#68D49E"] |
| 26 | }); |
| 27 | |
| 28 | async function submitForm(tkn) { |
| 29 | if ( clicked ) { |
| 30 | return |
| 31 | } |
| 32 | setClicked(true); |
| 33 | reward(); |
| 34 | let code = await Axios.post('/api/nucleus/verify/complete', { |
| 35 | code:"TEST", |
| 36 | tkn: tkn |
| 37 | }); |
| 38 | setTimeout(() => { |
| 39 | if (code.data.success === true ) return Router.push('/nucleus/verify/success','/nucleus/verify') |
| 40 | else return Router.push('/nucleus/verify/failure','/nucleus/verify') |
| 41 | }, 2500); |
| 42 | } |
| 43 | |
| 44 | return <> |
| 45 | <Header |
| 46 | name="Clocks finite state machine" |
| 47 | customImage={"https://i1.sndcdn.com/artworks-000045941811-q634od-t500x500.jpg"} |
| 48 | roundImage={true} |
| 49 | subtext={`-5 members`} |
| 50 | gradient={["F27878", "D96B6B"]} |
| 51 | wave="web/waves/header/nucleus" |
| 52 | buttons={[]} |
PineaFan | a465f35 | 2023-02-05 16:45:01 +0000 | [diff] [blame] | 53 | season={props.season} |
pineafan | fd93e6e | 2022-05-06 20:30:09 +0100 | [diff] [blame] | 54 | /> |
| 55 | <AutoLayout> |
| 56 | <Panel> |
| 57 | <Title>Verify</Title> |
| 58 | <Divider name="commands"/> |
| 59 | <Text>Complete the check below to join ERROR</Text> |
| 60 | <div style={{height: "125px"}}> |
| 61 | <HCaptcha |
| 62 | id="Captchas mitigate problems" |
| 63 | sitekey="85074411-fa13-4d9b-b901-53095c6d1fc6" |
| 64 | onVerify={tkn => submitForm(tkn)} |
| 65 | theme="dark" |
| 66 | /> |
| 67 | </div> |
| 68 | <List colour="F27878"> |
| 69 | <ListItem>This is an automatic check performed by Nucleus.</ListItem> |
| 70 | <ListItem>By completing the CAPTCHA, you will be given the <code>MISSING</code> role in <code>ERROR</code>.</ListItem> |
PineaFan | 4141862 | 2023-10-14 21:36:48 +0100 | [diff] [blame^] | 71 | <ListItem>For the full list of data stored by Nucleus, please check <a href="https://clickscodes.github.io/policies/nucleus#verification">here</a></ListItem> |
pineafan | fd93e6e | 2022-05-06 20:30:09 +0100 | [diff] [blame] | 72 | </List> |
| 73 | <div id="confetti" /> |
| 74 | </Panel> |
| 75 | <Panel halfSize={false} id="invite"> |
| 76 | <Title>Invite</Title> |
| 77 | <Divider /> |
| 78 | <CardRow> |
| 79 | <Card |
| 80 | wave="nucleus" |
| 81 | icon="bots/nucleus/circle" |
| 82 | buttonText={"FFFFFF"} gradient={["F27878", "D96B6B"]} |
| 83 | title="Nucleus" |
| 84 | subtext="Invite Nucleus to your server" |
| 85 | buttons={[ |
| 86 | {color: "424242", link: "https://discord.com/api/oauth2/authorize?client_id=715989276382462053&permissions=121295465718&scope=bot%20applications.commands", text: "Invite"} |
| 87 | ]} |
| 88 | url="https://discord.com/api/oauth2/authorize?client_id=715989276382462053&permissions=121295465718&scope=bot%20applications.commands" |
| 89 | /> |
| 90 | </CardRow> |
| 91 | </Panel> |
| 92 | </AutoLayout> |
| 93 | </> |
| 94 | } |
| 95 | |
| 96 | export default Verify; |