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"
|
||||
value={questions[index].options}
|
||||
onChange={this.handleTextOptionsChange(questions, index)}
|
||||
required
|
||||
/>
|
||||
{this.requiredField()}
|
||||
</>
|
||||
@@ -117,8 +118,8 @@ class OptionsWidget extends React.Component<OptionsWidgetProps> {
|
||||
placeholder="Yes;no;maybe"
|
||||
value={joinedValue}
|
||||
onChange={this.handleListOptionsChange(questions, index)}
|
||||
required
|
||||
/>
|
||||
{this.requiredField()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -133,6 +134,7 @@ class OptionsWidget extends React.Component<OptionsWidgetProps> {
|
||||
placeholder="A;B;C"
|
||||
value={joinedValue}
|
||||
onChange={this.handleListOptionsChange(questions, index)}
|
||||
required
|
||||
/>
|
||||
{this.requiredField()}
|
||||
</>
|
||||
|
||||
@@ -23,11 +23,11 @@ interface 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)} />
|
||||
);
|
||||
|
||||
handleNameInputChange = (questions: Question[], index: number) => (event) => {
|
||||
handleNameInputChange = (questions: Question[], index: number): React.ChangeEventHandler<HTMLInputElement> => (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<QuestionListProps> {
|
||||
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<QuestionListProps> {
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
render(): JSX.Element {
|
||||
const { placeholder, innerRef } = this.props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -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,
|
||||
})) : [];
|
||||
|
||||
@@ -43,7 +43,7 @@ const FreshmenPageView: React.FC = () => (
|
||||
<p>
|
||||
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>
|
||||
|
||||
<h6>Matka nimeltä Teekkarius</h6>
|
||||
@@ -70,7 +70,7 @@ const FreshmenPageView: React.FC = () => (
|
||||
<h6>Fuksikapteenit</h6>
|
||||
<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ä.
|
||||
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>
|
||||
|
||||
<h6>Hymyillään, kun tavataan!</h6>
|
||||
@@ -103,21 +103,21 @@ const FreshmenPageView: React.FC = () => (
|
||||
</div>
|
||||
<div>
|
||||
<InfoBox>
|
||||
<Link to="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021.pdf">
|
||||
<FopasImage
|
||||
<Link to="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021.pdf" target="_blank">
|
||||
<FopasImage
|
||||
src="https://static.sahkoinsinoorikilta.fi/FTMK/Fuksiopas2021-kansi.png"
|
||||
/>
|
||||
</Link>
|
||||
<h6>Killan Fuksiopas</h6>
|
||||
<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>
|
||||
<br/>
|
||||
<br />
|
||||
<h6>Telegram?</h6>
|
||||
<p>
|
||||
Telegram on pikaviestinpalvelu, jota käytetään otaniemessä paljon.
|
||||
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>
|
||||
SIK:n fukseilla on oma Telegram-ryhmä, jonne pääset liitymään tästä:
|
||||
@@ -125,12 +125,12 @@ const FreshmenPageView: React.FC = () => (
|
||||
<QRImages
|
||||
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>
|
||||
<QRImages
|
||||
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>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user