"use client"
import { useState, useEffect } from "react"
export default function HelpModal() {
const [isOpen, setIsOpen] = useState(false)
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
// Check for Shift+? (Shift+/ produces "?")
// Also check for event.key === "?" as fallback for some keyboard layouts
const isQuestionMark =
(event.shiftKey && event.key === "/") ||
event.key === "?" ||
(event.code === "Slash" && event.shiftKey)
// Only trigger if Shift is pressed (not Ctrl/Cmd)
if (event.shiftKey && isQuestionMark && !event.ctrlKey && !event.metaKey) {
event.preventDefault()
setIsOpen((prev) => !prev)
}
// Also close on Escape key
if (event.key === "Escape" && isOpen) {
setIsOpen(false)
}
}
window.addEventListener("keydown", handleKeyDown)
return () => window.removeEventListener("keydown", handleKeyDown)
}, [isOpen])
if (!isOpen) return null
return (
<>
{/* Overlay */}
setIsOpen(false)}
>
{/* Modal */}
e.stopPropagation()}
>
{/* Header */}
Welcome to MirrorMatch
{/* Content */}
{/* What is MirrorMatch */}
What is MirrorMatch?
MirrorMatch is a fun and engaging photo guessing game where you can upload photos
and challenge other players to guess who is in the picture. Test your knowledge of
friends, family, or colleagues while competing for points on the leaderboard!
{/* How to Play */}
How to Play
Upload Photos: Go to the Upload page and add photos with answer
names. You can upload files or use image URLs.
Guess Photos: Browse the Photos page and click on any photo to
make your guess. Enter the name of the person you think is in the picture.
Earn Points: Get points for each correct guess! The more you
guess correctly, the higher you'll climb on the leaderboard.
Compete: Check the Leaderboard to see how you rank against other
players.
{/* Features */}
Key Features
•Photo Upload: Share photos via file upload or URL
•Guessing System: Submit guesses and get instant feedback
•Email Notifications: Get notified when new photos are
uploaded
•Leaderboard: Track rankings and compete with others
•Profile Management: View your points and manage your account
{/* Keyboard Shortcuts */}
Keyboard Shortcuts
Shift
{" + "}
?
Open/Close this help window
Esc
Close help window
{/* Tips */}
Tips
💡Guesses are case-insensitive, so don't worry about capitalization
💡You can't guess your own photos, but you can still view them
💡
You'll receive email notifications when other users upload new photos
💡Check the leaderboard regularly to see your ranking