Merge conflicts and small fixes

This commit is contained in:
williameriksson126 2020-12-10 13:21:09 +01:00
commit f7cbe39b0d
12 changed files with 88 additions and 45 deletions

View File

@ -1,5 +1,5 @@
{
"name":"1",
"name": "Användare 1",
"deviceId": "1",
"stoppointgid": "9022014014754001"
}

View File

@ -1,5 +1,5 @@
{
"name":"2",
"name": "Användare 2",
"deviceId": "2",
"stoppointgid": "9022014014020001"
}

View File

@ -1,5 +1,5 @@
{
"name":"3",
"name": "Användare 3",
"deviceId": "3",
"stoppointgid": "9022014014751001"
}

View File

@ -1,5 +1,5 @@
{
"name":"4",
"name": "Användare 4",
"deviceId": "4",
"stoppointgid": "9021014014225000"
}

View File

@ -2,12 +2,11 @@ import User from './classes/User.js';
import Disruption from './classes/Disruption.js'
import Coordinates from './classes/Coordinates.js';
import Stop from './classes/Stop.js'
import Departure from './classes/Departure.js';
let globalData = {
users : [],
user: new User(
"test",
"Exempelanvändare",
"123",
new Coordinates(),
"123"

View File

@ -4,14 +4,16 @@
name : String (Användarnamn)
deviceId : Int (Enhetens ID)
location : Coordinates (Användarens koordinater)
track : String (Nuvarande hållplatsläge)
*/
class User {
constructor(name, deviceId, location, stoppointgid) {
constructor(name, deviceId, location, stoppointgid, track) {
this.name = name;
this.deviceId = deviceId;
this.location = location;
this.stoppointgid = stoppointgid;
this.track = track;
}
}

View File

@ -1,5 +1,3 @@
import addNotification from "react-push-notification";
import globData from '../GlobalData.js';
import user1 from '../APIexamples/user1.json'
@ -110,14 +108,6 @@ class DisruptionButton extends Button {
}
globData.disruption = this.state.disruption
addNotification({
title: "Warning",
subtitle: "This is a subtitle",
message: "This is a very long message",
theme: "blue",
native: true, // when using native, your OS will handle theming.
});
}
render() {

View File

@ -9,7 +9,6 @@ import Button from './Button.js';
import './css/NavigationDrawer.css';
import userIcon from '../img/user.svg';
import { glob } from 'glob';
class NavigationDrawer extends Component {
@ -54,13 +53,14 @@ class NavigationDrawer extends Component {
}
render() {
return (
<>
<Popup ref={this.popupElem}>
<h3>Välj hållplats:</h3>
<ul>
<li><DisruptionButton path={"ex1"} onClick={[this.hidePopup]}>Störnings Scenario 1</DisruptionButton></li>
<li><DisruptionButton path={"ex2"} onClick={[this.hidePopup]}>Störnings Scenario 2</DisruptionButton></li>
<li><DisruptionButton path={"ex1"} onClick={[this.hidePopup]}>Störningsscenario 1</DisruptionButton></li>
<li><DisruptionButton path={"ex2"} onClick={[this.hidePopup]}>Störningsscenario 2</DisruptionButton></li>
</ul>
</Popup>

View File

@ -1,4 +1,3 @@
import globData from '../GlobalData.js';
import user1 from '../APIexamples/user1.json'
@ -17,9 +16,10 @@ import departureuser3 from '../APIexamples/departureuser3.json'
import departureuser4 from '../APIexamples/departureuser4.json'
import Button from './Button.js';
import disruptIcon from '../img/flash.svg';
import userIcon from '../img/userDark.svg';
import globalData from '../GlobalData.js';
class SelectUserButton extends Button {
state = {
first : false,
@ -53,17 +53,25 @@ class SelectUserButton extends Button {
this.genUsers()
if(this.props.path === "user1"){
globData.user = globData.users[0]
globData.stop = globData.users[0].stop
globData.user = user1
globData.user.track = locationuser1.LocationList.StopLocation[0].track
globData.stop = locationuser1.LocationList.StopLocation[0]
globData.stop.departures = departureuser1.DepartureBoard.Departures
}else if (this.props.path === "user2"){
globData.user = globData.users[1]
globData.stop = globData.users[1].stop
globData.user = user2
globData.user.track = locationuser2.LocationList.StopLocation[0].track
globData.stop = locationuser2.LocationList.StopLocation[0]
globData.stop.departures = departureuser2.DepartureBoard.Departures
}else if (this.props.path === "user3"){
globData.user = globData.users[2]
globData.stop = globData.users[2].stop
globData.user = user3
globData.user.track = locationuser3.LocationList.StopLocation[0].track
globData.stop = locationuser3.LocationList.StopLocation[0]
globData.stop.departures = departureuser3.DepartureBoard.Departures
}else if (this.props.path === "user4"){
globData.user = globData.users[3]
globData.stop = globData.users[3].stop
globData.user = user4
globData.user.track = locationuser4.LocationList.StopLocation[0].track
globData.stop = locationuser4.LocationList.StopLocation[0]
globData.stop.departures = departureuser4.DepartureBoard.Departures
}
}
@ -74,12 +82,11 @@ class SelectUserButton extends Button {
render() {
return (
<Button onClick={[this.selectUser, this.updatePage]} className="disruptBtn">
<img src={disruptIcon} alt="" />
<img src={userIcon} alt="" />
{this.props.username}
</Button>
);
}
}
export default SelectUserButton;

View File

@ -1,12 +1,38 @@
import React, { Component } from 'react';
import Button from './Button.js';
import Popup from './Popup.js';
import './css/StopTitle.css';
class StopTitle extends Component {
render() {
class StopTitle extends Component {
constructor(props) {
super(props);
this.popupElem = React.createRef();
}
showPopup = () => {
this.popupElem.current.show();
};
hidePopup = () => {
this.popupElem.current.hide();
};
render() {
return (
<div id="stopTitle">
<Popup ref={this.popupElem} className="">
<h3>Välj läge:</h3>
<ul>
<>
<li><Button onClick={[this.hidePopup]}>{"Läge A"}</Button></li>
<li><Button onClick={[this.hidePopup]}>{"Läge B"}</Button></li>
</>
</ul>
</Popup>
<h1>{this.props.stop.name !== undefined ?
this.props.stop.name
: "Hållplats saknas"
@ -15,9 +41,9 @@ class StopTitle extends Component {
{this.props.stop.name !== undefined && this.props.stop.track !== undefined ?
<div>
<h3>
<span>{this.props.stop.track}</span>
<span>{"Läge " + this.props.stop.track}</span>
</h3>
<button>Byt Läge</button>
<Button onclick={this.showPopup}>Byt Läge</Button>
</div>
:
(this.props.stop.name !== undefined ?

View File

@ -24,7 +24,7 @@
color: var(--colorDiscrete);
}
@media screen and (min-width: 350px) {
@media screen and (min-width: 400px) {
#stopTitle h1 {
font-size: 35px;
}

19
src/img/userDark.svg Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 460.8 460.8" style="enable-background:new 0 0 460.8 460.8;" xml:space="preserve">
<g>
<g>
<path d="M230.4,0c-65.8,0-119.6,53.8-119.6,119.6s53.8,119.6,119.6,119.6S350,185.4,350,119.6S296.3,0,230.4,0z"/>
</g>
</g>
<g>
<g>
<path d="M435.8,334.9c-3.1-7.8-7.3-15.2-12-21.9c-24-35.5-61.1-59-102.9-64.8c-5.2-0.5-11,0.5-15.2,3.7
c-21.9,16.2-48.1,24.6-75.2,24.6s-53.3-8.4-75.2-24.6c-4.2-3.1-9.9-4.7-15.2-3.7c-41.8,5.7-79.4,29.3-102.9,64.8
c-4.7,6.8-8.9,14.6-12,21.9c-1.6,3.1-1,6.8,0.5,9.9c4.2,7.3,9.4,14.6,14.1,20.9c7.3,9.9,15.2,18.8,24,27.2
c7.3,7.3,15.7,14.1,24,20.9c41.3,30.8,90.9,47,142.1,47s100.8-16.2,142.1-47c8.4-6.3,16.7-13.6,24-20.9c8.4-8.4,16.7-17.2,24-27.2
c5.2-6.8,9.9-13.6,14.1-20.9C436.8,341.7,437.3,338,435.8,334.9z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB