Compare commits

...

6 Commits

Author SHA1 Message Date
Aarni Halinen d62ce26759 npm audit fix 2023-10-03 19:30:18 +03:00
Ojakoo faf5269eba set defult value for formSent to disable form hiding in edit view 2023-09-26 14:32:40 +03:00
Ojakoo 9a20cc009d quick fix #42 2023-09-26 13:53:40 +03:00
Tommi S 6891f87447 add new words 2023-08-08 19:44:03 +03:00
Tommi S 17633f3345 Add english page international telegram group link 2023-08-02 22:55:10 +03:00
Tommi S 59e7194cf7 Add english page international telegram group link 2023-08-02 22:52:41 +03:00
6 changed files with 644 additions and 499 deletions
+1 -1
View File
@@ -25,5 +25,5 @@ module.exports = withBundleAnalyzer(withSentryConfig({
}, },
sentry: { sentry: {
hideSourceMaps: true, // Hide source maps, see: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-source-maps hideSourceMaps: true, // Hide source maps, see: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-source-maps
} },
}, sentryWebpackPluginOptions)); }, sentryWebpackPluginOptions));
+619 -494
View File
File diff suppressed because it is too large Load Diff
+5
View File
@@ -15,6 +15,8 @@
"ja hallitukset kuulumiset": "and what the board has been up to", "ja hallitukset kuulumiset": "and what the board has been up to",
"Kuvia tapahtumista": "Photos from events", "Kuvia tapahtumista": "Photos from events",
"kuvagalleriassa": "in the photo gallery", "kuvagalleriassa": "in the photo gallery",
"Lisää killan": "Add guild's",
"Google-kalenteri": "Google-calendar",
"Hakemaasi sivua": "Hakemaasi sivua":
"Page", "Page",
@@ -51,6 +53,9 @@
"Ilmoittautuminen sulkeutuu": "Ilmoittautuminen sulkeutuu":
"Signup closes at", "Signup closes at",
"Ilmoittautuminen onnistui!":
"Signup successful!",
"Ilmoittauminen on umpeutunut!": "Ilmoittauminen on umpeutunut!":
"Signup has been closed!", "Signup has been closed!",
+14 -3
View File
@@ -1,11 +1,11 @@
import React from "react"; import React, { useState } from "react";
import { NextPage, GetStaticProps, GetStaticPaths } from "next"; import { NextPage, GetStaticProps, GetStaticPaths } from "next";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { ISubmitEvent } from "@rjsf/core"; import { ISubmitEvent } from "@rjsf/core";
import { toast } from "react-toastify"; import { toast } from "react-toastify";
import axios from "axios"; import axios from "axios";
import useSWR, { mutate } from "swr"; import useSWR from "swr";
import { Signup, SignupForm } from "@models/Signup"; import { Signup, SignupForm } from "@models/Signup";
import SignupApi from "@api/signupApi"; import SignupApi from "@api/signupApi";
import SignUpPageView from "@views/SignUpPage/SignUpPageView"; import SignUpPageView from "@views/SignUpPage/SignUpPageView";
@@ -25,6 +25,8 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
const id = String(initialForm?.id ?? ""); const id = String(initialForm?.id ?? "");
const URL = `${FORM_URL}${id}/`; const URL = `${FORM_URL}${id}/`;
const { data: signupForm, error } = useSWR<SignupForm>(URL, (url) => axios.get(url).then((res) => res.data), { fallbackData: initialForm }); 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) { if (error) {
console.error(error); console.error(error);
@@ -42,18 +44,26 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
} }
const onSubmit = async ({ formData }: ISubmitEvent<string>) => { const onSubmit = async ({ formData }: ISubmitEvent<string>) => {
setIsSending(true);
const payload: Signup = { const payload: Signup = {
signupForm_id: signupForm.id, signupForm_id: signupForm.id,
answer: formData, answer: formData,
}; };
if (isSending === true) {
toast.error("Sign-up form already submitted! No need to spam send. 😟");
return;
}
try { try {
await SignupApi.createSignup(payload); await SignupApi.createSignup(payload);
toast.success("Sign-up submitted successfully 😎"); toast.success("Sign-up submitted successfully 😎");
mutate(URL); setFormSent(true);
} catch (err) { } catch (err) {
console.error(err); console.error(err);
toast.error("Uh oh! Sign-up failed! 😟"); toast.error("Uh oh! Sign-up failed! 😟");
setIsSending(false);
} }
}; };
@@ -68,6 +78,7 @@ const SignUpPage: NextPage<InitialProps> = ({ initialForm }) => {
formData={{}} formData={{}}
onChange={noop} onChange={noop}
onSubmit={onSubmit} onSubmit={onSubmit}
formSent={formSent}
/> />
</PageWrapper> </PageWrapper>
</> </>
@@ -186,6 +186,8 @@ const InEnglishPageView: React.FC<InEnglishPageViewProps> = ({ events, feed }) =
<h3 id="freshmen">For exchange student</h3> <h3 id="freshmen">For exchange student</h3>
<div> <div>
<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&apos;s students.</p>
<h6>Freshman points</h6> <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&apos;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> <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&apos;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> <h6>Overalls</h6>
+3 -1
View File
@@ -23,6 +23,7 @@ interface SignUpPageViewProps {
formData: any; formData: any;
onChange: (e: IChangeEvent<unknown>, es?: ErrorSchema) => unknown; onChange: (e: IChangeEvent<unknown>, es?: ErrorSchema) => unknown;
onSubmit: (e: ISubmitEvent<unknown>) => unknown; onSubmit: (e: ISubmitEvent<unknown>) => unknown;
formSent?: boolean;
} }
const StyledSection = styled(TextSection)` const StyledSection = styled(TextSection)`
@@ -59,6 +60,7 @@ const SignUpPageView: React.FC<SignUpPageViewProps> = ({
formData, formData,
onChange, onChange,
onSubmit, onSubmit,
formSent = false,
}) => { }) => {
const { i18n, t } = useTranslation(); const { i18n, t } = useTranslation();
const startDate = new Date(signUpForm?.start_time); const startDate = new Date(signUpForm?.start_time);
@@ -136,7 +138,7 @@ const SignUpPageView: React.FC<SignUpPageViewProps> = ({
</h1> </h1>
<div> <div>
{form} { formSent ? <p>{`${t("Ilmoittautuminen onnistui!")}`}</p> : form }
</div> </div>
{signups} {signups}
</StyledSection> </StyledSection>