@mblinkov/whats-missing 20.0.4 → 20.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),se=window.origin+"/cloud/speakid/games/whatsmissing/",M=(r,c)=>r.map(([l,s])=>({src:`${se}${c}/${s.replace(/\s/g,"%20")}.png`,name:s})),ne=[["apple","apple"],["banana","banana"],["bread","bread"],["burger","burger"],["cake","cake"],["carrot","carrot"],["cheese","cheese"],["chicken","chicken"],["chocolate","chocolate"],["corn","corn"],["donut","donut"],["fish","fish"],["fries","fries"],["grapes","grapes"],["ice_cream","ice cream"],["milk","milk"],["orange","orange"],["pear","pear"],["pizza","pizza"],["rice","rice"],["sandwich","sandwich"],["soup","soup"],["strawberry","strawberry"],["tomato","tomato"],["watermelon","watermelon"]],re=[["bear","bear"],["cat","cat"],["crocodile","crocodile"],["dolphin","dolphin"],["elephant","elephant"],["fox","fox"],["giraffe","giraffe"],["horse","horse"],["kangaroo","kangaroo"],["lion","lion"],["monkey","monkey"],["owl","owl"],["panda","panda"],["penguin","penguin"],["squirrel","squirrel"],["tiger","tiger"],["tortoise","tortoise"],["wolf","wolf"],["zebra","zebra"]],ie=[["ball","ball"],["balloon","balloon"],["blocks","blocks"],["car","car"],["doll","doll"],["drum","drum"],["guitar","guitar"],["jump_rope","jump rope"],["kite","kite"],["paints","paints"],["plane","plane"],["puzzle","puzzle"],["rocket","rocket"],["scooter","scooter"],["skateboard","skateboard"],["slide","slide"],["teddy_bear","teddy bear"],["yo-yo","yo-yo"],["crayons","crayons"]],B={food:M(ne,"food"),animals:M(re,"animals"),toys:M(ie,"toys")},le=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),oe=window.origin+"/cloud/speakid/games/whatsmissing/",M=(r,c)=>r.map(([l,o])=>({src:`${oe}${c}/${o.replace(/\s/g,"%20")}.png`,name:o})),ne=[["apple","apple"],["banana","banana"],["bread","bread"],["burger","burger"],["cake","cake"],["carrot","carrot"],["cheese","cheese"],["chicken","chicken"],["chocolate","chocolate"],["corn","corn"],["donut","donut"],["fish","fish"],["fries","fries"],["grapes","grapes"],["ice_cream","ice cream"],["milk","milk"],["orange","orange"],["pear","pear"],["pizza","pizza"],["rice","rice"],["sandwich","sandwich"],["soup","soup"],["strawberry","strawberry"],["tomato","tomato"],["watermelon","watermelon"]],re=[["bear","bear"],["cat","cat"],["crocodile","crocodile"],["dolphin","dolphin"],["elephant","elephant"],["fox","fox"],["giraffe","giraffe"],["horse","horse"],["kangaroo","kangaroo"],["lion","lion"],["monkey","monkey"],["owl","owl"],["panda","panda"],["penguin","penguin"],["squirrel","squirrel"],["tiger","tiger"],["tortoise","tortoise"],["wolf","wolf"],["zebra","zebra"]],ie=[["ball","ball"],["balloon","balloon"],["blocks","blocks"],["car","car"],["doll","doll"],["drum","drum"],["guitar","guitar"],["jump_rope","jump rope"],["kite","kite"],["paints","paints"],["plane","plane"],["puzzle","puzzle"],["rocket","rocket"],["scooter","scooter"],["skateboard","skateboard"],["slide","slide"],["teddy_bear","teddy bear"],["yo-yo","yo-yo"],["crayons","crayons"]],B={food:M(ne,"food"),animals:M(re,"animals"),toys:M(ie,"toys")},le=`
2
2
  @keyframes spin {
3
3
  from { transform: rotate(0deg); }
4
4
  to { transform: rotate(360deg); }
5
5
  }
6
- `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=le,document.head.appendChild(r)}const ae={animation:"spin 1.4s linear infinite"},o={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100vh",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"600px",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"calc(210px * 3 + 20px * 2)",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent"},gmHourglass:{fontSize:"42px",...ae}},de=window.origin+"/cloud/speakid/games/whatsmissing/logo.png",ce=()=>{const r=document.createElement("style");r.textContent=`
6
+ `;if(typeof document<"u"&&!document.getElementById("spin-keyframes")){const r=document.createElement("style");r.id="spin-keyframes",r.innerHTML=le,document.head.appendChild(r)}const ae={animation:"spin 1.4s linear infinite"},s={gmCenterScreen:{position:"relative",zIndex:1,minHeight:"100vh",width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",textAlign:"center",color:"#1f2937",padding:"24px 16px",boxSizing:"border-box",transform:"translateY(20px)"},gmHeadline1:{fontWeight:700,fontSize:"clamp(28px, 4vw, 40px)",lineHeight:"110%"},gmHeadline3:{fontWeight:600,fontSize:"18px",lineHeight:"130%"},gmBodyM:{fontWeight:400,fontSize:"16px",lineHeight:"140%"},gmBodyS:{fontWeight:400,fontSize:"14px",lineHeight:"140%",color:"#6b7280"},gmButton:{fontFamily:'"Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans"',fontWeight:600,fontSize:"16px",padding:"10px 16px",borderRadius:"12px",border:"1px solid #e5e7eb",background:"#ec4c44",color:"#ffffff",cursor:"pointer",boxShadow:"0 6px 18px rgba(236, 76, 68, .18)",transition:"transform .06s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease"},gmButtonActive:{background:"#333",color:"#fff"},gmGameLayout:{position:"relative",width:"100%",maxWidth:"600px",minHeight:"100vh",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",color:"#1f2937",padding:"16px 8px",margin:"0 auto"},gmGrid:{width:"100%",maxWidth:"calc(210px * 3 + 20px * 2)",margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(3, 210px)",gridAutoRows:"210px",gap:"20px",justifyContent:"center"},gmCard:{border:"1px solid #e5e7eb",borderRadius:"16px",background:"#f9f9f9",aspectRatio:"1 / 1",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",transition:"transform .2s ease, box-shadow .2s ease, border-color .2s ease"},gmCorrect:{border:"2px solid #10b981",boxShadow:"0 0 18px rgba(16,185,129,.45)",background:"#ecfdf5"},gmWrong:{border:"2px solid #ec4c44",boxShadow:"0 0 18px rgba(236,76,68,.35)",background:"#fef2f2"},gmInput:{padding:"6px 10px",borderRadius:"6px",border:"1px solid #ccc",fontSize:"16px",fontFamily:'"Geist", system-ui',width:"160px"},gmTable:{marginTop:"20px",marginBottom:"32px",borderCollapse:"collapse",width:"100%",maxWidth:"520px",tableLayout:"fixed",textAlign:"center"},gmTableCell:{padding:"8px 12px",borderBottom:"1px solid #e5e7eb",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},gmLogoFixed:{position:"absolute",top:"16px",left:"24px",width:"120px",zIndex:10,pointerEvents:"none",background:"transparent"},gmLogoImg:{height:"clamp(28px, 5vw, 40px)",width:"auto",background:"transparent"},gmHourglass:{fontSize:"42px",...ae}},de=window.origin+"/cloud/speakid/games/whatsmissing/logo.png",ce=()=>{const r=document.createElement("style");r.textContent=`
7
7
  html, body, #root {
8
8
  margin: 0;
9
9
  padding: 0;
@@ -33,4 +33,4 @@
33
33
  from { transform: rotate(0deg); }
34
34
  to { transform: rotate(360deg); }
35
35
  }
36
- `,document.head.appendChild(r)},me=(r,c)=>{const l=Array.from({length:r.length+1},()=>Array(c.length+1).fill(0));for(let s=0;s<=r.length;s++)l[s][0]=s;for(let s=0;s<=c.length;s++)l[0][s]=s;for(let s=1;s<=r.length;s++)for(let a=1;a<=c.length;a++)l[s][a]=r[s-1]===c[a-1]?l[s-1][a-1]:Math.min(l[s-1][a-1],l[s][a-1],l[s-1][a])+1;return l[r.length][c.length]};function ge(){n.useEffect(()=>{ce()},[]);const[r,c]=n.useState(null),[l,s]=n.useState([]),[a,$]=n.useState(4),[h,L]=n.useState(!1),[f,W]=n.useState(1),[u,K]=n.useState(null),[m,y]=n.useState("ready"),[E,G]=n.useState(3),[k,C]=n.useState(7),[T,F]=n.useState(20),[V,v]=n.useState(0),[b,z]=n.useState(!1),[w,D]=n.useState(""),[p,R]=n.useState(!1),[I,q]=n.useState(!1),[P,x]=n.useState(null),[Z,A]=n.useState([]),[J,U]=n.useState([]),[j,Q]=n.useState(!1);n.useEffect(()=>{const t=()=>Q(window.innerWidth<768);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const Y=t=>[...t].sort(()=>Math.random()-.5).slice(0,6),N=()=>{if(!r)return;const t=Y(B[r]);s(t),L(!0),z(!1),W(1),v(0),A([]),U([]),O(t,[],!0)},O=(t=l,i=J,g=!1)=>{const d=Y(t.length?t:B[r]);let S=Math.floor(Math.random()*d.length),H=d[S].name,_=0;for(;i.includes(H)&&_<20;)S=Math.floor(Math.random()*d.length),H=d[S].name,_++;s(d),K(S),U([...i,H]),R(!1),D(""),F(20),x(null),g?(y("ready"),G(3),C(7)):(y("memorize"),C(7))};n.useEffect(()=>{if(!(!h||b||p)){if(m==="ready")if(E<=0)y("memorize");else{const t=setTimeout(()=>G(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="memorize")if(k<=0)y("guess");else{const t=setTimeout(()=>C(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="guess"){if(T<=0){R(!0),x("wrong");const i=l[u].name;A(g=>[...g,{round:f,answer:w,correct:i,result:"wrong"}]);return}const t=setTimeout(()=>F(i=>i-1),1e3);return()=>clearTimeout(t)}}},[m,E,k,T,h,b,p,l,u,f,w]);const X=()=>{if(u===null||I)return;const t=l[u].name,i=w.toLowerCase().trim();let g="wrong";i===t?(v(d=>d+1),x("correct"),g="correct"):me(i,t)===1?(v(d=>d+.5),x("almost"),g="almost"):(x("wrong"),g="wrong"),A(d=>[...d,{round:f,answer:i,correct:t,result:g}]),q(!0),setTimeout(()=>{q(!1),R(!0)},600)},ee=()=>f<a?(W(t=>t+1),O()):z(!0),te=()=>{L(!1),z(!1),c(null)},oe=n.useMemo(()=>e.jsx("div",{style:o.gmLogoFixed,children:e.jsx("img",{src:de,alt:"SPEAKID Logo",style:o.gmLogoImg})}),[]);return e.jsxs(e.Fragment,{children:[!j&&oe,!r&&!h&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsx("h1",{style:o.gmHeadline1,children:"WHAT'S MISSING?"}),e.jsx("p",{style:o.gmBodyM,children:"Select a theme:"}),e.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(t=>e.jsx("button",{style:o.gmButton,onClick:()=>c(t),children:t==="animals"?"🐶 Animals":t==="food"?"🍎 Food":"🧸 Toys"},t))}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx("p",{style:o.gmBodyS,children:"Choose number of rounds:"}),e.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(t=>e.jsx("button",{style:{...o.gmButton,...a===t?o.gmButtonActive:{}},onClick:()=>$(t),children:t},t))})]})]}),r&&!h&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsxs("h1",{style:o.gmHeadline1,children:["Theme selected: ",r]}),e.jsxs("p",{style:o.gmBodyM,children:["Rounds: ",a]}),e.jsx("button",{style:o.gmButton,onClick:N,children:"▶ Start game"})]}),b&&e.jsxs("div",{style:o.gmCenterScreen,children:[e.jsx("h1",{style:o.gmHeadline1,children:"Results"}),e.jsxs("h2",{style:o.gmHeadline3,children:["Your score: ",V," / ",a]}),e.jsxs("table",{style:o.gmTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Round"}),e.jsx("th",{children:"Your Answer"}),e.jsx("th",{children:"Correct"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:Z.map((t,i)=>e.jsxs("tr",{children:[e.jsx("td",{style:o.gmTableCell,children:t.round}),e.jsx("td",{style:o.gmTableCell,children:t.answer||"—"}),e.jsx("td",{style:o.gmTableCell,children:t.correct}),e.jsx("td",{style:o.gmTableCell,children:t.result==="correct"?"✔ Correct":t.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},i))})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[e.jsx("button",{style:o.gmButton,onClick:N,children:"🔁 Play again"}),e.jsx("button",{style:o.gmButton,onClick:te,children:"⬅️ Choose theme"})]})]}),h&&!b&&e.jsxs("div",{style:o.gmGameLayout,children:[e.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[m==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:{...o.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),e.jsx("div",{style:o.gmHourglass,children:"⏳"})]}),m==="memorize"&&e.jsxs("p",{style:{...o.gmBodyM,color:"#10b981"},children:["MEMORIZE (",k,")"]}),m==="guess"&&!p&&e.jsxs("p",{style:o.gmBodyM,children:["⏳ Time left: ",T,"s"]})]}),m!=="ready"&&e.jsx("div",{style:{...o.gmGrid,gridTemplateColumns:j?"repeat(2, 1fr)":"repeat(3, 210px)",gridAutoRows:j?"150px":"210px",gap:j?"12px":"20px",justifyItems:"center",...window.innerWidth>2e3?{gridTemplateColumns:"repeat(3, 260px)",gridAutoRows:"260px",gap:"28px"}:{},...window.innerWidth>2560?{gridTemplateColumns:"repeat(3, 300px)",gridAutoRows:"300px",gap:"32px"}:{}},children:l.map((t,i)=>{const g=u===i&&m==="guess"&&!p;return e.jsx("div",{style:{...o.gmCard,...P==="correct"&&u===i?o.gmCorrect:{},...P==="wrong"&&u===i?o.gmWrong:{}},children:!g&&e.jsx("img",{src:t.src,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},i)})}),e.jsxs("div",{style:{marginTop:16,height:80},children:[m==="guess"&&!p&&e.jsxs("div",{children:[e.jsx("input",{type:"text",placeholder:"Type the missing word",value:w,onChange:t=>D(t.target.value),style:o.gmInput}),e.jsx("button",{style:{...o.gmButton,marginLeft:8},onClick:X,disabled:I,children:I?"...":"Check"})]}),p&&e.jsx("button",{style:o.gmButton,onClick:ee,children:"Next round"})]})]})]})}exports.Game=ge;exports.themes=B;
36
+ `,document.head.appendChild(r)},me=(r,c)=>{const l=Array.from({length:r.length+1},()=>Array(c.length+1).fill(0));for(let o=0;o<=r.length;o++)l[o][0]=o;for(let o=0;o<=c.length;o++)l[0][o]=o;for(let o=1;o<=r.length;o++)for(let a=1;a<=c.length;a++)l[o][a]=r[o-1]===c[a-1]?l[o-1][a-1]:Math.min(l[o-1][a-1],l[o][a-1],l[o-1][a])+1;return l[r.length][c.length]};function ge(){n.useEffect(()=>{ce()},[]);const[r,c]=n.useState(null),[l,o]=n.useState([]),[a,$]=n.useState(4),[h,L]=n.useState(!1),[f,W]=n.useState(1),[u,K]=n.useState(null),[m,y]=n.useState("ready"),[E,G]=n.useState(3),[k,C]=n.useState(7),[T,F]=n.useState(20),[V,v]=n.useState(0),[b,z]=n.useState(!1),[w,D]=n.useState(""),[p,R]=n.useState(!1),[I,q]=n.useState(!1),[P,x]=n.useState(null),[Z,A]=n.useState([]),[J,U]=n.useState([]),[j,Q]=n.useState(!1);n.useEffect(()=>{const t=()=>Q(window.innerWidth<768);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const Y=t=>[...t].sort(()=>Math.random()-.5).slice(0,6),N=()=>{if(!r)return;const t=Y(B[r]);o(t),L(!0),z(!1),W(1),v(0),A([]),U([]),O(t,[],!0)},O=(t=l,i=J,g=!1)=>{const d=Y(t.length?t:B[r]);let S=Math.floor(Math.random()*d.length),H=d[S].name,_=0;for(;i.includes(H)&&_<20;)S=Math.floor(Math.random()*d.length),H=d[S].name,_++;o(d),K(S),U([...i,H]),R(!1),D(""),F(20),x(null),g?(y("ready"),G(3),C(7)):(y("memorize"),C(7))};n.useEffect(()=>{if(!(!h||b||p)){if(m==="ready")if(E<=0)y("memorize");else{const t=setTimeout(()=>G(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="memorize")if(k<=0)y("guess");else{const t=setTimeout(()=>C(i=>i-1),1e3);return()=>clearTimeout(t)}if(m==="guess"){if(T<=0){R(!0),x("wrong");const i=l[u].name;A(g=>[...g,{round:f,answer:w,correct:i,result:"wrong"}]);return}const t=setTimeout(()=>F(i=>i-1),1e3);return()=>clearTimeout(t)}}},[m,E,k,T,h,b,p,l,u,f,w]);const X=()=>{if(u===null||I)return;const t=l[u].name,i=w.toLowerCase().trim();let g="wrong";i===t?(v(d=>d+1),x("correct"),g="correct"):me(i,t)===1?(v(d=>d+.5),x("almost"),g="almost"):(x("wrong"),g="wrong"),A(d=>[...d,{round:f,answer:i,correct:t,result:g}]),q(!0),setTimeout(()=>{q(!1),R(!0)},600)},ee=()=>f<a?(W(t=>t+1),O()):z(!0),te=()=>{L(!1),z(!1),c(null)},se=n.useMemo(()=>e.jsx("div",{style:s.gmLogoFixed,children:e.jsx("img",{src:de,alt:"SPEAKID Logo",style:s.gmLogoImg})}),[]);return e.jsx("div",{id:"whats-missing-root",style:{all:"initial",display:"block"},children:e.jsxs("div",{style:{all:"unset"},children:[!j&&se,!r&&!h&&e.jsxs("div",{style:s.gmCenterScreen,children:[e.jsx("h1",{style:s.gmHeadline1,children:"WHAT'S MISSING?"}),e.jsx("p",{style:s.gmBodyM,children:"Select a theme:"}),e.jsx("div",{style:{display:"flex",gap:16},children:["animals","food","toys"].map(t=>e.jsx("button",{style:s.gmButton,onClick:()=>c(t),children:t==="animals"?"🐶 Animals":t==="food"?"🍎 Food":"🧸 Toys"},t))}),e.jsxs("div",{style:{marginTop:24},children:[e.jsx("p",{style:s.gmBodyS,children:"Choose number of rounds:"}),e.jsx("div",{style:{display:"flex",gap:12,marginTop:8},children:[3,4,5].map(t=>e.jsx("button",{style:{...s.gmButton,...a===t?s.gmButtonActive:{}},onClick:()=>$(t),children:t},t))})]})]}),r&&!h&&e.jsxs("div",{style:s.gmCenterScreen,children:[e.jsxs("h1",{style:s.gmHeadline1,children:["Theme selected: ",r]}),e.jsxs("p",{style:s.gmBodyM,children:["Rounds: ",a]}),e.jsx("button",{style:s.gmButton,onClick:N,children:"▶ Start game"})]}),b&&e.jsxs("div",{style:s.gmCenterScreen,children:[e.jsx("h1",{style:s.gmHeadline1,children:"Results"}),e.jsxs("h2",{style:s.gmHeadline3,children:["Your score: ",V," / ",a]}),e.jsxs("table",{style:s.gmTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Round"}),e.jsx("th",{children:"Your Answer"}),e.jsx("th",{children:"Correct"}),e.jsx("th",{children:"Result"})]})}),e.jsx("tbody",{children:Z.map((t,i)=>e.jsxs("tr",{children:[e.jsx("td",{style:s.gmTableCell,children:t.round}),e.jsx("td",{style:s.gmTableCell,children:t.answer||"—"}),e.jsx("td",{style:s.gmTableCell,children:t.correct}),e.jsx("td",{style:s.gmTableCell,children:t.result==="correct"?"✔ Correct":t.result==="almost"?"◐ Almost (0.5)":"✘ Wrong"})]},i))})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24},children:[e.jsx("button",{style:s.gmButton,onClick:N,children:"🔁 Play again"}),e.jsx("button",{style:s.gmButton,onClick:te,children:"⬅️ Choose theme"})]})]}),h&&!b&&e.jsxs("div",{style:s.gmGameLayout,children:[e.jsxs("div",{style:{minHeight:160,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[m==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{style:{...s.gmHeadline1,color:"#ec4c44"},children:"GET READY"}),e.jsx("div",{style:s.gmHourglass,children:"⏳"})]}),m==="memorize"&&e.jsxs("p",{style:{...s.gmBodyM,color:"#10b981"},children:["MEMORIZE (",k,")"]}),m==="guess"&&!p&&e.jsxs("p",{style:s.gmBodyM,children:["⏳ Time left: ",T,"s"]})]}),m!=="ready"&&e.jsx("div",{style:{...s.gmGrid,gridTemplateColumns:j?"repeat(2, 1fr)":"repeat(3, 210px)",gridAutoRows:j?"150px":"210px",gap:j?"12px":"20px",justifyItems:"center",...window.innerWidth>2e3?{gridTemplateColumns:"repeat(3, 260px)",gridAutoRows:"260px",gap:"28px"}:{},...window.innerWidth>2560?{gridTemplateColumns:"repeat(3, 300px)",gridAutoRows:"300px",gap:"32px"}:{}},children:l.map((t,i)=>{const g=u===i&&m==="guess"&&!p;return e.jsx("div",{style:{...s.gmCard,...P==="correct"&&u===i?s.gmCorrect:{},...P==="wrong"&&u===i?s.gmWrong:{}},children:!g&&e.jsx("img",{src:t.src,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}})},i)})}),e.jsxs("div",{style:{marginTop:16,height:80},children:[m==="guess"&&!p&&e.jsxs("div",{children:[e.jsx("input",{type:"text",placeholder:"Type the missing word",value:w,onChange:t=>D(t.target.value),style:s.gmInput}),e.jsx("button",{style:{...s.gmButton,marginLeft:8},onClick:X,disabled:I,children:I?"...":"Check"})]}),p&&e.jsx("button",{style:s.gmButton,onClick:ee,children:"Next round"})]})]})]})})}exports.Game=ge;exports.themes=B;
@@ -1,4 +1,4 @@
1
- import { jsx as o, jsxs as s, Fragment as O } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as s, Fragment as ie } from "react/jsx-runtime";
2
2
  import { useEffect as L, useState as l, useMemo as se } from "react";
3
3
  const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r.map(([a, n]) => ({
4
4
  src: `${le}${m}/${n.replace(/\s/g, "%20")}.png`,
@@ -69,7 +69,7 @@ const le = window.origin + "/cloud/speakid/games/whatsmissing/", W = (r, m) => r
69
69
  ["teddy_bear", "teddy bear"],
70
70
  ["yo-yo", "yo-yo"],
71
71
  ["crayons", "crayons"]
72
- ], V = {
72
+ ], O = {
73
73
  food: W(ae, "food"),
74
74
  animals: W(de, "animals"),
75
75
  toys: W(ce, "toys")
@@ -274,21 +274,21 @@ function xe() {
274
274
  L(() => {
275
275
  ue();
276
276
  }, []);
277
- const [r, m] = l(null), [a, n] = l([]), [d, Z] = l(4), [f, j] = l(!1), [x, E] = l(1), [u, J] = l(null), [g, b] = l("ready"), [G, F] = l(3), [v, S] = l(7), [z, D] = l(20), [Q, R] = l(0), [w, I] = l(!1), [k, U] = l(""), [h, A] = l(!1), [H, Y] = l(!1), [N, y] = l(null), [X, M] = l([]), [ee, P] = l([]), [C, te] = l(!1);
277
+ const [r, m] = l(null), [a, n] = l([]), [d, V] = l(4), [f, j] = l(!1), [x, E] = l(1), [u, Z] = l(null), [g, b] = l("ready"), [G, F] = l(3), [v, S] = l(7), [z, D] = l(20), [J, R] = l(0), [w, I] = l(!1), [k, U] = l(""), [h, A] = l(!1), [H, Y] = l(!1), [N, y] = l(null), [Q, M] = l([]), [X, P] = l([]), [C, ee] = l(!1);
278
278
  L(() => {
279
- const e = () => te(window.innerWidth < 768);
279
+ const e = () => ee(window.innerWidth < 768);
280
280
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
281
281
  }, []);
282
282
  const _ = (e) => [...e].sort(() => Math.random() - 0.5).slice(0, 6), $ = () => {
283
283
  if (!r) return;
284
- const e = _(V[r]);
284
+ const e = _(O[r]);
285
285
  n(e), j(!0), I(!1), E(1), R(0), M([]), P([]), q(e, [], !0);
286
- }, q = (e = a, i = ee, p = !1) => {
287
- const c = _(e.length ? e : V[r]);
286
+ }, q = (e = a, i = X, p = !1) => {
287
+ const c = _(e.length ? e : O[r]);
288
288
  let T = Math.floor(Math.random() * c.length), B = c[T].name, K = 0;
289
289
  for (; i.includes(B) && K < 20; )
290
290
  T = Math.floor(Math.random() * c.length), B = c[T].name, K++;
291
- n(c), J(T), P([...i, B]), A(!1), U(""), D(20), y(null), p ? (b("ready"), F(3), S(7)) : (b("memorize"), S(7));
291
+ n(c), Z(T), P([...i, B]), A(!1), U(""), D(20), y(null), p ? (b("ready"), F(3), S(7)) : (b("memorize"), S(7));
292
292
  };
293
293
  L(() => {
294
294
  if (!(!f || w || h)) {
@@ -333,7 +333,7 @@ function xe() {
333
333
  x,
334
334
  k
335
335
  ]);
336
- const oe = () => {
336
+ const te = () => {
337
337
  if (u === null || H) return;
338
338
  const e = a[u].name, i = k.toLowerCase().trim();
339
339
  let p = "wrong";
@@ -343,18 +343,26 @@ function xe() {
343
343
  ]), Y(!0), setTimeout(() => {
344
344
  Y(!1), A(!0);
345
345
  }, 600);
346
- }, ne = () => x < d ? (E((e) => e + 1), q()) : I(!0), re = () => {
346
+ }, oe = () => x < d ? (E((e) => e + 1), q()) : I(!0), ne = () => {
347
347
  j(!1), I(!1), m(null);
348
- }, ie = se(
348
+ }, re = se(
349
349
  () => /* @__PURE__ */ o("div", { style: t.gmLogoFixed, children: /* @__PURE__ */ o("img", { src: pe, alt: "SPEAKID Logo", style: t.gmLogoImg }) }),
350
350
  []
351
351
  );
352
- return /* @__PURE__ */ s(O, { children: [
353
- !C && ie,
352
+ return /* @__PURE__ */ o("div", { id: "whats-missing-root", style: { all: "initial", display: "block" }, children: /* @__PURE__ */ s("div", { style: { all: "unset" }, children: [
353
+ !C && re,
354
354
  !r && !f && /* @__PURE__ */ s("div", { style: t.gmCenterScreen, children: [
355
355
  /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "WHAT'S MISSING?" }),
356
356
  /* @__PURE__ */ o("p", { style: t.gmBodyM, children: "Select a theme:" }),
357
- /* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o("button", { style: t.gmButton, onClick: () => m(e), children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys" }, e)) }),
357
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: 16 }, children: ["animals", "food", "toys"].map((e) => /* @__PURE__ */ o(
358
+ "button",
359
+ {
360
+ style: t.gmButton,
361
+ onClick: () => m(e),
362
+ children: e === "animals" ? "🐶 Animals" : e === "food" ? "🍎 Food" : "🧸 Toys"
363
+ },
364
+ e
365
+ )) }),
358
366
  /* @__PURE__ */ s("div", { style: { marginTop: 24 }, children: [
359
367
  /* @__PURE__ */ o("p", { style: t.gmBodyS, children: "Choose number of rounds:" }),
360
368
  /* @__PURE__ */ o("div", { style: { display: "flex", gap: 12, marginTop: 8 }, children: [3, 4, 5].map((e) => /* @__PURE__ */ o(
@@ -364,7 +372,7 @@ function xe() {
364
372
  ...t.gmButton,
365
373
  ...d === e ? t.gmButtonActive : {}
366
374
  },
367
- onClick: () => Z(e),
375
+ onClick: () => V(e),
368
376
  children: e
369
377
  },
370
378
  e
@@ -386,7 +394,7 @@ function xe() {
386
394
  /* @__PURE__ */ o("h1", { style: t.gmHeadline1, children: "Results" }),
387
395
  /* @__PURE__ */ s("h2", { style: t.gmHeadline3, children: [
388
396
  "Your score: ",
389
- Q,
397
+ J,
390
398
  " / ",
391
399
  d
392
400
  ] }),
@@ -397,7 +405,7 @@ function xe() {
397
405
  /* @__PURE__ */ o("th", { children: "Correct" }),
398
406
  /* @__PURE__ */ o("th", { children: "Result" })
399
407
  ] }) }),
400
- /* @__PURE__ */ o("tbody", { children: X.map((e, i) => /* @__PURE__ */ s("tr", { children: [
408
+ /* @__PURE__ */ o("tbody", { children: Q.map((e, i) => /* @__PURE__ */ s("tr", { children: [
401
409
  /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.round }),
402
410
  /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.answer || "—" }),
403
411
  /* @__PURE__ */ o("td", { style: t.gmTableCell, children: e.correct }),
@@ -406,7 +414,7 @@ function xe() {
406
414
  ] }),
407
415
  /* @__PURE__ */ s("div", { style: { display: "flex", gap: 12, marginTop: 24 }, children: [
408
416
  /* @__PURE__ */ o("button", { style: t.gmButton, onClick: $, children: "🔁 Play again" }),
409
- /* @__PURE__ */ o("button", { style: t.gmButton, onClick: re, children: "⬅️ Choose theme" })
417
+ /* @__PURE__ */ o("button", { style: t.gmButton, onClick: ne, children: "⬅️ Choose theme" })
410
418
  ] })
411
419
  ] }),
412
420
  f && !w && /* @__PURE__ */ s("div", { style: t.gmGameLayout, children: [
@@ -421,7 +429,7 @@ function xe() {
421
429
  alignItems: "center"
422
430
  },
423
431
  children: [
424
- g === "ready" && /* @__PURE__ */ s(O, { children: [
432
+ g === "ready" && /* @__PURE__ */ s(ie, { children: [
425
433
  /* @__PURE__ */ o("h1", { style: { ...t.gmHeadline1, color: "#ec4c44" }, children: "GET READY" }),
426
434
  /* @__PURE__ */ o("div", { style: t.gmHourglass, children: "⏳" })
427
435
  ] }),
@@ -502,18 +510,18 @@ function xe() {
502
510
  "button",
503
511
  {
504
512
  style: { ...t.gmButton, marginLeft: 8 },
505
- onClick: oe,
513
+ onClick: te,
506
514
  disabled: H,
507
515
  children: H ? "..." : "Check"
508
516
  }
509
517
  )
510
518
  ] }),
511
- h && /* @__PURE__ */ o("button", { style: t.gmButton, onClick: ne, children: "Next round" })
519
+ h && /* @__PURE__ */ o("button", { style: t.gmButton, onClick: oe, children: "Next round" })
512
520
  ] })
513
521
  ] })
514
- ] });
522
+ ] }) });
515
523
  }
516
524
  export {
517
525
  xe as Game,
518
- V as themes
526
+ O as themes
519
527
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblinkov/whats-missing",
3
- "version": "20.0.4",
3
+ "version": "20.0.5",
4
4
  "main": "dist/whats-missing.umd.js",
5
5
  "module": "dist/whats-missing.es.js",
6
6
  "types": "dist/index.d.ts",
package/src/Game.tsx CHANGED
@@ -224,7 +224,6 @@ export default function Game() {
224
224
  setTheme(null);
225
225
  };
226
226
 
227
- // ✅ мемоизированный логотип (больше не мигает)
228
227
  const MemoizedLogo = useMemo(
229
228
  () => (
230
229
  <div style={styles.gmLogoFixed}>
@@ -235,204 +234,210 @@ export default function Game() {
235
234
  );
236
235
 
237
236
  return (
238
- <>
239
- {!isMobile && MemoizedLogo}
237
+ <div id="whats-missing-root" style={{ all: "initial", display: "block" }}>
238
+ <div style={{ all: "unset" }}>
239
+ {!isMobile && MemoizedLogo}
240
240
 
241
- {!theme && !started && (
242
- <div style={styles.gmCenterScreen}>
243
- <h1 style={styles.gmHeadline1}>WHAT'S MISSING?</h1>
244
- <p style={styles.gmBodyM}>Select a theme:</p>
245
- <div style={{ display: "flex", gap: 16 }}>
246
- {["animals", "food", "toys"].map((t) => (
247
- <button key={t} style={styles.gmButton} onClick={() => setTheme(t as Theme)}>
248
- {t === "animals" ? "🐶 Animals" : t === "food" ? "🍎 Food" : "🧸 Toys"}
249
- </button>
250
- ))}
251
- </div>
252
- <div style={{ marginTop: 24 }}>
253
- <p style={styles.gmBodyS}>Choose number of rounds:</p>
254
- <div style={{ display: "flex", gap: 12, marginTop: 8 }}>
255
- {[3, 4, 5].map((n) => (
241
+ {!theme && !started && (
242
+ <div style={styles.gmCenterScreen}>
243
+ <h1 style={styles.gmHeadline1}>WHAT'S MISSING?</h1>
244
+ <p style={styles.gmBodyM}>Select a theme:</p>
245
+ <div style={{ display: "flex", gap: 16 }}>
246
+ {["animals", "food", "toys"].map((t) => (
256
247
  <button
257
- key={n}
258
- style={{
259
- ...styles.gmButton,
260
- ...(rounds === n ? styles.gmButtonActive : {}),
261
- }}
262
- onClick={() => setRounds(n)}
248
+ key={t}
249
+ style={styles.gmButton}
250
+ onClick={() => setTheme(t as Theme)}
263
251
  >
264
- {n}
252
+ {t === "animals" ? "🐶 Animals" : t === "food" ? "🍎 Food" : "🧸 Toys"}
265
253
  </button>
266
254
  ))}
267
255
  </div>
256
+ <div style={{ marginTop: 24 }}>
257
+ <p style={styles.gmBodyS}>Choose number of rounds:</p>
258
+ <div style={{ display: "flex", gap: 12, marginTop: 8 }}>
259
+ {[3, 4, 5].map((n) => (
260
+ <button
261
+ key={n}
262
+ style={{
263
+ ...styles.gmButton,
264
+ ...(rounds === n ? styles.gmButtonActive : {}),
265
+ }}
266
+ onClick={() => setRounds(n)}
267
+ >
268
+ {n}
269
+ </button>
270
+ ))}
271
+ </div>
272
+ </div>
268
273
  </div>
269
- </div>
270
- )}
271
-
272
- {theme && !started && (
273
- <div style={styles.gmCenterScreen}>
274
- <h1 style={styles.gmHeadline1}>Theme selected: {theme}</h1>
275
- <p style={styles.gmBodyM}>Rounds: {rounds}</p>
276
- <button style={styles.gmButton} onClick={startGame}>
277
- ▶ Start game
278
- </button>
279
- </div>
280
- )}
274
+ )}
281
275
 
282
- {finished && (
283
- <div style={styles.gmCenterScreen}>
284
- <h1 style={styles.gmHeadline1}>Results</h1>
285
- <h2 style={styles.gmHeadline3}>
286
- Your score: {score} / {rounds}
287
- </h2>
288
- <table style={styles.gmTable}>
289
- <thead>
290
- <tr>
291
- <th>Round</th>
292
- <th>Your Answer</th>
293
- <th>Correct</th>
294
- <th>Result</th>
295
- </tr>
296
- </thead>
297
- <tbody>
298
- {resultsTable.map((r, i) => (
299
- <tr key={i}>
300
- <td style={styles.gmTableCell}>{r.round}</td>
301
- <td style={styles.gmTableCell}>{r.answer || "—"}</td>
302
- <td style={styles.gmTableCell}>{r.correct}</td>
303
- <td style={styles.gmTableCell}>
304
- {r.result === "correct"
305
- ? "✔ Correct"
306
- : r.result === "almost"
307
- ? "◐ Almost (0.5)"
308
- : "✘ Wrong"}
309
- </td>
310
- </tr>
311
- ))}
312
- </tbody>
313
- </table>
314
- <div style={{ display: "flex", gap: 12, marginTop: 24 }}>
276
+ {theme && !started && (
277
+ <div style={styles.gmCenterScreen}>
278
+ <h1 style={styles.gmHeadline1}>Theme selected: {theme}</h1>
279
+ <p style={styles.gmBodyM}>Rounds: {rounds}</p>
315
280
  <button style={styles.gmButton} onClick={startGame}>
316
- 🔁 Play again
317
- </button>
318
- <button style={styles.gmButton} onClick={exitGame}>
319
- ⬅️ Choose theme
281
+ Start game
320
282
  </button>
321
283
  </div>
322
- </div>
323
- )}
284
+ )}
324
285
 
325
- {started && !finished && (
326
- <div style={styles.gmGameLayout}>
327
- <div
328
- style={{
329
- minHeight: 160,
330
- display: "flex",
331
- flexDirection: "column",
332
- justifyContent: "center",
333
- alignItems: "center",
334
- }}
335
- >
336
- {phase === "ready" && (
337
- <>
338
- <h1 style={{ ...styles.gmHeadline1, color: "#ec4c44" }}>GET READY</h1>
339
- <div style={styles.gmHourglass}>⏳</div>
340
- </>
341
- )}
342
- {phase === "memorize" && (
343
- <p style={{ ...styles.gmBodyM, color: "#10b981" }}>
344
- MEMORIZE ({memorizeTime})
345
- </p>
346
- )}
347
- {phase === "guess" && !answered && (
348
- <p style={styles.gmBodyM}>⏳ Time left: {timeLeft}s</p>
349
- )}
286
+ {finished && (
287
+ <div style={styles.gmCenterScreen}>
288
+ <h1 style={styles.gmHeadline1}>Results</h1>
289
+ <h2 style={styles.gmHeadline3}>
290
+ Your score: {score} / {rounds}
291
+ </h2>
292
+ <table style={styles.gmTable}>
293
+ <thead>
294
+ <tr>
295
+ <th>Round</th>
296
+ <th>Your Answer</th>
297
+ <th>Correct</th>
298
+ <th>Result</th>
299
+ </tr>
300
+ </thead>
301
+ <tbody>
302
+ {resultsTable.map((r, i) => (
303
+ <tr key={i}>
304
+ <td style={styles.gmTableCell}>{r.round}</td>
305
+ <td style={styles.gmTableCell}>{r.answer || "—"}</td>
306
+ <td style={styles.gmTableCell}>{r.correct}</td>
307
+ <td style={styles.gmTableCell}>
308
+ {r.result === "correct"
309
+ ? "✔ Correct"
310
+ : r.result === "almost"
311
+ ? "◐ Almost (0.5)"
312
+ : "✘ Wrong"}
313
+ </td>
314
+ </tr>
315
+ ))}
316
+ </tbody>
317
+ </table>
318
+ <div style={{ display: "flex", gap: 12, marginTop: 24 }}>
319
+ <button style={styles.gmButton} onClick={startGame}>
320
+ 🔁 Play again
321
+ </button>
322
+ <button style={styles.gmButton} onClick={exitGame}>
323
+ ⬅️ Choose theme
324
+ </button>
325
+ </div>
350
326
  </div>
327
+ )}
351
328
 
352
- {phase !== "ready" && (
329
+ {started && !finished && (
330
+ <div style={styles.gmGameLayout}>
353
331
  <div
354
332
  style={{
355
- ...styles.gmGrid,
356
- gridTemplateColumns: isMobile ? "repeat(2, 1fr)" : "repeat(3, 210px)",
357
- gridAutoRows: isMobile ? "150px" : "210px",
358
- gap: isMobile ? "12px" : "20px",
359
- justifyItems: "center",
360
- ...(window.innerWidth > 2000
361
- ? {
362
- gridTemplateColumns: "repeat(3, 260px)",
363
- gridAutoRows: "260px",
364
- gap: "28px",
365
- }
366
- : {}),
367
- ...(window.innerWidth > 2560
368
- ? {
369
- gridTemplateColumns: "repeat(3, 300px)",
370
- gridAutoRows: "300px",
371
- gap: "32px",
372
- }
373
- : {}),
333
+ minHeight: 160,
334
+ display: "flex",
335
+ flexDirection: "column",
336
+ justifyContent: "center",
337
+ alignItems: "center",
374
338
  }}
375
339
  >
376
- {files.map((file, i) => {
377
- const isHidden =
378
- hiddenIndex === i && phase === "guess" && !answered;
379
- return (
380
- <div
381
- key={i}
382
- style={{
383
- ...styles.gmCard,
384
- ...(result === "correct" && hiddenIndex === i
385
- ? styles.gmCorrect
386
- : {}),
387
- ...(result === "wrong" && hiddenIndex === i
388
- ? styles.gmWrong
389
- : {}),
390
- }}
391
- >
392
- {!isHidden && (
393
- <img
394
- src={file.src}
395
- alt={file.name}
396
- style={{
397
- width: "100%",
398
- height: "100%",
399
- objectFit: "cover",
400
- }}
401
- />
402
- )}
403
- </div>
404
- );
405
- })}
340
+ {phase === "ready" && (
341
+ <>
342
+ <h1 style={{ ...styles.gmHeadline1, color: "#ec4c44" }}>GET READY</h1>
343
+ <div style={styles.gmHourglass}>⏳</div>
344
+ </>
345
+ )}
346
+ {phase === "memorize" && (
347
+ <p style={{ ...styles.gmBodyM, color: "#10b981" }}>
348
+ MEMORIZE ({memorizeTime})
349
+ </p>
350
+ )}
351
+ {phase === "guess" && !answered && (
352
+ <p style={styles.gmBodyM}>⏳ Time left: {timeLeft}s</p>
353
+ )}
406
354
  </div>
407
- )}
408
355
 
409
- <div style={{ marginTop: 16, height: 80 }}>
410
- {phase === "guess" && !answered && (
411
- <div>
412
- <input
413
- type="text"
414
- placeholder="Type the missing word"
415
- value={inputValue}
416
- onChange={(e) => setInputValue(e.target.value)}
417
- style={styles.gmInput}
418
- />
419
- <button
420
- style={{ ...styles.gmButton, marginLeft: 8 }}
421
- onClick={checkAnswer}
422
- disabled={animating}
423
- >
424
- {animating ? "..." : "Check"}
425
- </button>
356
+ {phase !== "ready" && (
357
+ <div
358
+ style={{
359
+ ...styles.gmGrid,
360
+ gridTemplateColumns: isMobile ? "repeat(2, 1fr)" : "repeat(3, 210px)",
361
+ gridAutoRows: isMobile ? "150px" : "210px",
362
+ gap: isMobile ? "12px" : "20px",
363
+ justifyItems: "center",
364
+ ...(window.innerWidth > 2000
365
+ ? {
366
+ gridTemplateColumns: "repeat(3, 260px)",
367
+ gridAutoRows: "260px",
368
+ gap: "28px",
369
+ }
370
+ : {}),
371
+ ...(window.innerWidth > 2560
372
+ ? {
373
+ gridTemplateColumns: "repeat(3, 300px)",
374
+ gridAutoRows: "300px",
375
+ gap: "32px",
376
+ }
377
+ : {}),
378
+ }}
379
+ >
380
+ {files.map((file, i) => {
381
+ const isHidden =
382
+ hiddenIndex === i && phase === "guess" && !answered;
383
+ return (
384
+ <div
385
+ key={i}
386
+ style={{
387
+ ...styles.gmCard,
388
+ ...(result === "correct" && hiddenIndex === i
389
+ ? styles.gmCorrect
390
+ : {}),
391
+ ...(result === "wrong" && hiddenIndex === i
392
+ ? styles.gmWrong
393
+ : {}),
394
+ }}
395
+ >
396
+ {!isHidden && (
397
+ <img
398
+ src={file.src}
399
+ alt={file.name}
400
+ style={{
401
+ width: "100%",
402
+ height: "100%",
403
+ objectFit: "cover",
404
+ }}
405
+ />
406
+ )}
407
+ </div>
408
+ );
409
+ })}
426
410
  </div>
427
411
  )}
428
- {answered && (
429
- <button style={styles.gmButton} onClick={nextRound}>
430
- Next round
431
- </button>
432
- )}
412
+
413
+ <div style={{ marginTop: 16, height: 80 }}>
414
+ {phase === "guess" && !answered && (
415
+ <div>
416
+ <input
417
+ type="text"
418
+ placeholder="Type the missing word"
419
+ value={inputValue}
420
+ onChange={(e) => setInputValue(e.target.value)}
421
+ style={styles.gmInput}
422
+ />
423
+ <button
424
+ style={{ ...styles.gmButton, marginLeft: 8 }}
425
+ onClick={checkAnswer}
426
+ disabled={animating}
427
+ >
428
+ {animating ? "..." : "Check"}
429
+ </button>
430
+ </div>
431
+ )}
432
+ {answered && (
433
+ <button style={styles.gmButton} onClick={nextRound}>
434
+ Next round
435
+ </button>
436
+ )}
437
+ </div>
433
438
  </div>
434
- </div>
435
- )}
436
- </>
439
+ )}
440
+ </div>
441
+ </div>
437
442
  );
438
443
  }