Files
adnexus/assets/Dashboard-B71DycTi.js
2026-09-20 08:53:09 -07:00

2 lines
5.0 KiB
JavaScript

import{r as i,j as e}from"./ui-SA1K2VdO.js";import{B as a,F as p}from"./index-BBRaFEzF.js";import{b as f,L as r}from"./vendor-khT4bKqW.js";import{S as N,L as y,ai as w,aj as v,a7 as k,G as d,ak as S,al as I,am as C,A,z as P}from"./utils-BOogt4zp.js";const E=()=>{const n=f(),[l,o]=i.useState(0),[m,x]=i.useState(""),[g,h]=i.useState(!1);i.useEffect(()=>{if(!localStorage.getItem("authToken")){n("/login");return}const c=parseInt(localStorage.getItem("userCredits")||"0"),t=localStorage.getItem("userName")||"User",b=localStorage.getItem("isAdmin")==="true";o(c),x(t),h(b)},[n]);const j=()=>{localStorage.removeItem("authToken"),localStorage.removeItem("userEmail"),localStorage.removeItem("userName"),n("/login")},u=[{id:"revision",name:"Revision",credits:50,icon:k,description:"Get revisions on existing work"},{id:"new-page",name:"New Page",credits:50,icon:d,description:"Add a new page to your website"},{id:"custom-artwork",name:"Custom Artwork",credits:150,icon:S,description:"Perfect for social media content"},{id:"logo-design",name:"Logo Design",credits:200,icon:I,description:"Professional logo design"},{id:"branding-kit",name:"Branding Kit",credits:500,icon:C,description:"Complete brand identity package"},{id:"instant-site",name:"3-Page Instant Site",credits:500,icon:d,description:"24-hour turnaround website"}];return e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"pt-32 pb-20 bg-black text-white min-h-screen",children:e.jsxs("div",{className:"container-custom max-w-7xl",children:[e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center mb-12",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-4xl md:text-5xl font-bold mb-2",children:["Welcome back, ",m]}),e.jsx("p",{className:"text-gray-400",children:"Manage your credits and redeem design services"})]}),e.jsxs("div",{className:"mt-4 md:mt-0 flex items-center gap-4",children:[g&&e.jsx(r,{to:"/admin",children:e.jsxs(a,{className:"bg-gray-800 hover:bg-gray-700 text-white px-4 py-2 rounded-lg flex items-center gap-2",children:[e.jsx(N,{className:"h-4 w-4"}),"Admin Panel"]})}),e.jsxs("button",{onClick:j,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors",children:[e.jsx(y,{className:"h-5 w-5"}),e.jsx("span",{children:"Log out"})]})]})]}),e.jsx("div",{className:"bg-gray-900/30 border border-gray-800 rounded-xl p-8 mb-12",children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 mb-2",children:"Available Credits"}),e.jsx("p",{className:"text-5xl font-bold",children:l.toLocaleString()}),e.jsx("p",{className:"text-gray-400 mt-2",children:"1 credit = $1"})]}),e.jsxs("div",{className:"mt-6 md:mt-0 flex gap-4",children:[e.jsx(r,{to:"/purchase-credits",children:e.jsxs(a,{className:"bg-white hover:bg-gray-100 text-black px-6 py-3 rounded-lg flex items-center gap-2",children:[e.jsx(w,{className:"h-5 w-5"}),"Purchase Credits"]})}),e.jsx(r,{to:"/history",children:e.jsxs(a,{className:"bg-gray-800 hover:bg-gray-700 text-white px-6 py-3 rounded-lg flex items-center gap-2",children:[e.jsx(v,{className:"h-5 w-5"}),"View History"]})})]})]})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold mb-8",children:"Available Services"}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:u.map(s=>{const c=s.icon,t=l>=s.credits;return e.jsxs("div",{className:`bg-gray-900/30 border border-gray-800 rounded-xl p-6 transition-all ${t?"hover:border-white":"opacity-50"}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("div",{className:"w-12 h-12 bg-gray-800 rounded-lg flex items-center justify-center",children:e.jsx(c,{className:"h-6 w-6 text-white"})}),e.jsxs("span",{className:"text-lg font-semibold",children:[s.credits," credits"]})]}),e.jsx("h3",{className:"text-xl font-semibold mb-2",children:s.name}),e.jsx("p",{className:"text-gray-400 text-sm mb-6",children:s.description}),e.jsx(r,{to:t?`/redeem/${s.id}`:"#",className:t?"":"pointer-events-none",children:e.jsx(a,{disabled:!t,className:`w-full ${t?"bg-white hover:bg-gray-100 text-black":"bg-gray-800 text-gray-500 cursor-not-allowed"} py-3 rounded-lg flex items-center justify-center gap-2`,children:t?e.jsxs(e.Fragment,{children:["Redeem Service",e.jsx(A,{className:"h-4 w-4"})]}):"Insufficient Credits"})})]},s.id)})})]}),e.jsx("div",{className:"mt-12 bg-gray-900/30 border border-gray-800 rounded-xl p-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(P,{className:"h-6 w-6 text-gray-400"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:"Need more credits?"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Purchase credit packs starting at 100 credits"})]})]}),e.jsx(r,{to:"/purchase-credits",children:e.jsx(a,{className:"bg-gray-800 hover:bg-gray-700 text-white px-4 py-2 rounded-lg",children:"Buy Credits"})})]})})]})}),e.jsx(p,{})]})};export{E as default};