From f3396276e7fb876cb56cae4e1638221526f76baf Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Thu, 23 Jan 2025 15:21:58 -0800 Subject: [PATCH] Disallow challenges with no profile --- src/components/ProgressModal.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/ProgressModal.tsx b/src/components/ProgressModal.tsx index 44f2970556..2a8bdb8172 100644 --- a/src/components/ProgressModal.tsx +++ b/src/components/ProgressModal.tsx @@ -5,6 +5,7 @@ import { Button } from '@site/src/ui/design-system/src/lib/Components/Button'; import { useProgress } from '../hooks/use-progress'; import { submitNoopChallenge } from '../utils/gold-star'; import ChallengeModal from './ChallengeModal'; +import { useProfile } from '../hooks/use-profile'; interface ProgressModalProps { isOpen: boolean; @@ -17,6 +18,7 @@ const ProgressModal: React.FC = ({ onClose, onOpenProfileModal, }) => { + const { profile, isLoading: isProfileLoading } = useProfile(); const { profileItems, challengeItems } = useProgress(); const [challengeModalOpen, setChallengeModalOpen] = useState(false); @@ -34,8 +36,8 @@ const ProgressModal: React.FC = ({

- Complete the steps below to unlock rewards and challenges. Keep track of your progress and stay on track - with your goals! + Complete the steps below to unlock rewards and challenges. Keep + track of your progress and stay on track with your goals!

{/* Profile Section */} @@ -62,8 +64,11 @@ const ProgressModal: React.FC = ({ variant="primary" className="w-full max-w-md" onClick={openChallengeModal} + disabled={!profile} > - View First Challenge to Complete + {profile || isProfileLoading + ? 'View First Challenge to Complete' + : 'Create Profile to View Challenge'}