Changeset 9bd09b0 for components
- Timestamp:
- 06/23/22 00:08:35 (2 years ago)
- Branches:
- main
- Children:
- ace7865
- Parents:
- 285c3cc
- Location:
- components
- Files:
-
- 10 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
components/Alert.jsx
r285c3cc r9bd09b0 8 8 9 9 import { setBlackjack, setStyle } from '../redux/reducers/styleSlice' 10 import { set Game } from '../redux/reducers/playerSlice'10 import { setBlackjackGame } from '../redux/reducers/playerSlice' 11 11 12 12 const Alert = () => { … … 30 30 axios.get(`/api/blackjack?action=play_again&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => { 31 31 if (res.data?.success && res.data?.game) { 32 dispatch(set Game({33 ...playerState. game,32 dispatch(setBlackjackGame({ 33 ...playerState.blackjackGame, 34 34 status: res.data.game?.status, 35 35 playerCards: res.data.game?.playerCards, -
components/LoginScreen.jsx
r285c3cc r9bd09b0 77 77 axios.post(`/api/postgre`, { 78 78 action: 'login', 79 username: styleState.style.loginScreenInfo.username, 80 password: styleState.style.loginScreenInfo.password, 79 username: 'drama', 80 password: 'drama' 81 // username: styleState.style.loginScreenInfo.username, 82 // password: styleState.style.loginScreenInfo.password, 81 83 }) 82 84 .then(res => { -
components/blackjack/Blackjack.jsx
r285c3cc r9bd09b0 1 1 import React from 'react' 2 2 3 import Head from 'next/head' 4 3 5 import BlackjackHeader from './BlackjackHeader' 4 5 import Head from 'next/head'6 6 import PlayButtons from '../../components/blackjack/PlayButtons' 7 7 import Cards from '../../components/blackjack/Cards' … … 13 13 const Blackjack = () => { 14 14 return ( 15 <div className="app " style={{backgroundImage: 'url("/images/blackjack-bg.png")', backgroundPosition: '0% 30%'}}>15 <div className="app blackjackMainContainer" style={{backgroundImage: 'url("/images/blackjack-bg.png")', backgroundPosition: '0% 30%'}}> 16 16 <Head> 17 17 <title>Caessino - Blackjack</title> -
components/blackjack/BlackjackHeader.jsx
r285c3cc r9bd09b0 10 10 import { useDispatch, useSelector } from 'react-redux' 11 11 12 import { set Game, setPlayer } from '../../redux/reducers/playerSlice'12 import { setBlackjackGame, setPlayer } from '../../redux/reducers/playerSlice' 13 13 import { setBlackjack, setStyle } from '../../redux/reducers/styleSlice' 14 14 … … 50 50 })); 51 51 52 dispatch(set Game({53 ...playerState. game,52 dispatch(setBlackjackGame({ 53 ...playerState.blackjackGame, 54 54 status: res.data?.status, 55 55 playerCards: res.data?.playerCards, … … 224 224 initialBet: { 225 225 ...styleState.blackjack.inputControls.initialBet, 226 chosenCredits: parseInt( postgreRes.data?.credits/2),226 chosenCredits: parseInt(res.data?.credits/2), 227 227 } 228 228 }, -
components/blackjack/Cards.jsx
r285c3cc r9bd09b0 22 22 return ( 23 23 <div className="blackjackCards"> 24 {playerState?. game?.playerCards?.map((card, i) => (24 {playerState?.blackjackGame?.playerCards?.map((card, i) => ( 25 25 <Card key={card} card={card} rotateZ={i*splitCardsMultiplyByInt} pos={{left: playerPos.left+i*splitCardsMultiplyByInt, top: playerPos.top}}/> 26 26 ))} 27 {playerState?. game?.dealerCards?.map((card, i) => (27 {playerState?.blackjackGame?.dealerCards?.map((card, i) => ( 28 28 <Card key={card} card={card} rotateZ={i*splitCardsMultiplyByInt} pos={{left: dealerPos.left+i*splitCardsMultiplyByInt, top: dealerPos.top}}/> 29 29 ))} -
components/blackjack/DisplayBet.jsx
r285c3cc r9bd09b0 7 7 const styleState = useSelector(state => state.style); 8 8 9 let display = parseInt(playerState. game.status.substr(1, 1)) >= 2 ? 'block' : 'none';10 let displaySideBet = ( parseInt(playerState. game.status.substr(1, 1)) >= 3 && parseInt(styleState.blackjack.inputControls.sideBet.chosenCredits) > 0 ) ? 'block' : 'none';9 let display = parseInt(playerState.blackjackGame.status.substr(1, 1)) >= 2 ? 'block' : 'none'; 10 let displaySideBet = ( parseInt(playerState.blackjackGame.status.substr(1, 1)) >= 3 && parseInt(styleState.blackjack.inputControls.sideBet.chosenCredits) > 0 ) ? 'block' : 'none'; 11 11 12 12 return ( -
components/blackjack/PlayButtons.jsx
r285c3cc r9bd09b0 4 4 import { AiFillCheckCircle } from 'react-icons/ai' 5 5 6 import { set Game, setPlayer } from '../../redux/reducers/playerSlice';6 import { setBlackjackGame, setPlayer } from '../../redux/reducers/playerSlice'; 7 7 import { setBlackjack, setStyle } from '../../redux/reducers/styleSlice'; 8 8 … … 46 46 axios.get(`/api/blackjack?action=make_initial_bet&session_id=${localStorage.CAESSINO_SESSION_ID}&bet=${styleState.blackjack.inputControls.initialBet.chosenCredits}`).then(res => { 47 47 if (res.data?.success) { 48 dispatch(set Game({49 ...playerState. game,48 dispatch(setBlackjackGame({ 49 ...playerState.blackjackGame, 50 50 status: res.data?.status, 51 51 })) … … 124 124 const texts = splitTexts(e.target.innerHTML); 125 125 126 dispatch(set Game({127 ...playerState. game,126 dispatch(setBlackjackGame({ 127 ...playerState.blackjackGame, 128 128 sideBetName: sideBetName 129 129 })) … … 145 145 146 146 function placeSideBetClicked() { 147 axios.get(`/api/blackjack?action=make_side_bet&session_id=${localStorage.CAESSINO_SESSION_ID}&bet=${styleState.blackjack.inputControls.sideBet.chosenCredits}&betName=${playerState. game.sideBetName}`).then(res => {148 if (res.data?.success) { 149 dispatch(set Game({150 ...playerState. game,147 axios.get(`/api/blackjack?action=make_side_bet&session_id=${localStorage.CAESSINO_SESSION_ID}&bet=${styleState.blackjack.inputControls.sideBet.chosenCredits}&betName=${playerState.blackjackGame.sideBetName}`).then(res => { 148 if (res.data?.success) { 149 dispatch(setBlackjackGame({ 150 ...playerState.blackjackGame, 151 151 status: res.data?.status, 152 152 })) … … 201 201 axios.get(`/api/blackjack?action=get_initial_cards&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => { 202 202 if (res.data?.success) { 203 dispatch(set Game({204 ...playerState. game,203 dispatch(setBlackjackGame({ 204 ...playerState.blackjackGame, 205 205 status: res.data?.status, 206 206 playerCards: res.data?.playerCards, … … 210 210 if (res.data?.sideBetOutcome !== '') { 211 211 if (res.data.sideBetOutcome === 'side_bet_won') { 212 dispatch(set Game({213 ...playerState. game,212 dispatch(setBlackjackGame({ 213 ...playerState.blackjackGame, 214 214 credits: res.data?.credits, 215 215 })) … … 250 250 axios.get(`/api/blackjack?action=hit_a_card&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => { 251 251 if (res.data?.success) { 252 dispatch(set Game({253 ...playerState. game,252 dispatch(setBlackjackGame({ 253 ...playerState.blackjackGame, 254 254 status: res.data?.status, 255 255 playerCards: res.data?.playerCards, … … 284 284 axios.get(`/api/blackjack?action=stand&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => { 285 285 if (res.data?.success) { 286 dispatch(set Game({287 ...playerState. game,286 dispatch(setBlackjackGame({ 287 ...playerState.blackjackGame, 288 288 status: res.data?.status, 289 289 playerCards: res.data?.playerCards,
Note:
See TracChangeset
for help on using the changeset viewer.