@@ -3,6 +3,7 @@ import { Card, CardBody, Image, CardHeader } from "@nextui-org/react";
3
3
import { Table , TableHeader , TableColumn , TableBody , TableRow , TableCell , Pagination , getKeyValue } from "@nextui-org/react" ;
4
4
import { users } from "../utils/users_data" ;
5
5
6
+ import Link from "next/link" ;
6
7
7
8
import { createClientComponentClient } from "@supabase/auth-helpers-nextjs" ;
8
9
@@ -16,9 +17,10 @@ export default function HomeArea() {
16
17
React . useEffect ( ( ) => {
17
18
console . log ( "DB Request" ) ;
18
19
19
- const fetchData = async ( ) => {
20
+ const fetchData = async ( category ) => {
20
21
try {
21
- const { data, error } = await supabase . from ( "ctf" ) . select ( "*" ) ;
22
+ const { data, error } = await supabase . from ( "ctf" ) . select ( "*" )
23
+ // .eq("category", category);
22
24
console . log ( "Get CTF By Category: (error):\n" , error ) ;
23
25
console . log ( "Get CTF By Category: (data):\n" , data ) ;
24
26
@@ -71,46 +73,48 @@ export default function HomeArea() {
71
73
< div className = "w-full h-full px-4 sm:px-8 md:px-16 py-2 sm:py-4 md:py-8 bg-[#2D3250]" >
72
74
< div className = "grid gap-6 sm:gap-8 md:gap-10 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" >
73
75
{ list . map ( ( item , index ) => (
74
- < Card
75
- className = "bg-[#1e243a] hover:bg-[#12172a] shadow-2xl"
76
- radius = "sm"
77
- shadow = "lg"
78
- key = { index }
79
- isPressable
80
- onPress = { ( ) => console . log ( "item pressed" ) }
81
- >
82
- { /* <CardBody className="overflow-visible p-0">
76
+ < Link href = { `/challenge/${ item . id } ` } className = "w-full" >
77
+ < Card
78
+ className = "bg-[#1e243a] hover:bg-[#12172a] shadow-2xl"
79
+ radius = "sm"
80
+ shadow = "lg"
81
+ key = { index }
82
+ isPressable
83
+ // onPress={() => console.log("item pressed")}
84
+ >
85
+ { /* <CardBody className="overflow-visible p-0">
83
86
84
87
</CardBody> */ }
85
- < CardHeader className = "flex gap-3 bg-[#1e243a]" >
86
- < Image
87
- alt = "nextui logo"
88
- height = { 40 }
89
- color = "primary"
90
- radius = "sm"
91
- src = "https://img.icons8.com/ios/50/flag.png"
92
- width = { 40 }
93
- />
94
- < div className = "flex flex-col" >
95
- < p className = "text-small text-gray-400" > { item . difficulty } </ p >
96
- </ div >
97
- </ CardHeader >
98
- < CardBody className = "text-lg justify-between" >
99
- < div className = "flex flex-col w-full" >
100
- < div className = "flex flex-row justify-between" >
101
- < b className = "text-yellow-400" > { item . title } </ b >
102
- { /* <p className="text-default-500">{item.no_of_qs}</p> */ }
103
- < div class = "relative flex items-center justify-center" >
104
- < div class = "absolute h-6 w-6 bg-primary-500 rounded-full" > </ div >
105
- < p class = "text-default-200 text-[12px] z-10" > { item . score } </ p >
88
+ < CardHeader className = "flex gap-3 bg-[#1e243a]" >
89
+ < Image
90
+ alt = "nextui logo"
91
+ height = { 40 }
92
+ color = "primary"
93
+ radius = "sm"
94
+ src = "https://img.icons8.com/ios/50/flag.png"
95
+ width = { 40 }
96
+ />
97
+ < div className = "flex flex-col" >
98
+ < p className = "text-small text-gray-400" > { item . difficulty } </ p >
99
+ </ div >
100
+ </ CardHeader >
101
+ < CardBody className = "text-lg justify-between" >
102
+ < div className = "flex flex-col w-full" >
103
+ < div className = "flex flex-row justify-between" >
104
+ < b className = "text-yellow-400" > { item . title } </ b >
105
+ { /* <p className="text-default-500">{item.no_of_qs}</p> */ }
106
+ < div class = "relative flex items-center justify-center" >
107
+ < div class = "absolute h-6 w-6 bg-primary-500 rounded-full" > </ div >
108
+ < p class = "text-default-200 text-[12px] z-10" > { item . score } </ p >
109
+ </ div >
106
110
</ div >
111
+ { /* <div className="flex flex-row justify-between"> */ }
112
+ < span className = "text-[12px] text-slate-400" > { item . description } </ span >
113
+ { /* </div> */ }
107
114
</ div >
108
- { /* <div className="flex flex-row justify-between"> */ }
109
- < span className = "text-[12px] text-slate-400" > { item . description } </ span >
110
- { /* </div> */ }
111
- </ div >
112
- </ CardBody >
113
- </ Card >
115
+ </ CardBody >
116
+ </ Card >
117
+ </ Link >
114
118
) ) }
115
119
</ div >
116
120
</ div >
0 commit comments