PageSourceSearch

https://svfans.macaly.app/assets/admin-ChzgC4yO.js

js svfans.macaly.app collected 2026-10-03 04:59:18 UTC 17,137 bytes, 1 lines download raw bytes

1import{b as w,R as _,j as e,u as D,r as i,c as y,d as C}from"./index-CGKDoePc.js";import{a as g}from"./api-B4MxgEL3.js";function P({children:n}){const{isLoading:a,isAuthenticated:x}=w();return a||!x?null:_.createElement(_.Fragment,null,n)}function U({children:n}){const{isLoading:a,isAuthenticated:x}=w();return a||x?null:_.createElement(_.Fragment,null,n)}function O({children:n}){const{isLoading:a}=w();return a?_.createElement(_.Fragment,null,n):null}function $(){return e.jsxs("div",{className:"min-h-screen",style:{background:"hsl(210,20%,5%)",fontFamily:"'Inter', sans-serif"},children:[e.jsx(O,{children:e.jsx("div",{className:"flex items-center justify-center min-h-screen text-muted-foreground",children:"Načítám…"})}),e.jsx(U,{children:e.jsx(z,{})}),e.jsx(P,{children:e.jsx(F,{})})]})}function z(){const{signIn:n}=D(),[a,x]=i.useState(""),[c,u]=i.useState(""),[m,t]=i.useState(null),[r,o]=i.useState(!1),[b,v]=i.useState(null),[N,S]=i.useState(""),[j,k]=i.useState(!1),f="w-full px-4 py-2.5 rounded-lg text-sm text-foreground bg-[hsl(210_16%_11%)] border border-[hsl(210_14%_18%)] focus:border-[hsl(110_73%_50%/0.5)] focus:outline-none transition-colors",l="w-full py-2.5 px-4 rounded-lg text-sm font-semibold transition-all cursor-pointer",h=async d=>{d.preventDefault(),t(null),o(!0);const p=new FormData;p.set("email",a),p.set("password",c),p.set("flow",j?"signUp":"signIn");try{await n("password",p),v(a)}catch(A){const E=A instanceof Error?A.message:"Chyba při přihlášení";E.includes("already exists")?t("Účet již existuje – přihlas se."):E.includes("password")?t("Heslo musí mít alespoň 8 znaků."):t("Špatný email nebo heslo.")}finally{o(!1)}},s=async d=>{d.preventDefault(),t(null),o(!0);const p=new FormData;p.set("email",b),p.set("code",N);try{await n("resend-otp",p)}catch{t("Neplatný nebo expirovaný kód.")}finally{o(!1)}};return e.jsx("div",{className:"flex items-center justify-center min-h-screen px-4",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("span",{className:"text-[hsl(110_73%_55%)] text-2xl font-bold",style:{fontFamily:"'Press Start 2P', monospace",fontSize:"18px"},children:"SVFans"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-2",children:"Admin panel"})]}),e.jsx("div",{className:"bg-[hsl(210_18%_8%)] border border-[hsl(210_14%_14%)] rounded-xl p-6",children:b?e.jsxs("form",{onSubmit:s,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-foreground font-medium mb-1",children:"Ověření emailu"}),e.jsxs("p",{className:"text-muted-foreground text-xs mb-4",children:["Zadej kód z emailu ",e.jsx("strong",{children:b})]}),e.jsx("input",{value:N,onChange:d=>S(d.target.value),placeholder:"6místný kód",className:f,maxLength:6,inputMode:"numeric",required:!0})]}),m&&e.jsx("p",{className:"text-[hsl(0_80%_65%)] text-xs",children:m}),e.jsx("button",{type:"submit",disabled:r,className:`${l} text-[hsl(210_20%_5%)]`,style:{background:"hsl(110,73%,50%)"},children:r?"Ověřuji…":"Ověřit"})]}):e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{value:a,onChange:d=>x(d.target.value),type:"email",placeholder:"Email",required:!0,className:f}),e.jsx("input",{value:c,onChange:d=>u(d.target.value),type:"password",placeholder:"Heslo",required:!0,className:f})]}),m&&e.jsx("p",{className:"text-[hsl(0_80%_65%)] text-xs",children:m}),e.jsx("button",{type:"submit",disabled:r,className:`${l} text-[hsl(210_20%_5%)]`,style:{background:"hsl(110,73%,50%)"},children:r?"Přihlašuji…":j?"Registrovat":"Přihlásit se"}),e.jsx("button",{type:"button",onClick:()=>{k(d=>!d),t(null)},className:"w-full text-xs text-muted-foreground hover:text-foreground transition-colors",children:j?"Už mám účet – přihlásit se":"Ještě nemám účet – registrovat"})]})})]})})}function F(){const{signOut:n}=D(),[a,x]=i.useState("status"),c=y(g.schedule.seed),u=y(g.news.seed),m=async()=>{await n()},t=async()=>{await c(),await u()};return e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-foreground font-bold text-xl",style:{fontFamily:"'Press Start 2P', monospace",fontSize:"16px",color:"hsl(110,73%,55%)"},children:"SVFans Admin"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Spravuj obsah webu"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:t,className:"px-3 py-1.5 text-xs rounded border border-[hsl(210_14%_18%)] text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:"Načíst výchozí data"}),e.jsx("button",{onClick:m,className:"px-3 py-1.5 text-xs rounded bg-[hsl(0_80%_55%/0.15)] border border-[hsl(0_80%_55%/0.3)] text-[hsl(0_80%_65%)] hover:bg-[hsl(0_80%_55%/0.25)] transition-colors cursor-pointer",children:"Odhlásit"})]})]}),e.jsx("div",{className:"flex gap-1 mb-6 bg-[hsl(210_18%_8%)] p-1 rounded-lg w-fit",children:["status","schedule","news"].map(r=>e.jsx("button",{onClick:()=>x(r),className:`px-4 py-1.5 rounded text-sm font-medium transition-colors cursor-pointer ${a===r?"bg-[hsl(110_73%_50%/0.15)] text-[hsl(110_73%_60%)] border border-[hsl(110_73%_50%/0.3)]":"text-muted-foreground hover:text-foreground"}`,children:r==="status"?"🟢 Status":r==="schedule"?"📅 Rozvrh":"📰 Novinky"},r))}),a==="status"?e.jsx(I,{}):a==="schedule"?e.jsx(L,{}):e.jsx(q,{})]})}const V=[{value:"online",label:"🟢 Online",desc:"Server funguje normálně",color:"hsl(110,73%,60%)",bg:"hsl(110,73%,50%/0.1)",border:"hsl(110,73%,50%/0.4)"},{value:"offline",label:"🔴 Offline",desc:"Server je nedostupný",color:"hsl(0,80%,65%)",bg:"hsl(0,80%,55%/0.1)",border:"hsl(0,80%,55%/0.4)"},{value:"restarting",label:"🟡 Restartuje se",desc:"Krátká odstávka, server se brzy vrátí",color:"hsl(48,100%,60%)",bg:"hsl(48,100%,55%/0.1)",border:"hsl(48,100%,55%/0.4)"},{value:"dev",label:"🔵 DEV TIME",desc:"Server je v režimu vývoje / testování",color:"hsl(210,90%,65%)",bg:"hsl(210,90%,55%/0.1)",border:"hsl(210,90%,55%/0.4)"}];function I(){const n=C(g.serverStatus.get),a=y(g.serverStatus.set),[x,c]=i.useState(null),u=async t=>{c(t);try{await a({status:t})}finally{c(null)}},m=n?.status??"online";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-foreground font-semibold mb-1",children:"Status serveru"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Zvol stav serveru — změní se okamžitě na hlavní stránce pro všechny."})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 mt-4",children:V.map(t=>{const r=m===t.value,o=x===t.value;return e.jsxs("button",{onClick:()=>u(t.value),disabled:x!==null,className:"p-5 rounded-xl text-left transition-all cursor-pointer hover:scale-[1.02] active:scale-[0.98] disabled:opacity-60 disabled:cursor-not-allowed",style:{background:r?t.bg:"hsl(210,18%,8%)",border:`2px solid ${r?t.border:"hsl(210,14%,14%)"}`,boxShadow:r?`0 0 20px ${t.bg}`:"none"},children:[e.jsx("div",{className:"font-semibold text-base mb-1",style:{color:t.color},children:o?"Ukládám…":t.label}),e.jsx("div",{className:"text-muted-foreground text-xs",children:t.desc}),r&&e.jsx("div",{className:"mt-2 text-[10px] font-semibold tracking-wider",style:{color:t.color,fontFamily:"'Press Start 2P', monospace"},children:"✓ AKTIVNÍ"})]},t.value)})}),e.jsx("div",{className:"mt-4 p-4 rounded-lg bg-[hsl(210_18%_8%)] border border-[hsl(210_14%_14%)]",children:e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["💡 ",e.jsx("strong",{className:"text-foreground",children:"Automatický restart"})," probíhá každý den v ",e.jsx("strong",{className:"text-[hsl(48,100%,60%)]",children:"23:50 – 00:00"}),'. Nastav status na „Restartuje se" před restartem a po dokončení přepni zpět na „Online".']})})]})}function L(){const n=C(g.schedule.list),a=y(g.schedule.upsert),x=y(g.schedule.remove),[c,u]=i.useState(null),[m,t]=i.useState(!1),[r,o]=i.useState({day:"",time:"",reason:"DEV Time",order:0}),[b,v]=i.useState(!1),N=()=>{o({day:"",time:"",reason:"DEV Time",order:n?.length??0}),t(!0),u(null)},S=l=>{o({day:l.day,time:l.time,reason:l.reason,order:l.order}),u(l),t(!1)},j=async l=>{l.preventDefault(),v(!0);try{await a({id:c?._id,...r}),t(!1),u(null)}finally{v(!1)}},k=async l=>{confirm("Opravdu smazat?")&&await x({id:l})},f="w-full px-3 py-2 rounded-lg text-sm text-foreground bg-[hsl(210_16%_11%)] border border-[hsl(210_14%_18%)] focus:border-[hsl(110_73%_50%/0.5)] focus:outline-none transition-colors";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h2",{className:"text-foreground font-semibold",children:"Plánované odstávky & DEV Time"}),e.jsx("button",{onClick:N,className:"px-4 py-2 text-sm rounded-lg font-medium cursor-pointer transition-all",style:{background:"hsl(110,73%,50%)",color:"hsl(210,20%,5%)"},children:"+ Přidat"})]}),(m||c)&&e.jsxs("form",{onSubmit:j,className:"bg-[hsl(210_18%_8%)] border border-[hsl(110_73%_50%/0.3)] rounded-xl p-5 space-y-3",children:[e.jsx("p",{className:"text-foreground font-medium text-sm",children:c?"Upravit položku":"Nová položka"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Den"}),e.jsx("input",{value:r.day,onChange:l=>o(h=>({...h,day:l.target.value})),placeholder:"např. Pondělí",required:!0,className:f})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Čas"}),e.jsx("input",{value:r.time,onChange:l=>o(h=>({...h,time:l.target.value})),placeholder:"např. 20:00 – 22:00",required:!0,className:f})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Typ"}),e.jsxs("select",{value:r.reason,onChange:l=>o(h=>({...h,reason:l.target.value})),className:f,children:[e.jsx("option",{children:"DEV Time"}),e.jsx("option",{children:"Automatický restart"}),e.jsx("option",{children:"Plánovaná odstávka"})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{type:"submit",disabled:b,className:"px-4 py-2 text-sm rounded-lg font-medium cursor-pointer",style:{background:"hsl(110,73%,50%)",color:"hsl(210,20%,5%)"},children:b?"Ukládám…":"Uložit"}),e.jsx("button",{type:"button",onClick:()=>{t(!1),u(null)},className:"px-4 py-2 text-sm rounded-lg border border-[hsl(210_14%_18%)] text-muted-foreground hover:text-foreground cursor-pointer transition-colors",children:"Zrušit"})]})]}),n===void 0&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"Načítám…"}),n?.length===0&&e.jsx("p",{className:"text-muted-foreground text-sm",children:'Žádné položky. Klikni na „Načíst výchozí data" nebo přidej novou.'}),e.jsx("div",{className:"space-y-2",children:n?.map(l=>e.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg border ${l.reason==="DEV Time"?"bg-[hsl(185_75%_55%/0.05)] border-[hsl(185_75%_55%/0.2)]":"bg-[hsl(210_18%_8%)] border-[hsl(210_14%_14%)]"}`,children:[e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${l.reason==="DEV Time"?"text-[hsl(185_75%_65%)]":"text-[hsl(0_80%_65%)]"}`,children:l.reason}),e.jsx("span",{className:"text-muted-foreground text-sm mx-2",children:"·"}),e.jsx("span",{className:"text-foreground text-sm",children:l.day}),e.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:l.time})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>S(l),className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer px-2 py-1",children:"Upravit"}),e.jsx("button",{onClick:()=>k(l._id),className:"text-xs text-[hsl(0_80%_60%)] hover:text-[hsl(0_80%_75%)] transition-colors cursor-pointer px-2 py-1",children:"Smazat"})]})]},l._id))})]})}const T=[{label:"AKTUALIZACE",color:"green"},{label:"DEV TIME",color:"cyan"},{label:"INFO",color:"yellow"},{label:"UDÁLOST",color:"green"},{label:"VAROVÁNÍ",color:"red"}];function q(){const n=C(g.news.list),a=y(g.news.upsert),x=y(g.news.remove),[c,u]=i.useState(null),[m,t]=i.useState(!1),[r,o]=i.useState({tag:"AKTUALIZACE",tagColor:"green",title:"",body:"",date:"",order:0}),[b,v]=i.useState(!1),N=new Date().toLocaleDateString("cs-CZ",{day:"numeric",month:"long",year:"numeric"}),S=()=>{o({tag:"AKTUALIZACE",tagColor:"green",title:"",body:"",date:N,order:n?.length??0}),t(!0),u(null)},j=s=>{o({tag:s.tag,tagColor:s.tagColor,title:s.title,body:s.body,date:s.date,order:s.order}),u(s),t(!1)},k=async s=>{s.preventDefault(),v(!0);try{await a({id:c?._id,...r}),t(!1),u(null)}finally{v(!1)}},f=s=>{const d=T.find(p=>p.label===s.target.value);o(p=>({...p,tag:s.target.value,tagColor:d?.color??"green"}))},l=async s=>{confirm("Opravdu smazat?")&&await x({id:s})},h="w-full px-3 py-2 rounded-lg text-sm text-foreground bg-[hsl(210_16%_11%)] border border-[hsl(210_14%_18%)] focus:border-[hsl(110_73%_50%/0.5)] focus:outline-none transition-colors";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h2",{className:"text-foreground font-semibold",children:"Novinky"}),e.jsx("button",{onClick:S,className:"px-4 py-2 text-sm rounded-lg font-medium cursor-pointer transition-all",style:{background:"hsl(110,73%,50%)",color:"hsl(210,20%,5%)"},children:"+ Přidat"})]}),(m||c)&&e.jsxs("form",{onSubmit:k,className:"bg-[hsl(210_18%_8%)] border border-[hsl(110_73%_50%/0.3)] rounded-xl p-5 space-y-3",children:[e.jsx("p",{className:"text-foreground font-medium text-sm",children:c?"Upravit novinku":"Nová novinka"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Typ"}),e.jsx("select",{value:r.tag,onChange:f,className:h,children:T.map(s=>e.jsx("option",{children:s.label},s.label))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Datum"}),e.jsx("input",{value:r.date,onChange:s=>o(d=>({...d,date:s.target.value})),placeholder:"npr. 3. července 2026",required:!0,className:h})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Nadpis"}),e.jsx("input",{value:r.title,onChange:s=>o(d=>({...d,title:s.target.value})),placeholder:"Nadpis novinky",required:!0,className:h})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-muted-foreground text-xs mb-1 block",children:"Text"}),e.jsx("textarea",{value:r.body,onChange:s=>o(d=>({...d,body:s.target.value})),placeholder:"Text novinky…",required:!0,rows:3,className:`${h} resize-none`})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{type:"submit",disabled:b,className:"px-4 py-2 text-sm rounded-lg font-medium cursor-pointer",style:{background:"hsl(110,73%,50%)",color:"hsl(210,20%,5%)"},children:b?"Ukládám…":"Uložit"}),e.jsx("button",{type:"button",onClick:()=>{t(!1),u(null)},className:"px-4 py-2 text-sm rounded-lg border border-[hsl(210_14%_18%)] text-muted-foreground hover:text-foreground cursor-pointer transition-colors",children:"Zrušit"})]})]}),n===void 0&&e.jsx("p",{className:"text-muted-foreground text-sm",children:"Načítám…"}),n?.length===0&&e.jsx("p",{className:"text-muted-foreground text-sm",children:'Žádné novinky. Klikni na „Načíst výchozí data" nebo přidej novou.'}),e.jsx("div",{className:"space-y-2",children:n?.map(s=>e.jsxs("div",{className:"flex items-start justify-between p-4 rounded-lg bg-[hsl(210_18%_8%)] border border-[hsl(210_14%_14%)]",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded border",style:{fontFamily:"'Press Start 2P', monospace",color:s.tagColor==="green"?"hsl(110,73%,60%)":s.tagColor==="cyan"?"hsl(185,75%,65%)":s.tagColor==="yellow"?"hsl(48,100%,60%)":"hsl(0,80%,65%)",borderColor:s.tagColor==="green"?"hsl(110,73%,50%,0.3
1)":"hsl(185,75%,55%,0.3)",background:"transparent"},children:s.tag}),e.jsx("span",{className:"text-muted-foreground text-xs",children:s.date})]}),e.jsx("p",{className:"text-foreground text-sm font-medium",children:s.title}),e.jsx("p",{className:"text-muted-foreground text-xs mt-0.5 truncate",children:s.body})]}),e.jsxs("div",{className:"flex gap-2 ml-4 flex-shrink-0",children:[e.jsx("button",{onClick:()=>j(s),className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer px-2 py-1",children:"Upravit"}),e.jsx("button",{onClick:()=>l(s._id),className:"text-xs text-[hsl(0_80%_60%)] hover:text-[hsl(0_80%_75%)] transition-colors cursor-pointer px-2 py-1",children:"Smazat"})]})]},s._id))})]})}export{$ as component};

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.