1- import React , { useState , useEffect } from 'react' ;
2- import { Link } from 'react-router-dom' ;
3- import { ArrowLeftIcon , CirclesFourIcon } from '@phosphor-icons/react' ;
1+ import React , { useState , useEffect } from 'react' ;
2+ import { Link } from 'react-router-dom' ;
3+ import { ArrowLeftIcon , CirclesFourIcon } from '@phosphor-icons/react' ;
44import colors from '../../config/colors' ;
55import useSeo from '../../hooks/useSeo' ;
66import BreadcrumbTitle from '../../components/BreadcrumbTitle' ;
7+ import { useAchievements } from '../../context/AchievementContext' ;
78
89const BUBBLE_COUNT = 100 ; // Number of bubbles
910
@@ -21,6 +22,7 @@ const BubbleWrapPage = () => {
2122 twitterImage : 'https://fezcode.github.io/logo512.png' ,
2223 } ) ;
2324
25+ const { unlockAchievement} = useAchievements ( ) ;
2426 const [ bubbles , setBubbles ] = useState ( Array ( BUBBLE_COUNT ) . fill ( false ) ) ;
2527 const [ popCount , setPopCount ] = useState ( 0 ) ;
2628
@@ -31,6 +33,12 @@ const BubbleWrapPage = () => {
3133 setAudioContext ( new ( window . AudioContext || window . webkitAudioContext ) ( ) ) ;
3234 } , [ ] ) ;
3335
36+ useEffect ( ( ) => {
37+ if ( popCount === BUBBLE_COUNT ) {
38+ unlockAchievement ( 'entropy_increaser' ) ;
39+ }
40+ } , [ popCount , unlockAchievement ] ) ;
41+
3442 const playPopSound = ( ) => {
3543 if ( ! audioContext ) return ;
3644
@@ -79,11 +87,11 @@ const BubbleWrapPage = () => {
7987 to = "/apps"
8088 className = "group text-primary-400 hover:underline flex items-center justify-center gap-2 text-lg mb-4"
8189 >
82- < ArrowLeftIcon className = "text-xl transition-transform group-hover:-translate-x-1" /> { ' ' }
90+ < ArrowLeftIcon className = "text-xl transition-transform group-hover:-translate-x-1" />
8391 Back to Apps
8492 </ Link >
85- < BreadcrumbTitle title = "Bubble Wrap" slug = "pop" />
86- < hr className = "border-gray-700" />
93+ < BreadcrumbTitle title = "Bubble Wrap" slug = "pop" />
94+ < hr className = "border-gray-700" />
8795 < div className = "flex justify-center items-center mt-16" >
8896 < div
8997 className = "group bg-transparent border rounded-lg shadow-2xl p-6 flex flex-col justify-between relative transform overflow-hidden h-full w-full max-w-3xl"
@@ -99,9 +107,9 @@ const BubbleWrapPage = () => {
99107 > </ div >
100108 < div className = "relative z-10 p-1 text-center" >
101109 < h1 className = "text-3xl font-arvo font-normal mb-4 text-app flex items-center justify-center gap-2" >
102- < CirclesFourIcon size = { 32 } /> Bubble Wrap
110+ < CirclesFourIcon size = { 32 } /> Bubble Wrap
103111 </ h1 >
104- < hr className = "border-gray-700 mb-6" />
112+ < hr className = "border-gray-700 mb-6" />
105113
106114 < div className = "flex justify-between items-center mb-6 px-4" >
107115 < div className = "text-xl font-bold" > Popped: { popCount } </ div >
@@ -124,10 +132,10 @@ const BubbleWrapPage = () => {
124132 onClick = { ( ) => popBubble ( index ) }
125133 className = { `w-12 h-12 rounded-full border-2 transition-all duration-100 relative overflow-hidden focus:outline-none
126134 ${
127- isPopped
128- ? 'bg-transparent scale-95 opacity-50 border-gray-600'
129- : 'bg-white/10 hover:bg-white/20 scale-100 cursor-pointer'
130- } `}
135+ isPopped
136+ ? 'bg-transparent scale-95 opacity-50 border-gray-600'
137+ : 'bg-white/10 hover:bg-white/20 scale-100 cursor-pointer'
138+ } `}
131139 style = { {
132140 borderColor : isPopped ? 'gray' : cardStyle . color ,
133141 boxShadow : isPopped
0 commit comments