import React, { useEffect } from "react";

function KeyboardShortcuts() {
  useEffect(() => {
    const handleKeyDown = (e) => {
      if (e.key === "p") {
        console.log("Debug key pressed: Clearing auth data and refreshing");
        localStorage.removeItem("hf_oauth");
        localStorage.removeItem("auth_return_to");
        alert("Auth data cleared. Page will reload.");
        window.location.reload();
      }
    };

    window.addEventListener("keydown", handleKeyDown);
    return () => {
      window.removeEventListener("keydown", handleKeyDown);
    };
  }, []);

  return null;
}

export default KeyboardShortcuts;
