PageSourceSearch

https://ratecard-charm-44.lovable.app/assets/RateCards-B72GyQqv.js

js ratecard-charm-44.lovable.app collected 2026-10-03 03:41:47 UTC 15,139 bytes, 26 lines download raw bytes

1import{c as m,r as d,u as ae,j as e,g as te,h as re,a as ie,N as le,p as ne,G as de,J as ce,q as oe,K as ue,O as xe,Q as he,B as a,T as me,U as ge,V as je,W as ve,y as be,t as p,x as C,v as Ne,w as pe,Y as fe,Z as S,E as ye,P as A,_ as we}from"./index-BO4WO3ko.js";import{u as Ce}from"./useProfiles-BgCdwORC.js";import{P as $,A as E,a as _,T as U,b as F,c as V,d as q,e as I,f as Y,g as G,h as H}from"./alert-dialog-LIzrdjNp.js";import{L as ke,P as B}from"./label-BG66BMTw.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Pe=m("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const De=m("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Re=m("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Le=m("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const ze=m("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var O="Toggle",W=d.forwardRef((i,l)=>
26{const{pressed:c,defaultPressed:o,onPressedChange:u,...g}=i,[n,f]=ae({prop:c,onChange:u,defaultProp:o??!1,caller:O});return e.jsx(te.button,{type:"button","aria-pressed":n,"data-state":n?"on":"off","data-disabled":i.disabled?"":void 0,...g,ref:l,onClick:re(i.onClick,()=>{i.disabled||f(!n)})})});W.displayName=O;var J=W;const Me=le("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),k=d.forwardRef(({className:i,variant:l,size:c,...o},u)=>e.jsx(J,{ref:u,className:ie(Me({variant:l,size:c,className:i})),...o}));k.displayName=J.displayName;function _e(){const{user:i}=ne(),{profiles:l,loading:c,createProfile:o,deleteProfile:u}=Ce(),{subscribed:g,subscription_plan:n,loading:f}=de();ce();const x=oe(),{toast:r}=ue(),[K,j]=d.useState(!1),[Q,v]=d.useState(!1),[b,P]=d.useState(""),[y,D]=d.useState(!1),[N,R]=d.useState("grid"),L=n||"free",h=g&&n==="pro",Z=s=>{switch(s){case"pro":return 1/0;default:return 1}},w=()=>i?g&&n==="pro"?!0:l.length<1:!1,z=s=>{switch(s){case"active":return"bg-green-500";case"inactive":return"bg-yellow-500";default:return"bg-gray-500"}},M=s=>{switch(s){case"active":return"Live";case"inactive":return"Inactive";default:return"Draft"}},X=async()=>{if(!b.trim()){r({title:"Name required",description:"Please enter a name for your rate card.",variant:"destructive"});return}if(!w()){r({title:"Upgrade required",description:"Upgrade to Pro to create unlimited rate cards.",variant:"destructive"});return}D(!0);try{const s=await o({name:b.trim(),display_name:"",status:"draft"});if(s)r({title:"Rate card created",description:"Your new rate card has been created successfully."}),j(!1),P(""),x(`/app/design/${s.id}/edit`);else throw new Error("Failed to create profile")}catch(s){const t=s instanceof Error?s.message:"Failed to create rate card. Please try again.";t.includes("Profile limit exceeded")?r({title:"Profile limit reached",description:t,variant:"destructive"}):r({title:"Error",description:t,variant:"destructive"})}finally{D(!1)}},ee=s=>{if(s.status==="active"){const t=s.subdomain?`/${s.subdomain}`:`/c/${s.slug}`;window.open(t,"_blank")}},se=async s=>{const t=s.subdomain?`https://rateon.cloud/${s.subdomain}`:s.slug?`https://rateon.cloud/c/${s.slug}`:null;if(t)try{await navigator.clipboard.writeText(t),r({title:"Link copied",description:"The link has been copied to your clipboard."})}catch{r({title:"Failed to copy",description:"Unable to copy link to clipboard.",variant:"destructive"})}},T=async s=>{try{if(await u(s.id))r({title:"Rate card deleted",description:"Your rate c
26ard has been deleted successfully."});else throw new Error("Failed to delete profile")}catch{r({title:"Error",description:"Failed to delete rate card. Please try again.",variant:"destructive"})}};return c||f?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),e.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading your rate cards..."})]})}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsxs("div",{className:"max-w-7xl mx-auto p-4 sm:p-6 lg:p-8",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"Rate Cards"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Manage all your rate cards in one place"})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-4 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center border rounded-lg",children:[e.jsx(k,{pressed:N==="grid",onPressedChange:()=>R("grid"),className:"rounded-r-none",children:e.jsx(De,{className:"w-4 h-4"})}),e.jsx(k,{pressed:N==="list",onPressedChange:()=>R("list"),className:"rounded-l-none",children:e.jsx(Le,{className:"w-4 h-4"})})]}),e.jsxs(xe,{open:K,onOpenChange:j,children:[e.jsx(he,{asChild:!0,children:e.jsxs(a,{disabled:!w(),children:[e.jsx($,{className:"w-4 h-4 mr-2"}),"Create New Rate Card"]})}),e.jsxs(me,{children:[e.jsxs(ge,{children:[e.jsx(je,{children:"Create New Rate Card"}),e.jsx(ve,{children:"Give your rate card a name to get started."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ke,{htmlFor:"cardName",children:"Rate Card Name"}),e.jsx(be,{id:"cardName",value:b,onChange:s=>P(s.target.value),placeholder:"e.g., Wedding Photography, Web Design",maxLength:50})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(a,{variant:"outline",onClick:()=>j(!1),disabled:y,children:"Cancel"}),e.jsx(a,{onClick:X,disabled:y||!b.trim(),children:y?"Creating...":"Create Rate Card"})]})]})]})]})]})]}),!w()&&!h&&e.jsx(p,{className:"mb-6 border-yellow-200 bg-yellow-50 dark:border-yellow-800 dark:bg-yellow-950",children:e.jsx(C,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(ze,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-200",children:"Upgrade to Pro for unlimited rate cards"}),e.jsxs("p",{className:"text-sm text-yellow-600 dark:text-yellow-400",children:["You've reached the limit for your current plan (",l.length,"/",Z(L)," rate cards)."]})]}),e.jsx(a,{variant:"outline",size:"sm",onClick:()=>v(!0),children:"Upgrade Now"})]})})}),l.length===0?e.jsxs(p,{className:"text-center py-12",children:[e.jsxs(Ne,{children:[e.jsx(pe,{children:"No Rate Cards Yet"}),e.jsx(fe,{children:"Create your first rate card to get started sharing your services."})]}),e.jsx(C,{children:e.jsxs(a,{onClick:()=>j(!0),children:[e.jsx($,{className:"w-4 h-4 mr-2"}),"Create Your First Rate Card"]})})]}):e.jsx("div",{className:N==="grid"?"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6":"space-y-4",children:l.map(s=>N==="grid"?e.jsxs(p,{className:"overflow-hidden",children:[e.jsxs("div",{className:"aspect-[3/4] relative",children:[s.avatar_url?e.jsx("img",{src:s.avatar_url,alt:"Profile",className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-100 via-purple-50 to-pink-100"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent to-black/20"}),e.jsx("div",{className:"absolute bottom-4 left-4 right-4 bg-white rounded-xl p-3 shadow-lg",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-bold text-lg text-gray-900 leading-tight",children:s.display_name||"No name"}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:s.position||"No role"}),s.location&&e.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:s.location})]}),e.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center ml-3 flex-shrink-0 bg-slate-50",children:e.jsx("span",{className:"text-sm",children:s.emoji||"💼"})})]})})]}),e.jsxs(C,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"font-semibold truncate",children:s.name||"Untitled Rate Card"}),e.jsx(S,{variant:"outline",className:`${z(s.status)} text-white`,children:M(s.status)})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3 truncate",children:s.display_name||"No description"}),(s.slug||s.subdomain)&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mb-1",children:[e.jsx(Re,{className:"w-3 h-3 mr-1"}),"Public Link"]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("p",{className:"text-xs bg-muted px-2 py-1 rounded text-muted-foreground truncate flex-1",children:s.subdomain?`rateon.cloud/${s.subdomain}`:s.slug?`${window.location.host}/c/${s.slug}`:"No public link available"}),e.jsx(a,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>se(s),children:e.jsx(Pe,{className:"w-3 h-3"})}),s.status==="active"&&e.jsx(a,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>ee(s),children:e.jsx(ye,{className:"w-3 h-3"})})]})]}),e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsxs(a,{variant:"outline",size:"sm",className:"w-full",onClick:()=>x(`/app/design/${s.id}/edit`),children:[e.jsx(B,{className:"w-3 h-3 mr-1"}),"Edit Content"]}),e.jsxs(a,{variant:"outline",size:"sm",className:"w-full",onClick:()=>{h?x(`/app/design/${s.id}/design`):v(!0)},children:[e.jsx(A,{className:"w-3 h-3 mr-1"}),"Edit Design ",!h&&"(Pro)"]}),e.jsxs(E,{children:[e.jsx(_,{asChild:!0,children:e.jsxs(a,{variant:"outline",size:"sm",className:"w-full text-destructive hover:text-destructive",children:[e.jsx(U,{className:"w-3 h-3 mr-1"}),"Delete"]})}),e.jsxs(F,{children:[e.jsxs(V,{children:[e.jsx(q,{children:"Delete Rate Card"}),e.jsxs(I,{children:['Are you sure you want to delete "',s.name||"Untitled Rate Card",'"? This action cannot be undone.']})]}),e.jsxs(Y,{children:[e.jsx(G,{children:"Cancel"}),e.jsx(H,{onClick:()=>T(s),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})]},s.id):e.jsx(p,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("div",{className:"w-16 h-20 rounded-lg overflow-hidden relative",children:[s.avatar_url?e.jsx("img",{src:s.avatar_url,alt:"Profile",className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-100 via-purple-50 to-pink-100"}),e.jsx("div",{className:"absolute bottom-1 left-1 right-1 bg-white rounded-md p-1",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-medium truncate",children:s.display_name||"No name"}),e.jsx("div",{className:"text-xs text-gray-500 truncate",children:s.position||"No role"})]}),e.jsx("div",{className:"w-3 h-3 bg-black rounded-sm flex items-center justify-center ml-1 flex-shrink-0",children:e.jsx("span",{className:"text-xs leading-none",children:s.emoji||"💼"})})]})})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:s.name||"Untitled Rate Card"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.display_name||"No description"}),e.jsx(S,{variant:"outline",className:`${z(s.status)} text-white mt-1`,children:M(s.status)})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:()=>x(`/app/design/${s.id}/edit`),children:[e.jsx(B,{className:"w-3 h-3 mr-1"}),"Edit"]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:()=>{h?x(`/app/design/${s.id}/design`):v(!0)},children:[e.jsx(A,{className:"w-3 h-3 mr-1"}),"Design ",!h&&"(Pro)"]}),e.jsxs(E,{children:[e.jsx(_,{asChild:!0,children:e.jsx(a,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",children:e.jsx(U,{className:"w-3 h-3"})})}),e.jsxs(F,{children:[e.jsxs(V,{children:[e.jsx(q,{children:"Delete Rate Card"}),e.jsxs(I,{children:['Are you sure you want to delete "',s.name||"Untitled Rate Card",'"? This action cannot be undone.']})]}),e.jsxs(Y,{children:[e.jsx(G,{children:"Cancel"}),e.jsx(H,{onClick:()=>T(s),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})},s.id))})]}),e.jsx(we,{open:Q,onOpenChange:v,currentPlan:L})]})}export{_e 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.