Merge branch 'master' into 'production'
Prod deploy: Signup fixes See merge request sahkoinsinoorikilta/vtmk/web2.0-frontend!75
This commit is contained in:
@@ -85,6 +85,7 @@ class OptionsWidget extends React.Component<OptionsWidgetProps> {
|
|||||||
placeholder="Write something informative"
|
placeholder="Write something informative"
|
||||||
value={questions[index].options}
|
value={questions[index].options}
|
||||||
onChange={this.handleTextOptionsChange(questions, index)}
|
onChange={this.handleTextOptionsChange(questions, index)}
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
{this.requiredField()}
|
{this.requiredField()}
|
||||||
</>
|
</>
|
||||||
@@ -117,8 +118,8 @@ class OptionsWidget extends React.Component<OptionsWidgetProps> {
|
|||||||
placeholder="Yes;no;maybe"
|
placeholder="Yes;no;maybe"
|
||||||
value={joinedValue}
|
value={joinedValue}
|
||||||
onChange={this.handleListOptionsChange(questions, index)}
|
onChange={this.handleListOptionsChange(questions, index)}
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
{this.requiredField()}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -133,6 +134,7 @@ class OptionsWidget extends React.Component<OptionsWidgetProps> {
|
|||||||
placeholder="A;B;C"
|
placeholder="A;B;C"
|
||||||
value={joinedValue}
|
value={joinedValue}
|
||||||
onChange={this.handleListOptionsChange(questions, index)}
|
onChange={this.handleListOptionsChange(questions, index)}
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
{this.requiredField()}
|
{this.requiredField()}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ interface QuestionListProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class QuestionList extends React.Component<QuestionListProps> {
|
class QuestionList extends React.Component<QuestionListProps> {
|
||||||
renderTextWidget = ({ questions, value, index }: InputProps) => (
|
renderTextWidget = ({ questions, value, index }: InputProps): JSX.Element => (
|
||||||
<input type="text" value={value} onChange={this.handleNameInputChange(questions, index)} />
|
<input type="text" value={value} onChange={this.handleNameInputChange(questions, index)} />
|
||||||
);
|
);
|
||||||
|
|
||||||
handleNameInputChange = (questions: Question[], index: number) => (event) => {
|
handleNameInputChange = (questions: Question[], index: number): React.ChangeEventHandler<HTMLInputElement> => (event) => {
|
||||||
const { onChange } = this.props;
|
const { onChange } = this.props;
|
||||||
const val = event.target.value;
|
const val = event.target.value;
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
@@ -35,14 +35,14 @@ class QuestionList extends React.Component<QuestionListProps> {
|
|||||||
onChange(questions);
|
onChange(questions);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleElementRemove = (questions: Question[], index: number) => () => {
|
handleElementRemove = (questions: Question[], index: number) => (): void => {
|
||||||
const { onChange } = this.props;
|
const { onChange } = this.props;
|
||||||
const newQuestions = [...questions];
|
const newQuestions = [...questions];
|
||||||
newQuestions.splice(index, 1);
|
newQuestions.splice(index, 1);
|
||||||
onChange(newQuestions);
|
onChange(newQuestions);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderQuestions() {
|
renderQuestions(): JSX.Element[] {
|
||||||
const { questions, onChange } = this.props;
|
const { questions, onChange } = this.props;
|
||||||
return questions.map((q, index) => {
|
return questions.map((q, index) => {
|
||||||
const nameWidgetProps = {
|
const nameWidgetProps = {
|
||||||
@@ -77,7 +77,7 @@ class QuestionList extends React.Component<QuestionListProps> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render(): JSX.Element {
|
||||||
const { placeholder, innerRef } = this.props;
|
const { placeholder, innerRef } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ const SignupEmailPage: NextPage = () => {
|
|||||||
|
|
||||||
const title = signupForm ? signupForm.title_fi : "Loading...";
|
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,
|
title: q.name,
|
||||||
id: q.id,
|
id: q.id,
|
||||||
})) : [];
|
})) : [];
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const FreshmenPageView: React.FC = () => (
|
|||||||
<p>
|
<p>
|
||||||
Ensi askeleina suosittelemme, että liityt teille fukseille tehdyille Telegram-kanaville.
|
Ensi askeleina suosittelemme, että liityt teille fukseille tehdyille Telegram-kanaville.
|
||||||
{" "}
|
{" "}
|
||||||
<Link to={TG_GROUP_CHAT_LINK}>Tästä</Link> tutustumaan fuksikavereihin ja ISOihisi ja <Link to={TG_NOTIFICATIONS_LINK}>tästä</Link> pääset tiedotuskanavalle.
|
<Link to={TG_GROUP_CHAT_LINK} target="_blank">Tästä</Link> tutustumaan fuksikavereihin ja ISOihisi ja <Link to={TG_NOTIFICATIONS_LINK} target="_blank">tästä</Link> pääset tiedotuskanavalle.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h6>Matka nimeltä Teekkarius</h6>
|
<h6>Matka nimeltä Teekkarius</h6>
|
||||||
@@ -70,7 +70,7 @@ const FreshmenPageView: React.FC = () => (
|
|||||||
<h6>Fuksikapteenit</h6>
|
<h6>Fuksikapteenit</h6>
|
||||||
<p>
|
<p>
|
||||||
Me olemme fuksikapteenisi <strong>Toni</strong> ja <strong>Toni</strong> ja tulemme olemaan tukenasi sekä valvomassa suorituksiasi fuksivuoden seikkailuissa kohti teekkarilakkia, jonka voit ansaita mahdollisesti järjestettävänä Wappuna ensi keväällä.
|
Me olemme fuksikapteenisi <strong>Toni</strong> ja <strong>Toni</strong> 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 <Link to={TG_GROUP_CHAT_LINK}>Telegramissa</Link> tai <a href={EMAIL_LINK_MAILTO}>sähköpostitse</a>.
|
Jos sinulla on mitään kysymyksiä, ota ihmeessä meihin yhteyttä esimerkiksi <Link to={TG_GROUP_CHAT_LINK} target="_blank">Telegramissa</Link> tai <a href={EMAIL_LINK_MAILTO}>sähköpostitse</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h6>Hymyillään, kun tavataan!</h6>
|
<h6>Hymyillään, kun tavataan!</h6>
|
||||||
@@ -103,21 +103,21 @@ const FreshmenPageView: React.FC = () => (
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<InfoBox>
|
<InfoBox>
|
||||||
<Link to="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021.pdf">
|
<Link to="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021.pdf" target="_blank">
|
||||||
<FopasImage
|
<FopasImage
|
||||||
src="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021-kansi.png"
|
src="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021-kansi.png"
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
<h6>Killan Fuksiopas</h6>
|
<h6>Killan Fuksiopas</h6>
|
||||||
<p>Ennen opintojen alkua on hyvä tutustua killan fuksioppaaseen. Sitä pääset selailemaan
|
<p>Ennen opintojen alkua on hyvä tutustua killan fuksioppaaseen. Sitä pääset selailemaan
|
||||||
<Link to="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021.pdf"> tästä.</Link>
|
<Link to="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021.pdf" target="_blank"> tästä.</Link>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br />
|
||||||
<h6>Telegram?</h6>
|
<h6>Telegram?</h6>
|
||||||
<p>
|
<p>
|
||||||
Telegram on pikaviestinpalvelu, jota käytetään otaniemessä paljon.
|
Telegram on pikaviestinpalvelu, jota käytetään otaniemessä paljon.
|
||||||
Hieman samanlainen kuin Whatsapp, mutta ominaisuuksiltaan paremmaksi todettu.
|
Hieman samanlainen kuin Whatsapp, mutta ominaisuuksiltaan paremmaksi todettu.
|
||||||
Lisätietoja: <Link to="https://telegram.org/faq">https://telegram.org/faq</Link>.
|
Lisätietoja: <Link to="https://telegram.org/faq" target="_blank">https://telegram.org/faq</Link>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
SIK:n fukseilla on oma Telegram-ryhmä, jonne pääset liitymään tästä:
|
SIK:n fukseilla on oma Telegram-ryhmä, jonne pääset liitymään tästä:
|
||||||
@@ -125,12 +125,12 @@ const FreshmenPageView: React.FC = () => (
|
|||||||
<QRImages
|
<QRImages
|
||||||
src="https://static.sahkoinsinoorikilta.fi/FTMK/sik-fuksit-2021-tg.png"
|
src="https://static.sahkoinsinoorikilta.fi/FTMK/sik-fuksit-2021-tg.png"
|
||||||
/>
|
/>
|
||||||
<p>tai <Link to="https://tinyurl.com/sik-fuksit-2021">tästä</Link></p>
|
<p>tai <Link to="https://tinyurl.com/sik-fuksit-2021" target="_blank">tästä</Link></p>
|
||||||
<p>Liity myös samalla SIK-fuksien tiedotuskanavalle tästä:</p>
|
<p>Liity myös samalla SIK-fuksien tiedotuskanavalle tästä:</p>
|
||||||
<QRImages
|
<QRImages
|
||||||
src="https://static.sahkoinsinoorikilta.fi/FTMK/sik-fuksit-2021-tiedotus-tg.png"
|
src="https://static.sahkoinsinoorikilta.fi/FTMK/sik-fuksit-2021-tiedotus-tg.png"
|
||||||
/>
|
/>
|
||||||
<p>tai <Link to="https://tinyurl.com/sik-fuksit-2021-tiedotus">tästä</Link></p>
|
<p>tai <Link to="https://tinyurl.com/sik-fuksit-2021-tiedotus" target="_blank">tästä</Link></p>
|
||||||
</InfoBox>
|
</InfoBox>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -116,6 +116,15 @@ export const buildFormSchema = (signUpForm: SignupForm) => {
|
|||||||
|
|
||||||
export const buildValidationSchema = (questions: Question[]) => {
|
export const buildValidationSchema = (questions: Question[]) => {
|
||||||
let schemaProps = {};
|
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 requiredIds = questions.filter((q) => q.required).map((q) => q.id);
|
||||||
const schemaPropsArray = questions.map(questionToValidationSchema);
|
const schemaPropsArray = questions.map(questionToValidationSchema);
|
||||||
schemaPropsArray.forEach((schemaProp) => {
|
schemaPropsArray.forEach((schemaProp) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user