diff --git a/webclient/src/App.js b/webclient/src/App.js index 35d865c..c850192 100644 --- a/webclient/src/App.js +++ b/webclient/src/App.js @@ -16,6 +16,7 @@ import { Training } from './Training.js'; import { AdminTransactions } from './AdminTransactions.js'; import { Admin } from './Admin.js'; import { Paste } from './Paste.js'; +import { Sign } from './Sign.js'; import { Courses, CourseDetail } from './Courses.js'; import { Classes, ClassDetail } from './Classes.js'; import { Members, MemberDetail } from './Members.js'; @@ -219,6 +220,10 @@ function App() { + + + + diff --git a/webclient/src/Home.js b/webclient/src/Home.js index 063b514..427595b 100644 --- a/webclient/src/Home.js +++ b/webclient/src/Home.js @@ -7,6 +7,7 @@ import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Me import { statusColor, BasicTable, siteUrl, staticUrl, requester, isAdmin } from './utils.js'; import { LoginForm, SignupForm } from './LoginSignup.js'; import { AccountForm } from './Account.js'; +import { SignForm } from './Sign.js'; import { PayPalSubscribeDeal } from './PayPal.js'; function MemberInfo(props) { @@ -138,53 +139,6 @@ function MemberInfo(props) { ); }; -function SignForm(props) { - const { token } = props; - const [error, setError] = useState({}); - const [sign, setSign] = useState(''); - const [loading, setLoading] = useState(false); - const [success, setSuccess] = useState(false); - - const handleValues = (e, v) => setSign(v.value); - const handleChange = (e) => handleValues(e, e.currentTarget); - - const handleSubmit = (e) => { - if (loading) return; - setLoading(true); - const data = {sign: sign}; - requester('/stats/sign/', 'POST', token, data) - .then(res => { - setLoading(false); - setSuccess(true); - setError({}); - setSign(''); - }) - .catch(err => { - setLoading(false); - console.log(err); - setError(err.data); - }); - }; - - return ( -
-

Send a message to the sign:

- - - - - Submit - - {success &&
Success!
} - - ); -}; - export function Home(props) { const { user, token } = props; const [stats, setStats] = useState(JSON.parse(localStorage.getItem('stats', 'false'))); diff --git a/webclient/src/Sign.js b/webclient/src/Sign.js new file mode 100644 index 0000000..f4f51f5 --- /dev/null +++ b/webclient/src/Sign.js @@ -0,0 +1,64 @@ +import React, { useState, useEffect, useReducer, useContext } from 'react'; +import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom'; +import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; +import { apiUrl, statusColor, BasicTable, staticUrl, requester } from './utils.js'; +import { NotFound } from './Misc.js'; + +export function SignForm(props) { + const { token } = props; + const [error, setError] = useState({}); + const [sign, setSign] = useState(''); + const [loading, setLoading] = useState(false); + const [success, setSuccess] = useState(false); + + const handleValues = (e, v) => setSign(v.value); + const handleChange = (e) => handleValues(e, e.currentTarget); + + const handleSubmit = (e) => { + if (loading) return; + setLoading(true); + const data = {sign: sign}; + requester('/stats/sign/', 'POST', token, data) + .then(res => { + setLoading(false); + setSuccess(true); + setError({}); + setSign(''); + }) + .catch(err => { + setLoading(false); + console.log(err); + setError(err.data); + }); + }; + + return ( +
+

Send a message to the sign:

+ + + + + Submit + + {success &&
Success!
} + + ); +}; + +export function Sign(props) { + const { token } = props; + + return ( + +
Protospace Sign
+ + +
+ ); +};