Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d62ce26759 | |||
| faf5269eba | |||
| 9a20cc009d | |||
| 6891f87447 | |||
| 17633f3345 | |||
| 59e7194cf7 |
+1
-1
@@ -25,5 +25,5 @@ module.exports = withBundleAnalyzer(withSentryConfig({
|
||||
},
|
||||
sentry: {
|
||||
hideSourceMaps: true, // Hide source maps, see: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-source-maps
|
||||
}
|
||||
},
|
||||
}, sentryWebpackPluginOptions));
|
||||
|
||||
Generated
+619
-494
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,8 @@
|
||||
"ja hallitukset kuulumiset": "and what the board has been up to",
|
||||
"Kuvia tapahtumista": "Photos from events",
|
||||
"kuvagalleriassa": "in the photo gallery",
|
||||
"Lisää killan": "Add guild's",
|
||||
"Google-kalenteri": "Google-calendar",
|
||||
|
||||
"Hakemaasi sivua":
|
||||
"Page",
|
||||
@@ -51,6 +53,9 @@
|
||||
"Ilmoittautuminen sulkeutuu":
|
||||
"Signup closes at",
|
||||
|
||||
"Ilmoittautuminen onnistui!":
|
||||
"Signup successful!",
|
||||
|
||||
"Ilmoittauminen on umpeutunut!":
|
||||
"Signup has been closed!",
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import { NextPage, GetStaticProps, GetStaticPaths } from "next";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { ISubmitEvent } from "@rjsf/core";
|
||||
import { toast } from "react-toastify";
|
||||
import axios from "axios";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import useSWR from "swr";
|
||||
import { Signup, SignupForm } from "@models/Signup";
|
||||
import SignupApi from "@api/signupApi";
|
||||
import SignUpPageView from "@views/SignUpPage/SignUpPageView";
|
||||
@@ -25,6 +25,8 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
|
||||
const id = String(initialForm?.id ?? "");
|
||||
const URL = `${FORM_URL}${id}/`;
|
||||
const { data: signupForm, error } = useSWR<SignupForm>(URL, (url) => axios.get(url).then((res) => res.data), { fallbackData: initialForm });
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const [formSent, setFormSent] = useState(false);
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
@@ -42,18 +44,26 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
|
||||
}
|
||||
|
||||
const onSubmit = async ({ formData }: ISubmitEvent<string>) => {
|
||||
setIsSending(true);
|
||||
|
||||
const payload: Signup = {
|
||||
signupForm_id: signupForm.id,
|
||||
answer: formData,
|
||||
};
|
||||
|
||||
if (isSending === true) {
|
||||
toast.error("Sign-up form already submitted! No need to spam send. 😟");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await SignupApi.createSignup(payload);
|
||||
toast.success("Sign-up submitted successfully 😎");
|
||||
mutate(URL);
|
||||
setFormSent(true);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
toast.error("Uh oh! Sign-up failed! 😟");
|
||||
setIsSending(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,6 +78,7 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
|
||||
formData={{}}
|
||||
onChange={noop}
|
||||
onSubmit={onSubmit}
|
||||
formSent={formSent}
|
||||
/>
|
||||
</PageWrapper>
|
||||
</>
|
||||
|
||||
@@ -186,6 +186,8 @@ const InEnglishPageView: React.FC<InEnglishPageViewProps> = ({ events, feed }) =
|
||||
<h3 id="freshmen">For exchange student</h3>
|
||||
<div>
|
||||
<div>
|
||||
<h6>Telegram group 2023-2024</h6>
|
||||
<p>For starters, we recommend you join the <Link to="https://t.me/+ewiOhvuTXAcwODRk">Telegram-channel</Link> made for new exchange and master's students.</p>
|
||||
<h6>Freshman points</h6>
|
||||
<p>What is student life like in Finland? What are the unique cool things to experience? To find out we recommend collecting the fuksi points (freshman points) to your fuksi point card. It's fun! The point card gives you a guideline to experiencing the student life and allows you to get a diploma with the privilege to wear the teekkari cap. Note that internationals are also fuksis on their first year in Aalto even though they are not really freshmen. Even Finns who change to a different study program get to be a fuksi again.</p>
|
||||
<h6>Overalls</h6>
|
||||
|
||||
@@ -23,6 +23,7 @@ interface SignUpPageViewProps {
|
||||
formData: any;
|
||||
onChange: (e: IChangeEvent<unknown>, es?: ErrorSchema) => unknown;
|
||||
onSubmit: (e: ISubmitEvent<unknown>) => unknown;
|
||||
formSent?: boolean;
|
||||
}
|
||||
|
||||
const StyledSection = styled(TextSection)`
|
||||
@@ -59,6 +60,7 @@ const SignUpPageView: React.FC<SignUpPageViewProps> = ({
|
||||
formData,
|
||||
onChange,
|
||||
onSubmit,
|
||||
formSent = false,
|
||||
}) => {
|
||||
const { i18n, t } = useTranslation();
|
||||
const startDate = new Date(signUpForm?.start_time);
|
||||
@@ -136,7 +138,7 @@ const SignUpPageView: React.FC<SignUpPageViewProps> = ({
|
||||
</h1>
|
||||
|
||||
<div>
|
||||
{form}
|
||||
{ formSent ? <p>{`${t("Ilmoittautuminen onnistui!")}`}</p> : form }
|
||||
</div>
|
||||
{signups}
|
||||
</StyledSection>
|
||||
|
||||
Reference in New Issue
Block a user