From 5f28f5ad8162b8e18787e320cd9ae9108c2184b9 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 29 Jun 2021 19:01:34 +0300 Subject: [PATCH 1/6] Signup form bugfixes: required radio inputs & require input for some question types --- .../Widgets/SignupQuestionsWidget/OptionsWidget.tsx | 4 +++- src/views/SignUpPage/FormUtils.tsx | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx b/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx index 73c9714..ab57700 100644 --- a/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx +++ b/src/components/Widgets/SignupQuestionsWidget/OptionsWidget.tsx @@ -85,6 +85,7 @@ class OptionsWidget extends React.Component { placeholder="Write something informative" value={questions[index].options} onChange={this.handleTextOptionsChange(questions, index)} + required /> {this.requiredField()} @@ -117,8 +118,8 @@ class OptionsWidget extends React.Component { placeholder="Yes;no;maybe" value={joinedValue} onChange={this.handleListOptionsChange(questions, index)} + required /> - {this.requiredField()} ); } @@ -133,6 +134,7 @@ class OptionsWidget extends React.Component { placeholder="A;B;C" value={joinedValue} onChange={this.handleListOptionsChange(questions, index)} + required /> {this.requiredField()} diff --git a/src/views/SignUpPage/FormUtils.tsx b/src/views/SignUpPage/FormUtils.tsx index 22cade2..f6d189b 100644 --- a/src/views/SignUpPage/FormUtils.tsx +++ b/src/views/SignUpPage/FormUtils.tsx @@ -116,6 +116,15 @@ export const buildFormSchema = (signUpForm: SignupForm) => { export const buildValidationSchema = (questions: Question[]) => { let schemaProps = {}; + + // Force every radiobutton to be required field + questions.forEach((q) => { + if (q.type === "radiobutton") { + // eslint-disable-next-line no-param-reassign + q.required = true; + } + }); + const requiredIds = questions.filter((q) => q.required).map((q) => q.id); const schemaPropsArray = questions.map(questionToValidationSchema); schemaPropsArray.forEach((schemaProp) => { From a6ad6a039060738db5ea3197155bff56a879c8a9 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 29 Jun 2021 19:01:46 +0300 Subject: [PATCH 2/6] add some types --- .../Widgets/SignupQuestionsWidget/QuestionList.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx b/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx index 1743953..5fba0e6 100644 --- a/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx +++ b/src/components/Widgets/SignupQuestionsWidget/QuestionList.tsx @@ -23,11 +23,11 @@ interface QuestionListProps { } class QuestionList extends React.Component { - renderTextWidget = ({ questions, value, index }: InputProps) => ( + renderTextWidget = ({ questions, value, index }: InputProps): JSX.Element => ( ); - handleNameInputChange = (questions: Question[], index: number) => (event) => { + handleNameInputChange = (questions: Question[], index: number): React.ChangeEventHandler => (event) => { const { onChange } = this.props; const val = event.target.value; // eslint-disable-next-line no-param-reassign @@ -35,14 +35,14 @@ class QuestionList extends React.Component { onChange(questions); }; - handleElementRemove = (questions: Question[], index: number) => () => { + handleElementRemove = (questions: Question[], index: number) => (): void => { const { onChange } = this.props; const newQuestions = [...questions]; newQuestions.splice(index, 1); onChange(newQuestions); }; - renderQuestions() { + renderQuestions(): JSX.Element[] { const { questions, onChange } = this.props; return questions.map((q, index) => { const nameWidgetProps = { @@ -77,7 +77,7 @@ class QuestionList extends React.Component { }); } - render() { + render(): JSX.Element { const { placeholder, innerRef } = this.props; return ( From fa8dd34b3fb950c8a8df4162883fae99a4479c31 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 29 Jun 2021 19:17:17 +0300 Subject: [PATCH 3/6] fix hero styling and center content --- src/components/Hero/Hero.tsx | 2 +- src/components/Hero/HeroPrimarySection.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Hero/Hero.tsx b/src/components/Hero/Hero.tsx index d26409a..cfb8570 100644 --- a/src/components/Hero/Hero.tsx +++ b/src/components/Hero/Hero.tsx @@ -9,7 +9,7 @@ const Container = styled.div` justify-content: space-between; position: relative; padding: 0; - min-height: 75vh; + min-height: 87vh; section { padding: 2rem 6rem; diff --git a/src/components/Hero/HeroPrimarySection.tsx b/src/components/Hero/HeroPrimarySection.tsx index 555df48..7130931 100644 --- a/src/components/Hero/HeroPrimarySection.tsx +++ b/src/components/Hero/HeroPrimarySection.tsx @@ -10,7 +10,8 @@ interface HeroPrimarySectionProps { const Section = styled.section` max-width: 50%; - margin: 10vh auto 0; + margin: auto; + display: inline; text-align: center; @media screen and (max-width: ${breakpoints.mobile}) { From e75d553cc9a29d56156c4c9bce567ea974c4f37f Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 29 Jun 2021 19:19:52 +0300 Subject: [PATCH 4/6] filter out info questions from admin signup listing --- src/pages/admin/signups/[id]/list.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/admin/signups/[id]/list.tsx b/src/pages/admin/signups/[id]/list.tsx index 9b1c3d6..d474696 100644 --- a/src/pages/admin/signups/[id]/list.tsx +++ b/src/pages/admin/signups/[id]/list.tsx @@ -47,7 +47,8 @@ const SignupEmailPage: NextPage = () => { const title = signupForm ? signupForm.title_fi : "Loading..."; - const questions = signupForm ? signupForm.questions.map((q) => ({ + // TODO: ATM we filter 'info' questions from table here. Maybe remove them from answer JSON altogether? + const questions = signupForm ? signupForm.questions.filter((q) => q.type !== "info").map((q) => ({ title: q.name, id: q.id, })) : []; From 1178acceccd47fc917829e9d040f0093114cbab9 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 29 Jun 2021 19:36:48 +0300 Subject: [PATCH 5/6] open some links on new tab --- src/views/FreshmenPage/FreshmenPageView.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/views/FreshmenPage/FreshmenPageView.tsx b/src/views/FreshmenPage/FreshmenPageView.tsx index 4ea0748..64c57c4 100644 --- a/src/views/FreshmenPage/FreshmenPageView.tsx +++ b/src/views/FreshmenPage/FreshmenPageView.tsx @@ -43,7 +43,7 @@ const FreshmenPageView: React.FC = () => (

Ensi askeleina suosittelemme, että liityt teille fukseille tehdyille Telegram-kanaville. {" "} - Tästä tutustumaan fuksikavereihin ja ISOihisi ja tästä pääset tiedotuskanavalle. + Tästä tutustumaan fuksikavereihin ja ISOihisi ja tästä pääset tiedotuskanavalle.

Matka nimeltä Teekkarius
@@ -70,7 +70,7 @@ const FreshmenPageView: React.FC = () => (
Fuksikapteenit

Me olemme fuksikapteenisi Toni ja Toni ja tulemme olemaan tukenasi sekä valvomassa suorituksiasi fuksivuoden seikkailuissa kohti teekkarilakkia, jonka voit ansaita mahdollisesti järjestettävänä Wappuna ensi keväällä. - Jos sinulla on mitään kysymyksiä, ota ihmeessä meihin yhteyttä esimerkiksi Telegramissa tai sähköpostitse. + Jos sinulla on mitään kysymyksiä, ota ihmeessä meihin yhteyttä esimerkiksi Telegramissa tai sähköpostitse.

Hymyillään, kun tavataan!
@@ -103,21 +103,21 @@ const FreshmenPageView: React.FC = () => (
- - +
Killan Fuksiopas

Ennen opintojen alkua on hyvä tutustua killan fuksioppaaseen. Sitä pääset selailemaan - tästä. + tästä.

-
+
Telegram?

Telegram on pikaviestinpalvelu, jota käytetään otaniemessä paljon. Hieman samanlainen kuin Whatsapp, mutta ominaisuuksiltaan paremmaksi todettu. - Lisätietoja: https://telegram.org/faq. + Lisätietoja: https://telegram.org/faq.

SIK:n fukseilla on oma Telegram-ryhmä, jonne pääset liitymään tästä: @@ -125,12 +125,12 @@ const FreshmenPageView: React.FC = () => ( -

tai tästä

+

tai tästä

Liity myös samalla SIK-fuksien tiedotuskanavalle tästä:

-

tai tästä

+

tai tästä

From 4bbc78c2a7c0c4331fdb8ea3a6f492cb618e75ac Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 29 Jun 2021 17:14:16 +0000 Subject: [PATCH 6/6] Revert "fix hero styling and center content" This reverts commit fa8dd34b3fb950c8a8df4162883fae99a4479c31 --- src/components/Hero/Hero.tsx | 2 +- src/components/Hero/HeroPrimarySection.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Hero/Hero.tsx b/src/components/Hero/Hero.tsx index cfb8570..d26409a 100644 --- a/src/components/Hero/Hero.tsx +++ b/src/components/Hero/Hero.tsx @@ -9,7 +9,7 @@ const Container = styled.div` justify-content: space-between; position: relative; padding: 0; - min-height: 87vh; + min-height: 75vh; section { padding: 2rem 6rem; diff --git a/src/components/Hero/HeroPrimarySection.tsx b/src/components/Hero/HeroPrimarySection.tsx index 7130931..555df48 100644 --- a/src/components/Hero/HeroPrimarySection.tsx +++ b/src/components/Hero/HeroPrimarySection.tsx @@ -10,8 +10,7 @@ interface HeroPrimarySectionProps { const Section = styled.section` max-width: 50%; - margin: auto; - display: inline; + margin: 10vh auto 0; text-align: center; @media screen and (max-width: ${breakpoints.mobile}) {