Skip to content
Snippets Groups Projects
Verified Commit f81da0b4 authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Sort events by date

parent b479f852
No related branches found
No related tags found
No related merge requests found
Pipeline #18757 passed
import 'moment/locale/hu'; import "moment/locale/hu";
import { import {
Accordion, Accordion,
...@@ -7,12 +7,12 @@ import { ...@@ -7,12 +7,12 @@ import {
Header, Header,
Icon, Icon,
Segment, Segment,
} from 'semantic-ui-react'; } from "semantic-ui-react";
import React, { Component } from 'react'; import React, { Component } from "react";
import { connect } from 'react-redux'; import { connect } from "react-redux";
import { getStudentEvents } from '../../actions/statistics'; import { getStudentEvents } from "../../actions/statistics";
import moment from 'moment'; import moment from "moment";
class Schedule extends Component { class Schedule extends Component {
// eslint-disable-next-line react/state-in-constructor // eslint-disable-next-line react/state-in-constructor
...@@ -34,7 +34,9 @@ class Schedule extends Component { ...@@ -34,7 +34,9 @@ class Schedule extends Component {
const { activeIndex } = this.state; const { activeIndex } = this.state;
const { events } = this.props; const { events } = this.props;
const panels = events.map((event) => ( const panels = events
.sort((a, b) => a.date - b.date)
.map((event) => (
<Accordion key={Math.random()}> <Accordion key={Math.random()}>
<Accordion.Title <Accordion.Title
active={activeIndex === event.id} active={activeIndex === event.id}
...@@ -44,17 +46,17 @@ class Schedule extends Component { ...@@ -44,17 +46,17 @@ class Schedule extends Component {
<h2> <h2>
<Grid> <Grid>
<Grid.Column floated="left" width={5} textAlign="left"> <Grid.Column floated="left" width={5} textAlign="left">
<Icon name="calendar alternate outline" color="blue" />{' '} <Icon name="calendar alternate outline" color="blue" />{" "}
{event.name} {event.name}
</Grid.Column> </Grid.Column>
<Grid.Column floated="right" width={8} textAlign="right"> <Grid.Column floated="right" width={8} textAlign="right">
{moment(event.date).locale('hu').format('LLLL')} {moment(event.date).locale("hu").format("LLLL")}
</Grid.Column> </Grid.Column>
</Grid> </Grid>
</h2> </h2>
</Accordion.Title> </Accordion.Title>
<Accordion.Content active={activeIndex === event.id}> <Accordion.Content active={activeIndex === event.id}>
<Segment textAlign="left" style={{ overflowWrap: 'break-word' }}> <Segment textAlign="left" style={{ overflowWrap: "break-word" }}>
{event.description} {event.description}
</Segment> </Segment>
</Accordion.Content> </Accordion.Content>
...@@ -68,10 +70,10 @@ class Schedule extends Component { ...@@ -68,10 +70,10 @@ class Schedule extends Component {
as="h1" as="h1"
content="Képzés alkalmak" content="Képzés alkalmak"
style={{ style={{
fontSize: '2em', fontSize: "2em",
fontWeight: 'bold', fontWeight: "bold",
marginBottom: '0.5em', marginBottom: "0.5em",
marginTop: '0.5em', marginTop: "0.5em",
}} }}
/> />
<Accordion fluid styled> <Accordion fluid styled>
...@@ -81,10 +83,10 @@ class Schedule extends Component { ...@@ -81,10 +83,10 @@ class Schedule extends Component {
as="h1" as="h1"
content="Tábor" content="Tábor"
style={{ style={{
fontSize: '2em', fontSize: "2em",
fontWeight: 'bold', fontWeight: "bold",
marginBottom: '0.5em', marginBottom: "0.5em",
marginTop: '1.5em', marginTop: "1.5em",
}} }}
/> />
</Container> </Container>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment