Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
19241b1
Revert "Fix login url to prevent redirect"
jhanninen Dec 27, 2022
21e91d1
Merge branch 'master' into development
jhanninen Jan 27, 2023
5e77bff
Show prompt when template isn't selected instead of generating (#109)
e-halinen Oct 10, 2023
6d07051
AB#32667: Add smaller TerminalPoster variant (#110)
e-halinen Apr 3, 2024
72030bf
AB#32085: Add UI for testing line timetable generation (#111)
e-halinen Aug 6, 2024
23ef948
Ab#32085: Prevent LineTimetable generation without dates (#112)
e-halinen Aug 6, 2024
070ed39
AB#32085: Improve search UX, generate multiple line timetables at onc…
e-halinen Sep 12, 2024
235fb7f
AB#32085: Print LineTimetable as A5 (#114)
e-halinen Oct 15, 2024
1889714
AB#46862: Tweak placeholder texts for route filtering (#115)
e-halinen Nov 18, 2024
0d1ab8b
Add local env
e-halinen Nov 26, 2024
3f839bd
Merge branch 'master' into development
e-halinen Nov 26, 2024
1ceb5c0
AB#48698: Add option for printing out the cover page for timetables (…
e-halinen Jan 29, 2025
54dfd83
AB#53258: Fix map-publisher showing up in google search results (#119)
e-halinen Feb 20, 2025
d078b4f
AB#55632: Kilvitysohje UI first version (#121)
e-halinen May 6, 2025
c8c0bc0
AB#57920: Add line query mode for StopRoutePlate component (#123)
e-halinen May 21, 2025
72da27a
AB#56573: Add version numbering and PR check against prod version (#124)
e-halinen May 23, 2025
9e67734
AB#56568: Change license to AGPL-3.0-only (#125)
e-halinen Jun 3, 2025
0018273
AB#57970: Switch to configurable ID provider, change prod ID provider…
e-halinen Jun 4, 2025
b2375c9
Merge branch 'master' into development
e-halinen Jun 12, 2025
1680719
v1.1.0
e-halinen Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ REACT_APP_API_URL=http://localhost:4000
REACT_APP_JORE_API_URL=https://kartat.hsl.fi/jore/graphql
REACT_APP_CLIENT_ID=7833861618225795
REACT_APP_REDIRECT_URI=http://localhost:3000
REACT_APP_LOGIN_PROVIDER_URI=https://hslid-uat.cinfra.fi
REACT_APP_NAMESPACE=hsl-kartta

CYPRESS_TESTING_HSLID_USERNAME=
Expand Down
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ REACT_APP_API_URL=https://dev.kartat.hsl.fi/julkaisin-api
REACT_APP_JORE_API_URL=https://dev.kartat.hsl.fi/jore/graphql
REACT_APP_CLIENT_ID=7833861618225795
REACT_APP_REDIRECT_URI=https://dev.kartat.hsl.fi/julkaisin
REACT_APP_LOGIN_PROVIDER_URI=https://hslid-uat.cinfra.fi
REACT_APP_NAMESPACE=hsl-kartta

CYPRESS_TESTING_HSLID_USERNAME=
Expand Down
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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_LOGIN_PROVIDER_URI=https://hslid-uat.cinfra.fi
REACT_APP_NAMESPACE=hsl-kartta

CYPRESS_TESTING_HSLID_USERNAME=
Expand Down
3 changes: 2 additions & 1 deletion .env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

REACT_APP_API_URL=https://kartat.hsl.fi/julkaisin-api
REACT_APP_JORE_API_URL=https://kartat.hsl.fi/jore/graphql
REACT_APP_CLIENT_ID=7833861618225795
REACT_APP_CLIENT_ID=0704589208046070
REACT_APP_REDIRECT_URI=https://kartat.hsl.fi/julkaisin
REACT_APP_LOGIN_PROVIDER_URI=https://id.hsl.fi
REACT_APP_NAMESPACE=hsl-kartta
12 changes: 0 additions & 12 deletions .env.stage

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check version numbering is updated prior to merging

on:
pull_request:
branches:
- master

jobs:
check_version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2
- name: Fail if version is not changed prior to merge
if: steps.check.outputs.changed == 'false'
uses: actions/github-script@v7
with:
script: |
core.setFailed('No version number change found. Run `yarn version`-command to upgrade version before merge can be completed.')
232 changes: 211 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "hsl-map-publisher-ui",
"version": "0.1.0",
"version": "1.1.0",
"private": true,
"license": "MIT",
"license": "AGPL-3.0-only",
"homepage": "./",
"dependencies": {
"@material-ui/core": "^4.11.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/Build.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Build = props => {
{props.pending < 1 && props.ready > 0 && (
<RaisedButton
onClick={() => downloadBuild({ id: props.id })}
label="Lataa PDF"
label="Lataa tulosteet"
style={{ marginLeft: 10 }}
primary
/>
Expand Down
35 changes: 33 additions & 2 deletions src/components/BuildDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import Divider from 'material-ui/Divider';

import { downloadPoster, downloadBuildSection } from '../util/api';
import { downloadPoster, downloadBuildSection, downloadCoverPageBuild } from '../util/api';

const Root = styled.div`
overflow: auto;
Expand Down Expand Up @@ -117,7 +117,7 @@ const Poster = props => (
<FlatButton
disabled={props.status !== 'READY'}
onClick={() => downloadPoster({ id: props.id })}
label="Lataa PDF"
label={props.component === 'StopRoutePlate' ? 'Lataa CSV' : 'Lataa PDF'}
primary
/>
<FlatButton
Expand Down Expand Up @@ -160,6 +160,22 @@ class BuildDetails extends Component {
this.setState({ last: { value, isValid } });
};

isCoverPagePrintingAllowed = posters => {
// Enable timetable cover page only if the build contains timetables
const hasTimetablePosters = posters.filter(poster => poster.component === 'Timetable');
return hasTimetablePosters.length > 0;
};

hasSpreadsheetDownload = posters => {
const hasCSVFiles = posters.filter(poster => poster.component === 'StopRoutePlate');
return hasCSVFiles.length > 0;
};

hasOnlySpreadsheetDownloads = posters => {
const hasOnlyCSVFiles = posters.filter(poster => poster.component === 'StopRoutePlate');
return hasOnlyCSVFiles.length === posters.length;
};

render() {
const buildDownloadEnabled = this.state.first.isValid && this.state.last.isValid;
return (
Expand Down Expand Up @@ -222,6 +238,21 @@ class BuildDetails extends Component {
label="Lataa PDF"
primary
/>
<RaisedButton
disabled={
buildDownloadEnabled ? !this.isCoverPagePrintingAllowed(this.props.posters) : true
}
style={{ marginLeft: '1rem' }}
onClick={() =>
downloadCoverPageBuild({
id: this.props.id,
first: this.state.first.value - 1,
last: this.state.last.value,
})
}
label="Lataa kansilehdellinen PDF"
primary
/>
</Buttons>
</Root>
</Dialog>
Expand Down
102 changes: 82 additions & 20 deletions src/components/Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { inject, observer, PropTypes } from 'mobx-react';
import styled from 'styled-components';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import { Switch } from '@material-ui/core';
import DatePicker from 'material-ui/DatePicker';
import TextField from 'material-ui/TextField';
import RadioGroup from './RadioGroup';
Expand All @@ -13,7 +14,7 @@ import SelectTemplate from './SelectTemplate';
import SelectRuleTemplates from './SelectRuleTemplates';
import { componentsWithMapOptions } from '../stores/generatorStore';
import TerminalSelect from './TerminalSelect';
import LineSelect from './LineSelect';
import { ObservedLineSelect, ObservedSingleLineSelect } from './LineSelect';

const Root = styled.div`
display: flex;
Expand Down Expand Up @@ -78,6 +79,15 @@ const Generator = props => {
case 'LineTimetable':
text = generatorStore.selectedLines.length;
break;

case 'StopRoutePlate':
if (generatorStore.useLineQuery && generatorStore.selectedRoutePlateLine) {
text = 1;
} else {
text = stopCount;
}
break;

default:
text = 0;
break;
Expand Down Expand Up @@ -119,6 +129,22 @@ const Generator = props => {
/>
</div>
)}
{generatorStore.component === 'StopRoutePlate' && (
<div style={{ marginLeft: '20px' }}>
<span style={{ opacity: generatorStore.useLineQuery ? 0.4 : 1.0 }}>
Pysäkkihaku
</span>
<Switch
checked={generatorStore.useLineQuery}
onChange={() => generatorStore.toggleUseLineQuery()}
color="primary"
inputProps={{ 'aria-label': 'Linjahaku' }}
className="muiSwitch-toggle"
style={{ color: '#0077c7' }}
/>
<span style={{ opacity: generatorStore.useLineQuery ? 1.0 : 0.4 }}>Linjahaku</span>
</div>
)}
</div>
</Column>

Expand Down Expand Up @@ -156,9 +182,17 @@ const Generator = props => {
</Column>

<Column>
<h3>Voimassaolokausi alkaa</h3>
<h3>
{generatorStore.component === 'StopRoutePlate'
? 'Vertailuvälin alku'
: 'Voimassaolokausi alkaa'}
</h3>
<DatePicker
name="Voimassaolokausi alkaa"
name={
generatorStore.component === 'StopRoutePlate'
? 'Vertailuvälin alku'
: 'Voimassaolokausi alkaa'
}
value={generatorStore.dateBegin}
onChange={(event, value) => generatorStore.setDateBegin(value)}
hintText="oletus"
Expand All @@ -167,9 +201,17 @@ const Generator = props => {
</Column>

<Column>
<h3>Voimassaolokausi loppuu</h3>
<h3>
{generatorStore.component === 'StopRoutePlate'
? 'Vertailuvälin loppu'
: 'Voimassaolokausi loppuu'}
</h3>
<DatePicker
name="Voimassaolokausi loppuu"
name={
generatorStore.component === 'StopRoutePlate'
? 'Vertailuvälin loppu'
: 'Voimassaolokausi loppuu'
}
value={generatorStore.dateEnd}
onChange={(event, value) => generatorStore.setDateEnd(value)}
hintText="oletus"
Expand All @@ -190,7 +232,7 @@ const Generator = props => {

{generatorStore.component === 'LineTimetable' && (
<Main>
<LineSelect
<ObservedLineSelect
setLineQuery={commonStore.setLineQuery}
lines={commonStore.lines}
lineQuery={commonStore.lineQuery}
Expand All @@ -201,7 +243,20 @@ const Generator = props => {
</Main>
)}

{generatorStore.component !== 'LineTimetable' && (
{generatorStore.component === 'StopRoutePlate' && generatorStore.useLineQuery && (
<Main>
<ObservedSingleLineSelect
setLineQuery={commonStore.setLineQuery}
lines={commonStore.lines}
lineQuery={commonStore.lineQuery}
selectedRoutePlateLine={generatorStore.selectedRoutePlateLine}
setSelectedRoutePlateLine={generatorStore.setSelectedRoutePlateLine}
clearSelectedRoutePlateLine={generatorStore.clearSelectedRoutePlateLine}
/>
</Main>
)}

{generatorStore.component !== 'LineTimetable' && !generatorStore.useLineQuery && (
<div>
<Main>
<StopList
Expand All @@ -210,19 +265,22 @@ const Generator = props => {
disabled={generatorStore.component === 'LineTimetable'}
/>
</Main>
<Main>
<SelectTemplate
currentTemplate={commonStore.currentTemplate}
templates={commonStore.templates}
onSelectTemplate={commonStore.selectTemplate}
showControls={false}
/>
</Main>
{generatorStore.component !== 'StopRoutePlate' && (
<Main>
<SelectTemplate
currentTemplate={commonStore.currentTemplate}
templates={commonStore.templates}
onSelectTemplate={commonStore.selectTemplate}
showControls={false}
/>
</Main>
)}
</div>
)}

{generatorStore.component !== 'TerminalPoster' &&
generatorStore.component !== 'LineTimetable' && (
generatorStore.component !== 'LineTimetable' &&
generatorStore.component !== 'StopRoutePlate' && (
<Main>
<SelectRuleTemplates
selectedRuleTemplates={generatorStore.selectedRuleTemplates}
Expand Down Expand Up @@ -278,8 +336,7 @@ const Generator = props => {
</Row>
)}


{generatorStore.component !== 'LineTimetable' && (
{generatorStore.component !== 'LineTimetable' && !generatorStore.useLineQuery && (
<div>
<h3>Poissuodatettavat linjat</h3>
<Row>
Expand Down Expand Up @@ -311,12 +368,17 @@ const Generator = props => {
<RaisedButton
data-cy="generate-button"
disabled={
(stopCount < 1 && generatorStore.component !== 'LineTimetable') ||
(stopCount < 1 &&
generatorStore.component !== 'LineTimetable' &&
!generatorStore.useLineQuery) ||
(generatorStore.useLineQuery && generatorStore.selectedRoutePlateLine === null) ||
!generatorStore.buildId ||
(generatorStore.component === 'TerminalPoster' && generatorStore.terminalId === '') ||
(generatorStore.component === 'LineTimetable' && generatorStore.lineId === '') ||
(generatorStore.component === 'LineTimetable' && !generatorStore.dateBegin) ||
(generatorStore.component === 'LineTimetable' && !generatorStore.dateEnd)
(generatorStore.component === 'LineTimetable' && !generatorStore.dateEnd) ||
(generatorStore.component === 'StopRoutePlate' && !generatorStore.dateBegin) ||
(generatorStore.component === 'StopRoutePlate' && !generatorStore.dateEnd)
}
onClick={async () => {
if ((await commonStore.currentTemplate) === undefined) {
Expand Down
40 changes: 38 additions & 2 deletions src/components/LineSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ListContainer = styled.div`
`;

const mapLineItems = (lines, onClick) => {
if (lines.length > 0) {
if (lines.length > 0 && lines[0] !== null) {
return lines.map((line, index) => (
<ListItem onClick={() => onClick(line)} key={index}>
<ListItemTitle>{line.lineIdParsed}</ListItemTitle> <p>{line.nameFi}</p>
Expand Down Expand Up @@ -54,6 +54,26 @@ const LineSelect = props => (
</div>
);

const SingleLineSelect = props => (
<div>
<SectionHeading>Linjahaku</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.setSelectedRoutePlateLine)}</ListContainer>
<div>
<SelectedLinesTitle>Valittu linja</SelectedLinesTitle>
{mapLineItems([props.selectedRoutePlateLine], props.clearSelectedRoutePlateLine)}
</div>
</div>
);

LineSelect.propTypes = {
setLineQuery: PropTypes.func.isRequired,
lineQuery: PropTypes.string.isRequired,
Expand All @@ -63,4 +83,20 @@ LineSelect.propTypes = {
selectedLines: PropTypes.object.isRequired,
};

export default observer(LineSelect);
SingleLineSelect.propTypes = {
setLineQuery: PropTypes.func.isRequired,
lineQuery: PropTypes.string.isRequired,
lines: PropTypes.object.isRequired,
selectedRoutePlateLine: PropTypes.object,
setSelectedRoutePlateLine: PropTypes.func.isRequired,
clearSelectedRoutePlateLine: PropTypes.func.isRequired,
};

SingleLineSelect.defaultProps = {
selectedRoutePlateLine: null,
};

export const ObservedLineSelect = observer(LineSelect);
export const ObservedSingleLineSelect = observer(SingleLineSelect);

export default { ObservedLineSelect, ObservedSingleLineSelect };
Loading
Loading