Skip to content

Commit

Permalink
Merge branch 'staging' into refact/code-splitting
Browse files Browse the repository at this point in the history
* staging:
  fix: add match value for youtu.be formatted links
  refactor: GEY-2067 add cancel invoice mutation when qr section unmounts (#853)
  fix: add bold to contribution disclaimer
  fix: word-wrap in community voting widget
  fix: revert deepscan change (#840) (#841)
  fix: update featured project to miprimerbitcoinbiggestgraduationinmay
  feat: update featured project to orangepilljam
  fix: remove featured grant
  fix: display featured project
  fix: use default value as fundingTx paidAt if date is not provided
  fix: pass in date time value
  fix: funding flow success for on-chain funding
  fix: support for no good lightning email address
  fix: handle conflict
  fix: update hot-jar id
  fix: increase spacing
  feat: add hotjar to production
  feat: test out hotjar for staging
  fix: entry view
  fix: profile page
  • Loading branch information
sajald77 committed May 11, 2023
2 parents 21e82d4 + 77757a4 commit 1744ef5
Show file tree
Hide file tree
Showing 22 changed files with 203 additions and 60 deletions.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
<script defer data-domain="geyser.fund" src="https://plausible.io/js/plausible.js"></script>
<noscript><img src="https://sa.geyser.fund/noscript.gif" alt=""
referrerpolicy="no-referrer-when-downgrade" /></noscript>
<!-- Hotjar Tracking Code for https://geyser.fund -->
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:3363357,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import {
import {
FundingTxForLandingPageFragment,
FundingTxForUserContributionFragment,
FundingTxFragment,
} from '../../../types/generated/graphql'

type ExternalAccountLinkIconProps = {
fundingTx:
| FundingTxForLandingPageFragment
| FundingTxForUserContributionFragment
| FundingTxFragment
}

const sourceUrlMap: any = {
Expand All @@ -35,9 +37,13 @@ export const ExternalAccountLinkIcon = ({
const { source, funder } = fundingTx

const getExternalAccount = (type: string) => {
return funder.user?.externalAccounts.find(
(account) => account?.accountType === type,
)?.externalUsername
return (
funder.user &&
'externalAccounts' in funder.user &&
funder.user.externalAccounts.find(
(account) => account?.accountType === type,
)?.externalUsername
)
}

const linkDestination: string = useMemo(() => {
Expand Down
7 changes: 0 additions & 7 deletions src/constants/platform/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ export const projectTypes = {

export type FundingTxStatus = 'unpaid' | 'paid' | 'canceled' | 'pending'

export type ShippingDestination = 'national' | 'international'

export const shippingTypes = {
national: 'national' as ShippingDestination,
international: 'international' as ShippingDestination,
}

export const SelectCountryOptions: ISelectOption[] = [
{
label: 'Deliver inside the USA',
Expand Down
3 changes: 3 additions & 0 deletions src/graphql/fragments/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export const FRAGMENT_FUNDING_TX = gql`
projectId
funder {
id
amountFunded
timesFunded
confirmedAt
user {
id
username
Expand Down
11 changes: 10 additions & 1 deletion src/graphql/mutations/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ export const MUTATION_FUND = gql`
}
`

export const REFRESH_FUNDING_INVOICE = gql`
export const MUTATION_FUNDING_INVOICE_REFRESH = gql`
${FRAGMENT_FUNDING_TX_WITH_INVOICE_STATUS}
mutation RefreshFundingInvoice($fundingTxID: BigInt!) {
fundingInvoiceRefresh(fundingTxId: $fundingTxID) {
...FundingTxWithInvoiceStatus
}
}
`

export const MUTATION_FUNDING_INVOICE_CANCEL = gql`
mutation FundingInvoiceCancel($invoiceId: String!) {
fundingInvoiceCancel(invoiceId: $invoiceId) {
id
success
}
}
`
8 changes: 6 additions & 2 deletions src/helpers/computeBadges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IBadge } from '../interfaces'
import {
Funder,
FundingTxForLandingPageFragment,
FundingTxFragment,
} from '../types/generated/graphql'

type IBadges<TKey extends string = string> = Record<TKey, IBadge>
Expand Down Expand Up @@ -44,9 +45,12 @@ const roleBadges: IBadges<RoleBadges> = {
}

interface Props {
creationDateStringOfFundedContent: string
funder: Funder | FundingTxForLandingPageFragment['funder']
useShortForm?: boolean
creationDateStringOfFundedContent: string
funder:
| Funder
| FundingTxForLandingPageFragment['funder']
| FundingTxFragment['funder']
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/helpers/getAvatarMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ import { BreezLogoUrl, FountainLogoUrl } from '../constants'
import {
Funder,
FundingTxForLandingPageFragment,
FundingTxFragment,
} from '../types/generated/graphql'
import { getRandomOrb } from '../utils'

export const getAvatarMetadata = ({
funder,
source,
}: {
funder: Funder | FundingTxForLandingPageFragment['funder']
funder:
| Funder
| FundingTxForLandingPageFragment['funder']
| FundingTxFragment['funder']
source?: string
}) => {
if (!funder.user) {
Expand Down
5 changes: 4 additions & 1 deletion src/helpers/getIconForLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export const getIconForLink = (value: Maybe<string>) => {
return BsInstagram
}

if (value?.toLowerCase().includes('youtube')) {
if (
value?.toLowerCase().includes('youtube') ||
value?.toLowerCase().includes('youtu.be')
) {
return BsYoutube
}

Expand Down
9 changes: 6 additions & 3 deletions src/hooks/useFundingFormState.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { useContext, useEffect, useState } from 'react'

import { ShippingDestination, shippingTypes } from '../constants'
import { AuthContext } from '../context'
import { useBTCConverter } from '../helpers'
import { IRewardCount } from '../interfaces'
import { ProjectReward, RewardCurrency } from '../types/generated/graphql'
import {
ProjectReward,
RewardCurrency,
ShippingDestination,
} from '../types/generated/graphql'
import { Satoshis } from '../types/types'

export interface IFundForm {
Expand Down Expand Up @@ -46,7 +49,7 @@ export const useFundingFormState = ({ rewards }: UseFundStateProps) => {
donationAmount: 0,
rewardsCost: 0,
comment: '',
shippingDestination: shippingTypes.national,
shippingDestination: ShippingDestination.National,
shippingCost: 0,
anonymous: !(user && user.id), // The default user has id 0
funderAvatarURL: user.imageUrl || '',
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/funding.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShippingDestination } from '../constants'
import { ShippingDestination } from '../types'
import { IFunder } from './participant'
import { IProject, IProjectListEntryItem } from './project'

Expand Down
4 changes: 3 additions & 1 deletion src/pages/grants/grantsPage/sections/CommunityVoting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export const CommunityVoting = ({
<H3 fontSize="18px">{project.title}</H3>
</Link>
<Link to={projectLink}>
<Text noOfLines={4}>{project.description}</Text>
<Text noOfLines={4} wordBreak="break-word">
{project.description}
</Text>
</Link>
</Box>
{!isMobile && (
Expand Down
17 changes: 13 additions & 4 deletions src/pages/landing/feed/components/ContributionActivityItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ import {
import { getPath } from '../../../../constants'
import { computeFunderBadges, getAvatarMetadata } from '../../../../helpers'
import { fonts } from '../../../../styles'
import { FundingTxForLandingPageFragment } from '../../../../types'
import {
FundingTxForLandingPageFragment,
FundingTxFragment,
} from '../../../../types'
import { getDaysAgo, getRandomOrb, toSmallImageUrl } from '../../../../utils'
import { commaFormatted } from '../../../../utils/formatData/helperFunctions'

type Props = HTMLChakraProps<'div'> & {
fundingTx: FundingTxForLandingPageFragment
fundingTx: FundingTxFragment | FundingTxForLandingPageFragment
dateTime?: string
showsProjectLink?: boolean
count?: number
Expand All @@ -52,11 +55,17 @@ export const ContributionActivityItem = ({

const funderBadges = computeFunderBadges({
creationDateStringOfFundedContent:
fundingTx.sourceResource?.createdAt || '',
'sourceResource' in fundingTx && fundingTx.sourceResource?.createdAt
? fundingTx.sourceResource.createdAt
: '',
funder,
})

const renderResource = () => {
if (!('sourceResource' in fundingTx)) {
return null
}

const resource = fundingTx.sourceResource
switch (resource?.__typename) {
case 'Project':
Expand Down Expand Up @@ -167,7 +176,7 @@ export const ContributionActivityItem = ({

<ExternalAccountLinkIcon fundingTx={fundingTx} />

{showsProjectLink && fundingTx.sourceResource && (
{showsProjectLink && 'sourceResource' in fundingTx && (
<HStack
overflow="hidden"
backgroundColor="neutral.100"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,16 @@ export const ProjectFundingQRScreenQRCodeSection = ({ fundingFlow }: Props) => {
<Box>
<FaBitcoin fontSize={'50px'} />
</Box>
<Text fontSize={'10px'} fontWeight={400}>
Fund with any on-chain or lightning wallet. If you are paying
on-chain, make sure to send the exact amount, otherwise it will not
be displayed. The transaction will be confirmed after 1
confirmation.
</Text>
<Box>
<Text fontSize={'10px'} fontWeight={700}>
Fund with any on-chain or lightning wallet.
</Text>
<Text fontSize={'10px'} fontWeight={400}>
If you are paying on-chain, make sure to send the exact amount,
otherwise it will not be displayed. The transaction will be
confirmed after 1 confirmation.
</Text>
</Box>
</HStack>
{renderQrBox()}
</VStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { HiOutlineCheck } from 'react-icons/hi'
import { Body2, H3 } from '../../../../components/typography'
import { useProjectContext } from '../../../../context'
import { colors, fonts } from '../../../../styles'
import { Badge, FundingTx } from '../../../../types/generated/graphql'
import { Badge, FundingTxFragment } from '../../../../types/generated/graphql'
import { useNotification } from '../../../../utils'
import { AvatarElement } from '../../projectMainBody/components'

Expand All @@ -24,7 +24,7 @@ export const SuccessImageComponent = ({
fundingTx,
}: {
currentBadge?: Badge
fundingTx: FundingTx
fundingTx: FundingTxFragment
}) => {
const { toast } = useNotification()
const [copied, setCopied] = useState(false)
Expand Down
13 changes: 6 additions & 7 deletions src/pages/projectView/projectActivityPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { AuthModal } from '../../../components/molecules'
import { fundingStages } from '../../../constants'
import { AuthContext, MobileViews, useProjectContext } from '../../../context'
import { useBtcContext } from '../../../context/btc'
import { IFundForm, IFundFormState } from '../../../hooks'
import { IFundingInput, IRewardFundingInput } from '../../../interfaces'
import { IFundForm, IFundFormState, UseFundingFlowReturn } from '../../../hooks'
import {
FundingInput,
FundingResourceType,
ProjectFragment,
ProjectReward,
RewardFundingInput,
} from '../../../types/generated/graphql'
import { toInt, useMobileMode } from '../../../utils'
import {
Expand All @@ -25,7 +26,7 @@ import { useStyles } from './styles'

type Props = {
project: ProjectFragment
fundingFlow: any
fundingFlow: UseFundingFlowReturn
resourceType: FundingResourceType
resourceId: number
fundForm: IFundFormState
Expand Down Expand Up @@ -58,7 +59,6 @@ export const ProjectActivityPanel = ({
const {
fundState,
setFundState,
amounts,
fundingRequestLoading,
fundingTx,
resetFundingFlow,
Expand Down Expand Up @@ -124,7 +124,7 @@ export const ProjectActivityPanel = ({
media,
} = state

const input: IFundingInput = {
const input: FundingInput = {
projectId: toInt(project.id),
anonymous,
...(donationAmount !== 0 && { donationInput: { donationAmount } }),
Expand Down Expand Up @@ -152,7 +152,7 @@ export const ProjectActivityPanel = ({
(reward): reward is FilteredReward =>
reward.quantity !== 0 && reward.quantity !== undefined,
)
const rewardInput: IRewardFundingInput = {
const rewardInput: RewardFundingInput = {
shipping: { cost, destination },
rewards: filteredRewards,
rewardsCost: Math.round(rewardsCost / btcRate),
Expand Down Expand Up @@ -215,7 +215,6 @@ export const ProjectActivityPanel = ({
state={formState}
project={project}
fundingFlow={fundingFlow}
amounts={amounts}
handleCloseButton={handleQRCloseButton}
/>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { useQueryWithPagination } from '../../../../hooks'
import {
Funder,
FundingTx,
FundingTxFragment,
ProjectFragment,
} from '../../../../types/generated/graphql'
import {
Expand All @@ -37,7 +37,7 @@ type Props = {
project: ProjectFragment
btcRate: number
test?: boolean
fundingTx: FundingTx
fundingTx: FundingTxFragment
}

const itemLimit = 50
Expand All @@ -57,7 +57,10 @@ export const ProjectFundingInitialInfoScreen = ({
FundingTxWithCount[]
>([])

const fundingTxs = useQueryWithPagination<FundingTx, FundingTxWithCount>({
const fundingTxs = useQueryWithPagination<
FundingTxFragment,
FundingTxWithCount
>({
itemLimit,
queryName: 'getFundingTxs',
query: QUERY_GET_FUNDING_TXS_LANDING,
Expand Down
Loading

0 comments on commit 1744ef5

Please sign in to comment.