Changeset 64dc53b for components
- Timestamp:
- 06/11/22 23:50:19 (2 years ago)
- Branches:
- main
- Children:
- 4a1a3ca
- Parents:
- 87614a5
- Location:
- components
- Files:
-
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
components/Alert.jsx
r87614a5 r64dc53b 8 8 9 9 import { setBlackjack, setStyle } from '../redux/reducers/styleSlice' 10 import { setGame , setPlayer} from '../redux/reducers/playerSlice'10 import { setGame } from '../redux/reducers/playerSlice' 11 11 12 12 const Alert = () => { -
components/GameCircle.jsx
r87614a5 r64dc53b 4 4 5 5 import { useRouter } from 'next/router' 6 7 import { useState } from 'react'8 9 import { setInGame } from '../redux/reducers/playerSlice'10 import { useDispatch } from 'react-redux'11 import FullwidthText from './FullwidthText'12 6 13 7 const GameCircle = ( { src, text, routeTo, game } ) => { -
components/Header.jsx
r87614a5 r64dc53b 3 3 import Link from 'next/link' 4 4 5 import { useRouter } from 'next/router' 6 7 import { useState, useEffect } from 'react' 5 import { useEffect } from 'react' 8 6 import { useDispatch, useSelector } from 'react-redux' 9 7 … … 23 21 ...styleState.style, 24 22 displayRegisterScreen: true, 23 registerScreenInfo: { 24 ...styleState.style.registerScreenInfo, 25 setFocus: true 26 } 25 27 })) 26 28 } … … 30 32 ...styleState.style, 31 33 displayLoginScreen: true, 34 loginScreenInfo: { 35 ...styleState.style.loginScreenInfo, 36 setFocus: true 37 } 32 38 })) 33 39 } … … 128 134 </div> 129 135 </Link> 130 <nav >136 <nav className='mainHeaderNavigation'> 131 137 <ul> 132 138 {playerState.player.displayName === '' || playerState.player.displayName === 'Guest' ? ( -
components/LoginScreen.jsx
r87614a5 r64dc53b 2 2 3 3 import { useSelector, useDispatch } from 'react-redux' 4 5 import { useRef } from 'react' 4 6 5 7 import { setPlayer } from '../redux/reducers/playerSlice'; … … 9 11 10 12 const LoginScreen = () => { 13 const ref = useRef(null); 14 11 15 const dispatch = useDispatch(); 12 16 13 17 const playerState = useSelector(state => state.player); 14 18 const styleState = useSelector(state => state.style); 19 20 setTimeout(() => { 21 if (styleState.style.displayLoginScreen && styleState.style.loginScreenInfo.setFocus) { 22 ref.current.focus(); 23 dispatch(setStyle({ 24 ...styleState.style, 25 loginScreenInfo: { 26 ...styleState.style.loginScreenInfo, 27 setFocus: false 28 } 29 })) 30 } 31 }, 10); 15 32 16 33 function onChangeUsername(e) { … … 34 51 } 35 52 53 function keyUp(e) { 54 if (e.key === 'Enter') { 55 login(); 56 } 57 } 58 36 59 function closeForm() { 37 60 dispatch(setStyle({ … … 44 67 inlineAlertText: '', 45 68 })); 69 46 70 } 47 48 71 function login() { 49 72 dispatch(setStyle({ … … 119 142 <div> 120 143 <span>Username:</span> 121 <input type="text" onChange={(e) => {onChangeUsername(e)}} value={styleState.style.loginScreenInfo.username}/>144 <input ref={ref} type="text" onChange={(e) => {onChangeUsername(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.loginScreenInfo.username} placeholder="your username..."/> 122 145 <span>Password:</span> 123 <input type="password" onChange={(e) => {onChangePassword(e)}} value={styleState.style.loginScreenInfo.password}/>146 <input type="password" onChange={(e) => {onChangePassword(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.loginScreenInfo.password} placeholder="your password..."/> 124 147 <div style={{width: '100%', display: 'flex', flexDirection: 'row', justifyContent: 'space-between'}}> 125 148 <button className="primaryButton" onClick={() => closeForm()}>Close Form</button> -
components/RegisterScreen.jsx
r87614a5 r64dc53b 2 2 3 3 import { useSelector, useDispatch } from 'react-redux' 4 5 import { useRef } from 'react' 4 6 5 7 import { setStyle } from '../redux/reducers/styleSlice'; … … 8 10 9 11 const RegisterScreen = () => { 12 const ref = useRef(null); 13 10 14 const dispatch = useDispatch(); 11 15 12 16 const styleState = useSelector(state => state.style); 17 18 setTimeout(() => { 19 if (styleState.style.displayRegisterScreen && styleState.style.registerScreenInfo.setFocus) { 20 ref.current.focus(); 21 dispatch(setStyle({ 22 ...styleState.style, 23 registerScreenInfo: { 24 ...styleState.style.registerScreenInfo, 25 setFocus: false 26 } 27 })) 28 } 29 }, 10); 13 30 14 31 function onChangeUsername(e) { … … 40 57 } 41 58 })) 59 } 60 61 function keyUp(e) { 62 if (e.key === 'Enter') { 63 register(); 64 } 42 65 } 43 66 … … 89 112 status: 'success', 90 113 }, 114 inlineAlertText: '', 91 115 })); 92 116 } … … 107 131 <div> 108 132 <span>Username:</span> 109 <input type="text" onChange={(e) => {onChangeUsername(e)}} value={styleState.style.registerScreenInfo.username}/>133 <input ref={ref} type="text" onChange={(e) => {onChangeUsername(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.registerScreenInfo.username} placeholder="your username..."/> 110 134 <span>Display Name:</span> 111 <input type="text" onChange={(e) => {onChangeDisplayName(e)}} value={styleState.style.registerScreenInfo.displayName}/>135 <input type="text" onChange={(e) => {onChangeDisplayName(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.registerScreenInfo.displayName} placeholder="your display name..."/> 112 136 <span>Password:</span> 113 <input type="password" onChange={(e) => {onChangePassword(e)}} value={styleState.style.registerScreenInfo.password}/>137 <input type="password" onChange={(e) => {onChangePassword(e)}} onKeyUp={(e) => keyUp(e)} value={styleState.style.registerScreenInfo.password} placeholder="your password..."/> 114 138 <div style={{width: '100%', display: 'flex', flexDirection: 'row', justifyContent: 'space-between'}}> 115 139 <button className="primaryButton" onClick={() => closeForm()}>Close Form</button> -
components/blackjack/Blackjack.jsx
r87614a5 r64dc53b 1 1 import React from 'react' 2 2 3 import InGameHeader from '../../components/InGameHeader'3 import BlackjackHeader from './BlackjackHeader' 4 4 5 5 import Head from 'next/head' … … 18 18 </Head> 19 19 20 < InGameHeader/>20 <BlackjackHeader/> 21 21 22 22 <PlayButtons/> -
components/blackjack/BlackjackHeader.jsx
r87614a5 r64dc53b 7 7 import { AiOutlineArrowLeft } from 'react-icons/ai' 8 8 9 import { use State, useEffect } from 'react'9 import { useEffect } from 'react' 10 10 import { useDispatch, useSelector } from 'react-redux' 11 11 12 import { setGame, setPlayer } from '../ redux/reducers/playerSlice'13 import { setBlackjack, setStyle } from '../ redux/reducers/styleSlice'12 import { setGame, setPlayer } from '../../redux/reducers/playerSlice' 13 import { setBlackjack, setStyle } from '../../redux/reducers/styleSlice' 14 14 15 15 import axios from 'axios'; 16 16 17 const InGameHeader = () => {17 const BlackjackHeader = () => { 18 18 const dispatch = useDispatch(); 19 19 … … 267 267 } 268 268 269 export default InGameHeader269 export default BlackjackHeader -
components/blackjack/Cards.jsx
r87614a5 r64dc53b 2 2 3 3 import { useSelector } from 'react-redux' 4 5 import { useState } from 'react'6 4 7 5 import Card from '../Card' … … 9 7 const Cards = () => { 10 8 const playerState = useSelector(state => state.player) 11 12 let initialPos = {13 left: 70,14 top: 24,15 }16 9 17 10 let playerPos = { -
components/blackjack/PlayButtons.jsx
r87614a5 r64dc53b 8 8 9 9 import { useSelector, useDispatch } from 'react-redux' 10 import { useState, useEffect } from 'react'11 10 12 11 import axios from 'axios';
Note:
See TracChangeset
for help on using the changeset viewer.