mirror of
https://github.com/mizanxali/uno-online
synced 2024-11-22 18:54:53 +00:00
Replaced Redux completely with React hooks
This commit is contained in:
parent
ac6dee77bc
commit
ff7cbe703e
@ -8,11 +8,8 @@
|
|||||||
"@testing-library/user-event": "^12.7.0",
|
"@testing-library/user-event": "^12.7.0",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-redux": "^7.2.2",
|
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.2.0",
|
||||||
"react-scripts": "4.0.2",
|
"react-scripts": "4.0.2"
|
||||||
"redux": "^4.0.5",
|
|
||||||
"web-vitals": "^1.1.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
|
File diff suppressed because it is too large
Load Diff
13
src/index.js
13
src/index.js
@ -3,19 +3,12 @@ import ReactDOM from 'react-dom'
|
|||||||
import './index.css'
|
import './index.css'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import { BrowserRouter } from 'react-router-dom'
|
import { BrowserRouter } from 'react-router-dom'
|
||||||
import { Provider } from 'react-redux'
|
|
||||||
import { createStore } from 'redux'
|
|
||||||
import reducer from './store/reducer'
|
|
||||||
|
|
||||||
const store = createStore(reducer)
|
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<Provider store={store}>
|
<BrowserRouter>
|
||||||
<BrowserRouter>
|
<App />
|
||||||
<App />
|
</BrowserRouter>
|
||||||
</BrowserRouter>
|
|
||||||
</Provider>
|
|
||||||
</React.StrictMode>,
|
</React.StrictMode>,
|
||||||
document.getElementById('root')
|
document.getElementById('root')
|
||||||
)
|
)
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
export const START_GAME = 'START_GAME'
|
|
||||||
export const CARD_PLAYED = 'CARD_PLAYED'
|
|
||||||
export const CARD_DRAWN = 'CARD_DRAWN'
|
|
File diff suppressed because it is too large
Load Diff
8
src/utils/packOfCards.js
Normal file
8
src/utils/packOfCards.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//pack of 108 cards (# = reverse)
|
||||||
|
export default CARDS = [
|
||||||
|
'0R', '1R', '1R', '2R', '2R', '3R', '3R', '4R', '4R', '5R', '5R', '6R', '6R', '7R', '7R', '8R', '8R', '9R', '9R', 'skipR', 'skipR', '#R', '#R', 'D2R', 'D2R',
|
||||||
|
'0G', '1G', '1G', '2G', '2G', '3G', '3G', '4G', '4G', '5G', '5G', '6G', '6G', '7G', '7G', '8G', '8G', '9G', '9G', 'skipG', 'skipG', '#G', '#G', 'D2G', 'D2G',
|
||||||
|
'0B', '1B', '1B', '2B', '2B', '3B', '3B', '4B', '4B', '5B', '5B', '6B', '6B', '7B', '7B', '8B', '8B', '9B', '9B', 'skipB', 'skipB', '#B', '#B', 'D2B', 'D2B',
|
||||||
|
'0Y', '1Y', '1Y', '2Y', '2Y', '3Y', '3Y', '4Y', '4Y', '5Y', '5Y', '6Y', '6Y', '7Y', '7Y', '8Y', '8Y', '9Y', '9Y', 'skipY', 'skipY', '#Y', '#Y', 'D2Y', 'D2Y',
|
||||||
|
'W', 'W', 'W', 'W', 'D4W', 'D4W', 'D4W', 'D4W'
|
||||||
|
]
|
9
src/utils/shuffleArray.js
Normal file
9
src/utils/shuffleArray.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export default function shuffleArray(array) {
|
||||||
|
for (var i = array.length - 1; i > 0; i--) {
|
||||||
|
var j = Math.floor(Math.random() * (i + 1))
|
||||||
|
var temp = array[i]
|
||||||
|
array[i] = array[j]
|
||||||
|
array[j] = temp;
|
||||||
|
}
|
||||||
|
return array
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user