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/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 ( 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, })) : []; 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ä

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) => {