Skip to content

Commit

Permalink
Merge branch 'staging' into sajal/gys-9033-heroes-frontend-implementa…
Browse files Browse the repository at this point in the history
…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
sajald77 committed Nov 20, 2024
2 parents 1dbf154 + 2a30ac2 commit 02d5fe1
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 98 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ FROM dependencies AS build
WORKDIR /usr/app
COPY ./public ./public
COPY ./src ./src
copy ./language ./language
COPY index.html tsconfig.json tsconfig.node.json vite.config.ts eslint.config.mjs .prettierrc ./

ARG VITE_APP_API_ENDPOINT
Expand Down
11 changes: 6 additions & 5 deletions language/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1272,9 +1272,9 @@
"Your project is live and can receive contributions. Share your project to get more visibility.": "Your project is live and can receive contributions. Share your project to get more visibility.",
"Your project is in review and therefore cannot receive contributions, and is not visible by the public.": "Your project is in review and therefore cannot receive contributions, and is not visible by the public.",
"You project has been flagged for violating our Terms & Conditions. You should have received an email with further detail on how to proceed. Your project is currently not visible to the public.": "You project has been flagged for violating our Terms & Conditions. You should have received an email with further detail on how to proceed. Your project is currently not visible to the public.",
"Post saved successfully!": "Post saved successfully!",
"failed to upload image": "failed to upload image",
"Contribute without login": "Contribute without login",
"To a goal": "To a goal",
"Email and Updates": "Email and Updates",
"Rewards total": "Rewards total",
"Follow Project and receive direct project updates to your email": "Follow Project and receive direct project updates to your email",
"See all badges": "See all badges",
"No projects": "No projects",
Expand Down Expand Up @@ -1315,7 +1315,6 @@
"Receive One Time Password": "Receive One Time Password",
"We sent you an OTP code to": "We sent you an OTP code to",
"Paste (or type) it below to continue.": "Paste (or type) it below to continue.",
"Resend code": "Resend code",
"No contributions have been made to this project.": "No contributions have been made to this project.",
"Banner": "Banner",
"Spread the word": "Spread the word",
Expand Down Expand Up @@ -1353,5 +1352,7 @@
"Contributor Ranking": "Contributor Ranking",
"Ambassador Ranking": "Ambassador Ranking",
"Current month": "Current month",
"Current week": "Current week"
"Current week": "Current week",
"Resend code": "Resend code",
"Geyser Manifesto": "Geyser Manifesto"
}
87 changes: 78 additions & 9 deletions src/config/i18next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,85 @@ import { initReactI18next } from 'react-i18next'

import { __development__, VITE_APP_LNG_PORT } from '@/shared/constants'

import {
ArabicTranslations,
ChineseTranslations,
CzechTranslations,
EnglishTranslations,
FrenchTranslations,
GermanTranslations,
GreekTranslations,
ItalianTranslations,
JapaneseTranslations,
PolishTranslations,
PortugueseTranslation,
SpanishTranslations,
SwahiliTranslations,
TurkishTranslations,
} from '../../language/translations'
import { lng } from '../shared/constants'

const languagePostUrl = `http://localhost:${VITE_APP_LNG_PORT}/language/{{lng}}`

const initOptions = __development__
? {
fallbackLng: 'en',
debug: true,
saveMissing: true,
backend: {
loadPath: '/language/translations/{{lng}}.json',
addPath: languagePostUrl,
},
}
: {
fallbackLng: 'en',
resources: {
[lng.en]: {
translation: EnglishTranslations,
},

[lng.fr]: {
translation: FrenchTranslations,
},
[lng.de]: {
translation: GermanTranslations,
},
[lng.it]: {
translation: ItalianTranslations,
},
[lng.el]: {
translation: GreekTranslations,
},
[lng.pl]: {
translation: PolishTranslations,
},
[lng.cz]: {
translation: CzechTranslations,
},
[lng.zh]: {
translation: ChineseTranslations,
},
[lng.es]: {
translation: SpanishTranslations,
},
[lng.pt]: {
translation: PortugueseTranslation,
},
[lng.ar]: {
translation: ArabicTranslations,
},
[lng.sw]: {
translation: SwahiliTranslations,
},
[lng.tr]: {
translation: TurkishTranslations,
},
[lng.ja]: {
translation: JapaneseTranslations,
},
},
}

i18next
// detect user language
// learn more: https://github.com/i18next/i18next-browser-languageDetector
Expand All @@ -16,14 +93,6 @@ i18next
.use(initReactI18next)
// init i18next
// for all options read: https://www.i18next.com/overview/configuration-options
.init({
debug: Boolean(__development__),
fallbackLng: 'en',
saveMissing: Boolean(__development__),
backend: {
loadPath: '/language/translations/{{lng}}.json',
addPath: languagePostUrl,
},
})
.init(initOptions)

export default i18next
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { FeaturedGrantCard } from '../components/FeaturedGrantCard'
import { FeaturedCardSkeleton, FeaturedProjectCard } from '../components/FeaturedProjectCard'
import { ProjectRowLayout } from '../components/ProjectRowLayout'

const GEYSER_PROJECT_NAME = 'geyser'
const GEYSER_GET_FEATURED_REWARD_ID = '4957'
const GEYSER_PROMOTIONS_PROJECT_NAME = 'geyserpromotions'
const GEYSER_GET_FEATURED_REWARD_ID = '5332'

export type FeatureAirtableData = {
Name: string
Expand Down Expand Up @@ -68,7 +68,7 @@ export const Featured = () => {
return (
<Button
as={RouterLink}
to={getPath('projectRewardView', GEYSER_PROJECT_NAME, GEYSER_GET_FEATURED_REWARD_ID)}
to={getPath('projectRewardView', GEYSER_PROMOTIONS_PROJECT_NAME, GEYSER_GET_FEATURED_REWARD_ID)}
variant="surface"
colorScheme="primary1"
rightIcon={<PiStarFour />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
getPath,
GeyserAboutUrl,
GeyserGithubUrl,
GeyserManifestoUrl,
GeyserSubscribeUrl,
GeyserUpdatesUrl,
GuideUrl,
} from '@/shared/constants'
import { HeroStats, useUserHeroStatsQuery } from '@/types'
Expand Down Expand Up @@ -132,8 +132,8 @@ export const ProfileNavContent = () => {

<Divider borderColor="neutral1.6" />

<MenuItem as={ChakraLink} isExternal href={GeyserUpdatesUrl} _focusVisible={{}} gap={2}>
<Body size="md">{t('Geyser updates')}</Body>
<MenuItem as={ChakraLink} isExternal href={GeyserManifestoUrl} _focusVisible={{}} gap={2}>
<Body size="md">{t('Geyser Manifesto')}</Body>
<PiArrowUpRight fontSize="18px" />
</MenuItem>
<MenuItem as={ChakraLink} isExternal href={GeyserSubscribeUrl} _focusVisible={{}} gap={2}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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>
)
}
1 change: 1 addition & 0 deletions src/pages/grants/hooks/useGrant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const GRANT_CUSTOM_URL_TO_ID_MAP = {
bitcoin2024: 10,
thailandbitcoinconference: 11,
bonlyconference: 12,
satshack2024: 13,
} as {
[key: string]: number
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants/platform/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const FAQUrl = 'https://geyser.notion.site/Geyser-FAQs-310e7900fa904732b9
export const GuideUrl = 'https://guide.geyser.fund/'
export const FeedbackUrl = 'https://geyser.steelsync.io/feedback'
export const GeyserAboutUrl = 'https://about.geyser.fund'
export const GeyserUpdatesUrl = 'https://about.geyser.fund/updates'
export const GeyserManifestoUrl = 'https://about.geyser.fund/manifesto'
export const GeyserSubscribeUrl = 'https://about.geyser.fund/subscribe'

// Geyser footer Links
Expand Down

0 comments on commit 02d5fe1

Please sign in to comment.