all repos — caroster @ e0e4355b87b11e45d294e6cd17e38188b7d03217

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

:recycle: group  labels for menu items, in a menu: key
Hadrien Froger hadrien@octree.ch
Sat, 18 Jul 2020 08:39:26 +0100
commit

e0e4355b87b11e45d294e6cd17e38188b7d03217

parent

38924a153dfb02705dc15ee9ed90a528ddf386df

M app/src/locales/fr.jsonapp/src/locales/fr.json

@@ -3,6 +3,15 @@ "meta": {

"title": "Caroster - Covoiturage de groupe - {{title}}", "about_href": "https://caroster.io/about" }, + "menu": { + "logout": "Se déconnecter", + "about": "À propos de Caroster", + "dashboard": "Mes évènements", + "login": "Se connecter", + "register": "S'inscrire", + "new_event": "Nouvel évènement", + "profile": "Profil" + }, "generic": { "loading": "Chargement...", "close": "Fermer",

@@ -30,23 +39,25 @@ "name": "Nom de l'événement",

"empty": "Non précisé" }, "creation": { + "title": "Nouvel un évènement", "event_name": "Nom de l'événement", "creator_email": "Votre e-mail", "date": "Date de l'événement", "address": "Adresse de l'événement", "next": "Suivant", - "newsletter": "Me tenir informé des évolutions de Caroster par e-mail" + "newsletter": "Me tenir informé des évolutions de Caroster par e-mail", + "actions": { + "dashboard": "Mes évènements", + "see_profile": "Profil", + "about": "À propos de Caroster" + } }, "actions": { "show_details": "Détails de l'événement", "hide_details": "Cacher les détails", "find_car": "Trouver une voiture", "copied": "Le lien a été copié dans votre presse-papier", - "add_to_my_events": "Ajouter à mes évènements", - "my_events": "Mes évènements", - "signin": "Se connecter", - "signup": "S'inscrire", - "my_profile": "Profil" + "add_to_my_events": "Ajouter à mes évènements" }, "errors": { "cant_create": "Impossible de créer l'événement",

@@ -96,10 +107,7 @@ },

"dashboard": { "title": "Évènements", "actions": { - "see_event": "Voir", - "see_profile": "Profil", - "add_event" : "Ajouter un évènement", - "about": "À propos de Caroster" + "see_event": "Voir" }, "sections":{ "future": "Évènement à venir",

@@ -113,6 +121,9 @@ "text_html": "Ici, vous y verrez <strong>les évènements auxquels vous participer</strong>, pour commencer créer un évènement !",

"create_event": "Nouvel évènement" } }, + "profile":{ + "title": "Mon profil" + } , "passenger": { "title": "Liste d'attente", "availability": {
M app/src/pages/Dashboard.jsapp/src/pages/Dashboard.js

@@ -26,17 +26,17 @@ <GenericMenu

title={t('dashboard.title')} actions={[ { - label: t('dashboard.actions.add_event'), + label: t('menu.new_event'), onClick: goNewEvent, id: 'AddEventTabs', }, { - label: t('dashboard.actions.see_profile'), + label: t('menu.profile'), onClick: goProfile, id: 'ProfileTabs', }, { - label: t('dashboard.actions.about'), + label: t('menu.about'), onClick: goAbout, id: 'AboutTabs', },
M app/src/pages/Event.jsapp/src/pages/Event.js

@@ -83,6 +83,7 @@

const signIn = history.push.bind(undefined, '/login'); const goToDashboard = history.push.bind(undefined, '/dashboard'); const goProfile = history.push.bind(undefined, '/profile'); + const goAbout = () => (window.location.href = t('meta.about_href')); if (!event) return <Loading />;

@@ -174,24 +175,29 @@ onClick: addToMyEvents,

id: 'AddToMyEventsTab', }, !!token && { - label: t('event.actions.my_events'), + label: t('menu.dashboard'), onClick: goToDashboard, id: 'GoToDashboardTab', }, !token && { - label: t('event.actions.signin'), + label: t('menu.login'), onClick: signIn, id: 'SignInTab', }, !token && { - label: t('event.actions.signup'), + label: t('menu.register'), onClick: signUp, id: 'SignUpTab', }, !!token && { - label: t('event.actions.my_profile'), + label: t('menu.profile'), onClick: goProfile, id: 'ProfileTab', + }, + { + label: t('menu.about'), + onClick: goAbout, + id: 'AboutTab', }, ].filter(Boolean)} />
M app/src/pages/Home.jsapp/src/pages/Home.js

@@ -3,15 +3,65 @@ import Layout from '../layouts/Centered';

import Paper from '../components/Paper'; import Logo from '../components/Logo'; import CreateEvent from '../containers/CreateEvent'; +import {useAuth} from 'strapi-react-context'; +import {useHistory} from 'react-router-dom'; +import {useTranslation} from 'react-i18next'; +import GenericMenu from '../containers/GenericMenu'; +const Menu = () => { + const history = useHistory(); + const {t} = useTranslation(); + const {token} = useAuth(); + const goProfile = history.push.bind(undefined, '/profile'); + const goDashboard = history.push.bind(undefined, '/dashboard'); + const goLogin = history.push.bind(undefined, '/login'); + const goRegister = history.push.bind(undefined, '/register'); + const goAbout = () => (window.location.href = t('meta.about_href')); + + return ( + <GenericMenu + title={t('event.creation.title')} + actions={[ + !!token && { + label: t('menu.dashboard'), + onClick: goDashboard, + id: 'SeeDashboardTabs', + }, + !!token && { + label: t('menu.profile'), + onClick: goProfile, + id: 'ProfileTabs', + }, + !token && { + label: t('menu.login'), + onClick: goLogin, + id: 'LoginTabs', + }, + !token && { + label: t('menu.register'), + onClick: goRegister, + id: 'RegisterTabs', + }, + { + label: t('menu.about'), + onClick: goAbout, + id: 'AboutTabs', + }, + ]} + /> + ); +}; const Home = () => { return ( - <Layout> - <Paper> - <Logo /> - <CreateEvent /> - </Paper> - </Layout> + <> + <Menu /> + <Layout> + <Paper> + <Logo /> + <CreateEvent /> + </Paper> + </Layout> + </> ); };
M app/src/pages/Profile.jsapp/src/pages/Profile.js

@@ -1,7 +1,55 @@

import React from 'react'; +import {useAuth} from 'strapi-react-context'; +import Layout from '../layouts/Centered'; +import {useTranslation} from 'react-i18next'; +import GenericMenu from '../containers/GenericMenu'; + +import {useHistory} from 'react-router-dom'; + +const Menu = () => { + const history = useHistory(); + const {t} = useTranslation(); + const {logout} = useAuth(); + const goDashboard = history.push.bind(undefined, '/dashboard'); + const goNewEvent = history.push.bind(undefined, '/new'); + const goAbout = () => (window.location.href = t('meta.about_href')); + + return ( + <GenericMenu + title={t('profile.title')} + actions={[ + { + label: t('menu.new_event'), + onClick: goNewEvent, + id: 'AddEventTabs', + }, + { + label: t('menu.dashboard'), + onClick: goDashboard, + id: 'DashboardTabs', + }, + { + label: t('menu.logout'), + onClick: logout, + id: 'LogoutTabs', + }, + { + label: t('menu.about'), + onClick: goAbout, + id: 'AboutTabs', + }, + ]} + /> + ); +}; const Profile = () => { - return <div>Profile – NOT IMPLEMENTED</div>; + return ( + <> + <Menu /> + <Layout>Profile – NOT IMPLEMENTED</Layout> + </> + ); }; export default Profile;