PageSourceSearch

https://scripotime.com/assets/CatalogInvites-BtajMR7o.js

js scripotime.com collected 2026-10-08 12:16:51 UTC 2,842 bytes, 1 lines download raw bytes

1import{u as b,r as n,j as e,P as h,N as w,H as C,I as k,B as l,c as a,s as d}from"./index-7trek_9M.js";import{C as _}from"./card-BuLLU6Vr.js";import{B as I}from"./badge-Cp9_3uoO.js";const A=()=>{const{user:m,roles:f,loading:g}=b(),c=f.includes("admin"),[r,x]=n.useState(""),[j,u]=n.useState(!1),[p,v]=n.useState([]);async function o(){const{data:t,error:s}=await d.from("catalog_invites").select("id, email, token, created_at, expires_at, accepted_at").order("created_at",{ascending:!1});if(s){a.error(s.message);return}v(t??[])}if(n.useEffect(()=>{c&&o()},[c]),g)return e.jsx(h,{children:e.jsx("div",{className:"container py-20"})});if(!m||!c)return e.jsx(w,{to:"/catalog",replace:!0});const N=async()=>{if(!r.trim())return;u(!0);const t=crypto.randomUUID().replace(/-/g,""),s=new Date(Date.now()+30*864e5).toISOString(),{error:i}=await d.from("catalog_invites").insert({email:r.trim().toLowerCase(),token:t,created_by:m.id,expires_at:s});if(u(!1),i){a.error(i.message);return}x(""),a.success("Invite created"),o()},y=async t=>{const{error:s}=await d.from("catalog_invites").delete().eq("id",t);if(s){a.error(s.message);return}o()};return e.jsxs(h,{children:[e.jsxs(C,{children:[e.jsx("title",{children:"Curator invites | ScripoTime"}),e.jsx("meta",{name:"robots",content:"noindex"})]}),e.jsxs("section",{className:"container max-w-3xl py-10",children:[e.jsx("h1",{className:"font-serif text-3xl text-primary mb-6",children:"Curator invites"}),e.jsxs(_,{className:"p-5 mb-8",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Issue a single-use invite token. Share the URL with the prospective curator."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{type:"email",value:r,onChange:t=>x(t.target.value),placeholder:"[email protected]"}),e.jsx(l,{onClick:N,disabled:j||!r.trim(),children:"Create invite"})]})]}),e.jsx("h2",{className:"font-serif text-xl text-primary mb-3",children:"Outstanding invites"}),p.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No invites yet."}):e.jsx("ul",{className:"space-y-2",children:p.map(t=>{const s=`${window.location.origin}/auth?invite=${t.token}`,i=!!t.accepted_at;return e.jsxs("li",{className:"flex items-center gap-3 border border-border rounded-md p-3 text-sm",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-primary truncate",children:t.email}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s})]}),i?e.jsx(I,{variant:"outline",className:"bg-emerald-100 text-emerald-900",children:"Accepted"}):e.jsxs(e.Fragment,{children:[e.jsx(l,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(s),a.success("Link copied")},children:"Copy"}),e.jsx(l,{size:"sm",variant:"ghost",onClick:()=>y(t.id),children:"Revoke"})]})]},t.id)})})]})]})};export{A 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.