diff --git a/src/app/rewards/page.tsx b/src/app/rewards/page.tsx index 4f1d780..cea7c8f 100644 --- a/src/app/rewards/page.tsx +++ b/src/app/rewards/page.tsx @@ -29,9 +29,8 @@ export default function RewardsPage() { try { await claim(claimableId); addToast("Reward claimed successfully!", "success"); - } catch (err) { + } catch { addToast("Failed to claim reward. Please try again.", "error"); - throw err; } }; diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 16f18c7..a09ad51 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -18,12 +18,6 @@ export default async function sitemap(): Promise { changeFrequency: "daily", priority: 0.9, }, - { - url: `${SITE_URL}/connect`, - lastModified: new Date(), - changeFrequency: "monthly", - priority: 0.5, - }, ]; let courseRoutes: MetadataRoute.Sitemap = []; diff --git a/src/components/course/course-card.tsx b/src/components/course/course-card.tsx index 391353e..f9e61e2 100644 --- a/src/components/course/course-card.tsx +++ b/src/components/course/course-card.tsx @@ -1,7 +1,7 @@ "use client"; import { memo } from "react"; -import Link from "next/link"; +import { useRouter } from "next/navigation"; import Image from "next/image"; import { cn } from "@/lib/utils/cn"; import { Card, CardContent, CardFooter } from "@/components/ui/card"; @@ -44,19 +44,36 @@ export const CourseCard = memo(function CourseCard({ onContinue, className, }: CourseCardProps) { + const router = useRouter(); + + const handleNavigate = () => { + router.push(`/courses/${course.id}`); + }; + + const handleCardKeyDown = (e: React.KeyboardEvent) => { + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + handleNavigate(); + } + }; + const handleEnroll = (e: React.MouseEvent) => { - e.preventDefault(); + e.stopPropagation(); onEnroll?.(course.id); }; const handleContinue = (e: React.MouseEvent) => { - e.preventDefault(); + e.stopPropagation(); onContinue?.(course.id); }; return ( - e.preventDefault()} + onClick={(e) => e.stopPropagation()} onKeyDown={(e) => { - if (e.key === "Enter" || e.key === " ") e.preventDefault(); + if (e.key === "Enter" || e.key === " ") e.stopPropagation(); }} > @@ -192,6 +209,5 @@ export const CourseCard = memo(function CourseCard({ )} - ); }); diff --git a/src/components/wallet/connect-button.tsx b/src/components/wallet/connect-button.tsx index 3ff76ad..8c99f2d 100644 --- a/src/components/wallet/connect-button.tsx +++ b/src/components/wallet/connect-button.tsx @@ -29,12 +29,48 @@ export function ConnectButton() { const [showMainnetConfirm, setShowMainnetConfirm] = useState(false); const dropdownRef = useRef(null); const triggerRef = useRef(null); + const menuRef = useRef(null); const closeDropdown = useCallback(() => { setShowDropdown(false); triggerRef.current?.focus(); }, []); + const getMenuItems = useCallback(() => { + if (!menuRef.current) return []; + return Array.from( + menuRef.current.querySelectorAll('[role="menuitem"]') + ); + }, []); + + const handleMenuKeyDown = (e: React.KeyboardEvent) => { + const items = getMenuItems(); + if (items.length === 0) return; + + const currentIndex = items.findIndex( + (item) => item === document.activeElement + ); + + switch (e.key) { + case "ArrowDown": + e.preventDefault(); + items[(currentIndex + 1 + items.length) % items.length].focus(); + break; + case "ArrowUp": + e.preventDefault(); + items[(currentIndex - 1 + items.length) % items.length].focus(); + break; + case "Home": + e.preventDefault(); + items[0].focus(); + break; + case "End": + e.preventDefault(); + items[items.length - 1].focus(); + break; + } + }; + useEffect(() => { if (!showDropdown) return; @@ -116,8 +152,10 @@ export function ConnectButton() { {showDropdown && (
Connected Wallet