diff --git a/public/index.html b/public/index.html index e1b4c45a8f295fe8277db48c22c83ad4e6299089..e5bc7b4484c9bfe757c85fa8164c3758623ca6c8 100644 --- a/public/index.html +++ b/public/index.html @@ -20,7 +20,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - <title>KSZKĂŠpzĂŠs 2018</title> + <title>KSZKĂŠpzĂŠs 2019</title> </head> <body> <noscript> diff --git a/src/components/ScrollToTop.js b/src/components/ScrollToTop.js new file mode 100644 index 0000000000000000000000000000000000000000..1b01052d6695b4a1648646a4a84eab3d6a021203 --- /dev/null +++ b/src/components/ScrollToTop.js @@ -0,0 +1,20 @@ +import React, { Component } from 'react'; +import { withRouter } from 'react-router-dom'; + +/* +* Default ScrollResoration: +* https://reacttraining.com/react-router/web/guides/scroll-restoration +*/ +class ScrollToTop extends Component { + componentDidUpdate(prevProps) { + if (this.props.location !== prevProps.location) { + window.scrollTo(0, 0) + } + } + + render() { + return this.props.children; + } +} + +export default withRouter(ScrollToTop); diff --git a/src/components/pages/ApplicantProfile.js b/src/components/pages/ApplicantProfile.js index 535617c75f03d53c51b485bdf0578051c346a6df..a8595aa590f64c9fc5b288138d4ddc681f7dec4c 100644 --- a/src/components/pages/ApplicantProfile.js +++ b/src/components/pages/ApplicantProfile.js @@ -1,16 +1,36 @@ import React, { Component } from 'react'; -import { Container, Header, Item, Button, Label } from 'semantic-ui-react'; +import { Container, Header, Item, Button, Label, List } from 'semantic-ui-react'; import { connect } from 'react-redux'; import { getSelectedProfile, setStatus } from '../../actions/statistics'; import ConfirmModal from '../forms/ConfirmModal'; +const options = [ + { key: 'DT', text: 'DevTeam' }, + { key: 'NET', text: 'NETeam' }, + { key: 'ST', text: 'SecurITeam' }, + { key: 'SYS', text: 'SysAdmin' }, + { key: 'HAT', text: 'HallgatĂłi TudĂĄsbĂĄzis' }, +]; + class ApplicantProfile extends Component { componentWillMount() { this.props.getSelectedProfile(this.props.match.params.id); } + renderGroups() { + const { groups } = this.props.selectedProfile; + const groupNames = options.map(item => (groups.includes(item.key) ? item.text : null)); + return groupNames.map(item => ( + <List.Item> + <List.Content> + <List.Header>{item}</List.Header> + </List.Content> + </List.Item> + )); + } + render() { - const { id, signed, role, full_name, nick, motivation_about, motivation_exercise, motivation_profession } + const { id, signed, groups, role, full_name, nick, motivation_about, motivation_exercise, motivation_profession } = this.props.selectedProfile; return ( <Container style={{ padding: '60px' }}> @@ -28,6 +48,14 @@ class ApplicantProfile extends Component { <p>{motivation_profession}</p> <Header as='h3'>Feladatok megoldĂĄsa:</Header> <p>{motivation_exercise}</p> + <Header as='h3'>ĂrdeklĹdĂŠs:</Header> + { groups ? + <List horizontal> + {this.renderGroups()} + </List> + : + null + } </Container> <Container textAlign='center' style={{ padding: '20px' }}> <Header as='h3'>StĂĄtusz:</Header> diff --git a/src/components/pages/Applications.js b/src/components/pages/Applications.js index 68e6ce9ca2521880986e17a23f95da35bb155aec..934252c893eb21d80c7acb6e5de67805516bdb43 100644 --- a/src/components/pages/Applications.js +++ b/src/components/pages/Applications.js @@ -52,16 +52,19 @@ class Applications extends Component { </Table.Cell> } <Table.Cell> - <ConfirmModal - button = {<Button - color='blue' - size='tiny' - > - Staff jog adĂĄs - </Button>} - text='staff jogot adsz neki' - onAccept={() => this.props.setStatus(profile.id, 'Staff')} - /> + { profile.role !== 'Staff' ? + <ConfirmModal + button={<Button + color='blue' + size='tiny' + > + Staff jog adĂĄs + </Button>} + text='staff jogot adsz neki' + onAccept={() => this.props.setStatus(profile.id, 'Staff')} + /> + : + null } </Table.Cell> </Table.Row> ); diff --git a/src/components/pages/CommentModal.js b/src/components/pages/CommentModal.js index eeba0feeb2628c848cdb518bd7b6ad3a07c37978..52433822677561d3ff84ea073cd627be3caf955c 100644 --- a/src/components/pages/CommentModal.js +++ b/src/components/pages/CommentModal.js @@ -9,9 +9,9 @@ class CommentModal extends Component { const { notes, user } = this.props; return notes.map((note) => { return ( - <Comment key={note.id}> + <Comment style={{ padding: '1em' }} stylekey={note.id}> <Comment.Content> - <Comment.Author>{note.created_by_name}</Comment.Author> + <Comment.Author><strong>{note.created_by_name}</strong></Comment.Author> <Comment.Text> {note.note} </Comment.Text> diff --git a/src/components/pages/EventDetail.js b/src/components/pages/EventDetail.js index fc748e5e90b481b71b1463bba924661d794e160b..4c75171b9575939b03b97bf9d23282ead8f8aba6 100644 --- a/src/components/pages/EventDetail.js +++ b/src/components/pages/EventDetail.js @@ -118,7 +118,7 @@ class EventDetail extends Component { </Table.Row> </Table.Header> <Table.Body> - { this.props.selectedEvent ? + { this.props.selectedEvent && this.props.trainees ? this.renderTrainees() : '' diff --git a/src/components/pages/Groups.js b/src/components/pages/Groups.js index 27518db98c3a962f415c66f552f6a5b34dc305d8..e04bf8eb9a2d7102dd5102ffcb89356fc8f9ccf2 100644 --- a/src/components/pages/Groups.js +++ b/src/components/pages/Groups.js @@ -6,22 +6,6 @@ export default class Groups extends Component { render() { return ( <div> - <Segment inverted textAlign='center' vertical> - <Container> - <Header - as='h1' - content='KĂśreink' - inverted - style={{ - fontSize: '3em', - fontWeight: 'normal', - marginBottom: 0, - marginTop: '0.5em', - }} - /> - </Container> - </Segment> - <Segment style={{ padding: '8em 0em' }} vertical> <Container text> <Header as='h3' style={{ fontSize: '2em' }}>DevTeam</Header> diff --git a/src/components/pages/News.js b/src/components/pages/News.js index 012ad5f1745f81d8325b6e18339e5066728ca202..d097356b870f5557b6aa25e9e80071086ea3c3e5 100644 --- a/src/components/pages/News.js +++ b/src/components/pages/News.js @@ -25,7 +25,10 @@ class News extends Component { style={{ fontSize: '2em', width: '100%' }} > <Grid> - <Grid.Column floated='left' width={8}> + <Grid.Column + floated='left' + width={this.props.user.role === 'Staff' ? 12 : 16} + > {item.title} </Grid.Column> { this.props.user.role === 'Staff' ? diff --git a/src/components/pages/Profile.js b/src/components/pages/Profile.js index be1396e0629c131b371bc7783b9efbdab65e9b9e..9cd0d06c8c157b3d1812bda469c0275b0023cdb8 100644 --- a/src/components/pages/Profile.js +++ b/src/components/pages/Profile.js @@ -20,7 +20,7 @@ class Profile extends Component { render() { const { - nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, + role, nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, } = this.props; return ( <Container @@ -123,14 +123,18 @@ class Profile extends Component { defaultValue={groups} /> <br /> - <Form.Checkbox - name='signed' - label='SzeretnĂŠk jelentkezni a KSZKĂŠpzĂŠsre' - onChange={(_, v) => - this.props.textChange({ target: { name: v.name, value: v.checked } }) - } - checked={signed} - /> + { role === 'Applicant' ? + <Form.Checkbox + name='signed' + label='SzeretnĂŠk jelentkezni a KSZKĂŠpzĂŠsre' + onChange={(_, v) => + this.props.textChange({ target: { name: v.name, value: v.checked } }) + } + checked={signed} + /> + : + null + } <Form.Button primary style={{ marginBottom: '10em' }} @@ -148,9 +152,10 @@ class Profile extends Component { const mapStateToProps = ({ user: { - nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, + role, nick, groups, motivationAbout, motivationProfession, motivationExercise, signed, id, }, }) => ({ + role, nick, groups, motivationAbout, diff --git a/src/components/pages/Schedule.js b/src/components/pages/Schedule.js index fb9b3b24c6be10e03b227ddca9940e8a17af5bd9..6f3ac1a64f19aa92de783ef5017b5fcba96c4320 100644 --- a/src/components/pages/Schedule.js +++ b/src/components/pages/Schedule.js @@ -32,7 +32,7 @@ class Schedule extends Component { > <h3> <Grid> - <Grid.Column floated='left' width={5} textAlign='left'> + <Grid.Column floated='left' width={8} textAlign='left'> <Icon name='angle right' color='blue' />{event.name} </Grid.Column> <Grid.Column floated='right' width={8} textAlign='right'> @@ -42,6 +42,7 @@ class Schedule extends Component { </h3> </Accordion.Title> <Accordion.Content active={activeIndex === event.id}> + <h4>LeĂrĂĄs:</h4> <p> {event.description} </p> @@ -56,7 +57,7 @@ class Schedule extends Component { padding: '60px' }} > - <h2>KĂŠpzĂŠs alkalmak:</h2> + <h2>KĂŠpzĂŠsalkalmak:</h2> <Accordion fluid styled diff --git a/src/components/pages/TraineeTableRow.js b/src/components/pages/TraineeTableRow.js index 34e58c3c4ac541fded95a5663c55875f3047e0d2..215ef8eff16bb6f818377810aa5cb923f9ad15fc 100644 --- a/src/components/pages/TraineeTableRow.js +++ b/src/components/pages/TraineeTableRow.js @@ -75,7 +75,7 @@ class TraineeTableRow extends Component { <Table.Cell> <Grid> <Grid.Row> - <Grid.Column floated='left' width={8} textAlign='left'> + <Grid.Column floated='left' width={11} textAlign='left'> {notes.length > 0 ? <Comment> @@ -92,7 +92,7 @@ class TraineeTableRow extends Component { null } </Grid.Column> - <Grid.Column floated='right' width={4} textAlign='right'> + <Grid.Column floated='right' width={5} textAlign='right'> {notes.length > 0 ? <CommentModal notes={notes} /> : diff --git a/src/index.js b/src/index.js index 01b0629513af598006adbe0cc42f5621aaf808d7..4731bad925093c606f194eea777e2537f3b127ac 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ import 'slick-carousel/slick/slick.css'; import 'slick-carousel/slick/slick-theme.css'; import 'semantic-ui-css/semantic.min.css'; import moment from 'moment'; +import ScrollToTop from './components/ScrollToTop'; import configureStore from './configureStore'; import App from './components/App'; @@ -17,7 +18,9 @@ const store = configureStore(); render( <Provider store={store}> <Router> - <App /> + <ScrollToTop> + <App /> + </ScrollToTop> </Router> </Provider>, document.getElementById('root'),