Skip to content

Commit

Permalink
Change superlike notice
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jun 12, 2024
1 parent ca65aec commit 67bf540
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/services/datahub/content-staking/subscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { gql } from 'graphql-request'
import { useEffect, useRef } from 'react'
import { toast } from 'sonner'
import { datahubSubscription, isDatahubAvailable } from '../utils'
import { getAddressLikeCountToPostQuery, getSuperLikeCountQuery } from './query'
import {
getAddressLikeCountToPostQuery,
getSuperLikeCountQuery,
getTodaySuperLikeCountQuery,
} from './query'

export function useDatahubContentStakingSubscriber() {
const queryClient = useQueryClient()
Expand Down Expand Up @@ -122,15 +126,25 @@ async function processSubscriptionEvent(
address: myAddress,
postId: post.persistentId,
})
const todayLike = getTodaySuperLikeCountQuery.getQueryData(
queryClient,
myAddress
)
const remaining = 10 - todayLike.count
let desc =
'✅ Great progress today! You used all the available likes. Come back tomorrow 😉'
if (remaining > 0) {
desc = `You earned 💎 2000 Points for liking the meme. ${remaining} more likes left for today`
}
toast.custom((t) => (
<Toast
t={t}
icon={(className) => (
<span className={cx(className, 'relative -top-px text-base')}>
🎉
💎
</span>
)}
title='You earned 2000 points!'
title={desc}
/>
))
}
Expand Down

0 comments on commit 67bf540

Please sign in to comment.