Skip to content

Commit 2392ec4

Browse files
committed
Fixes
1 parent 5eaaeee commit 2392ec4

File tree

5 files changed

+11
-23
lines changed

5 files changed

+11
-23
lines changed

src/Board/Point.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useCallback, useRef, useState, type DragEventHandler } from "react";
2-
import { playCheckerSound } from '../Utils';
32
import Piece from './Piece'
43

54
type PointProps = {
@@ -15,7 +14,6 @@ export default function Point({ pieces, move, position, onSelect, selected }: Po
1514
const pieceRef = useRef<HTMLImageElement>(null);
1615
const onDragOver: DragEventHandler = useCallback((event) => { event.preventDefault(); }, [])
1716
const onDrop: DragEventHandler = useCallback((event) => {
18-
playCheckerSound();
1917
navigator.vibrate?.(10);
2018
event.preventDefault();
2119
onSelect(null)

src/Dialogues/Login.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,10 @@ const uiConfig = {
2727
},
2828
};
2929

30-
interface Props {
31-
// The Firebase UI Web UI Config object.
32-
// See: https://github.com/firebase/firebaseui-web#configuration
33-
uiConfig: firebaseui.auth.Config;
34-
// Callback that will be passed the FirebaseUi instance before it is
35-
// started. This allows access to certain configuration options such as
36-
// disableAutoSignIn().
37-
uiCallback?(ui: firebaseui.auth.AuthUI): void;
38-
// The Firebase App auth instance to use.
39-
firebaseAuth: any; // As firebaseui-web
40-
className?: string;
41-
}
42-
4330
type LoginProps = {
4431
reset: () => void;
4532
friend?: { name: string };
33+
load: () => void;
4634
};
4735

4836
export default function Login({ reset, friend, load }: LoginProps) {

src/Types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type UserData = {
99
search: string;
1010
photoURL: string | null;
1111
language: string;
12-
fcmToken: string;
12+
fcmToken?: string;
1313
}
1414

1515
export type ModalState = 'chat' | 'profile' | 'friends' | 'login' | boolean;
@@ -39,7 +39,7 @@ export type GameType = {
3939
status?: string;
4040
board: number[];
4141
dice: number[];
42-
color: string;
42+
color: 'black' | 'white';
4343
turn: string;
4444
prison: {
4545
black: number;

src/Utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ export function calculate(state: GameType, from: number | "white" | "black", to:
113113

114114
export const playCheckerSound = () => {
115115
const mp3Files = [
116-
'public/capture.mp3',
117-
'public/castle.mp3',
118-
'public/move-check.mp3',
119-
'public/move-self.mp3',
120-
'public/notify.mp3',
121-
'public/promote.mp3',
116+
'capture.mp3',
117+
'castle.mp3',
118+
'move-check.mp3',
119+
'move-self.mp3',
120+
'notify.mp3',
121+
'promote.mp3',
122122
];
123123

124124
const randomIndex = Math.floor(Math.random() * mp3Files.length);

src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import './Toolbar.css'
1717
import { calculate, newGame, rollDie, vibrate } from './Utils';
1818
import firebase from "./firebase.config";
1919
import { saveMessagingDeviceToken } from './firebase-messaging-setup';
20+
import { playCheckerSound } from './Utils';
2021

2122
// Start React
2223
ReactDOM.createRoot(document.getElementById('root')!).render(<StrictMode><App /></StrictMode>)
@@ -222,6 +223,7 @@ export function App() {
222223
const move = useCallback((from: number | "white" | "black", to: number) => {
223224
const { state: nextState, moveLabel } = calculate(game, from, to);
224225
if (!moveLabel) return;
226+
playCheckerSound();
225227
setGame(nextState);
226228
// dispatch({ type: Actions.MOVE, data: { from, to } });
227229
// sendMove(nextState, `${nextState.dice.join("-")}: ${moveLabel}`);

0 commit comments

Comments
 (0)