diff --git a/packages/browseros-agent/apps/agent/components/referral/ShareForCredits.tsx b/packages/browseros-agent/apps/agent/components/referral/ShareForCredits.tsx index c5841c381..946d76659 100644 --- a/packages/browseros-agent/apps/agent/components/referral/ShareForCredits.tsx +++ b/packages/browseros-agent/apps/agent/components/referral/ShareForCredits.tsx @@ -1,3 +1,4 @@ +import { REFERRAL_LIMITS } from '@browseros/shared/constants/limits' import { ExternalLink, Loader2, Send } from 'lucide-react' import type { FC } from 'react' import { useState } from 'react' @@ -24,8 +25,11 @@ export const ShareForCredits: FC = ({ compact }) => { const { data } = useCredits() const invalidateCredits = useInvalidateCredits() + const credits = data?.credits ?? 0 + const atDailyMax = credits >= REFERRAL_LIMITS.MAX_DAILY_CREDITS + const handleSubmit = async () => { - if (!tweetUrl.trim() || !data?.browserosId) return + if (!tweetUrl.trim() || !data?.browserosId || atDailyMax) return setIsSubmitting(true) setResult(null) @@ -55,10 +59,22 @@ export const ShareForCredits: FC = ({ compact }) => { } } + if (atDailyMax) { + return ( +
+

+ You've reached the daily cap of {REFERRAL_LIMITS.MAX_DAILY_CREDITS}{' '} + credits. Come back tomorrow to earn more! +

+
+ ) + } + return (

- Share BrowserOS on Twitter to earn 200 bonus credits! + Share BrowserOS on Twitter to earn{' '} + {REFERRAL_LIMITS.CREDITS_PER_REFERRAL} bonus credits!

    @@ -67,6 +83,10 @@ export const ShareForCredits: FC = ({ compact }) => {
  • Tweet must be posted within the last 30 minutes
  • Each tweet can only be submitted once
  • +
  • + Daily cap of {REFERRAL_LIMITS.MAX_DAILY_CREDITS} credits — resets at + midnight UTC +