Skip to content
Snippets Groups Projects
Select Git revision
  • 54fba0d3b69b283d92467ee3e7415f0d4670bb2e
  • master default protected
  • 2023-ujoncdelutan
  • 2023-update
  • 1.4.7 protected
  • 1.4.6 protected
  • 1.4.5 protected
  • 1.4.4 protected
  • 1.4.3 protected
  • 1.4.2 protected
  • 1.4.1 protected
  • 1.4.0 protected
  • 1.3.19 protected
  • 1.3.18 protected
  • 1.3.17 protected
  • 1.3.16 protected
  • 1.3.15 protected
  • 1.3.14 protected
  • 1.3.13 protected
  • 1.3.12 protected
  • 1.3.10 protected
  • 1.3.11 protected
  • 1.3.9 protected
  • 1.3.8 protected
24 results

Profile.js

Blame
  • user avatar
    Tamás Szabó authored
    974b77ec
    History
    Profile.js 2.65 KiB
    import React, { Component } from 'react';
    import { Container, Segment, Form, Dropdown, Divider } from 'semantic-ui-react';
    import { connect } from 'react-redux';
    import { textChange, submitRegistration, groupChange } from '../../actions';
    
    const options = [
      { key: 'DT', text: 'DevTeam', value: 'DT' },
      { key: 'NET', text: 'NeTeam', value: 'NET' },
      { key: 'ST', text: 'SecurITeam', value: 'ST' },
      { key: 'SYS', text: 'SysAdmin', value: 'SYS' },
      { key: 'HAT', text: 'Hallgatói Tudásbázis', value: 'HAT' },
    ];
    
    class Profile extends Component {
      componentWillMount() {
        if (!this.props.id) {
          this.props.history.push('/home');
        }
      }
    
      render() {
        const {
          nick, groups, motivation, signed, id,
        } = this.props;
        return (
          <div>
            <Segment textAlign='center' vertical>
              <Container>
                <Form>
                  <Divider horizontal>Becenév</Divider>
                  <Form.Input
                    fluid
                    name='nick'
                    onChange={e => this.props.textChange(e)}
                    placeholder='Becenév'
                    value={nick}
                  />
                  <Divider horizontal>Motivációs levél</Divider>
                  <Form.TextArea
                    rows={10}
                    name='motivation'
                    onChange={e => this.props.textChange(e)}
                    placeholder='Miért szeretnék jelentkezni...'
                    value={motivation}
                  />
                  <Divider horizontal>Érdekelt Körök</Divider>
                  <Dropdown
                    fluid
                    multiple
                    selection
                    placeholder='DevTeam, ...'
                    onChange={(_, v) => this.props.groupChange(v.value)}
                    options={options}
                    defaultValue={groups}
                  />
                  <br />
                  <Form.Checkbox
                    name='signed'
                    label='Szeretnék jelentkezni a KSZK-ba'
                    onChange={(_, v) =>
                      this.props.textChange({ target: { name: v.name, value: v.checked } })
                    }
                    checked={signed}
                  />
                  <Form.Button
                    onClick={() => this.props.submitRegistration({
                      nick, motivation, signed, groups, id,
                    })}
                  >
                    Mentés
                  </Form.Button>
                </Form>
              </Container>
            </Segment>
          </div>
        );
      }
    }
    
    const mapStateToProps = ({
      user: {
        nick, groups, motivation, signed, id,
      },
    }) => ({
      nick,
      groups,
      motivation,
      signed,
      id,
    });
    
    export default connect(mapStateToProps, { textChange, submitRegistration, groupChange })(Profile);