diff --git a/app/events/page.tsx b/app/events/page.tsx
index f2262a15..70d513c1 100644
--- a/app/events/page.tsx
+++ b/app/events/page.tsx
@@ -19,6 +19,8 @@ import { cn } from "@/lib/utils";
import { useEvents } from "@/hooks/useEvents"
import { CompanyBadge } from "@/components/companies/CompanyBadge"
import type { Company } from "@/types/company"
+import { useMasterRegistrations } from "@/hooks/useMasterRegistrations"
+import { CheckCircle } from "lucide-react"
// Event categories for dropdown
const eventCategories = [
@@ -63,6 +65,9 @@ export default function EventsPage() {
// const { loading: featuredLoading } = useFeaturedEvents(5)
const featuredLoading = false
+ // Fetch user registrations to check registration status
+ const { registrations } = useMasterRegistrations({ activity_type: 'event' })
+
// Fetch companies for filter
useEffect(() => {
const fetchCompanies = async () => {
@@ -89,6 +94,11 @@ export default function EventsPage() {
const events = eventsData?.events || []
const isLoading = eventsLoading || featuredLoading
+ // Helper function to check if user is registered for an event
+ const isUserRegistered = (eventId: string | number) => {
+ return registrations.some(reg => reg.activity_id === String(eventId))
+ }
+
// Debug logging
console.log('Events Page Debug:', {
eventsLoading,
@@ -589,16 +599,29 @@ export default function EventsPage() {
{/* Action Button */}
-
+ {isUserRegistered(event.id) ? (
+
+ ) : (
+
+ )}
diff --git a/app/hackathons/page.tsx b/app/hackathons/page.tsx
index b366ca8d..25b703ed 100644
--- a/app/hackathons/page.tsx
+++ b/app/hackathons/page.tsx
@@ -21,6 +21,8 @@ import { cn } from "@/lib/utils";
import { useHackathons, useFeaturedHackathons } from "@/hooks/useHackathons"
import { CompanyBadge } from "@/components/companies/CompanyBadge"
import type { Company } from "@/types/company"
+import { useMasterRegistrations } from "@/hooks/useMasterRegistrations"
+import { CheckCircle } from "lucide-react"
// Hackathon categories for dropdown
const hackathonCategories = [
@@ -72,6 +74,14 @@ export default function HackathonsPage() {
const hackathons = hackathonsData?.hackathons || []
const isLoading = hackathonsLoading || featuredLoading
+ // Fetch user registrations to check registration status
+ const { registrations } = useMasterRegistrations({ activity_type: 'hackathon' })
+
+ // Helper function to check if user is registered for a hackathon
+ const isUserRegistered = (hackathonId: string | number) => {
+ return registrations.some(reg => reg.activity_id === String(hackathonId))
+ }
+
// Fetch companies for filter
useEffect(() => {
const fetchCompanies = async () => {
@@ -790,33 +800,61 @@ export default function HackathonsPage() {
{hackathon.price}
-
+
+ Registered
+
+
+ ) : (
+
+ )}
@@ -961,16 +999,29 @@ export default function HackathonsPage() {
{/* Action Button */}
-
+ {isUserRegistered(hackathon.id) ? (
+
+ ) : (
+
+ )}