11"use client" ;
22
3- import React from "react" ;
3+ import React , { useState } from "react" ;
44import { useTranslations } from "next-intl" ;
55import { motion } from "motion/react" ;
66import { Select , SelectContent , SelectGroup , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/Select" ;
@@ -10,6 +10,7 @@ import MyEventCard from "../components/MyEventCard";
1010import { EVENTS_TYPE } from "@/constants/event" ;
1111import Loader from "@/components/common/Loader" ;
1212import { UserEventType } from "@/domains/Events" ;
13+ import { NotFoundData } from "@/components/common/NotFoundData" ;
1314
1415interface UserEventPageProps {
1516 page ?: number ;
@@ -18,7 +19,8 @@ interface UserEventPageProps {
1819
1920const UserEventPage = ( { page = 1 , perPage = 10 } : UserEventPageProps ) => {
2021 const t = useTranslations ( "MyEventPage" ) ;
21- const { myEvents, isLoading } = useMyEvents ( page , perPage ) ;
22+ const [ typeActive , setTypeActive ] = useState ( "all" ) ;
23+ const { myEvents, isLoading } = useMyEvents ( page , perPage , typeActive ) ;
2224
2325 const totalEvents = myEvents . length ;
2426 const totalPages = Math . ceil ( totalEvents / perPage ) ;
@@ -55,12 +57,13 @@ const UserEventPage = ({ page = 1, perPage = 10 }: UserEventPageProps) => {
5557 transition = { { duration : 0.4 , delay : 0.7 } }
5658 className = "w-full sm:w-auto"
5759 >
58- < Select >
60+ < Select onValueChange = { setTypeActive } defaultValue = "all" >
5961 < SelectTrigger className = "sm:w-[180px]" >
60- < SelectValue placeholder = "Category " />
62+ < SelectValue placeholder = "All Type Event " />
6163 </ SelectTrigger >
6264 < SelectContent >
6365 < SelectGroup >
66+ < SelectItem value = "all" > All Type Event</ SelectItem >
6467 { EVENTS_TYPE . map ( ( item ) => (
6568 < SelectItem key = { item } value = { item } >
6669 { item }
@@ -74,6 +77,8 @@ const UserEventPage = ({ page = 1, perPage = 10 }: UserEventPageProps) => {
7477 </ header >
7578 { isLoading ? (
7679 < Loader />
80+ ) : events . length === 0 ? (
81+ < NotFoundData />
7782 ) : (
7883 < motion . div
7984 variants = { {
0 commit comments