Skip to content

Commit

Permalink
AB#32085: Tweak print parameters, clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
e-halinen committed Nov 25, 2024
1 parent 3800544 commit 5793a8f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
6 changes: 6 additions & 0 deletions src/components/lineTimetable/lineTimetable.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
height: fit-content;
}

.printBtnContainer {
position: absolute;
left: 680px;
top: 20px;
}

@media print {
.noPrint,
.noPrint * {
Expand Down
17 changes: 9 additions & 8 deletions src/components/lineTimetable/lineTimetable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styles from './lineTimetable.css';
import LineTimetableHeader from './lineTimetableHeader';
import LineTableColumns from './lineTableColumns';
import AllStopsList from './allStopsList';
import { PrintButton } from '../util';
import {
filter,
uniqBy,
Expand Down Expand Up @@ -59,7 +60,6 @@ const hasTimedStopRoutes = routes => {

const RouteDepartures = props => {
const {
showPrintBtn,
lang,
departuresByStop,
routeIdParsed,
Expand Down Expand Up @@ -193,7 +193,6 @@ const RouteDepartures = props => {
routeIdParsed={routeIdParsed}
nameFi={nameFi}
nameSe={nameSe}
showPrintBtn={showPrintBtn}
lang={lang}
/>
<span className={styles.timetableDays}>{getScheduleWeekdaysText(key)}</span>
Expand All @@ -217,7 +216,6 @@ RouteDepartures.defaultProps = {
routeIdParsed: '',
nameFi: '',
nameSe: '',
showPrintBtn: '',
lang: '',
departuresByStop: {},
dateBegin: '',
Expand All @@ -229,7 +227,6 @@ RouteDepartures.propTypes = {
routeIdParsed: PropTypes.string,
nameFi: PropTypes.string,
nameSe: PropTypes.string,
showPrintBtn: PropTypes.string,
lang: PropTypes.string,
departuresByStop: PropTypes.object,
dateBegin: PropTypes.string,
Expand Down Expand Up @@ -357,11 +354,13 @@ class LineTimetable extends Component {
return (
routeForDateRange.departuresByStop.length > 0 && (
<div>
<div className={styles.printBtnContainer}>
{this.props.showPrintButton && <PrintButton lang={this.props.lang} />}
</div>
<RouteDepartures
routeIdParsed={routeIdParsed}
nameFi={nameFi}
nameSe={nameSe}
showPrintBtn={this.props.showPrintBtn}
lang={this.props.lang}
departuresByStop={departuresByStop}
dateBegin={dateBegin}
Expand Down Expand Up @@ -482,11 +481,13 @@ class LineTimetable extends Component {
<div>
{hasDepartures && (
<div>
<div className={styles.printBtnContainer}>
{this.props.showPrintButton && <PrintButton lang={this.props.lang} />}
</div>
<RouteDepartures
routeIdParsed={routeIdParsed}
nameFi={nameFi}
nameSe={nameSe}
showPrintBtn={this.props.showPrintBtn}
lang={this.props.lang}
departuresByStop={departuresByStop}
dateBegin={dateBegin}
Expand Down Expand Up @@ -520,15 +521,15 @@ class LineTimetable extends Component {

LineTimetable.defaultProps = {
routes: {},
showPrintBtn: false,
showPrintButton: false,
lang: 'fi',
printPageNumbers: true,
};

LineTimetable.propTypes = {
line: PropTypes.object.isRequired,
routes: PropTypes.object,
showPrintBtn: PropTypes.bool,
showPrintButton: PropTypes.bool,
lang: PropTypes.string,
printPageNumbers: PropTypes.bool,
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/lineTimetable/lineTimetableContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const filterNotes = (notes, dateBegin) => {

const lineQueryMapper = mapProps(props => {
const line = props.data.lines.nodes[0];
const { showPrintBtn, lang } = props;
const { showPrintButton, lang } = props;

const mergedRoutes = mergeExtraRoutes(line.routes.nodes);

Expand Down Expand Up @@ -251,7 +251,7 @@ const lineQueryMapper = mapProps(props => {
return {
line: { ...line, notes: filteredNotes },
routes: filterRoutes(routesWithGroupedDepartures),
showPrintBtn,
showPrintButton,
lang,
};
});
Expand All @@ -261,7 +261,7 @@ const hoc = compose(graphql(lineQuery), apolloWrapper(lineQueryMapper));
const LineTimetableContainer = hoc(LineTimetable);

LineTimetableContainer.defaultProps = {
showPrintBtn: false,
showPrintButton: false,
lang: 'fi',
printPageNumbers: true,
};
Expand All @@ -270,7 +270,7 @@ LineTimetableContainer.propTypes = {
lineId: PropTypes.string.isRequired,
dateBegin: PropTypes.string.isRequired,
dateEnd: PropTypes.string.isRequired,
showPrintBtn: PropTypes.bool,
showPrintButton: PropTypes.bool,
lang: PropTypes.string,
printPageNumbers: PropTypes.bool,
};
Expand Down
5 changes: 0 additions & 5 deletions src/components/lineTimetable/lineTimetableHeader.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,3 @@
font-size: 15px;
font-family: GothamRounded-Book;
}

.printBtnContainer {
display: inline;
margin-top: 1rem;
}
7 changes: 1 addition & 6 deletions src/components/lineTimetable/lineTimetableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './lineTimetableHeader.css';
import { PrintButton } from '../util';

const LineTimetableHeader = props => {
const { showPrintBtn, lang, routeIdParsed, nameFi, nameSe } = props;
const { routeIdParsed, nameFi, nameSe } = props;
return (
<div className={styles.header}>
<div className={styles.lineId}>
Expand All @@ -19,24 +19,19 @@ const LineTimetableHeader = props => {
<span>{nameSe}</span>
</div>
</div>
<div className={styles.printBtnContainer}>{showPrintBtn && <PrintButton lang={lang} />}</div>
</div>
);
};

LineTimetableHeader.defaultProps = {
nameFi: '',
nameSe: '',
showPrintBtn: false,
lang: 'fi',
};

LineTimetableHeader.propTypes = {
routeIdParsed: PropTypes.string.isRequired,
nameFi: PropTypes.string,
nameSe: PropTypes.string,
showPrintBtn: PropTypes.bool,
lang: PropTypes.string,
};

export default LineTimetableHeader;

0 comments on commit 5793a8f

Please sign in to comment.