{"version":3,"file":"LogoutButton.Bryrnr-R.mjs","names":["useState","supabase","user","useState","user"],"sources":["https:/framerusercontent.com/modules/zlYb35A2PXVn2wcb00bh/jsC70Dg1zNqknGrReXbn/DashOptionInMenu.js","https:/framerusercontent.com/modules/KNas8qTnTyNpJoEvIiqI/1zUHqsOoVYcNFILUxoUM/LogoutButton.js"],"sourcesContent":["import{jsx as _jsx}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);export function DashOptionInMenu(){const[user,setUser]=useState(null);const[isHovered,setIsHovered]=useState(false);const[loading,setLoading]=useState(true)// 👈 new state\n;const[windowWidth,setWindowWidth]=useState(typeof window!==\"undefined\"?window.innerWidth:1200);const handleDashboard=async()=>{window.location.href=\"/dash-board\";};const handleLogin=async()=>{window.location.href=\"/login\";};useEffect(()=>{async function checkUser(){const{data:{user}}=await supabase.auth.getUser();setUser(user);setLoading(false)// ✅ finished checking\n;}checkUser();const{data:authListener}=supabase.auth.onAuthStateChange((_event,session)=>{setUser(session?.user??null);setLoading(false);});return()=>{authListener?.subscription.unsubscribe();};},[]);// ✅ Don't render anything while loading\n// if (loading) return null\nconst fontSize=windowWidth<1200?\"30px\":\"17px\";if(user&&!loading){return /*#__PURE__*/_jsx(\"p\",{onClick:handleDashboard,style:{// fontSize: `17px`,\nfontSize,color:`white`,cursor:`pointer`,fontFamily:`Gambetta, \"Gambetta Placeholder\", serif`,fontWeight:`400`,fontStyle:`normal`,width:`auto`,letterSpacing:`0em`},children:\"Dashboard\"});}else{return /*#__PURE__*/_jsx(\"p\",{onClick:handleLogin,style:{// fontSize: `17px`,\nfontSize,color:`white`,cursor:`pointer`,fontFamily:`Gambetta, \"Gambetta Placeholder\", serif`,fontWeight:`400`,fontStyle:`normal`,width:`auto`,letterSpacing:`0em`},children:\"Login\"});}}\nexport const __FramerMetadata__ = {\"exports\":{\"DashOptionInMenu\":{\"type\":\"reactComponent\",\"name\":\"DashOptionInMenu\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DashOptionInMenu.map","import{jsx as _jsx}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);export function LogoutButton(){const[user,setUser]=useState(null);const[isHovered,setIsHovered]=useState(false);const[windowWidth,setWindowWidth]=useState(typeof window!==\"undefined\"?window.innerWidth:1200);const handleLogout=async()=>{const{error}=await supabase.auth.signOut();if(error){console.error(\"Logout failed:\",error.message);}else window.location.href=\"/login\";};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();};},[]);const fontSize=windowWidth<1200?\"30px\":\"17px\";if(user){return /*#__PURE__*/_jsx(\"p\",{onClick:handleLogout,style:{fontSize,color:`white`,cursor:`pointer`,fontFamily:`Gambetta, \"Gambetta Placeholder\", serif`,fontWeight:`400`,fontStyle:`normal`,width:`auto`,letterSpacing:`0em`,margin:`0`},children:\"Logout\"});}}\nexport const __FramerMetadata__ = {\"exports\":{\"LogoutButton\":{\"type\":\"reactComponent\",\"name\":\"LogoutButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LogoutButton.map"],"mappings":"wLAAse,SAAgB,GAAkB,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,KAAK,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAC5nB,CAAC,EAAY,GAAgBA,EAAgB,IAAS,OAA8B,KAAlB,EAAO,WAAgB,CAAO,EAAgB,SAAS,CAAC,EAAO,SAAS,KAAK,eAAsB,EAAY,SAAS,CAAC,EAAO,SAAS,KAAK,UAAW,MAAc,CAAC,eAAe,GAAW,CAAC,GAAK,CAAC,KAAK,CAAC,KAAA,IAAO,MAAMC,EAAS,KAAK,SAAS,CAAC,EAAQC,EAAK,CAAC,EAAW,GAAM,CACzV,GAAW,CAAC,GAAK,CAAC,KAAK,GAAcD,EAAS,KAAK,mBAAmB,EAAO,IAAU,CAAC,EAAQ,GAAS,MAAM,KAAK,CAAC,EAAW,GAAM,EAAG,CAAC,UAAU,CAAC,GAAc,aAAa,aAAa,GAAK,EAAE,CAAC,CAEvM,IAAM,EAAS,EAAY,KAAK,OAAO,OACyJ,OAD/I,GAAM,CAAC,EAA6B,EAAK,IAAI,CAAC,QAAQ,EAAgB,MAAM,CAC7H,WAAS,MAAM,QAAQ,OAAO,UAAU,WAAW,0CAA0C,WAAW,MAAM,UAAU,SAAS,MAAM,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