11'use client' ;
22import { useEffect , useState } from 'react' ;
33
4- export default function SocialProof ( {
4+ // Define interfaces for the props
5+ interface RecentUpdate {
6+ title : string ;
7+ description : string ;
8+ date : string ;
9+ icon : string ;
10+ }
11+
12+ interface SocialProofProps {
13+ subscriberCount ?: number ;
14+ recentUpdates ?: RecentUpdate [ ] ;
15+ showLiveActivity ?: boolean ;
16+ }
17+
18+ export default function SocialProof ( {
519 subscriberCount = 1247 ,
620 recentUpdates = [ ] ,
7- showLiveActivity = true
8- } ) {
9- const [ liveCount , setLiveCount ] = useState ( subscriberCount ) ;
10- const [ recentActivity , setRecentActivity ] = useState ( [ ] ) ;
21+ showLiveActivity = true
22+ } : SocialProofProps ) {
23+ const [ liveCount , setLiveCount ] = useState < number > ( subscriberCount ) ;
24+ const [ recentActivity , setRecentActivity ] = useState < string [ ] > ( [ ] ) ; // Explicitly type as string array
1125
1226 useEffect ( ( ) => {
1327 if ( showLiveActivity ) {
@@ -26,14 +40,14 @@ export default function SocialProof({
2640 }
2741 } , [ showLiveActivity ] ) ;
2842
29- const formatCount = ( count ) => {
43+ const formatCount = ( count : number ) : string => {
3044 if ( count >= 1000 ) {
3145 return `${ ( count / 1000 ) . toFixed ( 1 ) } k` ;
3246 }
33- return count . toString ( ) ;
47+ return count . toString ( ) ;
3448 } ;
3549
36- return (
50+ return (
3751 < div className = "mt-12 space-y-8" >
3852 { /* Subscriber count */ }
3953 < div className = "text-center" >
@@ -44,6 +58,7 @@ export default function SocialProof({
4458 </ span >
4559 </ div >
4660 </ div >
61+
4762 { /* Recent activity */ }
4863 { recentActivity . length > 0 && (
4964 < div className = "max-w-md mx-auto" >
@@ -60,6 +75,7 @@ export default function SocialProof({
6075 </ div >
6176 </ div >
6277 ) }
78+
6379 { /* Development updates */ }
6480 { recentUpdates . length > 0 && (
6581 < div className = "max-w-2xl mx-auto" >
@@ -82,4 +98,4 @@ export default function SocialProof({
8298 ) }
8399 </ div >
84100 ) ;
85- }
101+ }
0 commit comments