PageSourceSearch

https://powercanvas.com/_next/static/chunks/2101-1b523b8d3da7c7f5.js

js powercanvas.com collected 2026-10-06 13:35:25 UTC 11,619 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2101],{42101:function(e,a,t){t.d(a,{Z:function(){return o}});var l=t(85893),i=t(67294),n=t(11163);function o(e){let{client:a,onClose:t,onCreated:o,redirectAfterCreate:c=!0}=e,p=(0,n.useRouter)(),[u,g]=(0,i.useState)({name:"",slug:"",teamSlug:(null==a?void 0:a.teamSlug)||"",description:"",isActive:!0,isPublic:!1,logoUrl:"",coverUrl:""}),[h,y]=(0,i.useState)(null),[b,m]=(0,i.useState)(!1),[f,x]=(0,i.useState)(!1),[j,v]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=e=>{"Escape"!==e.key||b||t()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,b]);let[k,S]=(0,i.useState)({checking:!1,available:null,message:""}),[w,z]=(0,i.useState)({checking:!1,available:null,message:""}),C=!!(null==a?void 0:a.teamSlug),T=(0,i.useCallback)(async(e,a)=>{if(!e||e.length<3){S({checking:!1,available:null,message:""});return}S({checking:!0,available:null,message:"Sprawdzanie..."});try{let t=await fetch("/api/team-shops/check-slug",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,teamSlug:a})}),l=await t.json();l.available?S({checking:!1,available:!0,message:"✓ Adres dostępny"}):S({checking:!1,available:!1,message:l.reason||"Adres zajęty"})}catch(e){S({checking:!1,available:!1,message:"Błąd sprawdzania"})}},[]),U=(0,i.useCallback)(async e=>{if(!e||e.length<3){z({checking:!1,available:null,message:""});return}z({checking:!0,available:null,message:"Sprawdzanie..."});try{let a=await fetch("/api/team-slug/check-availability",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e})});(await a.json()).available?z({checking:!1,available:!0,message:"✓ Adres dostępny"}):z({checking:!1,available:!1,message:"Adres zajęty"})}catch(e){z({checking:!1,available:!1,message:"Błąd sprawdzania"})}},[]);(0,i.useEffect)(()=>{let e=setTimeout(()=>{let e=C?a.teamSlug:u.teamSlug;e&&T(u.slug,e)},400);return()=>clearTimeout(e)},[u.slug,u.teamSlug,null==a?void 0:a.teamSlug,C,T]),(0,i.useEffect)(()=>{if(C)return;let e=setTimeout(()=>U(u.teamSlug),400);return()=>clearTimeout(e)},[u.teamSlug,C,U]);let B=async e=>{if(e.preventDefault(),y(null),!u.name||!u.slug){y("Wypełnij nazwę i adres sklepu");return}if(!C){if(!u.teamSlug||u.teamSlug.length<3){y("Adres drużyny jest wymagany (minimum 3 znaki)");return}if(!1===w.available){y("Wybrany adres drużyny jest zajęty");return}}if(!1===k.available){y("Wybrany adres sklepu jest niedostępny");return}m(!0);try{let e=await fetch("/api/admin/teamshops",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.name,slug:u.slug,description:u.description||null,clientId:a.id,isActive:u.isActive,isPublic:u.isPublic,logoUrl:u.logoUrl||null,coverUrl:u.coverUrl||null,teamSlug:C?a.teamSlug:u.teamSlug})}),t=await e.json();if(!t.success){y(t.error||"Nie udało się utworzyć sklepu");return}await fetch("/api/admin/teamshops/pipeline",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t.shop.id,stage:"todo"})}),null==o||o(t.shop),c&&p.push("/admin/teamshops/".concat(t.shop.id))}catch(e){console.error("CreateShopModal error:",e),y("Wystąpił błąd podczas tworzenia sklepu")}finally{m(!1)}},A=async(e,t)=>{if(!e)return;let l="logo"===t?x:v;l(!0);try{let l=await new Promise((a,t)=>{let l=new FileReader;l.onload=()=>a(l.result),l.onerror=t,l.readAsDataURL(e)}),i=await fetch("/api/upload-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:l,folder:"team-shops",filename:"".concat(a.id,"_shop_").concat(t,"_").concat(Date.now())})}),n=await i.json();n.success?g(e=>({...e,["logo"===t?"logoUrl":"coverUrl"]:n.url})):y("Błąd uploadu: ".concat(n.error))}catch(e){y("Wystąpił błąd podczas uploadu obrazka")}finally{l(!1)}},R=C?a.teamSlug:u.teamSlug;return(0,l.jsx)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"create-shop-modal-title",style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",padding:16},onClick:e=>{e.target===e.currentTarget&&t()},children:(0,l.jsxs)("div",{style:{background:"#fff",borderRadius:12,width:"100%",maxWidth:520,maxHeight:"90vh",overflowY:"auto",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},children:[(0,l.jsxs)("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{id:"create-shop-modal-title",style:{margin:0,fontSize:18,fontWeight:700,color:"#111827"},children:"Utw\xf3rz sklep drużynowy"}),(0,l.jsx)("p",{style:{margin:"4px 0 0",fontSize:13,color:"#6b7280"},children:null==a?void 0:a.name})]}),(0,l.jsx)("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:20,color:"#9ca3af",padding:"4px 8px"},children:"✕"})]}),(0,l.jsxs)("form",{onSubmit:B,style:{padding:24},children:[h&&(0,l.jsx)("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:8,marginBottom:20,color:"#dc2626",fontSize:13},children:h}),!C&&(0,l.jsxs)("div",{style:{marginBottom:20,padding:14,background:"#fffbeb",border:"1px solid #fcd34d",borderRadius:8},children:[(0,l.jsxs)("label",{style:s,children:["Adres drużyny ",(0,l.jsx)(d,{})]}),(0,l.jsx)("p",{style:{fontSize:12,color:"#92400e",margin:"0 0 8px"},children:"Ta drużyna nie ma jeszcze adresu URL. Ustaw go teraz."}),(0,l.jsx)("input",{style:{...r,fontFamily:"monospace",borderColor:!1===w.available?"#dc2626":!0===w.available?"#16a34a":"#fcd34d"},placeholder:"np. gryfony-2026",value:u.teamSlug,onChange:e=>g(a=>({...a,teamSlug:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")}))}),(0,l.jsx)("p",{style:{fontSize:11,margin:"4px 0 0",color:!1===w.available?"#dc2626":!0===w.available?"#16a34a":"#92400e"}
1,children:w.checking?"Sprawdzanie...":w.message||"Tylko małe litery, cyfry i myślniki. Min. 3 znaki."})]}),C&&(0,l.jsxs)("div",{style:{marginBottom:20,padding:"10px 14px",background:"#f0fdf4",border:"1px solid #86efac",borderRadius:8,display:"flex",gap:10,alignItems:"center"},children:[(0,l.jsx)("span",{style:{fontSize:16},children:"✅"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{style:{fontSize:11,color:"#166534"},children:"Adres drużyny"}),(0,l.jsxs)("div",{style:{fontFamily:"monospace",fontWeight:600,color:"#166534",fontSize:13},children:["/",a.teamSlug]})]})]}),(0,l.jsxs)("div",{style:{marginBottom:16},children:[(0,l.jsxs)("label",{style:s,children:["Nazwa sklepu ",(0,l.jsx)(d,{})]}),(0,l.jsx)("input",{style:r,placeholder:"np. Sezon Wiosna 2026",value:u.name,onChange:e=>{let a=e.target.value;g(e=>({...e,name:a,slug:a.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").substring(0,50)}))},required:!0,autoFocus:!0})]}),(0,l.jsxs)("div",{style:{marginBottom:16},children:[(0,l.jsxs)("label",{style:s,children:["Adres sklepu ",(0,l.jsx)(d,{})]}),(0,l.jsx)("input",{style:{...r,fontFamily:"monospace",borderColor:!1===k.available?"#dc2626":!0===k.available?"#16a34a":void 0},placeholder:"sezon-wiosna-2026",value:u.slug,onChange:e=>g(a=>({...a,slug:e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")})),required:!0}),(0,l.jsx)("p",{style:{fontSize:11,margin:"4px 0 0",color:!1===k.available?"#dc2626":!0===k.available?"#16a34a":"#6b7280"},children:k.checking?"Sprawdzanie...":k.message||(R?"URL: /team-shops/".concat(R,"/").concat(u.slug||"..."):"Najpierw ustaw adres drużyny")})]}),(0,l.jsxs)("div",{style:{marginBottom:20},children:[(0,l.jsx)("label",{style:s,children:"Opis (opcjonalny)"}),(0,l.jsx)("textarea",{style:{...r,minHeight:70,resize:"vertical"},placeholder:"Kr\xf3tki opis sklepu...",value:u.description,onChange:e=>g(a=>({...a,description:e.target.value})),maxLength:500})]}),(0,l.jsxs)("div",{style:{display:"flex",gap:16,marginBottom:20,paddingBottom:20,borderBottom:"1px solid #e5e7eb"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{style:{...s,marginBottom:6},children:"Logo"}),(0,l.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,l.jsx)("img",{src:u.logoUrl||"/images/placeholders/team-shop-logo.png",alt:"Logo",style:{width:80,height:80,borderRadius:10,objectFit:"cover",border:"1px solid #e2e8f0",display:"block"}}),u.logoUrl&&(0,l.jsx)("button",{type:"button",onClick:()=>g(e=>({...e,logoUrl:""})),style:{position:"absolute",top:-6,right:-6,width:20,height:20,borderRadius:"50%",background:"#ef4444",color:"white",border:"none",cursor:"pointer",fontSize:10,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]}),(0,l.jsxs)("label",{style:{display:"block",marginTop:6,cursor:f?"wait":"pointer",opacity:f?.6:1},children:[(0,l.jsx)("span",{style:{fontSize:12,color:"#6b7280",textDecoration:"underline"},children:f?"Wgrywanie...":"Zmień zdjęcie"}),(0,l.jsx)("input",{type:"file",accept:"image/*",onChange:e=>A(e.target.files[0],"logo"),disabled:f,style:{display:"none"}})]})]}),(0,l.jsxs)("div",{style:{flex:1},children:[(0,l.jsx)("label",{style:{...s,marginBottom:6},children:"Banner"}),(0,l.jsxs)("div",{style:{position:"relative"},children:[(0,l.jsx)("img",{src:u.coverUrl||"/images/placeholders/team-shop-banner.jpg",alt:"Banner",style:{width:"100%",height:80,borderRadius:10,objectFit:"cover",border:"1px solid #e2e8f0",display:"block"}}),u.coverUrl&&(0,l.jsx)("button",{type:"button",onClick:()=>g(e=>({...e,coverUrl:""})),style:{position:"absolute",top:-6,right:-6,width:20,height:20,borderRadius:"50%",background:"#ef4444",color:"white",border:"none",cursor:"pointer",fontSize:10,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]}),(0,l.jsxs)("label",{style:{display:"block",marginTop:6,cursor:j?"wait":"pointer",opacity:j?.6:1},children:[(0,l.jsx)("span",{style:{fontSize:12,color:"#6b7280",textDecoration:"underline"},children:j?"Wgrywanie...":"Zmień zdjęcie"}),(0,l.jsx)("input",{type:"file",accept:"image/*",onChange:e=>A(e.target.files[0],"cover"),disabled:j,style:{display:"none"}})]})]})]}),(0,l.jsxs)("div",{style:{marginBottom:24,display:"flex",gap:24},children:[(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:14},children:[(0,l.jsx)("input",{type:"checkbox",checked:u.isActive,onChange:e=>g(a=>({...a,isActive:e.target.checked})),style:{width:16,height:16}}),"Sklep aktywny"]}),(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:14},children:[(0,l.jsx)("input",{type:"checkbox",checked:u.isPublic,onChange:e=>g(a=>({...a,isPublic:e.target.checked})),style:{width:16,height:16}}),"Sklep publiczny"]})]}),(0,l.jsxs)("div",{style:{display:"flex",gap:10,justifyContent:"flex-end"},children:[(0,l.jsx)("button",{type:"button",onClick:t,style:{padding:"9px 18px",fontSize:14,fontWeight:600,border:"1px solid #e5e7eb",borderRadius:8,background:"#fff",color:"#374151",cursor:"pointer"},children:"Anuluj"}),(0,l.jsx)("button",{type:"submit",disabled:b,style:{padding:"9px 20px",fontSize:14,fontWeight:600,border:"none",borderRadius:8,background:b?"#9ca3af":"#10b981",color:"#fff",cursor:b?"not-allowed":"pointer"},children:b?"Tworzenie...":"\uD83C\uDFEA Utw\xf3rz sklep"})]})]})]})})}let s={display:"block",fontSize:13,fontWeight:600,color:"#374151",marginBottom:6},r={width:"100%",boxSizing:"border-box",padding:"8px 12px",fontSize:14,border:"1px solid #d1d5db",borderRadius:8,outline:"none",color:"#111827"};function d(){return(0,l.jsx)("span",{style:{color:"#dc2626"},children:" *"})}}}]);

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.