File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ import { Challenge } from './components/Challenges/ChallengeCard';
1212import { ThemeProvider } from './themeContent' ; // Import the new ThemeProvider
1313import ScrollToTop from './components/ScrollToTop/ScrollToTop' ;
1414
15-
1615function App ( ) {
16+
1717 const [ currentPage , setCurrentPage ] = useState < string > ( 'home' ) ;
1818 const [ selectedChallenge , setSelectedChallenge ] = useState < Challenge | null > ( null ) ;
1919
@@ -48,7 +48,7 @@ function App() {
4848 case 'submit' :
4949 return < SubmitChallenge /> ;
5050 case 'community' :
51- return < Community /> ;
51+ return < Community onNavigate = { handleNavigate } /> ; { /* ✅ updated */ }
5252 default :
5353 return (
5454 < >
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ interface Submission {
1414 isLiked ?: boolean ;
1515}
1616
17+ interface CommunityProps {
18+ onNavigate : ( page : string ) => void ;
19+ }
20+
1721const mockSubmissions : Submission [ ] = [
1822 {
1923 id : '1' ,
@@ -61,7 +65,7 @@ const mockSubmissions: Submission[] = [
6165 }
6266] ;
6367
64- export const Community : React . FC = ( ) => {
68+ export const Community : React . FC < CommunityProps > = ( { onNavigate } ) => {
6569 const [ selectedDomain , setSelectedDomain ] = useState ( 'All' ) ;
6670 const [ searchTerm , setSearchTerm ] = useState ( '' ) ;
6771 const [ likedSubmissions , setLikedSubmissions ] = useState < Set < string > > ( new Set ( ) ) ;
@@ -223,7 +227,10 @@ export const Community: React.FC = () => {
223227 < p className = "text-purple-700 dark:text-purple-300 mb-6" >
224228 Complete challenges and get valuable feedback from our supportive community
225229 </ p >
226- < button className = "px-6 py-3 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-all hover:transform hover:scale-105" >
230+ < button
231+ onClick = { ( ) => onNavigate ( 'challenges' ) }
232+ className = "px-6 py-3 bg-purple-600 hover:bg-purple-700 text-white rounded-lg font-medium transition-all hover:transform hover:scale-105"
233+ >
227234 Browse Challenges
228235 </ button >
229236 </ div >
You can’t perform that action at this time.
0 commit comments