Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mialana committed Oct 17, 2023
1 parent e2a1a79 commit cb1ae22
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface AddScheduleFriendsModalInteriorProps {
defaultValue: string;
placeholder: string;
overwriteDefault: boolean;
mode: string;
requestType: string;
activeFriendName: string;
}

Expand All @@ -35,7 +35,7 @@ const AddScheduleFriendsModalInterior = ({
defaultValue,
placeholder,
overwriteDefault = false,
mode,
requestType,
activeFriendName,
}: AddScheduleFriendsModalInteriorProps) => {
const [inputRef, setInputRef] = useState<HTMLInputElement | null>(null);
Expand All @@ -48,7 +48,7 @@ const AddScheduleFriendsModalInterior = ({
user,
userInput,
existingData as string[],
mode,
requestType,
changed,
setErrorObj
);
Expand All @@ -60,7 +60,7 @@ const AddScheduleFriendsModalInterior = ({
}

if (!errorObj.error) {
if (mode == "friend") {
if (requestType == "friend") {
sendFriendRequest(
user,
inputRef.value,
Expand All @@ -82,7 +82,7 @@ const AddScheduleFriendsModalInterior = ({
}
}
);
} else if (mode == "schedule") {
} else if (requestType == "schedule") {
namingFunction(inputRef.value);
close();
}
Expand Down
6 changes: 3 additions & 3 deletions frontend/plan/components/modals/model_content_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export const generateModalInterior = (reduxState) => {
<NameScheduleModalInterior
buttonName="Rename"
existingData={Object.keys(reduxState.schedule.schedules)}
mode="schedule"
requestType="schedule"
/>
);
case "CREATE_SCHEDULE":
return (
<NameScheduleModalInterior
buttonName="Create"
existingData={Object.keys(reduxState.schedule.schedules)}
mode="schedule"
requestType="schedule"
/>
);
case "ADD_FRIEND":
Expand All @@ -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
Expand Down
13 changes: 3 additions & 10 deletions frontend/plan/reducers/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit cb1ae22

Please sign in to comment.