Merge branch 'main' of ssh://git.octree.ch:6118/p/caroster
jump to
@@ -2,7 +2,8 @@ import Head from 'next/head';
type Metas = { title: string; - url: string; + description?: string; + url?: string; }; interface Props {@@ -17,6 +18,7 @@ const title = metas?.title
? `${metas.title} - Caroster` : 'Caroster - Covoiturage de groupe'; const description = + metas?.description || 'Covoiturez à un événement en proposant une voiture ou en prenant une place.'; const socialImage = '/assets/Caroster_Octree_Social.jpg';
@@ -0,0 +1,13 @@
+export const getLocaleForLang = async (lang: string, key: string) => { + let langFile = await getLangFile(lang); + return langFile?.[key] || (await getLangFile('en'))?.[key] || ''; +}; + +const getLangFile = async (lang: string) => { + try { + const langFile = await require(`../locales/${lang}.json`); + return langFile; + } catch (error) { + return null; + } +};
@@ -303,5 +303,6 @@ "travel.creation.travel.titleHelper": "Bitte geben Sie einen gültigen Namen an",
"travel.passengers.email_placeholder": "E-Mail", "travel.requestTrip.description": "Die folgenden Informationen werden dem Fahrer der Fahrt zugeschickt.", "signup.newsletter.consent": "Ich interessiere mich für Fahrgemeinschaften, ich möchte den Newsletter abonnieren.", - "signup.tos.consent": "Ich akzeptiere <tos-link>Nutzungsbedingungen</tos-link> und <data-privacy-link>Datenschutzbestimmungen</data-privacy-link>" + "signup.tos.consent": "Ich akzeptiere <tos-link>Nutzungsbedingungen</tos-link> und <data-privacy-link>Datenschutzbestimmungen</data-privacy-link>", + "meta.description": "Caroster Bilden Sie bei der Veranstaltung Fahrgemeinschaften, indem Sie ein Auto anbieten oder einen Platz einnehmen." }
@@ -312,5 +312,6 @@ "travel.vehicle.name": "Name of the vehicle",
"travel.vehicle.seats_number": "Seats number", "travel.vehicle.title": "My Vehicles", "travel.showMap": "Show map", - "travel.hideMap": "Hide map" + "travel.hideMap": "Hide map", + "meta.description": "Caroster Join the event by offering a car or taking a seat." }
@@ -311,5 +311,6 @@ "travel.vehicle.name": "Nom du véhicule",
"travel.vehicle.seats_number": "Nombre de places", "travel.vehicle.title": "Mes véhicules", "travel.showMap": "Afficher la carte", - "travel.hideMap": "Masquer la carte" + "travel.hideMap": "Masquer la carte", + "meta.description": "Caroster Covoiturez à l’événement en proposant une voiture ou en prenant une place." }
@@ -311,5 +311,6 @@ "placeInput.mapboxUnavailable": "Non è momentaneamente possibile suggerire posizioni geolocalizzate",
"signin.errors.CredentialsSignin": "Controlla email e password. Se il tuo account è connesso a Google, usa il pulsante di login con Google.", "tour.creator.step4": "L'evento può essere modificato cliccando il pulsante Modifica.", "emailConfirmation.toLogin": "Vai alla pagina di login", - "emailConfirmation.invalidMessage": "Questo link di registrazione non è più valido perché già utilizzato o scaduto." + "emailConfirmation.invalidMessage": "Questo link di registrazione non è più valido perché già utilizzato o scaduto.", + "meta.description": "Caroster Partecipa all'evento offrendo la tua automobile o prendendo un passaggio." }
@@ -304,5 +304,6 @@ "travel.vehicle.add": "Voertuig toevoegen",
"travel.vehicle.empty": "Er is nog geen voertuig aan u toegewezen. Klik op onderstaande knop om er een toe te voegen.", "travel.vehicle.name": "Voertuignaam", "travel.vehicle.seats_number": "Aantal plaatsen", - "travel.vehicle.title": "Mijn voertuigen" + "travel.vehicle.title": "Mijn voertuigen", + "meta.description": "Caroster Carpool naar het evenement door een auto aan te bieden of een plaats in te nemen." }
@@ -39,7 +39,6 @@ "next-i18next": "^15.4.0",
"next-pwa": "^5.6.0", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-helmet": "^6.1.0", "react-i18next": "^15.1.3", "react-international-phone": "^4.3.0", "react-leaflet": "^4.2.1",
@@ -8,6 +8,7 @@ TripAlertDocument,
TripAlertEntity, } from '../../../generated/graphql'; import pageUtils from '../../../lib/pageUtils'; +import {getLocaleForLang} from '../../../lib/getLocale'; interface Props { eventUUID: string;@@ -72,12 +73,18 @@ } catch (error) {
tripAlertEntity = null; } + const description = await getLocaleForLang( + event?.attributes?.lang, + 'meta.description' + ); + return { props: { eventUUID: uuid, tripAlertEntity, metas: { title: event?.attributes?.name || '', + description, url: `https://${host}${context.resolvedUrl}`, }, },
@@ -29,6 +29,7 @@ EventByUuidDocument,
useUpdateEventMutation, } from '../../../generated/graphql'; import {langLocales} from '../../../locales/constants'; +import {getLocaleForLang} from '../../../lib/getLocale'; interface Props { eventUUID: string;@@ -323,11 +324,17 @@ notFound: true,
}; } + const description = await getLocaleForLang( + event?.attributes?.lang, + 'meta.description' + ); + return { props: { eventUUID: uuid, metas: { title: event?.attributes?.name || '', + description, url: `https://${host}${context.resolvedUrl}`, }, },
@@ -12,6 +12,7 @@ FindUserVehiclesDocument,
VehicleEntity, useFindUserVehiclesQuery, } from '../../../generated/graphql'; +import {getLocaleForLang} from '../../../lib/getLocale'; interface Props { eventUUID: string;@@ -85,11 +86,17 @@ await apolloClient.query({
query: FindUserVehiclesDocument, }); + const description = await getLocaleForLang( + event?.attributes?.lang, + 'meta.description' + ); + return { props: { eventUUID: uuid, metas: { title: event?.attributes?.name || '', + description, url: `https://${host}${context.resolvedUrl}`, }, },
@@ -15,6 +15,7 @@ import CarosterPlusOption from '../../../containers/CarosterPlusOption';
import CarosterPlusSettings from '../../../containers/CarosterPlusSettings'; import {Typography} from '@mui/material'; import {useTranslation} from 'next-i18next'; +import {getLocaleForLang} from '../../../lib/getLocale'; interface Props { modulesSettings?: Module;@@ -113,12 +114,18 @@ } catch (error) {
console.error(error); } + const description = await getLocaleForLang( + event?.attributes?.lang, + 'meta.description' + ); + return { props: { modulesSettings, eventUUID: uuid, metas: { title: event?.attributes?.name || '', + description, url: `https://${host}${context.resolvedUrl}`, }, },
@@ -5,6 +5,7 @@ import pageUtils from '../../../lib/pageUtils';
import EventLayout, {TabComponent} from '../../../layouts/Event'; import {AddPassengerToWaitingList} from '../../../containers/NewPassengerDialog'; import {EventByUuidDocument} from '../../../generated/graphql'; +import {getLocaleForLang} from '../../../lib/getLocale'; interface Props { eventUUID: string;@@ -77,11 +78,17 @@ return {
notFound: true, }; + const description = await getLocaleForLang( + event?.attributes?.lang, + 'meta.description' + ); + return { props: { eventUUID: uuid, metas: { title: event?.attributes?.name || '', + description, url: `https://${host}${context.resolvedUrl}`, }, },