(this["webpackJsonpleague-quiz"]=this["webpackJsonpleague-quiz"]||[]).push([[0],{22:function(t,e,s){},23:function(t,e,s){},25:function(t,e,s){},38:function(t,e,s){"use strict";s.r(e);var a=s(2),n=s.n(a),i=s(10),c=s.n(i),r=(s(22),s(23),s(4)),o=s(5),l=s(6),u=s(8),b=s(7),d=s(0),j=function(t){Object(u.a)(s,t);var e=Object(b.a)(s);function s(t){var a;return Object(r.a)(this,s),(a=e.call(this,t)).checkDifference=function(t,e){for(var s=0,a=0,n=Math.max(t.length,e.length);a0&&!this.state.showAnswer?Object(d.jsxs)("div",{className:"feedback",children:[Object(d.jsx)("p",{className:"feedback-text incorrect",children:"Incorrect"}),Object(d.jsx)("hr",{className:"gradient-decor red"})]}):Object(d.jsx)("p",{className:"feedback-text"}),this.state.showAnswer&&!this.state.quizCompleted?Object(d.jsxs)("div",{className:"",children:[Object(d.jsx)("img",{className:"ability-image small",src:"".concat(this.state.sourceData[this.state.currentQuestion].image)}),Object(d.jsxs)("h1",{children:[this.state.currentQuestion+1,"/",this.state.totalQuestions]}),Object(d.jsxs)("p",{className:"ability-title",children:[this.state.sourceData[this.state.currentQuestion].name," - ",this.state.sourceData[this.state.currentQuestion].control]}),Object(d.jsx)("hr",{className:"gradient-decor"}),Object(d.jsxs)("div",{className:"image-container",children:[Object(d.jsx)("div",{className:"image-border"}),Object(d.jsx)("div",{className:"champion-img",style:{backgroundImage:"url(".concat(this.state.sourceData[this.state.currentQuestion].championImage,")"),backgroundRepeat:"no-repeat",backgroundSize:"cover"}})]}),Object(d.jsx)("div",{className:"ability-champion",children:this.state.sourceData[this.state.currentQuestion].champion}),Object(d.jsx)("p",{className:"ability-description",dangerouslySetInnerHTML:{__html:this.state.sourceData[this.state.currentQuestion].description}}),Object(d.jsx)("div",{className:"button-wrapper",children:Object(d.jsx)("button",{className:"primary-button",onClick:this.nextPage,children:"NEXT"})})]}):this.state.quizCompleted?Object(d.jsxs)("div",{className:"score-container",children:[Object(d.jsx)("div",{className:"score-text-background-img",style:{backgroundImage:"url(".concat(this.state.difficultyImg,")"),backgroundRepeat:"no-repeat",backgroundSize:"contain",backgroundPosition:"center"}}),Object(d.jsxs)("div",{className:"score-text",children:[Object(d.jsx)("p",{className:"larger",children:this.state.rank}),Object(d.jsx)("hr",{className:"gradient-decor wider"}),Object(d.jsxs)("p",{className:"smaller",children:[this.state.correctAnswers,"/",this.state.totalQuestions," correct"]})]}),Object(d.jsx)("div",{className:"rotating-border",children:" "}),Object(d.jsx)("p",{className:"",children:" "}),Object(d.jsx)("div",{className:"button-wrapper",children:Object(d.jsx)("button",{className:"primary-button",onClick:function(){window.location.reload()},children:" Try Again"})})]}):Object(d.jsxs)("div",{className:"",children:[Object(d.jsx)("img",{className:"ability-image",src:"".concat(this.state.sourceData[this.state.currentQuestion].image)}),Object(d.jsxs)("h1",{children:[this.state.currentQuestion+1,"/",this.state.totalQuestions]}),Object(d.jsx)("input",{type:"text",onChange:this.handleChange}),Object(d.jsx)("div",{className:"button-wrapper",children:Object(d.jsx)("button",{className:"primary-button",onClick:this.checkAnswer,children:"SUBMIT"})}),Object(d.jsx)("button",{className:"secondary-button",onClick:this.showAnswer,children:"I GIVE UP!"})]})]})}}]),s}(n.a.Component),m=(s(25),s(11)),h=s.n(m),f=function(t){Object(u.a)(s,t);var e=Object(b.a)(s);function s(t){var a;return Object(r.a)(this,s),(a=e.call(this,t)).startGame=function(){if(null==a.state.numberOfQuestions)a.setState({showModal:!0}),a.setState({feedbackMessage:"Please select a difficulty (number of questions)."});else{var t=Object(l.a)(a),e="".concat("https://ljygkgkq1i.execute-api.us-east-2.amazonaws.com","/prod/abilities/")+a.state.numberOfQuestions;if(a.setState({feedbackMessage:"Getting data... hang tight"}),a.setState({dataLoading:!0}),a.setState({showModal:!0}),fetch(e).then((function(t){return t.json()})).then((function(e){t.setState({sourceData:e.abilities}),t.setState({showIntro:!1})})),"all"==a.state.numberOfQuestions){var s="".concat("https://ljygkgkq1i.execute-api.us-east-2.amazonaws.com","/prod/abilitiesCount");fetch(s).then((function(t){return t.json()})).then((function(e){t.setState({numberOfQuestions:e.count})}))}a.setState({dataLoading:!1})}},a.setDifficulty=function(t,e){a.setState({feedbackMessage:null}),a.setState({numberOfQuestions:t}),a.setState({difficultyImg:e})},a.dismissModal=function(){a.setState({showModal:!1})},a.state={sourceData:[],questionData:null,showIntro:!0,dataLoading:!1,numberOfQuestions:null,feedBackMessage:null,difficultyImg:null,showModal:!1},a}return Object(o.a)(s,[{key:"render",value:function(){var t=this;return Object(d.jsxs)("div",{className:"app-container",children:[Object(d.jsx)("div",{className:"game-container",children:this.state.showIntro?Object(d.jsxs)("div",{children:[Object(d.jsx)("img",{className:"quiz-logo",alt:"League of Legends Ability Quiz",src:"./Logo.png"}),Object(d.jsxs)(h.a,{isOpen:this.state.showModal&&null==this.state.numberOfQuestions,contentLabel:"Minimal Modal Example",className:"modal",overlayClassName:"overlay",children:[Object(d.jsx)("p",{children:this.state.feedbackMessage}),Object(d.jsx)("div",{className:"button-wrapper",children:Object(d.jsxs)("button",{className:"primary-button",onClick:function(){t.dismissModal()},children:[" ","OK"," "]})})]}),Object(d.jsxs)(h.a,{isOpen:this.state.showModal&&!(null==this.state.numberOfQuestions),contentLabel:"Minimal Modal Example",className:"modal",overlayClassName:"overlay",children:[Object(d.jsx)("p",{children:this.state.feedbackMessage}),Object(d.jsx)("div",{className:"loader"})]}),Object(d.jsxs)("div",{className:"difficulty-buttons-container",children:[Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(10==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(10,"./Iron.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Iron.png"}),Object(d.jsx)("p",{children:"10 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(20==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(20,"./Bronze.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Bronze.png"}),Object(d.jsx)("p",{children:"20 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(30==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(30,"./Silver.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Silver.png"}),Object(d.jsx)("p",{children:"30 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(50==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(50,"./Gold.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Gold.png"}),Object(d.jsx)("p",{children:"50 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(100==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(100,"./Platinum.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Platinum.png"}),Object(d.jsx)("p",{children:"100 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(250==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(250,"./Diamond.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Diamond.png"}),Object(d.jsx)("p",{children:"250 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(500==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(500,"./Master.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Master.png"}),Object(d.jsx)("p",{children:"500 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+(700==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty(700,"./Grandmaster.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Grandmaster.png"}),Object(d.jsx)("p",{children:"700 Questions"})]}),Object(d.jsxs)("div",{className:"difficulty-button-wrapper"+("all"==this.state.numberOfQuestions?" selected":""),onClick:function(){t.setDifficulty("all","./Challenger.png")},children:[Object(d.jsx)("img",{className:"difficulty-button",role:"button",src:"./Challenger.png"}),Object(d.jsx)("p",{children:"ALL"})]})]}),Object(d.jsx)("div",{className:"button-wrapper",children:Object(d.jsxs)("button",{className:"primary-button large",onClick:this.startGame,children:[" ","START"," "]})})]}):Object(d.jsx)(j,{data:this.state})}),Object(d.jsxs)("footer",{className:"footer",children:["Like this quiz? ",Object(d.jsx)("a",{href:"https://www.buymeacoffee.com/sybbey",target:"_blank",children:"Consider supporting me by buying me a beer!"})]})]})}}]),s}(n.a.Component),p=s(15);var g=function(){return Object(d.jsxs)("div",{className:"App",children:[Object(d.jsxs)(p.a,{children:[Object(d.jsx)("title",{children:"League of Legends Ability Quiz"}),Object(d.jsx)("meta",{name:"description",content:"Test your knowlege to guess an ability based on its picture, with up to 1000 questions featuring abilities from Riot Games' League of Legends."}),Object(d.jsx)("meta",{itemprop:"name",content:"Reed"}),Object(d.jsx)("meta",{itemprop:"description",content:"Test your knowlege to guess an ability based on its picture, with up to 1000 questions featuring abilities from Riot Games' League of Legends."}),Object(d.jsx)("meta",{itemprop:"image",content:"./Logo.png"}),Object(d.jsx)("meta",{property:"og:url",content:"www.leagueabilityquiz.com"}),Object(d.jsx)("meta",{property:"og:type",content:"website"}),Object(d.jsx)("meta",{property:"og:title",content:"League Ability Quiz"}),Object(d.jsx)("meta",{property:"og:description",content:"Test your knowlege to guess an ability based on its picture, with up to 1000 questions featuring abilities from Riot Games' League of Legends."}),Object(d.jsx)("meta",{property:"og:image",content:"./background.jpg"}),Object(d.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),Object(d.jsx)("meta",{name:"twitter:title",content:"League Ability Quiz"}),Object(d.jsx)("meta",{name:"twitter:description",content:"Test your knowlege to guess an ability based on its picture, with up to 1000 questions featuring abilities from Riot Games' League of Legends."}),Object(d.jsx)("meta",{name:"twitter:image",content:"./background.jpg"})]}),Object(d.jsx)(f,{})]})},O=function(t){t&&t instanceof Function&&s.e(3).then(s.bind(null,39)).then((function(e){var s=e.getCLS,a=e.getFID,n=e.getFCP,i=e.getLCP,c=e.getTTFB;s(t),a(t),n(t),i(t),c(t)}))};c.a.render(Object(d.jsx)(n.a.StrictMode,{children:Object(d.jsx)(g,{})}),document.getElementById("root")),O()}},[[38,1,2]]]); //# sourceMappingURL=main.30a6a444.chunk.js.map