Skip to content

Commit 3a85994

Browse files
authored
Merge pull request #4381 from c2corg/smart-origin/prod
fix: Smart/Origin: several frontend hotfixes
2 parents 27a661e + 1396901 commit 3a85994

5 files changed

Lines changed: 154 additions & 114 deletions

File tree

src/translations/fr.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"Associated routes cotations": "Cotations des itinéraires associés au point de passage",
7676
"Association": "Camptocamp Association",
7777
"Associations history": "Historique des associations",
78+
"At least one access point in the route do not have a public transport stop within 5km.": "Au moins un point d'accès du topo ne dispose pas d'arrêt de transport en commun à moins de 5km.",
7879
"Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made.": "Attribution — Vous devez créditer l'Œuvre, intégrer un lien vers la licence et indiquer si des modifications ont été effectuées à l'Oeuvre. ",
7980
"Avalanche bulletins": "Bulletins d'avalanche",
8081
"Avalanche risk": "Risque d'avalanche",
@@ -376,6 +377,7 @@
376377
},
377378
"Invalid value": "Valeur invalide",
378379
"Issue report": "Signalement d'un problème",
380+
"It seems your trip can not be completed on the selected date and time": "Il semblerait que votre trajet ne puisse être réalisé à la date et aux horaires indiqués",
379381
"Join us": "Adhérer",
380382
"Know more about SERAC": "En savoir plus sur SERAC",
381383
"Large group = 5 people and more": "Grand groupe = 5 personnes et plus",
@@ -761,6 +763,7 @@
761763
"Warning: This action cannot be undone!": "Attention : cette action est irréversible !",
762764
"Waypoint's main properties": "Principales données du point de passage",
763765
"Waypoint's textual description": "Descriptions textuelles du point de passage",
766+
"We did not find any public transport stop point in a 5 km foot range from any route access point.": "Nous n'avons pas trouvé d'arrêt de transport en commun à moins de 5km à pied de l'un des points d'accès à l'itinéraire.",
764767
"We sent you an email, please click on the link to reset password.": "Vous allez bientôt recevoir un email. Veuillez cliquer sur le lien qu'il contient pour réinitialiser votre mot de passe.",
765768
"Weather & conditions": "Météo & conditions",
766769
"Weather forecast (meteoblue)": "Prévisions météo (meteoblue)",

src/views/document/WaypointView.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
<markdown-section :document="document" :field="fields.external_resources" />
130130
<div style="clear: both" />
131131
</div>
132-
<transports-box :document="[document]" />
133132

134133
<routes-box v-if="!isDraftView && document.waypoint_type !== 'climbing_indoor'" :document="document" />
135134
<recent-outings-box v-if="!isDraftView" :document="document" />

src/views/document/utils/boxes/NearbyStopsSection.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="public-transports-section">
2+
<div class="public-transports-section" :class="{ 'public-transports-section-not-served': !showAccessibilityInfo }">
33
<div v-if="showAccessibilityInfo" class="public-transports-result">
44
<div class="stop-cards" ref="stopCardContainer">
55
<div
@@ -44,7 +44,7 @@
4444
<div class="missing-transports-warning-text">
4545
<strong>{{ $gettext('This route is partially accessible by public transport.') }}</strong>
4646
<p>
47-
{{ $gettext("At least one access point in the route don't have a public transport stop within 5km.") }}
47+
{{ $gettext('At least one access point in the route do not have a public transport stop within 5km.') }}
4848
</p>
4949
</div>
5050
</div>
@@ -56,13 +56,15 @@
5656
<strong>{{ $gettext('Unfortunately, this route may not be deserved by public transport') }}</strong>
5757
<p>
5858
{{
59-
$gettext("We didn't find any public transport stop point in a 5 km foot range from any route access point.")
59+
$gettext(
60+
'We did not find any public transport stop point in a 5 km foot range from any route access point.'
61+
)
6062
}}
6163
</p>
6264
</div>
6365
</div>
6466

65-
<div class="public-transports-map">
67+
<div class="public-transports-map" v-if="showAccessibilityInfo">
6668
<map-view
6769
ref="mapView"
6870
:documents="filteredDocuments"
@@ -180,6 +182,9 @@ export default {
180182
},
181183
deep: true,
182184
},
185+
showAccessibilityInfo(newVal) {
186+
this.$emit('accessibility-info-changed', newVal);
187+
},
183188
},
184189
methods: {
185190
/** Fetch access waypoints */
@@ -512,10 +517,10 @@ export default {
512517
padding: 20px;
513518
border: 1px solid lightgray;
514519
border-radius: 4px;
515-
margin-top: 20px;
516520
gap: 30px;
517521
align-items: center;
518522
height: fit-content;
523+
width: 100%;
519524
520525
.public-transports-no-result-bus {
521526
margin-left: 20px;
@@ -525,6 +530,11 @@ export default {
525530
}
526531
}
527532
533+
.public-transports-section-not-served {
534+
height: auto;
535+
margin-top: 0;
536+
}
537+
528538
@media only screen and (max-width: 600px) {
529539
.public-transports-section {
530540
display: inline !important;
@@ -534,7 +544,7 @@ export default {
534544
}
535545
.public-transports-map {
536546
height: 275px !important;
537-
width: 319px !important;
547+
width: auto !important;
538548
margin-left: auto;
539549
margin-right: auto;
540550
}

src/views/document/utils/boxes/PlanATripSection.vue

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
<div class="no-itineraries-text">
209209
<div class="no-itineraries-found">{{ $gettext('No public transport found') }}</div>
210210
<div class="no-itineraries-detail">
211-
{{ $gettext("It seems your trip can't be completed on the selected date and and time") }}
211+
{{ $gettext('It seems your trip can not be completed on the selected date and time') }}
212212
</div>
213213
</div>
214214
</div>
@@ -495,8 +495,6 @@ export default {
495495
isUpdating: false,
496496
missingDepartureAddress: false,
497497
missingDestinationAddress: false,
498-
limitTransfers: false,
499-
maxTransfers: 0,
500498
},
501499
502500
// Data for return journey
@@ -518,8 +516,6 @@ export default {
518516
isUpdating: false,
519517
missingDepartureAddress: false,
520518
missingDestinationAddress: false,
521-
limitTransfers: false,
522-
maxTransfers: 0,
523519
},
524520
525521
userService: new UserProfileService(c2c),
@@ -530,6 +526,8 @@ export default {
530526
reachableWaypoints: [],
531527
loadingReachable: false,
532528
searchTimeout: null,
529+
limitTransfers: false,
530+
maxTransfers: 0,
533531
};
534532
},
535533
@@ -751,24 +749,6 @@ export default {
751749
},
752750
},
753751
754-
limitTransfers: {
755-
get() {
756-
return this.currentData.limitTransfers;
757-
},
758-
set(value) {
759-
this.currentData.limitTransfers = value;
760-
},
761-
},
762-
763-
maxTransfers: {
764-
get() {
765-
return this.limitTransfers ? this.currentData.maxTransfers : null;
766-
},
767-
set(value) {
768-
this.currentData.maxTransfers = value;
769-
},
770-
},
771-
772752
canAccessReturnTab() {
773753
return this.outboundData.journeys.length > 0;
774754
},
@@ -946,11 +926,13 @@ export default {
946926
adjustedDateTime.setTime(originalDateTime.getTime() - 15 * 60 * 1000);
947927
}
948928
949-
const dateTimeFormat =
950-
adjustedDateTime.toISOString().slice(0, 10).replace(/-/g, '') +
951-
'T' +
952-
adjustedDateTime.toTimeString().slice(0, 5).replace(':', '') +
953-
'00';
929+
const year = adjustedDateTime.getFullYear();
930+
const month = String(adjustedDateTime.getMonth() + 1).padStart(2, '0');
931+
const day = String(adjustedDateTime.getDate()).padStart(2, '0');
932+
const hours = String(adjustedDateTime.getHours()).padStart(2, '0');
933+
const minutes = String(adjustedDateTime.getMinutes()).padStart(2, '0');
934+
935+
const dateTimeFormat = `${year}${month}${day}T${hours}${minutes}00`;
954936
const dateTimeRepresents = this.timePreference === 'arrive-before' ? 'arrival' : 'departure';
955937
956938
try {
@@ -980,13 +962,7 @@ export default {
980962
});
981963
982964
if (filteredJourneys.length === 0) {
983-
if (this.activeTab === 'return') {
984-
await this.fetchExtendedTimeframeJourney(fromCoords, toCoords, dateTimeFormat, dateTimeRepresents);
985-
return;
986-
}
987-
988-
this.noResult = true;
989-
this.journeys = [];
965+
await this.fetchExtendedTimeframeJourney(fromCoords, toCoords, dateTimeFormat, dateTimeRepresents);
990966
return;
991967
}
992968
@@ -999,24 +975,11 @@ export default {
999975
await this.determineReturnWaypoint();
1000976
}
1001977
} else {
1002-
if (this.activeTab === 'return') {
1003-
await this.fetchExtendedTimeframeJourney(fromCoords, toCoords, dateTimeFormat, dateTimeRepresents);
1004-
return;
1005-
}
1006-
1007-
this.noResult = true;
1008-
this.journeys = [];
978+
await this.fetchExtendedTimeframeJourney(fromCoords, toCoords, dateTimeFormat, dateTimeRepresents);
1009979
}
1010980
} catch (error) {
1011981
console.error('Error retrieving routes:', error);
1012-
1013-
if (this.activeTab === 'return') {
1014-
await this.fetchExtendedTimeframeJourney(fromCoords, toCoords, dateTimeFormat, dateTimeRepresents);
1015-
return;
1016-
}
1017-
1018-
this.noResult = true;
1019-
this.journeys = [];
982+
await this.fetchExtendedTimeframeJourney(fromCoords, toCoords, dateTimeFormat, dateTimeRepresents);
1020983
} finally {
1021984
this.isUpdating = false;
1022985
}
@@ -1064,6 +1027,10 @@ export default {
10641027
this.journeys = [bestLastJourney];
10651028
this.noResult = true;
10661029
this.selectedRouteJourney = bestLastJourney;
1030+
if (this.activeTab === 'outbound') {
1031+
this.calculateReturnParameters();
1032+
await this.determineReturnWaypoint();
1033+
}
10671034
this.showTimeButton = true;
10681035
10691036
this.$emit('calculate-route', {
@@ -1434,7 +1401,6 @@ export default {
14341401
if (!this.outboundData.journeys || this.outboundData.journeys.length === 0) {
14351402
return;
14361403
}
1437-
14381404
const outboundJourney = this.outboundData.journeys[0];
14391405
const arrivalTime = outboundJourney.arrival_date_time;
14401406
@@ -1624,7 +1590,7 @@ export default {
16241590
if (this.document.durations.length === 1 && this.document.durations[0] === '10+') {
16251591
return '10+ ' + this.$gettext('Day(s)').toLowerCase();
16261592
}
1627-
// Priority to the calculated duration if the minimum duration is exactly 1 day
1593+
16281594
const shouldUseCalculated =
16291595
this.document.durations?.length &&
16301596
Math.min(...this.document.durations) === 1 &&
@@ -1638,8 +1604,14 @@ export default {
16381604
16391605
if (durationInDays < 1) {
16401606
const hours = durationInDays * 24;
1641-
const hoursInt = Math.floor(hours);
1642-
const minutes = Math.round((hours - hoursInt) * 60);
1607+
let hoursInt = Math.floor(hours);
1608+
let minutes = Math.round((hours - hoursInt) * 60);
1609+
1610+
if (minutes === 60) {
1611+
hoursInt += 1;
1612+
minutes = 0;
1613+
}
1614+
16431615
return `${hoursInt}h${minutes.toString().padStart(2, '0')}`;
16441616
}
16451617
@@ -2256,6 +2228,7 @@ export default {
22562228
.journey-steps {
22572229
display: flex;
22582230
margin-top: 8px;
2231+
flex-wrap: wrap;
22592232
22602233
.step-wrapper {
22612234
display: flex;
@@ -2347,7 +2320,7 @@ export default {
23472320
23482321
.plan-trip-map {
23492322
height: 275px !important;
2350-
width: 319px !important;
2323+
width: auto !important;
23512324
margin-left: auto;
23522325
margin-right: auto;
23532326
}

0 commit comments

Comments
 (0)