add wobler

This commit is contained in:
djmil 2023-10-31 20:33:36 +01:00
parent 66acd217e3
commit 352919581e
2 changed files with 6 additions and 13 deletions

View File

@ -2,6 +2,7 @@ import React from 'react';
import { AppContext } from '../../../context/app' import { AppContext } from '../../../context/app'
import { AppData } from '../../../context/data' import { AppData } from '../../../context/data'
import { WHITE, BLACK } from '../Stone' import { WHITE, BLACK } from '../Stone'
import Wobler from '../../Wobler'
export default function Create() { export default function Create() {
const ctx = Definitions() const ctx = Definitions()
@ -28,18 +29,10 @@ export default function Create() {
console.log("ctx", ctx) console.log("ctx", ctx)
return ( return (
<button <button
className={'game-action create' className={'game-action create' + (ctx.isEnabled ? ' enabled' : ' disabled')}
+ (ctx.isEnabled ? ' enabled' : ' disabled')
+ (ctx.isFetching === true ? ' woble' : '')
}
onClick={onClick} onClick={onClick}
> >
<span>C</span> <Wobler text="Leaderboard" dance={ctx.fetching} />
<span>r</span>
<span>e</span>
<span>a</span>
<span>t</span>
<span>e</span>
</button> </button>
) )
} }
@ -76,8 +69,8 @@ function Definitions() {
hasCurrentUser, hasCurrentUser,
isEnabled, isEnabled,
isFetching: ctx.newGame.isFetching, fetching: ctx.newGame.fetching,
setFetching: (status) => { console.log("setFetching: ", status); dispatchCtx({ update: "newGame", isFetching: status }) }, setFetching: (status) => { dispatchCtx({ update: "newGame", fetching: status }) },
get_GameProposalRequest, get_GameProposalRequest,
clear_Message2Opponent: () => { dispatchCtx({ update: "newGame", message: '' }) }, clear_Message2Opponent: () => { dispatchCtx({ update: "newGame", message: '' }) },

View File

@ -25,7 +25,7 @@ export const initialState = {
whitePlayer: '', whitePlayer: '',
blackPlayer: '', blackPlayer: '',
message: '', message: '',
isFetching: false, fetching: false,
}, },
} }