-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' into sajal/gys-9033-heroes-frontend-implementa…
…tion * staging: feat: add manifesto url in nav menu fix: copy language files when deploying fix: use normal language files load for staging and production instead of server load fix: post publish without email send options fix: get featured link feat: add custom url satshack fix: issues with copy and rewards seo fix: fix email section in funding details fix: loading icon for post image load fix: update padding for all components in
- Loading branch information
Showing
8 changed files
with
168 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ import { | |
useUserNotificationSettings, | ||
} from '@/modules/profile/pages/profileSettings/hooks/useUserNotificationSettings' | ||
import { useFundingFormAtom } from '@/modules/project/funding/hooks/useFundingFormAtom' | ||
import { useProjectAtom } from '@/modules/project/hooks/useProjectAtom' | ||
import { useFollowedProjectsValue } from '@/pages/auth/state' | ||
import { CardLayout } from '@/shared/components/layouts' | ||
import { H1 } from '@/shared/components/typography' | ||
|
@@ -34,9 +33,17 @@ const EMAIL_VALIDATION_STATE = { | |
export const FundingDetailsUserEmailAndUpdates = () => { | ||
const { t } = useTranslation() | ||
const { user } = useAuthContext() | ||
const { project } = useProjectAtom() | ||
const followedProjects = useFollowedProjectsValue() | ||
|
||
const { | ||
project, | ||
formState: { needsShipping, followProject, subscribeToGeyserEmails, email }, | ||
hasSelectedRewards, | ||
setTarget, | ||
fundingFormError, | ||
setErrorstate, | ||
} = useFundingFormAtom() | ||
|
||
const [followsProject] = useState(followedProjects.find((p) => p.id === project.id) !== undefined) | ||
const [userId] = useState(user?.id || 0) | ||
|
||
|
@@ -48,13 +55,9 @@ export const FundingDetailsUserEmailAndUpdates = () => { | |
|
||
const showEmailComponent = !user?.email || !followsProject || !subscribedToGeyserEmails | ||
|
||
const { | ||
formState: { needsShipping, followProject, subscribeToGeyserEmails, email }, | ||
hasSelectedRewards, | ||
setTarget, | ||
fundingFormError, | ||
setErrorstate, | ||
} = useFundingFormAtom() | ||
const descriptionCopy = hasSelectedRewards | ||
? t('This email will be used by the seller to reach out to you.') | ||
: t('Follow Project and receive direct project updates to your email') | ||
|
||
/* | ||
Set the email from the user to the funding form. We do this because the input field | ||
|
@@ -120,77 +123,72 @@ export const FundingDetailsUserEmailAndUpdates = () => { | |
} | ||
} | ||
|
||
if (!showEmailComponent) return null | ||
|
||
return ( | ||
<> | ||
{showEmailComponent && ( | ||
<CardLayout mobileDense width="100%" position="relative"> | ||
<H1 size="2xl" bold> | ||
{t('Email and Updates')} | ||
</H1> | ||
|
||
<FieldContainer | ||
title={`${t('Your email')} ${hasSelectedRewards ? '*' : ''}`} | ||
subtitle={t('This email will be used by the seller to reach out to you.')} | ||
> | ||
<FormControl isInvalid={Boolean(fundingFormError.email)}> | ||
<InputGroup> | ||
<Input | ||
disabled={Boolean(user?.email)} | ||
required={hasSelectedRewards} | ||
type="email" | ||
name="email" | ||
placeholder="[email protected]" | ||
value={email} | ||
inputMode="email" | ||
onChange={(e) => { | ||
setTarget({ target: { name: 'email', value: e.target.value } }) | ||
setEmailValidationState(EMAIL_VALIDATION_STATE.LOADING) | ||
debouncedEmailValidation(e.target.value) | ||
}} | ||
isInvalid={Boolean(fundingFormError.email)} | ||
onFocus={() => setErrorstate({ key: 'email', value: '' })} | ||
/> | ||
<InputRightElement>{renderEmailInputRightElement()}</InputRightElement> | ||
</InputGroup> | ||
{fundingFormError.email && <FormErrorMessage>{fundingFormError.email}</FormErrorMessage>} | ||
</FormControl> | ||
</FieldContainer> | ||
{needsShipping && ( | ||
<Feedback | ||
variant={FeedBackVariant.WARNING} | ||
text={t( | ||
'To receive the selected rewards, please send your shipping details to the creator’s email, which will be revealed in the success screen.', | ||
)} | ||
<CardLayout mobileDense width="100%" position="relative"> | ||
<H1 size="2xl" bold> | ||
{t('Email and Updates')} | ||
</H1> | ||
|
||
<FieldContainer title={`${t('Your email')} ${hasSelectedRewards ? '*' : ''}`} subtitle={descriptionCopy}> | ||
<FormControl isInvalid={Boolean(fundingFormError.email)}> | ||
<InputGroup> | ||
<Input | ||
disabled={Boolean(user?.email)} | ||
required={hasSelectedRewards} | ||
type="email" | ||
name="email" | ||
placeholder="[email protected]" | ||
value={email} | ||
inputMode="email" | ||
onChange={(e) => { | ||
setTarget({ target: { name: 'email', value: e.target.value } }) | ||
setEmailValidationState(EMAIL_VALIDATION_STATE.LOADING) | ||
debouncedEmailValidation(e.target.value) | ||
}} | ||
isInvalid={Boolean(fundingFormError.email)} | ||
onFocus={() => setErrorstate({ key: 'email', value: '' })} | ||
/> | ||
<InputRightElement>{renderEmailInputRightElement()}</InputRightElement> | ||
</InputGroup> | ||
{fundingFormError.email && <FormErrorMessage>{fundingFormError.email}</FormErrorMessage>} | ||
</FormControl> | ||
</FieldContainer> | ||
{needsShipping && ( | ||
<Feedback | ||
variant={FeedBackVariant.WARNING} | ||
text={t( | ||
'To receive the selected rewards, please send your shipping details to the creator’s email, which will be revealed in the success screen.', | ||
)} | ||
{!followsProject && ( | ||
<HorizontalFormField | ||
label="Follow Project: receive this project’s updates directly by email." | ||
htmlFor="creator-email-toggle" | ||
> | ||
<Switch | ||
id="creator-email-toggle" | ||
isChecked={followProject} | ||
onChange={(e) => { | ||
setTarget({ target: { name: 'followProject', value: e.target.checked } }) | ||
}} | ||
/> | ||
</HorizontalFormField> | ||
)} | ||
{!subscribedToGeyserEmails && ( | ||
<HorizontalFormField | ||
label="Subscribe to Geyser newsletter to discover new projects." | ||
htmlFor="geyser-email-toggle" | ||
> | ||
<Switch | ||
id="geyser-email-toggle" | ||
isChecked={subscribeToGeyserEmails} | ||
onChange={(e) => setTarget({ target: { name: 'subscribeToGeyserEmails', value: e.target.checked } })} | ||
/> | ||
</HorizontalFormField> | ||
)} | ||
</CardLayout> | ||
/> | ||
)} | ||
{!followsProject && ( | ||
<HorizontalFormField | ||
label="Follow Project: receive this project’s updates directly by email." | ||
htmlFor="creator-email-toggle" | ||
> | ||
<Switch | ||
id="creator-email-toggle" | ||
isChecked={followProject} | ||
onChange={(e) => { | ||
setTarget({ target: { name: 'followProject', value: e.target.checked } }) | ||
}} | ||
/> | ||
</HorizontalFormField> | ||
)} | ||
{!subscribedToGeyserEmails && ( | ||
<HorizontalFormField | ||
label="Subscribe to Geyser newsletter to discover new projects." | ||
htmlFor="geyser-email-toggle" | ||
> | ||
<Switch | ||
id="geyser-email-toggle" | ||
isChecked={subscribeToGeyserEmails} | ||
onChange={(e) => setTarget({ target: { name: 'subscribeToGeyserEmails', value: e.target.checked } })} | ||
/> | ||
</HorizontalFormField> | ||
)} | ||
</> | ||
</CardLayout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters