node-go/packages/play-node-go/build/static/js/main.164728a0.chunk.js.map
2020-02-07 17:51:09 -08:00

1 line
No EOL
82 KiB
Text

{"version":3,"sources":["config.js","io.js","components/Display/Logo/Logo.js","pages/Layout/NavBar/NavBar.js","pages/Account/AccountSidebar.js","services/authServices.js","components/Error/FormError/FormError.js","components/Form/Login/Login.js","components/Form/Signup/Signup.js","components/Form/Auth/Auth.js","components/Button/NewRoom/NewRoom.js","components/Form/FindRoom/FindRoom.js","components/Button/Library/Library.js","pages/Home/HomeSidebar.js","pages/News/NewsSidebar.js","components/Form/FindGame/FindGame.js","components/Button/NewGame/NewGame.js","components/Button/RoomArchive/RoomArchive.js","pages/Room/RoomSidebar.js","pages/Layout/Sidebar/Sidebar.js","pages/Account/Account.js","services/api/gamesServices.js","components/GameUI/Point/Point.js","components/GameUI/Board/Board.js","components/GameUI/PlayerArea/PlayerArea.js","pages/Game/Game.js","services/api/roomsServices.js","components/Button/Room/Room.js","components/Display/Loading/Loading.js","pages/Home/Home.js","pages/News/News.js","components/Button/Game/Game.js","components/Display/Message/Message.js","components/Error/ActionError/ActionError.js","components/Display/Development/Development.js","pages/Room/Room.js","pages/Layout/MainWrapper/MainWrapper.js","reducers/init/reducer.init.js","reducers/auth/reducer.auth.js","reducers/err/reducer.err.js","reducers/index/reducer.index.js","reducers/rooms/reducer.rooms.js","reducers/messages/reducer.messages.js","reducers/games/reducer.games.js","reducers/socket/reducer.socket.js","reducers/reducer.js","services/api/indexServices.js","App.js","serviceWorker.js","index.js"],"names":["config","runtimeEnv","REACT_APP_ENVIRONMENT","apiAddress","endpoint","authAddress","socketAddress","launch","nsp","dispatch","socket","socketIOClient","on","type","message","body","err","socketError","data","console","log","board","Logo","NavBar","props","className","data-testid","to","user","username","AccountSidebar","authEndpoint","signupEndpoint","loginEndpoint","headers","Headers","append","formData","a","async","fetch","method","credentials","JSON","stringify","then","res","text","parse","catch","response","FormError","errorMessage","error","Login","errors","useState","setUsername","password","setPassword","errorDispatchAction","postLoginForm","authServices","loginResponse","authError","handleSubmit","e","next","preventDefault","length","test","state","auth","onSubmit","htmlFor","name","id","onChange","target","value","default","Signup","email","setEmail","confirmPassword","setConfirmPassword","postSignupForm","signupResponse","Auth","showForm","setShowForm","onClick","NewRoomButton","FindRoomForm","LibraryButton","HomeSidebar","ifUser","ifNoUser","NewsSidebar","FindGameForm","NewGameButton","RoomArchiveButton","RoomSidebar","currentRoom","joinGame","Sidebar","page","displayComponent","Account","gamesAddress","gameIndex","obj","Object","assign","game","applicationVersion","application_version","boardSize","board_size","playerBlack","player_black","playerBlackRank","player_black_rank","playerWhite","player_white","playerWhiteRank","player_white_rank","capturesWhite","captures_white","capturesBlack","captures_black","mainTime","main_time","timePeriod","time_period","periodLength","period_length","overtimePeriod","overtime_period","overtimeLength","overtime_length","winType","win_type","Point","posX","posY","pointData","turn","action","room","move","player","pos","x","y","clickHandle","data-stone","data-dot","dot","Board","sizeFlag","i","boardPoints","Math","floor","push","key","renderPoints","PlayerArea","stones","captures","Game","gameId","parseInt","useParams","useEffect","gamesServices","fetchGameAPI","active","roomSocketConnect","record","roomsAddress","roomIndex","games","roomGames","map","RoomButton","roomData","Loading","Home","roomsServices","rooms","fetchRoomsAPI","renderRooms","News","GameButton","open","requestAction","requestJoinGame","gameLinkText","renderInProgressGame","Message","messageData","content","admin","ActionError","Development","Room","roomId","fetchRoomAPI","gameData","renderGames","messages","idx","renderMessages","MainWrapper","selectPage","initState","overtime","application","description","event","round","score","komi","handicap","connect","location","language","connected","loginReducer","newUser","errorReducer","authErrorReducer","joinRoom","joinRoomError","joinRoomErrorReducer","joinGameError","joinGameErrorReducer","roomsReducer","stateWithMessages","stateReducer","setMessages","setCurrentRoom","setGames","setJoinRoomError","gamesReducer","parseRank","formatGames","entries","rank","slice","toLowerCase","io","require","socketReducer","launchedSocket","priorSocket","emit","close","updatedState","connectRoomAction","connectGame","makeMove","errorStrippedState","stripErrors","authReducer","indexReducer","messagesReducer","App","useReducer","indexServices","fetchIndexAPI","path","Boolean","window","hostname","match","ReactDOM","render","document","getElementById","navigator","serviceWorker","ready","registration","unregister"],"mappings":"qJAiBMA,EAAuC,e,MAhBjCC,KAgBOC,sBAdA,CACjBC,WAAY,2CACZC,SAAU,qCACVC,YAAa,yCACbC,cAAe,qCAGG,CAClBH,WAAY,+BACZE,YAAa,6BACbD,SAAU,wBACVE,cAAe,yBAOF,mBACVN,I,qlBCtBL,0EAGMO,EAAS,SAACC,EAAKC,GACnB,IAAMC,EAASC,IAAe,GAAD,OAAIX,IAAOM,cAAX,YAA4BE,IAiCzD,OA/BAE,EAAOE,GAAG,aAAa,WACrBH,EAAS,CAAEI,KAAK,SAAUC,QAAQ,YAAaC,KAAK,CAACP,IAAKE,EAAOF,UAEnEE,EAAOE,GAAG,iBAAiB,SAAAI,GACzBP,EAAS,CAAEI,KAAM,MAAOC,QAAQ,eAAgBC,KAAM,CAAEE,YAAaD,QAEvEN,EAAOE,GAAG,SAAS,SAAAI,GACjBP,EAAS,CAAEI,KAAM,MAAOC,QAAQ,eAAgBC,KAAM,CAAEE,YAAaD,QAGvEN,EAAOE,GAAG,kBAAkB,SAACM,GAC3BT,EAAS,CAAEI,KAAM,QAASC,QAAS,eAAgBC,KAAMG,OAG3DR,EAAOE,GAAG,YAAY,SAACM,GACrBC,QAAQC,IAAI,qBACZX,EAAS,CAAEI,KAAM,QAASC,QAAS,WAAYC,KAAMG,OAGvDR,EAAOE,GAAG,kBAAkB,SAACM,GAC3BC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,2BACZX,EAAS,CAAEI,KAAM,QAASC,QAAS,eAAgBC,KAAMG,OAG3DR,EAAOE,GAAG,gBAAgB,SAACM,GACzBC,QAAQC,IAAIF,GACZC,QAAQC,IAAI,yBACZX,EAAS,CAAEI,KAAM,QAASC,QAAS,eAAgBC,KAAMG,EAAKG,WAGzDX,I,uLC1BMY,G,kBARF,WACX,OACE,8CCuBWC,EAvBA,SAACC,GAEd,OACE,yBAAKC,UAAU,SAASC,cAAY,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IAAD,CAAOwP,KAAK,YACV,kBAAC,GAAD,CAAavK,KAAK,UAAUnC,MAAOA,EAAO9D,SAAUA,KAGtD,kBAAC,IAAD,CAAOwQ,KAAK,cACV,kBAAC,GAAD,CAAavK,KAAK,OAAOnC,MAAOA,EAAO9D,SAAUA,KAGnD,kBAAC,IAAD,CAAOwQ,KAAK,cACV,kBAAC,GAAD,CAAavK,KAAK,OAAOnC,MAAOA,EAAO9D,SAAUA,KAGnD,kBAAC,IAAD,CAAOwQ,KAAK,SACV,kBAAC,GAAD,CAAavK,KAAK,OAAOnC,MAAOA,EAAO9D,SAAUA,KAGnD,kBAAC,IAAD,CAAOwQ,KAAK,SACV,kBAAC,GAAD,CAAavK,KAAK,OAAOnC,MAAOA,EAAO9D,SAAUA,KAGnD,kBAAC,IAAD,CAAOwQ,KAAK,KACT1M,EAAM3C,KAAKC,SACV,kBAAC,GAAD,CAAa6E,KAAK,OAAOnC,MAAOA,EAAO9D,SAAUA,IACjD,kBAAC,GAAD,CAAaiG,KAAK,OAAOnC,MAAOA,EAAO9D,SAAUA,MAIvD,uBAAGgB,UAAU,oBAAoB8C,EAAM2J,QAAQrN,KAAO,SAAM,cC7DhDqQ,QACW,cAA7BC,OAAOhD,SAASiD,UAEe,UAA7BD,OAAOhD,SAASiD,UAEhBD,OAAOhD,SAASiD,SAASC,MACvB,2DCZNC,IAASC,OACP,kBAAC,GAAD,MACEC,SAASC,eAAe,SD2HtB,kBAAmBC,WACrBA,UAAUC,cAAcC,MAAM/O,MAAK,SAAAgP,GACjCA,EAAaC,kB","file":"static/js/main.164728a0.chunk.js","sourcesContent":["import runtimeEnv from '@mars/heroku-js-runtime-env';\nconst env = runtimeEnv();\n\nconst production = {\n apiAddress: 'https://node-go-api.herokuapp.com/api/v1',\n endpoint: 'https://play-node-go.herokuapp.com',\n authAddress: 'https://node-go-api.herokuapp.com/auth',\n socketAddress: 'https://node-go-api.herokuapp.com'\n}\n\nconst development = {\n apiAddress: 'http://localhost:8000/api/v1',\n authAddress: 'http://localhost:8000/auth',\n endpoint: 'http://localhost:3000',\n socketAddress: 'http://localhost:8000'\n}\n\nconst config = env.REACT_APP_ENVIRONMENT === 'production' \n ? production\n : development\n\nexport default {\n ...config\n}","import socketIOClient from 'socket.io-client';\nimport config from './config';\n\nconst launch = (nsp, dispatch) => {\n const socket = socketIOClient(`${config.socketAddress}/${nsp}`);\n \n socket.on('connected', () => {\n dispatch({ type:'SOCKET', message:'CONNECTED', body:{nsp: socket.nsp} });\n });\n socket.on('connect_error', err => {\n dispatch({ type: 'ERR', message:'SOCKET_ERROR', body: { socketError: err }});\n });\n socket.on('error', err => {\n dispatch({ type: 'ERR', message:'SOCKET_ERROR', body: { socketError: err } });\n });\n \n socket.on('room_connected', (data) => {\n dispatch({ type: 'ROOMS', message: 'CONNECT_ROOM', body: data });\n });\n \n socket.on('new_user', (data) => {\n console.log('new_user received')\n dispatch({ type: 'ROOMS', message: 'NEW_USER', body: data })\n })\n\n socket.on('game_connected', (data) => {\n console.log(data)\n console.log('game_connected received')\n dispatch({ type: 'GAMES', message: 'UPDATE_BOARD', body: data })\n })\n \n socket.on('update_board', (data) => {\n console.log(data)\n console.log('update_board received')\n dispatch({ type: 'GAMES', message: 'UPDATE_BOARD', body: data.board })\n })\n\n return socket;\n}\n\nexport {\n launch\n}","import React from 'react';\nimport './Logo.scss';\n\nconst Logo = () => {\n return ( \n <>\n Logo\n </>\n );\n}\n \nexport default Logo;","import React from 'react';\nimport { Link } from 'react-router-dom';\nimport './NavBar.scss';\nimport Logo from '../../../components/Display/Logo/Logo';\n\nconst NavBar = (props) => {\n\n return (\n <div className=\"NavBar\" data-testid=\"NavBar\">\n <Link to=\"/home\" >\n <div className=\"NavBar__logo\"><Logo /></div>\n </Link>\n\n <Link to=\"/home\" >\n <div className=\"NavBar__menu-item NavBar__home\"><p>Find a Game</p></div>\n </Link>\n \n <Link to=\"/news\">\n <div className=\"NavBar__menu-item NavBar__news\"><p>News</p></div>\n </Link>\n\n <Link to=\"/account\">\n <div className=\"NavBar__menu-item NavBar__acount\">{props.user ? props.user.username : <></>}</div>\n </Link>\n </div>\n );\n}\n\nexport default NavBar;","import React from 'react';\n\nconst AccountSidebar = () => {\n return ( \n <nav>\n </nav>\n );\n}\n\nexport default AccountSidebar;","import config from '../config';\n\nconst authEndpoint = config.authAddress;\nconst signupEndpoint = `${authEndpoint}/signup`\nconst loginEndpoint = `${authEndpoint}/login`\n\nvar headers = new Headers();\nheaders.append('Content-Type', 'application/json');\nheaders.append('Accept', 'application/json');\nheaders.append('Sec-Fetch-Site', 'cross-site')\n\nconst loginService = async(formData) => {\n const response = await fetch(loginEndpoint, {\n method: 'POST',\n credentials: 'include',\n body: JSON.stringify(formData),\n headers: headers\n })\n .then(res => res.text())\n .then(text => JSON.parse(text))\n .catch(err => err);\n \n return response;\n}\n\nconst signupService = async (formData) => {\n const response = await fetch(signupEndpoint, {\n method: 'POST',\n credentials: 'include',\n body: JSON.stringify(formData),\n headers: headers\n })\n .then(res => res.text())\n .then(text => JSON.parse(text))\n .catch(err => err);\n\n return response;\n}\n\nexport default {\n loginService,\n signupService\n}","import React from 'react';\nimport './FormError.scss';\n\nconst FormError = (props) => {\n const errorMessage = props.error;\n return (\n <span \n className=\"error error--form\"\n data-testid=\"FormError\" \n >\n {errorMessage}\n </span>\n );\n}\n\nexport default FormError;","import React, { useState } from 'react';\nimport './Login.scss';\nimport authServices from '../../../services/authServices';\nimport FormError from '../../Error/FormError/FormError';\n\nconst Login = (props) => {\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const minimumPasswordLength = 8;\n const errorDispatchAction = {\n type: 'ERR',\n message: 'AUTH_ERROR'\n }\n\n const validateLoginForm = next => {\n if (password.length < minimumPasswordLength) {\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError: 'This password is invalid'}\n })\n }\n\n if (!/^[\\w\\d_.-]+$/.test(username)) {\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError: \"This username is invalid\"}\n })\n }\n \n next();\n }\n\n\n const postLoginForm = async () => {\n const loginResponse = await authServices.loginService({\n username,\n password\n })\n if (loginResponse.errors) {\n const authError = loginResponse.errors\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError }\n })\n }\n\n return props.dispatch({\n type: 'AUTH',\n message: 'LOGIN',\n body: loginResponse\n })\n }\n\n const handleSubmit = e => {\n e.preventDefault();\n validateLoginForm(postLoginForm);\n }\n\n const formError = errors => {\n if(!errors) return <></>;\n\n if (errors.auth) {\n return <FormError error={errors.auth}/>\n }\n }\n\n return (\n <div className=\"Login\" data-testid=\"Login\">\n {formError(props.state.errors)}\n <form \n className=\"Login__form\"\n data-testid=\"Login__form\"\n onSubmit={e => handleSubmit(e)}\n >\n\n <label \n className=\"form__label form__label--username\" \n htmlFor=\"username-input\"\n >Username:</label>\n <input \n name=\"username\"\n id=\"username-input\"\n className=\"form__input form__input--username\"\n type=\"text\"\n onChange={e => setUsername(e.target.value)}\n default=\"username\"\n />\n\n <label \n className=\"form__label form__label--password\"\n htmlFor=\"password-input\"\n >Password:</label>\n <input \n name=\"password\"\n id=\"password-input\"\n className=\"form__input form__input--password\"\n type=\"password\"\n onChange={e => setPassword(e.target.value)}\n default=\"\"\n />\n\n <input \n className=\"form__submit\"\n type=\"submit\" \n value=\"Login!\" \n />\n\n </form>\n </div>\n );\n}\n\nexport default Login;","import React, { useState } from 'react';\nimport './Signup.scss';\nimport authServices from '../../../services/authServices';\nimport FormError from '../../Error/FormError/FormError';\n\nconst Signup = (props) => {\n const [ username, setUsername ] = useState('');\n const [ email, setEmail ] = useState('');\n const [ password, setPassword ] = useState('');\n const [ confirmPassword, setConfirmPassword ] = useState('');\n const minimumPasswordLength = 8;\n const errorDispatchAction = {\n type: 'ERR',\n message: 'AUTH_ERROR'\n }\n\n const validateSignupForm = (next) => {\n if (password !== confirmPassword) {\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError: 'Password fields must be the same'}\n })\n }\n\n if (password.length < minimumPasswordLength) {\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError: 'Password must be at least 8 characters'}\n })\n }\n\n if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) {\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError: 'Please enter a valid email'}\n })\n }\n \n if (!/^[\\w\\d_.-]+$/.test(username)) {\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError: \"Username can only contain letters, numbers, '_', '.', or '-'\"}\n })\n }\n\n return next();\n }\n\n const postSignupForm = async () => {\n const signupResponse = await authServices.signupService({\n username,\n email,\n password,\n confirmPassword\n })\n\n if (signupResponse.errors) {\n const authError = signupResponse.errors[0].auth\n return props.dispatch({\n ...errorDispatchAction,\n body: { authError }\n })\n }\n\n return props.dispatch({\n type: 'AUTH',\n message: 'SIGNUP',\n body: signupResponse\n })\n }\n\n const handleSubmit = e => {\n e.preventDefault();\n validateSignupForm(postSignupForm);\n }\n\n const formError = errors => {\n if(!errors) return <></>;\n\n if (errors.auth) {\n return <FormError error={errors.auth}/>\n }\n }\n \n return (\n \n <div className=\"Signup\" data-testid=\"Signup\">\n {formError(props.state.errors)}\n <form \n className=\"Signup__form\"\n data-testid=\"Signup__form\"\n onSubmit={e => handleSubmit(e)}\n >\n\n <label \n className=\"form__label form__label--username\"\n htmlFor=\"username-input\"\n >Username:</label>\n <input \n className=\"form__input form__input--username\"\n default=\"username\"\n id=\"username-input\"\n name=\"username\"\n onChange={e => setUsername(e.target.value)}\n type=\"text\"\n />\n\n <label \n className=\"form__label form__label--email\"\n htmlFor=\"email-input\"\n >Email:</label>\n <input \n className=\"form__input form__input--email\"\n default=\"email\"\n id=\"email-input\"\n name=\"email\"\n onChange={e => setEmail(e.target.value)}\n type=\"text\"\n />\n\n <label \n className=\"form__label form__label--password\"\n htmlFor=\"password-input\"\n >Password:</label>\n <input\n className=\"form__input form__input--password\" \n default=\"\"\n id=\"password-input\"\n name=\"password\"\n onChange={e => setPassword(e.target.value)}\n type=\"password\"\n />\n\n <label \n className=\"form__label form__label--password\"\n htmlFor=\"confirmPassword-input\"\n >Confirm password:</label>\n <input \n className=\"form__input form__input--password\" \n name=\"confirmPassword\"\n id=\"confirmPassword-input\"\n type=\"password\"\n onChange={e => setConfirmPassword(e.target.value)}\n default=\"\"\n />\n\n <input \n className=\"form__submit\"\n type=\"submit\" \n value=\"Create Account!\"\n />\n\n </form>\n </div>\n );\n}\n\nexport default Signup;","import React, { useState } from 'react';\n\nimport Login from '../Login/Login';\nimport Signup from '../Signup/Signup';\n\nconst Auth = (props) => {\n const [ showForm, setShowForm ] = useState('login')\n const { state, dispatch } = props;\n\n return (\n <>\n <div \n className=\"nav__section nav__section--auth\" \n onClick={()=>{setShowForm('login')}}\n >\n <p \n className=\"nav__section__label\"\n >Login</p>\n\n {\n showForm === 'login' \n ? <Login dispatch={dispatch} state={state}/> \n : <></>\n }\n </div>\n\n <div\n className=\"nav__section nav__section--auth\" \n onClick={()=>{setShowForm('signup')}}\n >\n <p \n className=\"nav__section__label\"\n >Signup</p>\n\n {\n showForm === 'signup' \n ? <Signup dispatch={dispatch} state={state}/> \n : <></>\n }\n </div>\n </>\n );\n}\n\nexport default Auth;\n","import React from 'react';\nimport './NewRoom.scss';\n\nconst NewRoomButton = () => {\n return (\n <div \n className=\"nav__section\" \n >\n <p \n className=\"nav__section__label\"\n >\n New Room\n </p>\n </div>\n );\n}\n\nexport default NewRoomButton;","import React from 'react';\nimport './FindRoom.scss';\n\nconst FindRoomForm = () => {\n return (\n <div \n className=\"nav__section\" \n >\n <p \n className=\"nav__section__label\"\n >\n Find Room\n </p>\n </div>\n );\n}\n\nexport default FindRoomForm;","import React from 'react';\nimport './Library.scss';\n\nconst LibraryButton = () => {\n return (\n <div \n className=\"nav__section\" \n >\n <p \n className=\"nav__section__label\"\n >\n Library\n </p>\n </div>\n );\n}\n\nexport default LibraryButton;","import React from 'react';\n\nimport Auth from '../../components/Form/Auth/Auth';\nimport NewRoomButton from '../../components/Button/NewRoom/NewRoom';\nimport FindRoomForm from '../../components/Form/FindRoom/FindRoom';\nimport LibraryButton from '../../components/Button/Library/Library';\n\nconst HomeSidebar = (props) => {\n const { state, dispatch } = props;\n\n const ifUser = <>\n <FindRoomForm />\n <NewRoomButton />\n <LibraryButton />\n </>\n\n const ifNoUser = <Auth state={state} dispatch={dispatch} />\n\n return ( \n <nav>\n {\n state.user.username \n ? ifUser \n : ifNoUser\n }\n </nav>\n );\n}\n\nexport default HomeSidebar;","import React from 'react';\n\nconst NewsSidebar = () => {\n return ( \n <nav>\n </nav>\n );\n}\n\nexport default NewsSidebar;","import React from 'react';\nimport './FindGame.scss';\n\nconst FindGameForm = () => {\n return (\n <div \n className=\"nav__section\" \n >\n <p \n className=\"nav__section__label\"\n >\n Find Game\n </p>\n </div>\n );\n}\n\nexport default FindGameForm;","import React from 'react';\nimport './NewGame.scss';\n\nconst NewGameButton = () => {\n return (\n <div \n className=\"nav__section\" \n >\n <p \n className=\"nav__section__label\"\n >\n New Game\n </p>\n </div>\n );\n}\n\nexport default NewGameButton;","import React from 'react';\nimport './RoomArchive.scss';\n\nconst RoomArchiveButton = () => {\n return (\n <div \n className=\"nav__section\" \n >\n <p \n className=\"nav__section__label\"\n >\n Room Archive\n </p>\n </div>\n );\n}\n\nexport default RoomArchiveButton;","import React from 'react';\n\nimport Auth from '../../components/Form/Auth/Auth';\nimport FindGameForm from '../../components/Form/FindGame/FindGame';\nimport NewGameButton from '../../components/Button/NewGame/NewGame';\nimport RoomArchiveButton from '../../components/Button/RoomArchive/RoomArchive';\n\nconst RoomSidebar = props => {\n const {state, dispatch} = props;\n\n const showAuth = () => {\n if (state.errors.joinGame) {\n return (\n <Auth state={state} dispatch={dispatch} />\n )\n }\n return <></>\n }\n\n return ( \n <nav>\n <h3>{ state.currentRoom.name }</h3>\n {showAuth()}\n <FindGameForm />\n <NewGameButton />\n <RoomArchiveButton />\n </nav>\n );\n}\n\nexport default RoomSidebar;","import React from 'react';\nimport './Sidebar.scss';\n\nimport AccountSidebar from '../../Account/AccountSidebar';\nimport HomeSidebar from '../../Home/HomeSidebar';\nimport NewsSidebar from '../../News/NewsSidebar';\nimport RoomSidebar from '../../Room/RoomSidebar';\n\nconst Sidebar = (props) => {\n const {page, state, dispatch} = props\n const displayComponent = () =>{\n switch (page) {\n case 'account':\n return <AccountSidebar state={state} dispatch={dispatch}/>\n case 'home':\n return <HomeSidebar state={state} dispatch={dispatch}/>\n case 'news':\n return <NewsSidebar state={state} dispatch={dispatch}/>\n case 'room':\n return <RoomSidebar state={state} dispatch={dispatch}/>\n default:\n return <></>\n }\n }\n\n return (\n <aside className=\"Sidebar\" data-testid=\"Sidebar\">\n {displayComponent()}\n </aside>\n );\n}\n\nexport default Sidebar;","import React from 'react';\nimport './Account.scss';\n\nconst Account = () => {\n return ( \n <div className=\"Account\" data-testid=\"Account\">\n <p>Account</p>\n </div>\n );\n}\n\nexport default Account;","import config from '../../config';\n\nconst apiAddress = config.apiAddress;\nconst gamesAddress = `${apiAddress}/games`\n\nvar headers = new Headers();\nheaders.append('Content-Type', 'application/json');\nheaders.append('Accept', 'application/json');\nheaders.append('Sec-Fetch-Site', 'cross-site')\n\nconst getGameService = async (gameIndex) => {\n const response = await fetch(`${gamesAddress}/${gameIndex}`, \n {method: 'GET', credentials: 'include', headers: headers}\n )\n .then(res => res.text())\n .then(text => JSON.parse(text))\n .then(obj => {\n // Reformat from SQL coluumn name convention to JS\n delete Object.assign(obj.game, {applicationVersion: obj.game.application_version }).application_version;\n delete Object.assign(obj.game, {boardSize: obj.game.board_size }).board_size;\n delete Object.assign(obj.game, {playerBlack: obj.game.player_black }).player_black;\n delete Object.assign(obj.game, {playerBlackRank: obj.game.player_black_rank }).player_black_rank;\n delete Object.assign(obj.game, {playerWhite: obj.game.player_white }).player_white;\n delete Object.assign(obj.game, {playerWhiteRank: obj.game.player_white_rank }).player_white_rank;\n delete Object.assign(obj.game, {capturesWhite: obj.game.captures_white }).captures_white;\n delete Object.assign(obj.game, {capturesBlack: obj.game.captures_black }).captures_black;\n delete Object.assign(obj.game, {mainTime: obj.game.main_time }).main_time;\n delete Object.assign(obj.game, {timePeriod: obj.game.time_period }).time_period;\n delete Object.assign(obj.game, {periodLength: obj.game.period_length }).period_length;\n delete Object.assign(obj.game, {overtimePeriod: obj.game.overtime_period }).overtime_period;\n delete Object.assign(obj.game, {overtimeLength: obj.game.overtime_length }).overtime_length;\n delete Object.assign(obj.game, {winType: obj.game.win_type }).win_type;\n\n return obj;\n })\n .catch(err => err);\n\n return response;\n}\n \nexport default {\n getGameService\n}","import React from 'react';\nimport './Point.scss';\n\nconst Point = (props) => {\n const { posX, posY, user, game, dispatch, pointData } = props;\n const turn = game.turn > 0 ? 'black' : 'white';\n \n const stone = () => {\n if (pointData === 1) return 'black'\n if (pointData === -1) return 'white'\n return 'none'\n }\n\n const dot = () => {\n if (pointData === 'l') return game.turn;\n }\n\n const xFlag = () => {\n if ( posX === 1 ) return `board__point--top`\n if ( posX === game.boardSize ) return `board__point--bottom`\n return '';\n }\n const yFlag = () => {\n if ( posY === 1 ) return `board__point--left`\n if ( posY === game.boardSize ) return `board__point--right`\n return '';\n }\n const clickHandle = (e) => {\n const action = {\n type: 'SOCKET',\n message: 'MAKE_MOVE',\n body: {\n user,\n game,\n room: game.room,\n board: {},\n move: { player: turn, pos: { x: posX, y: posY } }\n }\n }\n dispatch(action);\n }\n\n return (\n <div \n className={`board__point ${xFlag()} ${yFlag()}`}\n onClick={e => clickHandle(e)}\n >\n <div className=\"board__point__stone\" \n data-stone={stone()}\n >\n <div className=\"board__point__dot\" data-dot={dot()}></div>\n </div>\n\n </div>\n );\n}\n\nexport default Point;","import React from 'react';\nimport './Board.scss';\nimport Point from '../Point/Point';\n\nconst Board = (props) => {\n const { game, user, dispatch, board } = props;\n const sizeFlag = `Game__board--size-${ game.boardSize }`\n\n const renderPoints = boardSize => {\n let i = 0, boardPoints = [];\n while (i < boardSize * boardSize) {\n const posX = Math.floor(i/boardSize) + 1;\n const posY = i % boardSize + 1;\n console.log(board[`${posX}-${posY}`])\n boardPoints.push(\n <Point \n key={`${posX}-${posY}`} \n posX={posX}\n posY={posY}\n pointData={board[`${posX}-${posY}`]}\n // point={board[posX][posY]}\n dispatch={dispatch}\n user={user}\n {...props}\n />\n ); i++;\n }\n return boardPoints;\n }\n\n return ( \n <div className={`Game__board ${sizeFlag}`}>\n { game.id ? renderPoints(game.boardSize) : <></> }\n </div>\n );\n}\n\nexport default Board;","import React from 'react';\nimport './PlayerArea.scss';\n\nconst PlayerArea = (props) => {\n // const { user } = props\n const user = {\n stones: 'black',\n username: 'Name',\n captures: 0\n }\n\n return (\n <div\n className={`player-container player-container--${user.stones}`}\n >\n <div \n className={`player-container__bowl player-container__bowl--${user.stones}`}\n >\n <p>Pass?</p>\n </div>\n <div\n className={`player-container__name-space player-container__name-space--${user.stones}`}\n >\n <h4>{user ? user.username : 'Waiting for player' }</h4>\n\n <div\n className={`player-container__caps-space player-container__caps-space__${user.stones}`}\n >\n <p\n className={`player-container__resign-message player-container__resign-message--${user.stones}`}\n >Resign?</p>\n\n <p \n className={`player-container__caps-counter player-container__caps-counter--${user.stones}`}\n >{user ? user.captures : 'Captures go here'}</p>\n\n </div>\n\n </div>\n\n </div>\n );\n}\n\nexport default PlayerArea;","import React, { useEffect } from 'react';\nimport { useParams } from 'react-router-dom';\nimport gamesServices from '../../services/api/gamesServices';\nimport './Game.scss';\nimport Logo from '../../components/Display/Logo/Logo';\nimport Board from '../../components/GameUI/Board/Board';\nimport PlayerArea from '../../components/GameUI/PlayerArea/PlayerArea';\n\nconst Game = (props) => {\n const { state, dispatch } = props;\n const gameId = parseInt(useParams().id) || 0;\n\n \n useEffect(() => {\n const fetchGameAPI = async () => {\n const response = await gamesServices.getGameService(gameId);\n if (response) {\n const action = {\n type: 'GAMES',\n message: 'SET_ACTIVE',\n body: response\n }\n return dispatch(action);\n }\n }\n fetchGameAPI();\n }, [ gameId, dispatch ])\n\n \n useEffect(() => {\n const roomSocketConnect = () => {\n const game = state.active.game;\n const user = state.user;\n const action = {\n type: 'SOCKET',\n message: 'CONNECT_GAME',\n body: { game, user, dispatch }\n }\n return dispatch(action);\n }\n roomSocketConnect();\n }, [ state.active , dispatch, state.user ] )\n\n return ( \n <div \n className=\"Game\" \n data-testid=\"Game\"\n >\n <div className=\"Game__meta-container\">\n <span \n className=\"Game__socket-flag\"\n >{state.socket ? '✓' : ' ⃠'}</span>\n <Logo />\n <p>Timer</p>\n <p>? Game Tree</p>\n </div>\n\n <div className=\"Game__board-container\">\n <PlayerArea />\n <Board \n dispatch={dispatch}\n game={state.active.game} \n record={state.active.record}\n user={state.user}\n board={state.board}\n />\n <PlayerArea />\n </div>\n\n <div className=\"Game__message-container\">\n <p>Messages</p>\n <p>Message Form</p>\n </div>\n </div>\n );\n}\n\nexport default Game;","import config from '../../config';\n\nconst apiAddress = config.apiAddress;\nconst roomsAddress = `${apiAddress}/rooms`\n\nvar headers = new Headers();\nheaders.append('Content-Type', 'application/json');\nheaders.append('Accept', 'application/json');\nheaders.append('Sec-Fetch-Site', 'cross-site')\n\nconst indexService = async () => {\n const response = await fetch(roomsAddress, \n {method: 'GET', credentials: 'include', headers: headers}\n )\n .then(res => res.text())\n .then(text => JSON.parse(text))\n .catch(err => err);\n \n return response;\n}\n\nconst getRoomService = async (roomIndex) => {\n const response = await fetch(`${roomsAddress}/${roomIndex}`, \n {method: 'GET', credentials: 'include', headers: headers}\n )\n .then(res => res.text())\n .then(text => JSON.parse(text))\n \n .then(obj => {\n obj.games = obj.roomGames.map(game => {\n delete Object.assign(game, {boardSize: game.board_size }).board_size;\n delete Object.assign(game, {playerBlack: game.player_black }).player_black;\n delete Object.assign(game, {playerBlackRank: game.player_black_rank }).player_black_rank;\n delete Object.assign(game, {playerWhite: game.player_white }).player_white;\n delete Object.assign(game, {playerWhiteRank: game.player_white_rank }).player_white_rank;\n delete Object.assign(game, {winType: game.win_type }).win_type;\n\n return game;\n })\n return obj;\n })\n .catch(err => err);\n\n return response;\n}\n \nexport default {\n indexService,\n getRoomService\n}","import React from 'react';\nimport { Link } from 'react-router-dom';\nimport './Room.scss';\n\nconst RoomButton = (props) => {\n const roomData = props.room;\n return (\n <div className=\"RoomButton\" data-testid=\"RoomButton\">\n <h4 className=\"RoomButton__room-name\">{roomData.name}</h4>\n <Link to={`/rooms/${roomData.id}`}>Join Room</Link>\n </div>\n );\n}\n\nexport default RoomButton;","import React from 'react';\nimport './Loading.scss';\n\nconst Loading = () => {\n return ( \n <div\n className=\"Loading\"\n >\n <div\n className=\"point\"\n id=\"a-1\"\n ></div>\n <div\n className=\"point\"\n id=\"a-2\"\n ></div>\n <div\n className=\"point\"\n id=\"a-3\"\n ></div>\n <div\n className=\"point\"\n id=\"a-4\"\n ></div>\n \n <div\n className=\"point\"\n id=\"b-1\"\n ></div>\n <div\n className=\"point\"\n id=\"b-2\"\n ></div>\n <div\n className=\"point\"\n id=\"b-3\"\n ></div>\n <div\n className=\"point\"\n id=\"b-4\"\n ></div>\n \n <div\n className=\"point\"\n id=\"c-1\"\n ></div>\n <div\n className=\"point\"\n id=\"c-2\"\n ></div>\n <div\n className=\"point\"\n id=\"c-3\"\n ></div>\n <div\n className=\"point\"\n id=\"c-4\"\n ></div>\n \n <div\n className=\"point\"\n id=\"d-1\"\n ></div>\n <div\n className=\"point\"\n id=\"d-2\"\n ></div>\n <div\n className=\"point\"\n id=\"d-3\"\n ></div>\n <div\n className=\"point\"\n id=\"d-4\"\n ></div>\n </div>\n );\n}\n\nexport default Loading;","import React, { useEffect } from 'react';\nimport './Home.scss';\nimport roomsServices from '../../services/api/roomsServices';\nimport RoomButton from '../../components/Button/Room/Room';\n\nimport Loading from '../../components/Display/Loading/Loading';\n\nconst Home = props => {\n const state = props.state || {};\n const dispatch = props.dispatch;\n \n const renderRooms = () => {\n const rooms = state.rooms || [];\n if (rooms.length) {\n return rooms.map(roomData => (\n <RoomButton \n key={`room-${roomData.id}`}\n room={roomData}\n />\n ))\n }\n // TODO stub loader\n return <Loading />\n }\n\n \n useEffect(() => {\n const fetchRoomsAPI = async () => {\n const response = await roomsServices.indexService();\n if (response) {\n const action = {\n type: 'ROOMS',\n message: 'SET_ROOMS',\n body: response.rooms\n }\n return dispatch(action)\n }\n }\n fetchRoomsAPI();\n }, [ dispatch ])\n\n return ( \n <div className=\"Home\" data-testid=\"Home\">\n {renderRooms()}\n </div>\n );\n}\n\nexport default Home;","import React from 'react';\nimport './News.scss';\n\nconst News = () => {\n return ( \n <div className=\"News\" data-testid=\"News\">\n <p>News</p>\n </div>\n );\n}\n\nexport default News;","import React from 'react';\nimport { Link } from 'react-router-dom';\nimport './Game.scss';\n\nconst GameButton = (props) => {\n const { game, dispatch, user } = props;\n\n const requestJoinGame = () => {\n console.log(`request to Join Game ${game.id}!`)\n const requestAction = {\n type: 'GAMES',\n message: 'JOIN_REQUEST',\n body: {id: game.id}\n }\n dispatch(requestAction);\n }\n\n const renderOpenGame = () => {\n return (\n <>\n <div onClick={() => requestJoinGame()} >Request to Join Game</div>\n\n <div className=\"GameButton__player-data GameButton__player-data--black\">\n <span className=\"GameButton__player-data__name GameButton__player-data__name--black\">{game.playerBlack}</span>\n <span className=\"GameButton__player-data__rank GameButton__player-data__rank--black\">{game.playerBlackRank}</span>\n </div>\n </>\n )\n }\n\n const renderInProgressGame = () => {\n const gameLinkText = game.winType ? 'Study Game' \n : user ? 'Rejoin Game' : 'Watch Game' \n return (\n <>\n <div className=\"GameButton__seat GameButton__seat--black\">\n\n </div>\n \n <div className=\"GameButton__table\">\n <div className=\"GameButton__table__meta\">\n <div \n className=\"GameButton__player-data GameButton__player-data--black\"\n >\n <span \n className=\"GameButton__player-data__name GameButton__player-data__name--black\"\n >{game.playerBlack}</span>\n <span \n className=\"GameButton__player-data__rank GameButton__player-data__rank\"\n >{game.playerBlackRank}</span>\n </div>\n \n <Link \n className=\"GameButton__link\"\n to={`/games/${game.id}`}\n >{gameLinkText}</Link>\n\n <div \n className=\"GameButton__player-data GameButton__player-data--white\"\n >\n <span \n className=\"GameButton__player-data__name GameButton__player-data__name--white\"\n >{game.playerWhite}</span>\n <span \n className=\"GameButton__player-data__rank GameButton__player-data__rank--white\"\n >{game.playerWhiteRank}</span>\n </div>\n </div>\n\n <div className=\"GameButton__table__image\">\n <div className=\"table__player-area table__player-area--black\">\n <div className=\"table__player-bowl table__player-bowl--black\"></div>\n </div>\n <div className=\"table__game-board\">\n <div className=\"table__game-board--grid\"></div>\n </div>\n <div className=\"table__player-area table__player-area--white\">\n <div className=\"table__player-bowl table__player-bowl--white\"></div>\n </div>\n </div>\n </div>\n\n <div className=\"GameButton__seat GameButton__seat--white\">\n\n </div>\n\n </>\n )\n }\n\n return (\n <div className=\"GameButton\" data-testid=\"GameButton\">\n {game.open ? renderOpenGame() : renderInProgressGame()}\n </div>\n );\n}\n\nexport default GameButton;","import React from 'react';\nimport './Message.scss';\n\nconst Message = (props) => {\n const messageData = props.message;\n return (\n <div \n className=\"Message\" \n data-testid=\"Message\"\n >\n <p>{messageData.content}</p>\n <p>{messageData.username}</p>\n <p>{messageData.admin ? 'admin' : <></>}</p>\n </div>\n );\n}\n\nexport default Message;","import React from 'react';\nimport './ActionError.scss';\n\nconst ActionError = (props) => {\n const errorMessage = props.error;\n return (\n <span \n className=\"error error--action\"\n data-testid=\"ActionError\" \n >\n {errorMessage}\n </span>\n );\n}\n\nexport default ActionError;","import React from 'react';\n\nconst Development = () => {\n return (<>\n <p>This Feature is in Development :)</p>\n </>);\n}\n\nexport default Development;","import React, { useEffect } from 'react';\nimport { useParams } from 'react-router-dom';\nimport './Room.scss';\nimport roomsServices from '../../services/api/roomsServices';\nimport GameButton from '../../components/Button/Game/Game';\nimport Message from '../../components/Display/Message/Message';\nimport ActionError from '../../components/Error/ActionError/ActionError';\n\nimport Development from '../../components/Display/Development/Development';\nimport Loading from '../../components/Display/Loading/Loading';\n\nconst Room = (props) => {\n const { state, dispatch } = props;\n const roomId = parseInt(useParams().id) || 0;\n\n \n useEffect(() => {\n const fetchRoomAPI = async () => {\n const response = await roomsServices.getRoomService(roomId);\n if (response) {\n const action = {\n type: 'ROOMS',\n message: 'JOIN_ROOM',\n body: response\n }\n return dispatch(action);\n }\n }\n fetchRoomAPI();\n }, [ roomId, dispatch ])\n\n useEffect(() => {\n const roomSocketConnect = () => {\n const action = {\n type: 'SOCKET',\n message: 'CONNECT_ROOM',\n body: {user: state.user, room: roomId, dispatch}\n }\n dispatch(action)\n }\n roomSocketConnect();\n }, [ roomId, state.user, dispatch ])\n\n const renderGames = () => {\n const games = state.games || [];\n if (games.length) {\n return games.map(gameData => (\n <GameButton \n key={`game-${gameData.id}`}\n game={gameData}\n dispatch={dispatch}\n user={gameData.playerBlack === state.user.username || gameData.playerWhite === state.user.username}\n />\n ))\n }\n return <Loading />\n }\n\n const renderMessages = () => {\n const messages = state.messages || [];\n if (messages.length) {\n return messages.map((messageData, idx) => (\n <Message\n key={`message-${idx}`}\n message={messageData}\n />\n ))\n }\n return <Loading />\n }\n\n\n return ( \n <div className=\"Room\" data-testid=\"Room\">\n \n <div className=\"Room__heading\">\n {state.errors.joinGame ? <ActionError error={state.errors.joinGame}/> : <></>}\n </div>\n\n <div className=\"Room__game-container\">\n {renderGames()}\n </div>\n\n <div className=\"Room__message-container\">\n {renderMessages()}\n <Development />\n </div>\n\n </div>\n );\n}\n\nexport default Room;","import React from 'react';\nimport './MainWrapper.scss';\n\nimport NavBar from '../NavBar/NavBar';\nimport Sidebar from '../Sidebar/Sidebar';\nimport Account from '../../Account/Account';\nimport Game from '../../Game/Game';\nimport Home from '../../Home/Home';\nimport News from '../../News/News';\nimport Room from '../../Room/Room';\n\nconst MainWrapper = (props) => {\n const { state, page, dispatch } = props;\n\n const setWrapperWithSidebarAndPage = () => {\n if (page === 'game') return selectPage()\n return (\n <div className=\"main-wrapper\" data-testid=\"main-wrapper\">\n <NavBar state={state}/>\n <div className=\"content-wrapper\">\n <Sidebar page={page} state={state} dispatch={dispatch}/>\n <main>\n {selectPage()}\n </main>\n </div>\n </div>\n )\n }\n\n const selectPage = () =>{\n switch (page) {\n case 'account':\n return <Account state={state} dispatch={dispatch}/>\n case 'game':\n return <Game state={state} dispatch={dispatch}/>\n case 'home':\n return <Home state={state} dispatch={dispatch}/>\n case 'news':\n return <News state={state} dispatch={dispatch}/>\n case 'room':\n return <Room state={state} dispatch={dispatch}/>\n default:\n return <></>\n }\n }\n\n return (\n <>\n { setWrapperWithSidebarAndPage() }\n </>\n );\n}\n\nexport default MainWrapper;","export const initState = () => {\n return {\n active: {\n game: {\n id: 0, room: 0, \n mainTime: '', timePeriod: 0, periodLength: 0, overtime: '', overtimePeriod: 0, overtimeLength: 0,\n application: '', applicationVersion: '', open: false, description: null,\n event: null, round: null, name: null, \n winType: null, capturesBlack: null, capturesWhite: null, score: null,\n boardSize: 0, komi: 0.0, handicap: 0,\n playerBlack: '', playerBlackRank: '', playerWhite: '', playerWhiteRank: '',\n },\n record: []\n },\n\n board: {},\n \n connect: { location: '', type: '' },\n \n currentRoom: { \n description: '', id: 0, language: '', name: '' \n },\n \n errors: {},\n \n games: [ { \n boardSize: 0, handicap: 0, id: 0, komi: 0.0, open: false, \n playerBlack: '', playerBlackRank: '', playerWhite: '',\n playerWhiteRank: '', winType: null\n } ],\n \n joinGame: {},\n \n messages: [ { \n admin: false, content: '', username: ''\n } ],\n \n socket: {\n connected: false,\n nsp: ''\n },\n \n user: { username: '', email: '', id: 0 }\n };\n}","export const authReducer = (state, action) => {\n switch (action.message) {\n case 'LOGIN':\n return loginReducer(state, action);\n \n case 'SIGNUP':\n return loginReducer(state, action);\n\n case 'LOGOUT':\n return state;\n\n default:\n return state;\n } \n}\n\nfunction loginReducer(state, action) {\n const newUser = action.body;\n return {...state, user: newUser }; \n}","export const errorReducer = (state, action) => {\n switch (action.message) {\n case 'AUTH_ERROR':\n return authErrorReducer(state, action);\n\n case 'JOIN_ROOM_ERROR':\n return joinRoomErrorReducer(state, action);\n \n case 'JOIN_GAME_ERROR':\n return joinGameErrorReducer(state, action);\n\n default:\n return state;\n } \n}\n\nfunction authErrorReducer(state, action) {\n const auth = action.body.authError;\n return {...state, errors: {auth} };\n}\n\nfunction joinRoomErrorReducer(state, action) {\n const joinRoom = action.body.joinRoomError;\n return { ...state, errors: {joinRoom} }\n}\n\nfunction joinGameErrorReducer(state, action) {\n const joinGame = action.body.joinGameError;\n return { ...state, errors: {joinGame} }\n}","export const indexReducer = (state, action) => {\n switch(action.message) {\n\n case 'SET_USER':\n const user = action.body;\n return {...state, user};\n \n default: \n return state;\n }\n}","import { stateReducer } from '../reducer';\n\nexport const roomsReducer = (state, action) => {\n switch(action.message) {\n\n case 'SET_ROOMS':\n const rooms = action.body;\n return {...state, rooms};\n\n case 'SET_CURRENT':\n const currentRoom = action.body;\n return {...state, currentRoom};\n\n case 'JOIN_ROOM': {\n const stateWithRoom = setCurrentRoom(state, action);\n const stateWithMessages = setMessages(stateWithRoom, action);\n if (!action.body.roomGames) {\n return setJoinRoomError(state);\n }\n const stateWithGames = setGames(stateWithMessages, action);\n\n return stateWithGames;\n }\n\n case 'NEW_USER': {\n if (!action.data) {\n return state;\n }\n return state;\n }\n \n default:\n return state;\n }\n}\n\nfunction setMessages(state, action) {\n if(action.body.messages.length) {\n const messages = action.body.messages;\n const messageAction = {\n type: 'MESSAGES',\n message: 'SET_MESSAGES',\n body: messages\n }\n return stateReducer(state, messageAction);\n }\n return state;\n}\n\nfunction setJoinRoomError(state, body) {\n const errorAction = {\n type: 'ERR',\n message: 'JOIN_ROOM_ERROR',\n body: { joinRoomError: 'Game room has no games' }\n }\n return stateReducer(state, errorAction);\n}\n\nfunction setCurrentRoom(state, action) {\n const currentRoom = action.body.currentRoom;\n const roomAction = {\n type: 'ROOMS',\n message: 'SET_CURRENT',\n body: currentRoom\n }\n return stateReducer(state, roomAction);\n}\n\nfunction setGames(state, action) {\n if (action.body.roomGames.length) {\n const games = action.body.roomGames;\n const gamesAction = {\n type: 'GAMES',\n message: 'SET_GAMES',\n body: games\n }\n return stateReducer(state, gamesAction);\n }\n return state;\n}","import { stateReducer } from '../reducer';\n\nexport const messagesReducer = (state, action) => {\n switch(action.message) {\n\n case 'SET_MESSAGES':\n const messages = action.body;\n return {...state, messages};\n\n \n default:\n return state;\n }\n}","import { stateReducer } from '../reducer';\n\nexport const gamesReducer = (state, action) => {\n switch(action.message) {\n\n case 'SET_GAMES':\n const games = formatGames(action);;\n return {...state, games};\n \n case 'JOIN_REQUEST':\n if (!Object.entries(state.user).length) {\n const errAction = {\n type: 'ERR',\n message: 'JOIN_GAME_ERROR',\n body: {joinGameError: 'user not logged in'}\n }\n return stateReducer(state, errAction)\n }\n const id = action.body;\n return {...state, joinGame: id};\n\n case 'UPDATE_BOARD':\n console.log(action.body)\n return {...state, board: action.body};\n\n case 'SET_ACTIVE':\n return {...state, active: action.body};\n \n default:\n return state;\n }\n}\n\nfunction parseRank(rank) {\n switch(rank[0]) {\n case 'D':\n return `${rank.slice(1)}${rank[0].toLowerCase()}`\n case 'K':\n return `${rank.slice(1)}${rank[0].toLowerCase()}`\n case 'U':\n return '?'\n }\n}\n\nfunction formatGames(action) {\n const games = [...action.body].map(game => {\n\n if (game.playerBlackRank) {\n game.playerBlackRank = parseRank(game.playerBlackRank)\n }\n\n if (game.playerWhiteRank) {\n game.playerWhiteRank = parseRank(game.playerWhiteRank)\n }\n\n return game;\n })\n\n return games;\n}","import { stateReducer } from '../reducer';\nconst io = require('../../io');\n\nexport const socketReducer = (state, action) => {\n switch(action.message) {\n\n case 'CONNECTED':\n console.log(action.body.nsp)\n return {...state, connect: { type: 'home', location: action.body.nsp } }\n\n case 'LAUNCH': {\n const {nsp, dispatch} = action.body;\n const launchedSocket = io.launch(nsp, dispatch);\n return {...state, socket: launchedSocket};\n }\n\n case 'CONNECT_ROOM': {\n const {user, room, dispatch} = action.body;\n let priorSocket = state.socket;\n if (!priorSocket.nsp) {\n priorSocket = io.launch('', dispatch)\n }\n if (priorSocket.nsp !== `/${room}`) {\n priorSocket.emit('connect_room', {user, room});\n priorSocket.close();\n }\n const socket = io.launch(room, dispatch);\n return {...state, socket}\n }\n\n case 'CONNECT_GAME': {\n return connectGame(state, action);\n }\n\n case 'MAKE_MOVE': {\n return makeMove(state, action);\n }\n\n default:\n return state;\n }\n}\n\nfunction connectGame (state, action) {\n const { user, game, dispatch } = action.body;\n const priorSocket = state.socket;\n let updatedState;\n if ( !priorSocket.nsp || priorSocket.nsp !== `/${game.room}` ) {\n const connectRoomAction = {\n type: 'SOCKET',\n message: 'CONNECT_ROOM',\n body: { user, room: game.room, dispatch}\n }\n updatedState = stateReducer(state, connectRoomAction);\n \n }\n if (!updatedState) updatedState = {...state};\n const socket = updatedState.socket;\n socket.emit('connect_game', {user, game});\n return {...updatedState};\n}\n\nfunction makeMove (state, action) {\n const { user, game, room, board, move } = action.body;\n const socket = state.socket;\n console.log(action)\n socket.emit('make_move', {...action.body});\n return state;\n}","import { initState } from './init/reducer.init';\nimport { authReducer } from './auth/reducer.auth';\nimport { errorReducer } from './err/reducer.err';\nimport { indexReducer } from './index/reducer.index';\nimport { roomsReducer } from './rooms/reducer.rooms';\nimport { messagesReducer } from './messages/reducer.messages';\nimport { gamesReducer } from './games/reducer.games';\nimport { socketReducer } from './socket/reducer.socket';\n\n\nexport const stateReducer = (state, action) => {\n const errorStrippedState = stripErrors({...state});\n \n switch (action.type) {\n case 'INIT': return initState();\n \n case 'AUTH':\n return authReducer(errorStrippedState, action);\n\n case 'GAMES':\n return gamesReducer(errorStrippedState, action);\n\n case 'INDEX':\n return indexReducer(errorStrippedState, action);\n\n case 'MESSAGES':\n return messagesReducer(errorStrippedState, action);\n\n case 'ROOMS':\n return roomsReducer(errorStrippedState, action);\n\n case 'SOCKET':\n return socketReducer(errorStrippedState, action);\n\n case 'ERR':\n return errorReducer(errorStrippedState, action);\n\n default: return state;\n }\n}\n\nfunction stripErrors(state) {\n return {...state, errors: {}}\n}","import config from '../../config';\n\nconst apiAddress = config.apiAddress;\n\nvar headers = new Headers();\nheaders.append('Content-Type', 'application/json');\nheaders.append('Accept', 'application/json');\nheaders.append('Sec-Fetch-Site', 'cross-site')\n\nconst indexService = async () => {\n const response = await fetch(apiAddress, \n {method: 'GET', credentials: 'include', headers: headers}\n )\n .then(res => res.text())\n .then(text => JSON.parse(text))\n .catch(err => {\n return err;\n });\n return response;\n}\n\nexport default {\n indexService\n}","import React, { useEffect, useReducer } from 'react';\nimport { Switch, Route, BrowserRouter as Router } from 'react-router-dom';\nimport MainWrapper from './pages/Layout/MainWrapper/MainWrapper';\nimport { stateReducer } from './reducers/reducer';\nimport { initState } from './reducers/init/reducer.init';\nimport indexServices from './services/api/indexServices';\nimport './App.scss';\n\n\nfunction App() {\n const [ state, dispatch ] = useReducer(\n stateReducer,\n {},\n initState\n );\n \n useEffect(() => {\n const fetchIndexAPI = async () => {\n const response = await indexServices.indexService();\n if (response) {\n const action = {\n type: 'INDEX',\n message: 'SET_USER',\n body: response\n }\n dispatch(action)\n }\n }\n fetchIndexAPI();\n }, [ ])\n\n \n useEffect(() => {\n const socketConnect = () => {\n if (state.connect.type) return;\n dispatch({type:'SOCKET', message: 'LAUNCH', body:{nsp:'', dispatch}});\n }\n socketConnect();\n }, [ state.connect ])\n\n return (\n <Router>\n \n <div data-testid=\"App\" className=\"App\">\n <Switch>\n\n <Route path=\"/account\">\n <MainWrapper page=\"account\" state={state} dispatch={dispatch}/>\n </Route>\n\n <Route path=\"/rooms/:id\">\n <MainWrapper page=\"room\" state={state} dispatch={dispatch}/>\n </Route>\n\n <Route path=\"/games/:id\">\n <MainWrapper page=\"game\" state={state} dispatch={dispatch}/>\n </Route>\n \n <Route path=\"/news\">\n <MainWrapper page=\"news\" state={state} dispatch={dispatch}/>\n </Route>\n\n <Route path=\"/home\">\n <MainWrapper page=\"home\" state={state} dispatch={dispatch}/>\n </Route>\n \n <Route path=\"/\">\n {state.user.username \n ? <MainWrapper page=\"home\" state={state} dispatch={dispatch}/> \n : <MainWrapper page=\"news\" state={state} dispatch={dispatch}/>}\n </Route>\n\n </Switch>\n <p className=\"App__socket-flag\">{state.connect.type ? '✓' : ' ⃠'}</p>\n </div>\n </Router>\n );\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' }\n })\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.scss';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(\n <App />\n , document.getElementById('root')\n);\n\nserviceWorker.unregister();\n"],"sourceRoot":""}