diff --git a/src/frontend/src/features/rooms/components/Rating.tsx b/src/frontend/src/features/rooms/components/Rating.tsx index b910bb25..d5d45615 100644 --- a/src/frontend/src/features/rooms/components/Rating.tsx +++ b/src/frontend/src/features/rooms/components/Rating.tsx @@ -1,5 +1,5 @@ -import { Button, H, Text, TextArea } from '@/primitives' -import { useEffect, useState } from 'react' +import { Button, H, Input, Text, TextArea } from '@/primitives' +import { useEffect, useMemo, useState } from 'react' import { cva } from '@/styled-system/css' import { useTranslation } from 'react-i18next' import { styled, VStack } from '@/styled-system/jsx' @@ -237,9 +237,74 @@ const ConfirmationMessage = ({ onNext }: { onNext: () => void }) => { ) } +const AuthenticationMessage = ({ + onNext, + posthog, +}: { + onNext: () => void + posthog: PostHog +}) => { + const { t } = useTranslation('rooms', { keyPrefix: 'authenticationMessage' }) + + const [email, setEmail] = useState('') + + const onSubmit = () => { + posthog.people.set({ unsafe_email: email }) + onNext() + } + + return ( + + {t('heading')} + setEmail(e.target.value)} + style={{ + marginBottom: '1rem', + }} + /> + + + + + + ) +} + export const Rating = () => { const posthog = usePostHog() + const isUserAnonymous = useMemo(() => { + return posthog.get_property('$user_state') == 'anonymous' + }, [posthog]) + const [step, setStep] = useState(0) if (step == 0) { @@ -251,6 +316,17 @@ export const Rating = () => { } if (step == 2) { + return isUserAnonymous ? ( + setStep(step + 1)} + /> + ) : ( + setStep(0)} /> + ) + } + + if (step == 3) { return setStep(0)} /> } } diff --git a/src/frontend/src/locales/de/rooms.json b/src/frontend/src/locales/de/rooms.json index 299bf8eb..15d91583 100644 --- a/src/frontend/src/locales/de/rooms.json +++ b/src/frontend/src/locales/de/rooms.json @@ -173,6 +173,12 @@ "heading": "", "body": "" }, + "authenticationMessage": { + "heading": "", + "placeholder": "", + "submit": "", + "ignore": "" + }, "participants": { "subheading": "", "contributors": "", diff --git a/src/frontend/src/locales/en/rooms.json b/src/frontend/src/locales/en/rooms.json index 2b343793..2076fa60 100644 --- a/src/frontend/src/locales/en/rooms.json +++ b/src/frontend/src/locales/en/rooms.json @@ -172,6 +172,12 @@ "heading": "Thank you for your submission", "body": "Our product team takes the time to carefully review your feedback. We will get back to you as soon as possible." }, + "authenticationMessage": { + "heading": "How can we contact you?", + "placeholder": "Your email", + "submit": "Send", + "ignore": "Ignore" + }, "participants": { "subheading": "In room", "you": "You", diff --git a/src/frontend/src/locales/fr/rooms.json b/src/frontend/src/locales/fr/rooms.json index ccffd018..cae9c09d 100644 --- a/src/frontend/src/locales/fr/rooms.json +++ b/src/frontend/src/locales/fr/rooms.json @@ -172,6 +172,12 @@ "heading": "Merci pour votre retour", "body": "Notre équipe produit prend le temps d'analyser attentivement vos réponses. Nous reviendrons vers vous dans les plus brefs délais." }, + "authenticationMessage": { + "heading": "Comment pouvons-nous vous recontacter ?", + "placeholder": "Votre email", + "submit": "Envoyer", + "ignore": "Ignorer" + }, "participants": { "subheading": "Dans la réunion", "you": "Vous",