{"version":3,"file":"UserIconComponent.Cp8F6NdP.mjs","names":["useState","user"],"sources":["https:/framerusercontent.com/modules/kjpoq9aAxgjcj3QWx12a/0b6xSkhjog2zdrjOnjDT/UserIconComponent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{createClient}from\"@supabase/supabase-js\";const SUPABASE_URL=\"https://ornyffipuckonctogwob.supabase.co\";const SUPABASE_ANON_KEY=\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9ybnlmZmlwdWNrb25jdG9nd29iIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTY4MzMzMjksImV4cCI6MjA3MjQwOTMyOX0.8QR1OqBsA841WrU1oTfVwE0ytmsO6VnpGVUgkXCAZ8w\";const supabase=createClient(SUPABASE_URL,SUPABASE_ANON_KEY);// SVG component for the user icon\nconst UserSvgIcon=()=>/*#__PURE__*/_jsxs(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M12 12C14.7614 12 17 9.76142 17 7C17 4.23858 14.7614 2 12 2C9.23858 2 7 4.23858 7 7C7 9.76142 9.23858 12 12 12Z\",stroke:\"#FFFFFF\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M20 22.0001C20 18.6946 16.4183 16 12 16C7.58172 16 4 18.6946 4 22.0001\",stroke:\"#FFFFFF\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]});export function UserIconComponent(){const[user,setUser]=useState(null);const[isHovered,setIsHovered]=useState(false);const handleLogout=async()=>{const{error}=await supabase.auth.signOut();if(error){console.error(\"Logout failed:\",error.message);}};useEffect(()=>{// Check if a user is currently logged in\nsupabase.auth.getUser().then(({data:{user}})=>{setUser(user);});// Listen for auth state changes\nconst{data:authListener}=supabase.auth.onAuthStateChange((event,session)=>{setUser(session?.user??null);});// Clean up the listener on component unmount\nreturn()=>{// Correctly call unsubscribe on the subscription property\nauthListener?.subscription.unsubscribe();};},[]);if(user){// User is logged in, show the icon with a dropdown on hover\nreturn /*#__PURE__*/_jsxs(\"div\",{className:\"dropdown-container\",onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),children:[/*#__PURE__*/_jsx(UserSvgIcon,{}),isHovered&&/*#__PURE__*/_jsxs(\"div\",{className:\"dropdown-menu\",children:[/*#__PURE__*/_jsx(\"a\",{href:\"/dash-board\",style:{fontSize:`16px`,color:`white`},children:\"Dashboard\"}),/*#__PURE__*/_jsx(\"p\",{onClick:handleLogout,style:{fontSize:`16px`,color:`white`,cursor:`pointer`,marginTop:`10px`},children:\"Logout\"})]})]});}else{// User is not logged in, show sign-in/sign-up link\nreturn /*#__PURE__*/_jsx(\"a\",{href:\"/login\",style:{fontSize:`16px`,color:`white`},children:/*#__PURE__*/_jsx(UserSvgIcon,{})});}}\nexport const __FramerMetadata__ = {\"exports\":{\"UserIconComponent\":{\"type\":\"reactComponent\",\"name\":\"UserIconComponent\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UserIconComponent.map"],"mappings":"gPAC0iB,SAAgB,GAAmB,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,KAAK,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAM9pB,OANkyB,MAAc,CAChzB,EAAS,KAAK,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,KAAA,MAAS,CAAC,EAAQC,EAAK,EAAG,CAC/D,GAAK,CAAC,KAAK,GAAc,EAAS,KAAK,mBAAmB,EAAM,IAAU,CAAC,EAAQ,GAAS,MAAM,KAAK,EAAG,CAC1G,UAAU,CACV,GAAc,aAAa,aAAa,GAAK,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