1- ' use client'
1+ " use client" ;
22
3- import { useState , useEffect } from ' react'
4- import Link from ' next/link'
5- import { Search , Plus , Filter } from ' lucide-react'
6- import { useRouter } from ' next/navigation'
7- import { useGuildStore } from ' @/store/guildStore'
8- import { GuildCard } from ' @/features/guilds/components/GuildCard'
9- import { Button } from ' @/components/ui/Button'
10- import { EmptyState } from ' @/components/ui/EmptyState'
3+ import { useState , useEffect } from " react" ;
4+ import Link from " next/link" ;
5+ import { Search , Plus , Filter } from " lucide-react" ;
6+ import { useRouter } from " next/navigation" ;
7+ import { useGuildStore } from " @/store/guildStore" ;
8+ import { GuildCard } from " @/features/guilds/components/GuildCard" ;
9+ import { Button } from " @/components/ui/Button" ;
10+ import { EmptyState } from " @/components/ui/EmptyState" ;
1111
1212export default function GuildsPage ( ) {
13- const router = useRouter ( )
14- const { guilds, fetchGuilds } = useGuildStore ( )
15- const [ searchQuery , setSearchQuery ] = useState ( '' )
16- const [ selectedCategory , setSelectedCategory ] = useState < string > ( '' )
17- const [ selectedTier , setSelectedTier ] = useState < string > ( '' )
13+ const router = useRouter ( ) ;
14+ const { guilds, fetchGuilds } = useGuildStore ( ) ;
15+ const [ searchQuery , setSearchQuery ] = useState ( "" ) ;
16+ const [ selectedCategory , setSelectedCategory ] = useState < string > ( "" ) ;
17+ const [ selectedTier , setSelectedTier ] = useState < string > ( "" ) ;
1818
1919 useEffect ( ( ) => {
20- fetchGuilds ( )
21- } , [ fetchGuilds ] )
20+ fetchGuilds ( ) ;
21+ } , [ fetchGuilds ] ) ;
2222
23- const categories = [ 'All' , 'Development' , 'DeFi' , 'Education' , 'Gaming' , 'NFT' , 'DAO' , 'Social' ]
24- const tiers = [ 'All' , 'bronze' , 'silver' , 'gold' , 'platinum' ]
23+ const categories = [
24+ "All" ,
25+ "Development" ,
26+ "DeFi" ,
27+ "Education" ,
28+ "Gaming" ,
29+ "NFT" ,
30+ "DAO" ,
31+ "Social" ,
32+ ] ;
33+ const tiers = [ "All" , "bronze" , "silver" , "gold" , "platinum" ] ;
2534
2635 const filteredGuilds = guilds . filter ( ( guild ) => {
2736 const matchesSearch =
2837 guild . name . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) ) ||
29- guild . description . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) )
38+ guild . description . toLowerCase ( ) . includes ( searchQuery . toLowerCase ( ) ) ;
3039
3140 const matchesCategory =
32- ! selectedCategory || selectedCategory === 'All' || guild . category === selectedCategory
41+ ! selectedCategory ||
42+ selectedCategory === "All" ||
43+ guild . category === selectedCategory ;
3344
34- const matchesTier = ! selectedTier || selectedTier === 'All' || guild . tier === selectedTier
45+ const matchesTier =
46+ ! selectedTier || selectedTier === "All" || guild . tier === selectedTier ;
3547
36- return matchesSearch && matchesCategory && matchesTier
37- } )
48+ return matchesSearch && matchesCategory && matchesTier ;
49+ } ) ;
3850
3951 return (
4052 < div className = "min-h-screen bg-gray-50 dark:bg-gray-900" >
@@ -81,7 +93,7 @@ export default function GuildsPage() {
8193 className = "w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-gray-800 dark:text-white"
8294 >
8395 { categories . map ( ( cat ) => (
84- < option key = { cat } value = { cat === ' All' ? '' : cat } >
96+ < option key = { cat } value = { cat === " All" ? "" : cat } >
8597 { cat }
8698 </ option >
8799 ) ) }
@@ -96,7 +108,7 @@ export default function GuildsPage() {
96108 className = "w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-gray-800 dark:text-white capitalize"
97109 >
98110 { tiers . map ( ( tier ) => (
99- < option key = { tier } value = { tier === ' All' ? '' : tier } >
111+ < option key = { tier } value = { tier === " All" ? "" : tier } >
100112 { tier }
101113 </ option >
102114 ) ) }
@@ -124,12 +136,12 @@ export default function GuildsPage() {
124136 title = "No guilds found"
125137 description = "Try adjusting your search or filters, or create a new guild."
126138 createLabel = "Create Guild"
127- onCreate = { ( ) => router . push ( ' /guilds/create' ) }
139+ onCreate = { ( ) => router . push ( " /guilds/create" ) }
128140 illustration = { < Filter className = "h-14 w-14 text-gray-400" /> }
129141 className = "border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800"
130142 />
131143 ) }
132144 </ div >
133145 </ div >
134- )
146+ ) ;
135147}
0 commit comments