-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] builds errors and warnings (#2982)
* Fix warnings in compononents * Fix warnings in kanban * Update livekeet componet and fix warning * Update UserProfileDetail * Fix warnings like unsed vars and non null assertion * Fix deepscan error * Remove empty arrow function * FIx null check error * Fix handling null assertion * Fix react-hooks exhaustive-deps warning * Simplify integration types retrieval logic * Add localization support for invalid auth code error * Fix scroll event listener dependency in pagination hook * Fix timer reset issue on initial load * Optimize callback handling in AuthCodeInputField * Refactor and cleanup hooks and component logic * Set default prop values directly in function signatures * Optimize performance with useMemo & cleanup hooks Enhanced performance by wrapping heavy computations and sort/filter operations with `useMemo` in `useDailyPlan` and `useUserProfilePage` to avoid unnecessary recalculations on re-renders. Refined hook dependencies and cleaned up redundant `useState` and `useEffect` usages to streamline state management logic. Adjusted drag-and-drop handlers for simpler plan updates. * Optimize state and memoize data in hooks * Refactor auth hooks and clean up invite modals * Simplify conditional rendering in TeamOutstandingNotifications --------- Co-authored-by: Paradoxe Ngwasi <paradoxngwasi@gmail.com>
- Loading branch information
1 parent
bff7251
commit cee7a8e
Showing
64 changed files
with
762 additions
and
630 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
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 |
---|---|---|
@@ -1,48 +1,52 @@ | ||
import { IDailyPlan, ITeamTask } from "@app/interfaces"; | ||
import { DropResult } from "react-beautiful-dnd"; | ||
import { IDailyPlan, ITeamTask } from '@app/interfaces'; | ||
import { DropResult } from 'react-beautiful-dnd'; | ||
|
||
export const handleDragAndDrop = (results: DropResult, plans: IDailyPlan[], setPlans: React.Dispatch<React.SetStateAction<IDailyPlan[]>>) => { | ||
const { source, destination } = results; | ||
export const handleDragAndDrop = ( | ||
results: DropResult, | ||
plans: IDailyPlan[], | ||
setPlans: React.Dispatch<React.SetStateAction<IDailyPlan[]>> | ||
) => { | ||
const { source, destination } = results; | ||
|
||
if (!destination || (source.droppableId === destination.droppableId && source.index === destination.index)) return; | ||
if (!destination || (source.droppableId === destination.droppableId && source.index === destination.index)) return; | ||
|
||
const newPlans = [...plans]; | ||
const newPlans = [...plans]; | ||
|
||
const planSourceIndex = newPlans.findIndex(plan => plan.id === source.droppableId); | ||
const planDestinationIndex = newPlans.findIndex(plan => plan.id === destination.droppableId); | ||
const planSourceIndex = newPlans.findIndex((plan) => plan.id === source.droppableId); | ||
const planDestinationIndex = newPlans.findIndex((plan) => plan.id === destination.droppableId); | ||
|
||
const newSourceTasks = [...newPlans[planSourceIndex].tasks!]; | ||
const newDestinationTasks = source.droppableId !== destination.droppableId | ||
? [...newPlans[planDestinationIndex].tasks!] | ||
: newSourceTasks; | ||
const newSourceTasks = [...(newPlans[planSourceIndex].tasks ?? [])]; | ||
const newDestinationTasks = | ||
source.droppableId !== destination.droppableId | ||
? [...(newPlans[planDestinationIndex].tasks ?? [])] | ||
: newSourceTasks; | ||
|
||
const [deletedTask] = newSourceTasks.splice(source.index, 1); | ||
newDestinationTasks.splice(destination.index, 0, deletedTask); | ||
const [deletedTask] = newSourceTasks.splice(source.index, 1); | ||
newDestinationTasks.splice(destination.index, 0, deletedTask); | ||
|
||
newPlans[planSourceIndex] = { | ||
...newPlans[planSourceIndex], | ||
tasks: newSourceTasks, | ||
}; | ||
newPlans[planDestinationIndex] = { | ||
...newPlans[planDestinationIndex], | ||
tasks: newDestinationTasks, | ||
}; | ||
setPlans(newPlans); | ||
newPlans[planSourceIndex] = { | ||
...newPlans[planSourceIndex], | ||
tasks: newSourceTasks | ||
}; | ||
newPlans[planDestinationIndex] = { | ||
...newPlans[planDestinationIndex], | ||
tasks: newDestinationTasks | ||
}; | ||
setPlans(newPlans); | ||
}; | ||
|
||
|
||
export const handleDragAndDropDailyOutstandingAll = ( | ||
results: DropResult, | ||
tasks: ITeamTask[], | ||
setTasks: React.Dispatch<React.SetStateAction<ITeamTask[]>> | ||
results: DropResult, | ||
tasks: ITeamTask[], | ||
setTasks: React.Dispatch<React.SetStateAction<ITeamTask[]>> | ||
) => { | ||
const { source, destination } = results; | ||
const { source, destination } = results; | ||
|
||
if (!destination || (source.droppableId === destination.droppableId && source.index === destination.index)) return; | ||
if (!destination || (source.droppableId === destination.droppableId && source.index === destination.index)) return; | ||
|
||
const newTasks = [...tasks]; | ||
const [movedTask] = newTasks.splice(source.index, 1); | ||
newTasks.splice(destination.index, 0, movedTask); | ||
const newTasks = [...tasks]; | ||
const [movedTask] = newTasks.splice(source.index, 1); | ||
newTasks.splice(destination.index, 0, movedTask); | ||
|
||
setTasks(newTasks); | ||
setTasks(newTasks); | ||
}; |
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
Oops, something went wrong.