1import{b as e,r as s,j as a}from"./vendor-react-BH6F5oQJ.js";import{s as t,C as r,m as n,M as i,N as c,O as l,f as d}from"./index-C_oSc_qP.js";import{a as o}from"./vendor-query-CC4VRGyP.js";import{J as m,C as u}from"./vendor-icons-CaI5__By.js";import"./vendor-ui-B4WC06Sp.js";import"./vendor-supabase-COwyE4EW.js";const x=()=>{const x=e(),[j,p]=s.useState(null);s.useEffect(()=>{t.auth.getUser().then(({data:e})=>{e.user?p(e.user.id):x("/admin/login")})},[x]);const{data:h,isLoading:f}=o({queryKey:["my-approval-status",j],queryFn:async()=>{if(!j)return null;const{data:e,error:s}=await t.from("pending_admin_approvals").select("*").eq("user_id",j).single();if(s)throw s;return e},enabled:!!j});return s.useEffect(()=>{"approved"===(null==h?void 0:h.status)&&x("/admin")},[h,x]),f?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:a.jsx(r,{className:"w-full max-w-md",children:a.jsx(n,{className:"pt-6",children:a.jsxs("div",{className:"flex flex-col items-center justify-center space-y-4",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"}),a.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})})})}):a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:a.jsxs(r,{className:"w-full max-w-md",children:[a.jsxs(i,{className:"space-y-1",children:[a.jsx("div",{className:"flex items-center justify-center mb-4",children:"rejected"===(null==h?void 0:h.status)?a.jsx(m,{className:"h-16 w-16 text-destructive"}):a.jsx(u,{className:"h-16 w-16 text-primary"})}),a.jsx(c,{className:"text-2xl text-center",children:"rejected"===(null==h?void 0:h.status)?"Request Rejected":"Pending Approval"}),a.jsx(l,{className:"text-center",children:"rejected"===(null==h?void 0:h.status)?"Your admin access request has been rejected":"Your admin access request is awaiting approval"})]}),a.jsxs(n,{className:"space-y-4",children:["rejected"===(null==h?void 0:h.status)?a.jsxs(a.Fragment,{children:[h.rejection_reason&&a.jsxs("div",{className:"p-4 bg-destructive/10 rounded-lg",children:[a.jsx("p",{className:"text-sm font-medium mb-2",children:"Reason:"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:h.rejection_reason})]}),a.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"Please contact a super admin if you believe this was a mistake."})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"p-4 bg-muted rounded-lg",children:a.jsx("p",{className:"text-sm text-center",children:"Your registration has been submitted successfully. A super admin will review your request shortly."})}),a.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsx("p",{children:"⢠You will receive an email notification once approved"}),a.jsx("p",{children:"⢠This process typically takes 24-48 hours"}),a.jsx("p",{children:"⢠You can close this window"})]})]}),a.jsx("div",{className:"flex justify-center pt-4",children:a.jsx(d,{variant:"outline",onClick:async()=>{await t.auth.signOut(),x("/admin/login")},children:"Return to Login"})})]})]})})};export{x as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.