2 lines
4.4 KiB
JavaScript
2 lines
4.4 KiB
JavaScript
import{u as m,a as u,b,c as p,r as g,j as e,L as l,O as v}from"./index-CpYyIBrK.js";import{L as f}from"./LanguageSwitch-CAsipeKu.js";import{u as j}from"./useTranslation-3oSnFigB.js";function L(){const{t:a}=j(),{user:o,logout:d}=m(),{site:t}=u(),h=b(),i=p(),[r,c]=g.useState(!1),n=(t==null?void 0:t.name)||"AI Platform",x=[{to:"/",label:a("nav.home"),auth:!1},{to:"/pricing",label:a("nav.pricing"),auth:!1},{to:"/packages",label:a("nav.packages"),auth:!1},...t!=null&&t.allow_sub_dist?[{to:"/sub-site",label:a("subDist.nav"),auth:!1}]:[],{to:"/dashboard",label:a("nav.dashboard"),auth:!0},{to:"/tokens",label:a("nav.apiKeys"),auth:!0},{to:"/logs",label:a("nav.logs"),auth:!0},...t!=null&&t.enable_topup?[{to:"/topup",label:a("nav.topup"),auth:!0}]:[]].filter(s=>!s.auth||o);return e.jsxs("div",{className:"min-h-screen flex flex-col bg-[#09090b]",children:[(t==null?void 0:t.announcement)&&e.jsx("div",{className:"bg-gradient-to-r from-violet-600/10 via-blue-600/10 to-cyan-600/10 border-b border-white/[0.06] text-center py-2.5 px-4",children:e.jsx("p",{className:"text-sm text-neutral-300",children:t.announcement})}),e.jsxs("header",{className:"sticky top-0 z-50 backdrop-blur-2xl bg-[#09090b]/80 border-b border-white/[0.06]",children:[e.jsxs("div",{className:"max-w-7xl mx-auto px-6 h-16 flex items-center justify-between",children:[e.jsxs(l,{to:"/",className:"flex items-center gap-3 group",children:[t!=null&&t.logo?e.jsx("img",{src:t.logo,alt:n,className:"h-8 w-auto"}):e.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-violet-500 via-blue-500 to-cyan-500 flex items-center justify-center text-white font-bold text-sm shadow-lg shadow-blue-500/20",children:n.charAt(0)}),e.jsx("span",{className:"text-lg font-semibold text-white group-hover:text-blue-400 transition-colors",children:n})]}),e.jsx("nav",{className:"hidden md:flex items-center gap-1 bg-white/[0.04] rounded-full px-1.5 py-1 border border-white/[0.06]",children:x.map(s=>e.jsx(l,{to:s.to,className:`px-4 py-1.5 text-sm rounded-full transition-all ${i.pathname===s.to?"text-white bg-white/[0.08]":"text-neutral-400 hover:text-white"}`,children:s.label},s.to))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"text-neutral-400 hover:text-white hover:bg-white/5"}),o?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-neutral-400 hidden sm:block",children:o.display_name||o.username}),e.jsx("button",{onClick:async()=>{await d(),h("/")},className:"text-sm text-neutral-400 hover:text-white transition-colors",children:a("nav.logout")})]}):e.jsxs(e.Fragment,{children:[e.jsx(l,{to:"/login",className:"text-sm text-neutral-400 hover:text-white transition-colors px-3 py-1.5 hidden sm:block",children:a("nav.login")}),e.jsx(l,{to:"/register",className:"px-5 py-2 rounded-full bg-white text-black text-sm font-medium hover:bg-neutral-100 transition-all",children:a("nav.signUp")})]}),e.jsx("button",{className:"md:hidden p-1.5 rounded-lg hover:bg-white/5 transition-colors",onClick:()=>c(!r),"aria-label":"Toggle menu",children:e.jsx("svg",{className:"w-5 h-5 text-neutral-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]})]}),r&&e.jsx("div",{className:"md:hidden border-t border-white/[0.06] bg-[#09090b]/95 backdrop-blur-2xl",children:e.jsx("nav",{className:"max-w-7xl mx-auto px-6 py-3 flex flex-col gap-1",children:x.map(s=>e.jsx(l,{to:s.to,onClick:()=>c(!1),className:`px-3 py-2 text-sm rounded-lg transition-colors ${i.pathname===s.to?"text-blue-400 bg-blue-500/10":"text-neutral-400 hover:text-white hover:bg-white/5"}`,children:s.label},s.to))})})]}),e.jsx("main",{className:"flex-1",children:e.jsx(v,{})}),e.jsx("footer",{className:"border-t border-white/[0.06] mt-auto bg-[#09090b]",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6 py-8 flex flex-col md:flex-row items-center justify-between gap-4",children:[e.jsxs("p",{className:"text-sm text-neutral-500",children:["© ",new Date().getFullYear()," ",n,"."]}),e.jsx("div",{className:"flex items-center gap-4",children:(t==null?void 0:t.contact_email)&&e.jsx("a",{href:`mailto:${t.contact_email}`,className:"text-sm text-neutral-500 hover:text-neutral-300 transition-colors",children:a("nav.contact")})})]})})]})}export{L as default};
|