PageSourceSearch

https://squadbalance.com/build/assets/BulkAddPlayersForm-CGRqCEyD.js

js squadbalance.com collected 2026-10-02 01:46:58 UTC 2,441 bytes, 5 lines download raw bytes

1import{r as l,j as e}from"./vendor-wHC2ntYA.js";import{r as g}from"./inertia-BxUlTYdw.js";import{I as b}from"./InputError-sYI1RUTE.js";import{I as y}from"./InputLabel-Ci6p2K74.js";import{P as j}from"./PrimaryButton-C8LzVF4J.js";import{c as N}from"./app-CJjB2_mY.js";/* empty css            */const p=l.forwardRef(({className:m,...n},o)=>e.jsx("textarea",{className:N("flex min-h-[60px] w-full rounded-input border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",m),ref:o,...n}));p.displayName="Textarea";function I({squad:m}){const[n,o]=l.useState(""),[c,d]=l.useState(!1),[x,u]=l.useState({}),i=l.useMemo(()=>n.trim()?n.split(`
2`).filter(t=>t.trim()).map(t=>{const a=t.trim();return a.length>255?{name:a,error:"Name too long (max 255 characters)"}:{name:a}}):[],[n]),s=i.filter(r=>!r.error&&r.name.length>0),h=i.some(r=>r.error),f=r=>{r.preventDefault(),u({});const t=s.map(a=>({name:a.name,skill_rating:null}));d(!0),g.post(route("players.bulk-store",m.id),{players:t},{onSuccess:()=>{o("")},onError:a=>{u(a)},onFinish:()=>{d(!1)}})};return e.jsxs("form",{onSubmit:f,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(y,{htmlFor:"players-text",value:"Players"}),e.jsx(p,{id:"players-text",value:n,onChange:r=>o(r.target.value),className:"mt-1 block w-full min-h-[200px]",placeholder:`Enter one player per line:
3John Doe
4Jane Smith
5Bob Wilson`}),e.jsx(b,{message:x.players,className:"mt-2"})]}),i.length>0&&e.jsxs("div",{className:"rounded-lg border border-zinc-200 bg-stone-50 p-4",children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-zinc-700",children:["Preview (",s.length," valid player",s.length!==1?"s":"",")"]}),e.jsx("ul",{className:"max-h-[200px] space-y-1 overflow-y-auto text-sm",children:i.map((r,t)=>e.jsxs("li",{className:`${r.error?"text-red-600":"text-zinc-600"}`,children:[e.jsx("span",{className:"truncate",children:r.name||e.jsx("span",{className:"italic",children:"Empty"})}),r.error&&e.jsx("span",{className:"ml-2 text-xs",children:r.error})]},t))})]}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx(j,{className:"min-h-[44px] rounded-button",disabled:c||s.length===0||h,children:c?"Adding...":s.length===0?"Add Players":`Add ${s.length} Player${s.length!==1?"s":""}`})})]})}export{I 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.