diff --git a/src/app/game/berry-dash/page.tsx b/src/app/game/berry-dash/page.tsx index 34ce1e5..b64e03a 100644 --- a/src/app/game/berry-dash/page.tsx +++ b/src/app/game/berry-dash/page.tsx @@ -103,13 +103,14 @@ export default function BerryDashGameInfo () {

Stuff you can do in the browser

- - View the Icon Marketplace! - +
+ + View the Icon Marketplace! + + + Submit a new Splash Text! + +

Downloads

(null) + const [result, setResult] = useState(-1) + const [loading, setLoading] = useState(true) + const router = useRouter() + + useEffect(() => { + document.title = 'Lncvrt Games - Reset Account Password' + + const token = getCookie('accountToken', '-1') + if (token === '-1') { + router.push('/account') + } else setLoading(false) + }, []) + + return ( +
+ + +

+ {loading + ? 'Loading...' + : result == -1 + ? 'Verify you are human to submit a splash text' + : 'Lncvrt Games Splash Text Submition'} +

+ {!loading && ( + <> + {result == -1 ? ( + { + setToken(token) + setResult(0) + }} + onError={() => setResult(1)} + className='flex justify-center' + /> + ) : result == 0 ? ( +
{ + e.preventDefault() + + const form = e.currentTarget + const formData = new FormData(form) + const text = formData.get('text') as string + + try { + const result = await axios.post( + '/api/account/berrydash/splash-text', + { + token, + content: text + }, + { + headers: { + authorization: getCookie('accountToken', '-1') + } + } + ) + if (result.data.success) { + setResult(2) + } else { + alert( + 'Failed to submit splash text, error: ' + + (result.data.message || 'n/a') + ) + } + } catch (e: any) { + if (e.response) { + alert( + 'Failed to submit splash text, error: ' + + (e.response.data?.message || + JSON.stringify(e.response.data)) + ) + } else if (e.request) { + alert( + 'Failed to submit splash text, no response from server.' + ) + } else { + alert('Failed to submit splash text, error: ' + e.message) + } + } + }} + > + + +
+ ) : ( + (result == 1 || result == 2) && ( +

+ {result == 1 + ? 'Unable to verify captcha, please reload page.' + : 'Successfully submitted splash text! It will be reviewed soon.'} +

+ ) + )} + + )} +
+ ) +}