all repos — caroster @ 745f88dd9d66f63801484d5a89b6d471782c9b0b

[Octree] Group carpool to your event https://caroster.io

Merge branch 'main' of ssh://git.octree.ch:6118/p/caroster
Tim Izzo tim@octree.ch
Tue, 10 Dec 2024 13:14:21 +0100
commit

745f88dd9d66f63801484d5a89b6d471782c9b0b

parent

8d70ecab1b49b1a63ffa379b2fadc2807ff9ea28

M frontend/containers/Metas/index.tsxfrontend/containers/Metas/index.tsx

@@ -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';
A frontend/lib/getLocale.ts

@@ -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; + } +};
M frontend/locales/de.jsonfrontend/locales/de.json

@@ -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." }
M frontend/locales/en.jsonfrontend/locales/en.json

@@ -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." }
M frontend/locales/fr.jsonfrontend/locales/fr.json

@@ -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." }
M frontend/locales/it.jsonfrontend/locales/it.json

@@ -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." }
M frontend/locales/nl.jsonfrontend/locales/nl.json

@@ -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." }
M frontend/package.jsonfrontend/package.json

@@ -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",
M frontend/pages/e/[uuid]/alerts.tsxfrontend/pages/e/[uuid]/alerts.tsx

@@ -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}`, }, },
M frontend/pages/e/[uuid]/details.tsxfrontend/pages/e/[uuid]/details.tsx

@@ -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}`, }, },
M frontend/pages/e/[uuid]/index.tsxfrontend/pages/e/[uuid]/index.tsx

@@ -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}`, }, },
M frontend/pages/e/[uuid]/options.tsxfrontend/pages/e/[uuid]/options.tsx

@@ -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}`, }, },
M frontend/pages/e/[uuid]/waitingList.tsxfrontend/pages/e/[uuid]/waitingList.tsx

@@ -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}`, }, },
M yarn.lockyarn.lock

@@ -1895,7 +1895,6 @@ next-i18next: "npm:^15.4.0"

next-pwa: "npm:^5.6.0" react: "npm:^18.3.1" react-dom: "npm:^18.3.1" - react-helmet: "npm:^6.1.0" react-i18next: "npm:^15.1.3" react-international-phone: "npm:^4.3.0" react-leaflet: "npm:^4.2.1"