all repos — caroster @ 1d71149a47b2eaca330a9b7e9c24e2caa51d897d

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

🐛 Fix menu action when sharing an event
#445
Simon Mulquin simon@octree.ch
Wed, 10 Jan 2024 08:50:06 +0000
commit

1d71149a47b2eaca330a9b7e9c24e2caa51d897d

parent

6b5d804cf3f640da2c53bed47096adb0bf368117

1 files changed, 12 insertions(+), 6 deletions(-)

jump to
M frontend/containers/EventBar/useActions.tsfrontend/containers/EventBar/useActions.ts

@@ -2,6 +2,8 @@ import {useRouter} from 'next/router';

import {useTranslation} from 'react-i18next'; import useProfile from '../../hooks/useProfile'; import useRedirectUrlStore from '../../stores/useRedirectUrl'; +import useShare from '../../hooks/useShare'; +import useEventStore from '../../stores/useEventStore'; interface Props { onAdd: (isAddToMyEvent: boolean) => void;

@@ -14,6 +16,8 @@ const {t} = useTranslation();

const router = useRouter(); const {connected} = useProfile(); const setRedirectUrl = useRedirectUrlStore(s => s.setRedirectUrl); + const {share} = useShare(); + const {event} = useEventStore(); const noUserMenuActions = [ {

@@ -26,9 +30,10 @@ },

{divider: true}, { label: t('event.actions.share'), - onClick: () => { - onAdd(true); - }, + onClick: () => + share({ + title: `Caroster ${event.name}`, + }), id: 'ShareEvent', }, {divider: true},

@@ -67,9 +72,10 @@ id: 'GoToDashboardTab',

}, { label: t('event.actions.share'), - onClick: () => { - onAdd(true); - }, + onClick: () => + share({ + title: `Caroster ${event.name}`, + }), id: 'ShareEvent', }, {divider: true},