Skip to content

Commit

Permalink
release: 2023-10-12 (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 12, 2023
2 parents e92e5a2 + 4732b3d commit b88afa1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 137 deletions.
9 changes: 7 additions & 2 deletions apps/app/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import { useRouter } from 'next/router'
import { type TFunction, Trans, useTranslation } from 'next-i18next'
import { useEffect, useRef, useState } from 'react'

import { donateEvent } from '@weareinreach/analytics/events'
import { ms } from '@weareinreach/api/lib/milliseconds'
import { trpcServerClient } from '@weareinreach/api/trpc'
import { AntiHatePopup } from '@weareinreach/ui/components/core/AntiHateMessage'
import { Link } from '@weareinreach/ui/components/core/Link'
import { UserReview } from '@weareinreach/ui/components/core/UserReview'
import { CallOut } from '@weareinreach/ui/components/sections/CallOut'
import { Hero } from '@weareinreach/ui/components/sections/Hero'
import { useCustomVariant } from '@weareinreach/ui/hooks'
import { useCustomVariant } from '@weareinreach/ui/hooks/useCustomVariant'
import { AccountVerifyModal } from '@weareinreach/ui/modals/AccountVerified'
import { PrivacyStatementModal } from '@weareinreach/ui/modals/PrivacyStatement'
import { ResetPasswordModal } from '@weareinreach/ui/modals/ResetPassword'
Expand Down Expand Up @@ -134,7 +135,11 @@ const CardTranslation = ({ i18nKey, t }: { i18nKey: string; t: TFunction }) => {
),
Text: <Text component='p'>.</Text>,
LinkFree: (
<Link href='https://inreach.kindful.com/?utm_source=inreach-app' {...linkProps}>
<Link
href='https://inreach.kindful.com/?campaign=1274815'
onClick={donateEvent.click}
{...linkProps}
>
.
</Link>
),
Expand Down
19 changes: 11 additions & 8 deletions apps/app/src/pages/support/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { type GetStaticProps } from 'next'
import dynamic from 'next/dynamic'
import { useTranslation } from 'next-i18next'

import { donateEvent } from '@weareinreach/analytics/events'
import { AntiHateMessage } from '@weareinreach/ui/components/core/AntiHateMessage'
import { Link } from '@weareinreach/ui/components/core/Link'
import { useCustomVariant } from '@weareinreach/ui/hooks'
import { useCustomVariant } from '@weareinreach/ui/hooks/useCustomVariant'
import { Icon } from '@weareinreach/ui/icon'
// import { GenericContentModal, PrivacyStatementModal } from '@weareinreach/ui/modals'
import { getServerSideTranslations } from '~app/utils/i18n'

// @ts-expect-error Next Dynamic doesn't like polymorphic components
Expand All @@ -19,10 +19,6 @@ const PrivacyStatementModal = dynamic(() =>
import('@weareinreach/ui/modals/PrivacyStatement').then((mod) => mod.PrivacyStatementModal)
)

const DonateModal = dynamic(() =>
import('@weareinreach/ui/components/core/Donate').then((mod) => mod.DonateModal)
)

const SupportItem = ({ tKey }: SupportItemProps) => {
const { t } = useTranslation('common')
const variants = useCustomVariant()
Expand All @@ -43,10 +39,17 @@ const SupportPage = () => {

const variants = useCustomVariant()
const linkVar = { variant: variants.Link.inlineInvertedUtil1 }

const support = [
<DonateModal key={7}>
<Link
key={7}
external
href='https://inreach.kindful.com/embeds/4d78c071-9369-4a0c-84c7-8e783b21a940'
onClick={donateEvent.click}
{...linkVar}
>
<SupportItem tKey='donate.to-inreach' />
</DonateModal>,
</Link>,
<Link key={0} href='/suggest' target='_self' {...linkVar}>
<SupportItem tKey='footer.suggest-org' />
</Link>,
Expand Down
160 changes: 33 additions & 127 deletions packages/ui/components/core/Donate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { useDisclosure, useTimeout } from '@mantine/hooks'
import { useRouter } from 'next/router'
import Script from 'next/script'
import { useTranslation } from 'next-i18next'
import { type ReactElement, useEffect, useState } from 'react'
import { useEffect, useState } from 'react'

import { donateEvent } from '@weareinreach/analytics/events'
import { Button } from '~ui/components/core/Button'
import { Link } from '~ui/components/core/Link'
import { useCustomVariant } from '~ui/hooks/useCustomVariant'
import { useScreenSize } from '~ui/hooks/useScreenSize'
import { bounce } from '~ui/theme/animation'
Expand All @@ -33,10 +32,7 @@ const useStyles = createStyles((theme) => ({
},
}))

interface DonateModalProps {
children?: ReactElement
}
export const DonateModal = ({ children }: DonateModalProps) => {
export const DonateModal = () => {
const [opened, handler] = useDisclosure(false)
const [modalOpened, modalHandler] = useDisclosure(false)
const { t } = useTranslation()
Expand Down Expand Up @@ -68,21 +64,8 @@ export const DonateModal = ({ children }: DonateModalProps) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

const InjectedChildren = () => {
if (!children) return null

return (
<Link onClick={buttonHandler} variant={variant.Link.inlineInvertedUtil1}>
{children}
</Link>
)
}

const showPopover = !children && (opened || !showEmoji)
const hasChildren = !!children
const isSupportPage = router.pathname === '/support'

if (isSupportPage && !hasChildren) return null
const showPopover = !isSupportPage && (opened || !showEmoji)

return (
<>
Expand All @@ -100,34 +83,30 @@ export const DonateModal = ({ children }: DonateModalProps) => {
// width={isMobile ? width - 40 : undefined}
styles={{ dropdown: { maxWidth: '90vw', textAlign: 'center' } }}
shadow='xl'
zIndex={100}
zIndex={200}
>
<Popover.Target>
{hasChildren ? (
<InjectedChildren />
) : (
<Affix position={buttonPosition}>
<Button
className={cx(
'kindful-donate-btn',
{ [classes.bounce]: !showEmoji },
{
[classes.shrink]: showEmoji,
}
)}
variant={variant.Button.primarySm}
bg={theme.other.colors.primary.allyGreen}
styles={{
inner: { color: theme.other.colors.secondary.black },
}}
onMouseEnter={handler.open}
onMouseLeave={handler.close}
onClick={buttonHandler}
>
{showEmoji ? donateEmoji : t('words.donate')}
</Button>
</Affix>
)}
<Affix position={buttonPosition} style={{ display: isSupportPage ? 'none' : undefined }}>
<Button
className={cx(
// 'kindful-donate-btn',
{ [classes.bounce]: !showEmoji },
{
[classes.shrink]: showEmoji,
}
)}
variant={variant.Button.primarySm}
bg={theme.other.colors.primary.allyGreen}
styles={{
inner: { color: theme.other.colors.secondary.black },
}}
onMouseEnter={handler.open}
onMouseLeave={handler.close}
onClick={buttonHandler}
>
{showEmoji ? donateEmoji : t('words.donate')}
</Button>
</Affix>
</Popover.Target>
<Popover.Dropdown>
<Text variant={variant.Text.utility1}>{t(showEmoji ? 'donate.hover' : 'donate.popup')}</Text>
Expand All @@ -136,7 +115,6 @@ export const DonateModal = ({ children }: DonateModalProps) => {
<Modal.Root
opened={modalOpened}
onClose={modalHandler.close}
// withCloseButton
styles={{ content: { minWidth: 'unset !important' } }}
keepMounted
fullScreen={isMobile}
Expand All @@ -153,88 +131,16 @@ export const DonateModal = ({ children }: DonateModalProps) => {
id='kindful-donate-form-9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
className={cx('kindful-embed-wrapper', classes.modalBody)}
style={{ paddingLeft: '0 !important', paddingRight: '0 !important' }}
>
<Script
src='https://inreach.kindful.com/embeds/9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b/init.js?type=form'
data-embed-id='9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
data-lookup-type='jquery-selector'
data-lookup-value='#kindful-donate-form-9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
data-styles-off='true'
/>
</Modal.Body>
></Modal.Body>
</Modal.Content>
</Modal.Root>
<Script
src='https://inreach.kindful.com/embeds/9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b/init.js?type=form'
data-embed-id='9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
data-lookup-type='jquery-selector'
data-lookup-value='#kindful-donate-form-9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
data-styles-off='true'
/>
</>
)
}

// export const Donate = () => {
// const [opened, handler] = useDisclosure(false)
// const { t } = useTranslation()
// const variant = useCustomVariant()
// const theme = useMantineTheme()
// const { classes, cx } = useStyles()
// const { isMobile } = useScreenSize()
// const donateEmoji = '💝'
// const [showEmoji, setShowEmoji] = useState(false)
// const { start } = useTimeout(() => {
// setShowEmoji(true)
// }, 10_000)
// const buttonPosition = isMobile ? { bottom: rem(100), right: rem(12) } : { bottom: rem(40), right: rem(40) }

// const buttonHandler = () => {
// if (isMobile) {
// if (!showEmoji || opened) {
// handler.close()
// }
// }
// }
// useEffect(() => {
// start()
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [])
// return (
// <Popover
// opened={!showEmoji || opened}
// withArrow
// position='top-end'
// closeOnClickOutside={false}
// closeOnEscape={false}
// keepMounted
// arrowPosition='center'
// arrowSize={12}
// middlewares={{ inline: true, shift: true, flip: false }}
// >
// <Popover.Target>
// <Affix position={buttonPosition}>
// <Button
// className={cx('kindful-donate-btn', classes.bounce, {
// [classes.shrink]: showEmoji,
// })}
// id='kindful-donate-btn-9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
// variant={variant.Button.primarySm}
// bg={theme.other.colors.primary.allyGreen}
// styles={{
// inner: { color: theme.other.colors.secondary.black },
// }}
// onMouseEnter={handler.open}
// onMouseLeave={handler.close}
// onClick={buttonHandler}
// >
// {showEmoji ? donateEmoji : t('words.donate')}
// </Button>
// <Script
// src='https://inreach.kindful.com/embeds/9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b/init.js?type=button'
// data-embed-id='9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
// data-lookup-type='jquery-selector'
// data-lookup-value='#kindful-donate-btn-9e692b4a-fcfc-46a2-9a0e-4f9b8b0bd37b'
// data-styles-off='true'
// />
// </Affix>
// </Popover.Target>
// <Popover.Dropdown>
// <Text variant={variant.Text.utility1}>{t(showEmoji ? 'donate.hover' : 'donate.popup')}</Text>
// </Popover.Dropdown>
// </Popover>
// )
// }

1 comment on commit b88afa1

@vercel
Copy link

@vercel vercel bot commented on b88afa1 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.