Skip to content
This repository has been archived by the owner on Dec 9, 2021. It is now read-only.

Rename gameReduces to teamReducer #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/basket/team/GamePresentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const TeamContainer: React.FC<TeamContainerProps> = ({ name, logo }) => {
};

const GamePresentation: React.FC = () => {
const teams = useSelector((state: RootState) => state.game);
const teams = useSelector((state: RootState) => state.team);

const logoGender = useSelector((state: RootState) => state.firiLogo.gender);
const firiLogoToUse =
Expand Down
2 changes: 1 addition & 1 deletion src/modules/basket/team/TeamPresentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import TeamPresentationComponent from "./component/TeamPresentationComponent";

const TeamPresentation: React.FC = () => {
const showTeamPresentation = useSelector(
(state: RootState) => state.game.showTeamPresentation
(state: RootState) => state.team.showTeamPresentation
);

return showTeamPresentation ? <TeamPresentationComponent /> : null;
Expand Down
8 changes: 4 additions & 4 deletions src/modules/basket/team/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Dispatch } from "redux";
import { AbaTekStreamingEvent } from "../../../types";
import { AbatekMessage } from "../events";
import {
hideGameInitialSummary,
hideGameInitialSummary as hideTeamInitialSummary,
hideTeamInformation,
showGameInitialSummary,
showTeamInitialSummary,
showTeamInformation,
} from "./reducer";

Expand All @@ -20,9 +20,9 @@ const handleGameEventControl = (
switch ((event as any).payload.control) {
case GameEventMessage.GAME_INITIAL_SUMMARY:
if ((event as any).payload.value) {
dispatch(showGameInitialSummary());
dispatch(showTeamInitialSummary());
} else {
dispatch(hideGameInitialSummary());
dispatch(hideTeamInitialSummary());
}
break;
case GameEventMessage.TEAM_INFORMATION:
Expand Down
10 changes: 3 additions & 7 deletions src/modules/basket/team/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ import { RootState } from "../../../store/store";
import GamePresentation from "./GamePresentation";

const Team: React.FC = () => {
const showGameSummary = useSelector(
(state: RootState) => state.game.showGameSummary
const showTeamSummary = useSelector(
(state: RootState) => state.team.showTeamSummary
);

if (showGameSummary) {
return <GamePresentation />;
} else {
return null;
}
return showTeamSummary ? <GamePresentation /> : null;
};
export default Team;
12 changes: 6 additions & 6 deletions src/modules/basket/team/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type TeamDetail = {
type TeamState = {
home: TeamDetail;
away: TeamDetail;
showGameSummary: boolean;
showTeamSummary: boolean;
showTeamPresentation: boolean;
};
const initialState: TeamState = {
Expand All @@ -30,20 +30,20 @@ const initialState: TeamState = {
players: [],
coaches: [],
},
showGameSummary: false,
showTeamSummary: false,
showTeamPresentation: true,
};

const teamReducer = createSlice({
name: "team",
initialState,
reducers: {
showGameInitialSummary: (state: TeamState) => {
state.showGameSummary = true;
showTeamInitialSummary: (state: TeamState) => {
state.showTeamSummary = true;
return state;
},
hideGameInitialSummary: (state: TeamState) => {
state.showGameSummary = false;
state.showTeamSummary = false;
return state;
},
showTeamInformation: (state: TeamState) => {
Expand All @@ -58,7 +58,7 @@ const teamReducer = createSlice({
});

export const {
showGameInitialSummary,
showTeamInitialSummary,
hideGameInitialSummary,
showTeamInformation,
hideTeamInformation,
Expand Down
4 changes: 2 additions & 2 deletions src/store/store.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { configureStore } from "@reduxjs/toolkit";
import scoreReducer from "../modules/basket/score/reducer";
import firiLogoReducer from "../modules/basket/firilogo/reducer";
import gameReducer from "./../modules/basket/team/reducer";
import teamReducer from "./../modules/basket/team/reducer";

export const store = configureStore({
reducer: {
score: scoreReducer,
firiLogo: firiLogoReducer,
game: gameReducer,
team: teamReducer,
},
});

Expand Down