diff --git a/app/client.js b/app/client.js index f6bd29677b..3912e6ea12 100644 --- a/app/client.js +++ b/app/client.js @@ -24,7 +24,6 @@ import { ReactRelayContext } from 'react-relay'; import { setRelayEnvironment } from '@digitransit-search-util/digitransit-search-util-query-utils'; import { configShape } from './util/shapes'; import { historyMiddlewares, render } from './routes'; -import Raven from './util/Raven'; import configureMoment from './util/configure-moment'; import StoreListeningIntlProvider from './util/StoreListeningIntlProvider'; import appCreator from './app'; @@ -48,29 +47,11 @@ import { fetchFavouritesComplete, } from './action/FavouriteActions'; -const plugContext = f => () => ({ - plugComponentContext: f, - plugActionContext: f, - plugStoreContext: f, -}); - window.debug = debug; // Allow _debug.enable('*') in browser console // TODO: this is an ugly hack, but required due to cyclical processing in app const { config } = window.state.context.plugins['extra-context-plugin']; const app = appCreator(config); -const raven = Raven(config.SENTRY_DSN); -const addRaven = c => { - c.raven = raven; // eslint-disable-line no-param-reassign -}; - -const ravenPlugin = { - name: 'RavenPlugin', - plugContext: plugContext(addRaven), -}; - -// Add plugins -app.plug(ravenPlugin); const getParams = query => { if (!query) { @@ -252,7 +233,6 @@ async function init() { const ContextProvider = provideContext(StoreListeningIntlProvider, { /* eslint-disable-next-line */ - raven: PropTypes.object, config: configShape, headers: PropTypes.objectOf(PropTypes.string), }); diff --git a/app/component/ErrorBoundary.js b/app/component/ErrorBoundary.js index 5f40850584..c743487137 100644 --- a/app/component/ErrorBoundary.js +++ b/app/component/ErrorBoundary.js @@ -9,26 +9,17 @@ import isRelayNetworkError from '../util/relayUtils'; export default class ErrorBoundary extends React.Component { static propTypes = { children: PropTypes.node.isRequired }; - static contextTypes = { - raven: PropTypes.shape({ - captureException: PropTypes.func.isRequired, - }), - }; - state = { error: null, hasRetried: false }; resetState = () => this.setState({ error: null, hasRetried: true }); - componentDidCatch(error, errorInfo) { + componentDidCatch(error) { if (this.state.hasRetried) { // Did retry, didn't help window.location.reload(); return; } this.setState({ error }); - if (this.context.raven && !isRelayNetworkError(error)) { - this.context.raven.captureException(error, { extra: errorInfo }); - } } render() { @@ -49,11 +40,6 @@ export default class ErrorBoundary extends React.Component { - {/* - - */}

); diff --git a/app/component/itinerary/navigator/NaviCardContainer.js b/app/component/itinerary/navigator/NaviCardContainer.js index 0df50d1fba..86dc0d16d8 100644 --- a/app/component/itinerary/navigator/NaviCardContainer.js +++ b/app/component/itinerary/navigator/NaviCardContainer.js @@ -17,7 +17,7 @@ import { } from './NaviUtils'; import { updateClient, getTopics } from '../ItineraryPageUtils'; -const TIME_AT_DESTINATION = 3; // * 10 seconds +const COUNT_AT_LEG_END = 2; // update cycles within DESTINATION_RADIUS from leg.to const TOPBAR_PADDING = 8; // pixels const HIDE_TOPCARD_DURATION = 2000; // milliseconds @@ -27,13 +27,13 @@ function addMessages(incominMessages, newMessages) { }); } -const handleLegChange = (leg, firstLeg, time) => { +const getLegType = (leg, firstLeg, time, countAtLegEnd) => { let legType; if (time < legTime(firstLeg.start)) { legType = LEGTYPE.PENDING; } else if (leg) { if (!leg.transitLeg) { - if (leg.current >= TIME_AT_DESTINATION) { + if (countAtLegEnd >= COUNT_AT_LEG_END) { legType = LEGTYPE.WAIT; } else { legType = LEGTYPE.MOVE; @@ -73,7 +73,7 @@ function NaviCardContainer( const legRef = useRef(currentLeg); const focusRef = useRef(false); // Destination counter. How long user has been at the destination. * 10 seconds - const destCountRef = useRef(0); + const legEndRef = useRef(0); const cardRef = useRef(null); const { intl, config, match, router } = context; const handleRemove = index => { @@ -212,12 +212,13 @@ function NaviCardContainer( if ( position && currentLeg && + nextLeg && // itinerary end has its own logic distance(position, currentLeg.to) <= DESTINATION_RADIUS ) { - destCountRef.current += 1; + legEndRef.current += 1; } else { // Todo: this works in transit legs, but do we need additional logic for bikes / scooters? - destCountRef.current = 0; + legEndRef.current = 0; } return () => clearTimeout(timeoutId); @@ -225,7 +226,7 @@ function NaviCardContainer( // LegChange fires animation, we need to keep the old data until card goes out of the view. const l = legChanging ? previousLeg : currentLeg; - const legType = handleLegChange(l, firstLeg, time); + const legType = getLegType(l, firstLeg, time, legEndRef.current); const containerTopPosition = mapLayerRef.current.getBoundingClientRect().top + TOPBAR_PADDING; @@ -244,7 +245,7 @@ function NaviCardContainer( > ); @@ -405,8 +412,8 @@ export const getItineraryAlerts = ( .map(alert => ({ severity: 'ALERT', content: ( -
- {alert.alertHeaderText} +
+ {alert.alertHeaderText}
), id: alertId(alert), @@ -426,17 +433,19 @@ export const getItineraryAlerts = ( const routeName = `${lMode} ${route.shortName}`; const m = ( - + + + ); // we want to show the show routes button only for the first canceled leg. const content = i === 0 ? ( withNewSearchBtn({ m }, itinerarySearchCallback) ) : ( -
{m}
+
{m}
); if (!messages.get(`canceled-${legId}`)) { @@ -463,17 +472,20 @@ export const getItineraryAlerts = ( alerts.push({ severity: prob.severity, content: withNewSearchBtn( - , + + + , itinerarySearchCallback, ), id: transferId, hideClose: prob.severity === 'ALERT', + expiresOn: legTime(prob.toLeg.start), }); } } diff --git a/app/component/itinerary/navigator/navigator.scss b/app/component/itinerary/navigator/navigator.scss index aa92bafea9..27404c7ef4 100644 --- a/app/component/itinerary/navigator/navigator.scss +++ b/app/component/itinerary/navigator/navigator.scss @@ -43,6 +43,11 @@ $fixed-width-padding: 16px; font-weight: $font-weight-medium; } +.notification-header { + font-size: $font-size-normal; + font-weight: $font-weight-medium; +} + .navi-card-container { position: fixed; width: 100vw; @@ -61,7 +66,7 @@ $fixed-width-padding: 16px; } } -.navi-top-card-button { +.navi-top-card { margin: 0 var(--space-s) 5px var(--space-s); border-radius: 8px; min-height: 70px; @@ -73,6 +78,8 @@ $fixed-width-padding: 16px; box-shadow: 0 2px 4px 0 rgba(51, 51, 51, 0.2); width: calc(100vw - #{$fixed-width-padding}); cursor: default; + font-size: $font-size-normal; + font-weight: $font-weight-book; &.expanded { max-height: unset; @@ -105,25 +112,17 @@ $fixed-width-padding: 16px; .instructions { display: flex; + align-items: flex-start; flex-direction: column; width: 100%; - font-size: $font-size-normal; - font-weight: $font-weight-medium; &.expanded { margin-bottom: 0; } - .destination-header { - font-size: $font-size-normal; - font-weight: 500; - display: flex; - } - .vehicle-leg { display: flex; margin-top: var(--space-xs); - font-weight: $font-weight-book; width: 80%; text-align: left; } @@ -141,7 +140,6 @@ $fixed-width-padding: 16px; } .wait-duration { - font-weight: $font-weight-book; margin-top: var(--space-xs); } @@ -163,7 +161,6 @@ $fixed-width-padding: 16px; .headsign { margin-left: 10px; font-size: $font-size-small; - font-weight: $font-weight-book; max-width: 85%; text-align: left; align-content: center; @@ -205,13 +202,11 @@ $fixed-width-padding: 16px; .stop-count { display: flex; margin-left: 35px; - font-weight: $font-weight-book; } .extension-routenumber { display: flex; flex-direction: row; - font-weight: $font-weight-book; margin-left: 35px; margin-bottom: var(--space-s); text-align: left; @@ -307,7 +302,6 @@ $fixed-width-padding: 16px; } .destination { - font-weight: $font-weight-book; text-align: left; .details { @@ -409,6 +403,8 @@ $fixed-width-padding: 16px; animation: slideDownFromTop 0.5s ease-out forwards, fadeIn 0.5s ease-out forwards; + font-size: $font-size-xsmall; + font-weight: $font-weight-book; .icon-container { display: flex; @@ -417,44 +413,24 @@ $fixed-width-padding: 16px; width: 16px; } + .navi-info-content { + display: flex; + flex-direction: column; + margin-left: 8px; + margin-right: 8px; + width: 100%; + } + &.info { background-color: #e5f2fa; } &.warning { background-color: #fff8e8; - - .navi-alert-content { - width: 100%; - margin: 0 8px; - display: flex; - flex-direction: column; - } } &.alert { background-color: #fdf3f6; - - .navi-alert-content { - display: flex; - flex-direction: column; - margin: 0 8px; - width: 100%; - - span:first-child { - font-weight: $font-weight-medium; - font-size: $font-size-normal; - } - - span:last-child { - font-size: $font-size-small; - font-weight: $font-weight-book; - } - - .header { - font-size: $font-size-small; - } - } } .new-itinerary-search { @@ -503,39 +479,6 @@ $fixed-width-padding: 16px; slideDownFromTop 0.5s ease-out forwards, fadeOut 0.5s ease-out forwards; } - - .navi-info { - display: flex; - flex-direction: column; - margin-left: 25px; - - span:first-child { - font-weight: $font-weight-medium; - font-size: $font-size-normal; - } - - span:last-child { - font-size: $font-size-xsmall; - } - } - - .navi-info-content { - display: flex; - flex-direction: column; - margin-left: 8px; - margin-right: 8px; - width: 100%; - - span:first-child { - font-weight: $font-weight-medium; - font-size: $font-size-normal; - } - - span:last-child { - font-size: $font-size-xsmall; - font-weight: $font-weight-book; - } - } } } diff --git a/app/configurations/config.default.js b/app/configurations/config.default.js index f57312e0e3..9153fb4bc8 100644 --- a/app/configurations/config.default.js +++ b/app/configurations/config.default.js @@ -15,7 +15,6 @@ const STOP_TIMETABLES_URL = process.env.STOP_TIMETABLES_URL || 'https://dev.kartat.hsl.fi'; const APP_PATH = process.env.APP_CONTEXT || ''; const { - SENTRY_DSN, // AXE, NODE_ENV, API_SUBSCRIPTION_QUERY_PARAMETER_NAME, @@ -34,7 +33,6 @@ const realtime = require('./realtimeUtils').default; const REALTIME_PATCH = safeJsonParse(process.env.REALTIME_PATCH) || {}; export default { - SENTRY_DSN, PORT, // AXE, CONFIG, diff --git a/app/translations.js b/app/translations.js index 180b09d307..2c8efc3409 100644 --- a/app/translations.js +++ b/app/translations.js @@ -1345,7 +1345,7 @@ const translations = { 'navileg-rent-scooter': 'Pick up scooter', 'navileg-scooter': 'Travel by scooter to', 'navileg-start-realtime': 'Lähtee klo {time} {stop} {stopName}', - 'navileg-start-schedule': '{mode}n {route} aikataulun muk. lähtö {time}', + 'navileg-start-schedule': '{mode} {route} aikataulun mukainen lähtö {time}', 'navileg-stops-remaining': 'TODO_{stopCount} pysähdystä ennen poistumista', 'navileg-walk': 'Walk to', nearest: '{ mode } near you', @@ -2622,7 +2622,8 @@ const translations = { 'navileg-rent-scooter': 'Nouda sähköpotkulauta', 'navileg-scooter': 'Potkulautaile', 'navileg-start-realtime': 'Lähtee klo {time} {stopOrStation} {stopName}', - 'navileg-start-schedule': '{mode}n {route} aikataulun muk. lähtö {time}', + 'navileg-start-schedule': + '{mode} {route} aikataulun mukainen lähtö {time}', 'navileg-stops-remaining': '{stopCount} pysähdystä ennen poistumista', 'navileg-walk': 'Kävele', nearest: 'Lähimmät {mode}', @@ -5551,7 +5552,7 @@ const translations = { 'navileg-rent-scooter': 'Hämta elsparkcykel', 'navileg-scooter': 'Åk elsparkcykel', 'navileg-start-realtime': 'Lähtee klo {time} {stop} {stopName}', - 'navileg-start-schedule': '{mode}n {route} aikataulun muk. lähtö {time}', + 'navileg-start-schedule': '{mode} {route} aikataulun mukainen lähtö {time}', 'navileg-stops-remaining': 'TODO_{stopCount} pysähdystä ennen poistumista', 'navileg-walk': 'Gå till', nearest: 'Närmaste { mode }', diff --git a/app/util/Raven.js b/app/util/Raven.js deleted file mode 100644 index f04d691a3b..0000000000 --- a/app/util/Raven.js +++ /dev/null @@ -1,18 +0,0 @@ -import { COMMIT_ID } from '../buildInfo'; - -export default function getRaven(sentryDsn) { - if (sentryDsn) { - /* eslint-disable global-require */ - const Raven = require('raven-js'); - Raven.addPlugin(require('raven-js/plugins/console')); - - Raven.config(sentryDsn, { - release: COMMIT_ID, - stacktrace: true, - sampleRate: 0.1, - }).install(); - - return Raven; - } - return undefined; -} diff --git a/server/server.js b/server/server.js index ae2c0c5f98..91f6555e2b 100644 --- a/server/server.js +++ b/server/server.js @@ -18,19 +18,11 @@ const proxy = require('express-http-proxy'); global.self = { fetch: global.fetch }; -let Raven; const devhost = ''; -if (process.env.NODE_ENV === 'production' && process.env.SENTRY_SECRET_DSN) { - Raven = require('raven'); - Raven.config(process.env.SENTRY_SECRET_DSN, { - captureUnhandledRejections: true, - }).install(); -} else { - process.on('unhandledRejection', (reason, p) => { - console.log('Unhandled Rejection at:', p, 'reason:', reason); - }); -} +process.on('unhandledRejection', (reason, p) => { + console.log('Unhandled Rejection at:', p, 'reason:', reason); +}); /* ********* Server ********* */ const express = require('express'); @@ -145,17 +137,7 @@ function onError(err, req, res) { res.end(err.message + err.stack); } -function setUpRaven() { - if (process.env.NODE_ENV === 'production' && process.env.SENTRY_SECRET_DSN) { - app.use(Raven.requestHandler()); - } -} - function setUpErrorHandling() { - if (process.env.NODE_ENV === 'production' && process.env.SENTRY_SECRET_DSN) { - app.use(Raven.errorHandler()); - } - app.use(onError); } @@ -458,7 +440,6 @@ function fetchCitybikeConfigurations() { if (process.env.OIDC_CLIENT_ID) { setUpOpenId(); } -setUpRaven(); setUpStaticFolders(); setUpMiddleware(); setUpRoutes();