-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Console-buche/chore/clean-up-round
- Loading branch information
Showing
17 changed files
with
128 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export type ReducerStateHotSpot = { | ||
personsIdsOnSpot: Set<string>; | ||
spotIdsAndAvailability: Map<number, boolean>; | ||
}; | ||
|
||
export type ReducerActionHotSpot = | ||
| { | ||
type: 'ADD'; | ||
payload: { | ||
uuid: string; | ||
isDragging: boolean; | ||
onHotSpotDrop: () => void; | ||
spotId: number; | ||
}; | ||
} | ||
| { type: 'REMOVE'; payload: string }; // TODO | ||
|
||
export function hopSpotReducer( | ||
state: ReducerStateHotSpot, | ||
action: ReducerActionHotSpot, | ||
): ReducerStateHotSpot { | ||
let personsIdsOnSpot = new Set<string>(); | ||
let currentSpotIds = new Map(); | ||
|
||
switch (action.type) { | ||
case 'ADD': | ||
if (!action.payload.isDragging) { | ||
return state; | ||
} | ||
personsIdsOnSpot = new Set( | ||
...state.personsIdsOnSpot, | ||
action.payload.uuid, | ||
); | ||
|
||
currentSpotIds = new Map(state.spotIdsAndAvailability); | ||
currentSpotIds.set(action.payload.spotId, false); | ||
|
||
action.payload.onHotSpotDrop(); | ||
return { | ||
personsIdsOnSpot, | ||
spotIdsAndAvailability: currentSpotIds, | ||
}; | ||
|
||
case 'REMOVE': | ||
// TODO | ||
return state; | ||
|
||
default: | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// threejs constants | ||
export const PERSON_HEIGHT = 6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.