From cb1ae22befc217df90f7c626e0dbd993a7efe2af Mon Sep 17 00:00:00 2001 From: mialana <96770662+mialana@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:32:56 -0400 Subject: [PATCH] resolved comments --- .../modals/AddScheduleFriendsModalInterior.tsx | 10 +++++----- .../components/modals/model_content_generator.js | 6 +++--- frontend/plan/reducers/schedule.js | 13 +++---------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/frontend/plan/components/modals/AddScheduleFriendsModalInterior.tsx b/frontend/plan/components/modals/AddScheduleFriendsModalInterior.tsx index 9af82c6a6..5f4b54abe 100644 --- a/frontend/plan/components/modals/AddScheduleFriendsModalInterior.tsx +++ b/frontend/plan/components/modals/AddScheduleFriendsModalInterior.tsx @@ -21,7 +21,7 @@ interface AddScheduleFriendsModalInteriorProps { defaultValue: string; placeholder: string; overwriteDefault: boolean; - mode: string; + requestType: string; activeFriendName: string; } @@ -35,7 +35,7 @@ const AddScheduleFriendsModalInterior = ({ defaultValue, placeholder, overwriteDefault = false, - mode, + requestType, activeFriendName, }: AddScheduleFriendsModalInteriorProps) => { const [inputRef, setInputRef] = useState(null); @@ -48,7 +48,7 @@ const AddScheduleFriendsModalInterior = ({ user, userInput, existingData as string[], - mode, + requestType, changed, setErrorObj ); @@ -60,7 +60,7 @@ const AddScheduleFriendsModalInterior = ({ } if (!errorObj.error) { - if (mode == "friend") { + if (requestType == "friend") { sendFriendRequest( user, inputRef.value, @@ -82,7 +82,7 @@ const AddScheduleFriendsModalInterior = ({ } } ); - } else if (mode == "schedule") { + } else if (requestType == "schedule") { namingFunction(inputRef.value); close(); } diff --git a/frontend/plan/components/modals/model_content_generator.js b/frontend/plan/components/modals/model_content_generator.js index 99c8a4de1..5fdc7a841 100644 --- a/frontend/plan/components/modals/model_content_generator.js +++ b/frontend/plan/components/modals/model_content_generator.js @@ -36,7 +36,7 @@ export const generateModalInterior = (reduxState) => { ); case "CREATE_SCHEDULE": @@ -44,7 +44,7 @@ export const generateModalInterior = (reduxState) => { ); case "ADD_FRIEND": @@ -53,7 +53,7 @@ export const generateModalInterior = (reduxState) => { user={reduxState.login.user} buttonName="Request" existingData={reduxState.friendships.acceptedFriends} - mode="friend" + requestType="friend" placeholder="Enter your friend's PennKey" activeFriendName={ reduxState.friendships.activeFriend.username diff --git a/frontend/plan/reducers/schedule.js b/frontend/plan/reducers/schedule.js index 813fdbe73..900cc3673 100644 --- a/frontend/plan/reducers/schedule.js +++ b/frontend/plan/reducers/schedule.js @@ -135,10 +135,7 @@ const handleUpdateSchedulesOnFrontend = (state, schedulesFromBackend) => { schedulesFromBackend.forEach((scheduleFromBackend) => { if ( - newState.deletedSchedules.reduce( - (acc, schedule) => acc || schedule === scheduleFromBackend.name, - false - ) + newState.deletedSchedules.find((schedule) => schedule === scheduleFromBackend.name) ) { return; } @@ -304,12 +301,8 @@ export const schedule = (state = initialState, action) => { case DELETE_SCHEDULE_ON_FRONTEND: return handleScheduleDeletion(state, action.scheduleName); case DELETION_ATTEMPTED: - return { - ...state, - deletedSchedules: state.deletedSchedules.push( - action.scheduleName - ), - }; + state.deletedSchedules.push(action.scheduleName) + return {...state}; case CREATE_CART_ON_FRONTEND: return { ...state,