Skip to content

Commit bc0bb2c

Browse files
drewvolzhawkrives
andcommitted
fix redux action for add/remove of favorite hours
Co-authored-by: Hawken Rives <[email protected]>
1 parent 38acb1c commit bc0bb2c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

modules/navigation-buttons/styles.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {StyleSheet, Platform} from 'react-native'
2+
import {link} from '@frogpond/colors'
23

34
export const commonStyles = StyleSheet.create({
45
button: {
@@ -40,6 +41,7 @@ export const rightButtonStyles = StyleSheet.create({
4041
}),
4142
},
4243
icon: {
44+
color: link,
4345
...Platform.select({
4446
ios: {
4547
fontSize: 24,

source/redux/parts/buildings.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ const slice = createSlice({
1717
reducers: {
1818
toggleFavoriteBuilding(state, action: PayloadAction<string>) {
1919
let favoritesSet = new Set(state.favorites)
20-
favoritesSet.delete(action.payload)
20+
21+
if (favoritesSet.has(action.payload)) {
22+
favoritesSet.delete(action.payload)
23+
} else {
24+
favoritesSet.add(action.payload)
25+
}
2126

2227
let newFavorites = Array.from(favoritesSet)
2328

0 commit comments

Comments
 (0)