This commit is contained in:
2026-05-20 18:08:37 +07:00
parent dd3fd889a3
commit 290d36e8cb
21 changed files with 1359 additions and 72 deletions

View File

@@ -44,6 +44,7 @@ export type Action =
| { type: "SET_RATING"; placeId: number; value: number }
| { type: "SET_NOTES"; placeId: number; value: string }
| { type: "ADD_PLACE"; place: Place }
| { type: "PATCH_PLACE"; placeId: number; patch: Partial<Place> }
| { type: "DELETE_PLACE"; placeId: number }
| { type: "TOAST"; value: string }
| { type: "CLEAR_TOAST"; key: number }
@@ -122,6 +123,12 @@ export function reducer(state: AppState, action: Action): AppState {
}
case "ADD_PLACE":
return { ...state, places: [action.place, ...state.places] };
case "PATCH_PLACE": {
const places = state.places.map((p) =>
p.id === action.placeId ? { ...p, ...action.patch } : p,
);
return { ...state, places };
}
case "DELETE_PLACE":
return {
...state,