-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge LineTimetable features to Prod (#117)
* Revert "Fix login url to prevent redirect" This reverts commit 7127c16. * Show prompt when template isn't selected instead of generating (#109) * AB#32667: Add smaller TerminalPoster variant (#110) * AB#32085: Add UI for testing line timetable generation (#111) * Ab#32085: Prevent LineTimetable generation without dates (#112) * AB#32085: Add UI for testing line timetable generation * AB#32085: Disable linetimetable generation without dates * AB#32085: Improve search UX, generate multiple line timetables at once (#113) * AB#32085: Improve search UX, add capability to generate multiple line timetables at once * Sort search results by lineId * Shorten train IDs so they display correctly * AB#32085: Print LineTimetable as A5 (#114) * AB#46862: Tweak placeholder texts for route filtering (#115) * Add local env --------- Co-authored-by: Juho Hänninen <[email protected]>
- Loading branch information
Showing
7 changed files
with
325 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Shared environment variables. Add env variables specific to your environment in .env | ||
|
||
REACT_APP_API_URL=http://localhost:4000 | ||
REACT_APP_JORE_API_URL=https://dev.kartat.hsl.fi/jore/graphql | ||
REACT_APP_CLIENT_ID=7833861618225795 | ||
REACT_APP_REDIRECT_URI=http://localhost:3000 | ||
REACT_APP_NAMESPACE=hsl-kartta | ||
|
||
CYPRESS_TESTING_HSLID_USERNAME= | ||
CYPRESS_TESTING_HSLID_PASSWORD= | ||
CYPRESS_HSLID_CLIENT_ID= | ||
CYPRESS_HSLID_CLIENT_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { observer } from 'mobx-react'; | ||
import styled from 'styled-components'; | ||
import { ListItem, TextField } from 'material-ui'; | ||
|
||
const SectionHeading = styled.h3` | ||
margin-bottom: 0.5rem; | ||
`; | ||
|
||
const ListItemTitle = styled.h4` | ||
display: inline; | ||
width: fit-content; | ||
`; | ||
|
||
const SelectedLinesTitle = styled.h3` | ||
font-size: 1.2rem; | ||
`; | ||
|
||
const ListContainer = styled.div` | ||
flex-grow: 1; | ||
max-height: 500px; | ||
overflow-y: scroll; | ||
`; | ||
|
||
const mapLineItems = (lines, onClick) => { | ||
if (lines.length > 0) { | ||
return lines.map((line, index) => ( | ||
<ListItem onClick={() => onClick(line)} key={index}> | ||
<ListItemTitle>{line.lineIdParsed}</ListItemTitle> <p>{line.nameFi}</p> | ||
</ListItem> | ||
)); | ||
} | ||
return ''; | ||
}; | ||
|
||
const LineSelect = props => ( | ||
<div> | ||
<SectionHeading>Linja-aikataulu</SectionHeading> | ||
<TextField | ||
id="line-select" | ||
hintText="Hae linjaa..." | ||
onChange={event => | ||
event.target.value ? props.setLineQuery(event.target.value) : props.setLineQuery('') | ||
} | ||
value={props.lineQuery} | ||
style={{ width: '100%' }} | ||
/> | ||
<ListContainer>{mapLineItems(props.lines, props.addLine)}</ListContainer> | ||
<div> | ||
<SelectedLinesTitle>Generoitavat linja-aikataulut</SelectedLinesTitle> | ||
{mapLineItems(props.selectedLines, props.removeLine)} | ||
</div> | ||
</div> | ||
); | ||
|
||
LineSelect.propTypes = { | ||
setLineQuery: PropTypes.func.isRequired, | ||
lineQuery: PropTypes.string.isRequired, | ||
lines: PropTypes.object.isRequired, | ||
addLine: PropTypes.func.isRequired, | ||
removeLine: PropTypes.func.isRequired, | ||
selectedLines: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default observer(LineSelect); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.