Update page when changing user
This commit is contained in:
parent
211257ac67
commit
8e21856eb2
@ -8,6 +8,7 @@ import user4 from '../APIexamples/user4.json'
|
|||||||
|
|
||||||
import Button from './Button.js';
|
import Button from './Button.js';
|
||||||
import disruptIcon from '../img/flash.svg';
|
import disruptIcon from '../img/flash.svg';
|
||||||
|
import globalData from '../GlobalData.js';
|
||||||
|
|
||||||
class SelectUserButton extends Button {
|
class SelectUserButton extends Button {
|
||||||
selectUser = () => {
|
selectUser = () => {
|
||||||
@ -22,9 +23,13 @@ class SelectUserButton extends Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePage = () => {
|
||||||
|
globalData.currentPage.render();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Button onClick={[this.selectUser]} className="disruptBtn">
|
<Button onClick={[this.selectUser, this.updatePage]} className="disruptBtn">
|
||||||
<img src={disruptIcon} alt="" />
|
<img src={disruptIcon} alt="" />
|
||||||
<span>{this.props.username}</span>
|
<span>{this.props.username}</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -2,9 +2,12 @@ import React, { Component } from 'react';
|
|||||||
|
|
||||||
import Header from '../Header.js';
|
import Header from '../Header.js';
|
||||||
import MainArea from '../MainArea.js';
|
import MainArea from '../MainArea.js';
|
||||||
|
import globalData from '../../GlobalData.js';
|
||||||
|
|
||||||
class Tickets extends Component {
|
class Tickets extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
globalData.currentPage = this;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header title="Biljetter" />
|
<Header title="Biljetter" />
|
||||||
|
@ -9,8 +9,12 @@ import clockIcon from '../../img/clock.svg';
|
|||||||
import calendarIcon from '../../img/calendar.svg';
|
import calendarIcon from '../../img/calendar.svg';
|
||||||
import recurringIcon from '../../img/redo.svg';
|
import recurringIcon from '../../img/redo.svg';
|
||||||
|
|
||||||
|
import globalData from '../../GlobalData.js';
|
||||||
|
|
||||||
class TicketsBuy extends Component {
|
class TicketsBuy extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
globalData.currentPage = this;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header title="Köp biljett" />
|
<Header title="Köp biljett" />
|
||||||
|
@ -10,15 +10,21 @@ import globalData from '../../GlobalData.js';
|
|||||||
|
|
||||||
|
|
||||||
class TrafficInfo extends Component {
|
class TrafficInfo extends Component {
|
||||||
|
state = {
|
||||||
|
stop: globalData.stop
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
globalData.currentPage = this;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header title="Trafikinfo" />
|
<Header title="Trafikinfo" />
|
||||||
<TopMenu>
|
<TopMenu>
|
||||||
<StopTitle stop={globalData.stop} />
|
<StopTitle stop={this.state.stop} />
|
||||||
</TopMenu>
|
</TopMenu>
|
||||||
<MainArea>
|
<MainArea>
|
||||||
<TrafficList departures={globalData.stop.departures} />
|
<TrafficList departures={this.state.stop.departures} />
|
||||||
</MainArea>
|
</MainArea>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -7,8 +7,12 @@ import TripSelector from '../TripSelector.js';
|
|||||||
|
|
||||||
import '../css/TripSelector.css';
|
import '../css/TripSelector.css';
|
||||||
|
|
||||||
|
import globalData from '../../GlobalData.js';
|
||||||
|
|
||||||
class Travel extends Component {
|
class Travel extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
globalData.currentPage = this;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header title="Reseplanering" />
|
<Header title="Reseplanering" />
|
||||||
|
Loading…
Reference in New Issue
Block a user