diff --git a/apps/mobile/app/services/client/queries/timer/timer.ts b/apps/mobile/app/services/client/queries/timer/timer.ts index fe25d37bc..eea042b4a 100644 --- a/apps/mobile/app/services/client/queries/timer/timer.ts +++ b/apps/mobile/app/services/client/queries/timer/timer.ts @@ -1,37 +1,47 @@ import { useQuery } from "react-query" import { getTimerStatusRequest, syncTimeSlotRequest } from "../../requests/timer" -import { ITimerTimeslotParams } from "../../../interfaces/ITimer" +import { ITimerTimeslotParams, TimerSource } from "../../../interfaces/ITimer" type IGetTimerStatusParams = ITimerTimeslotParams & { authToken: string } -const fetchTimerStatus = async (params: IGetTimerStatusParams) => { +const fetchTimerStatus = async ( + params: IGetTimerStatusParams, + isTimerRunning: boolean, + lastlogTimerSource: TimerSource | null, +) => { const { tenantId, organizationId, logType, authToken, employeeId } = params - const { data } = await getTimerStatusRequest( - { source: "MOBILE", tenantId, organizationId }, - authToken, - ) + if (isTimerRunning) { + await syncTimeSlotRequest( + { + tenantId, + organizationId, + source: lastlogTimerSource || TimerSource.MOBILE, + employeeId, + duration: 5, + logType, + }, + authToken, + ) + } - await syncTimeSlotRequest( - { - tenantId, - organizationId, - source: "MOBILE", - employeeId, - duration: 5, - logType, - }, - authToken, - ) + const { data } = await getTimerStatusRequest({ tenantId, organizationId }, authToken) return data } -const useFetchTimerStatus = (IGetTimerStatusParams, isTimerRunning: boolean) => - useQuery(["status-timer", IGetTimerStatusParams], () => fetchTimerStatus(IGetTimerStatusParams), { - enabled: isTimerRunning, - refetchInterval: 5000, - notifyOnChangeProps: ["data"], // Re-render only when data changes - notifyOnChangePropsExclusions: ["isFetching"], - }) +const useFetchTimerStatus = ( + IGetTimerStatusParams, + isTimerRunning: boolean, + lastlogTimerSource: TimerSource, +) => + useQuery( + ["status-timer", IGetTimerStatusParams], + () => fetchTimerStatus(IGetTimerStatusParams, isTimerRunning, lastlogTimerSource), + { + refetchInterval: 5000, + notifyOnChangeProps: ["data"], // Re-render only when data changes + notifyOnChangePropsExclusions: ["isFetching"], + }, + ) export default useFetchTimerStatus diff --git a/apps/mobile/app/services/client/requests/timer.ts b/apps/mobile/app/services/client/requests/timer.ts index b6f1feec1..a373a0679 100644 --- a/apps/mobile/app/services/client/requests/timer.ts +++ b/apps/mobile/app/services/client/requests/timer.ts @@ -5,14 +5,15 @@ import { ITimerStatus, ITimerParams, ITimerTimeslotParams, + TimerSource, } from "../../interfaces/ITimer" import { serverFetch } from "../fetch" export function getTimerStatusRequest( - { source = "MOBILE", tenantId, organizationId }: ITimerStatusParams, + { tenantId, organizationId }: ITimerStatusParams, bearer_token: string, ) { - const params = new URLSearchParams({ source, tenantId, organizationId }) + const params = new URLSearchParams({ tenantId, organizationId }) return serverFetch({ path: `/timesheet/timer/status?${params.toString()}`, method: "GET", @@ -42,7 +43,13 @@ export function stopTimerRequest(params: ITimerParams, bearer_token: string) { } export function toggleTimerRequest( - { source = "MOBILE", logType = "TRACKED", taskId, tenantId, organizationId }: ITimerParams, + { + source = TimerSource.MOBILE, + logType = "TRACKED", + taskId, + tenantId, + organizationId, + }: ITimerParams, bearer_token: string, ) { return serverFetch({ diff --git a/apps/mobile/app/services/hooks/useTimer.ts b/apps/mobile/app/services/hooks/useTimer.ts index da58a3c2d..1bcb52bec 100644 --- a/apps/mobile/app/services/hooks/useTimer.ts +++ b/apps/mobile/app/services/hooks/useTimer.ts @@ -3,7 +3,7 @@ import { convertMsToTime, secondsToTime } from "../../helpers/date" import { startTimerRequest, stopTimerRequest, toggleTimerRequest } from "../client/requests/timer" import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { useSyncRef } from "./useSyncRef" -import { ILocalTimerStatus, ITimerParams, ITimerStatus } from "../interfaces/ITimer" +import { ILocalTimerStatus, ITimerParams, ITimerStatus, TimerSource } from "../interfaces/ITimer" import { useFirstLoad } from "./useFirstLoad" import isEqual from "lodash/isEqual" import AsyncStorage from "@react-native-async-storage/async-storage" @@ -12,6 +12,7 @@ import { ITeamTask } from "../interfaces/ITask" import { useTeamTasks } from "./features/useTeamTasks" import useFetchTimerStatus from "../client/queries/timer/timer" import { useTaskStatistics } from "./features/useTaskStatics" +import moment from "moment-timezone" const LOCAL_TIMER_STORAGE_KEY = "local-timer-ever-teams" @@ -70,9 +71,17 @@ function useLocalTimeCounter( ;(async () => { const localStatus = await getLocalCounterStatus() localStatus && setLocalTimerStatus(localStatus) + + const timerStatusDate = timerStatus?.lastLog?.createdAt + ? moment(timerStatus?.lastLog?.createdAt).unix() * 1000 - timerStatus?.lastLog?.duration + : 0 + timerStatus && updateLocalTimerStatus({ - runnedDateTime: localStatus?.runnedDateTime || (timerStatus.running ? Date.now() : 0), + runnedDateTime: + (timerStatus.running ? timerStatusDate || Date.now() : 0) || + localStatus?.runnedDateTime || + 0, running: timerStatus.running, lastTaskId: timerStatus.lastLog?.taskId || null, }) @@ -164,13 +173,14 @@ export function useTimer() { employeeId: user?.employee?.id, }, timerStatus?.running, + timerStatusRef.current?.lastLog?.source, ) const toggleTimer = useCallback(async (taskId: string) => { const response = await toggleTimerRequest( { logType: "TRACKED", - source: "MOBILE", + source: TimerSource.MOBILE, tags: [], taskId, tenantId, @@ -208,7 +218,7 @@ export function useTimer() { tenantId, taskId: activeTask?.id, logType: "TRACKED", - source: "MOBILE", + source: TimerSource.MOBILE, tags: [], } @@ -225,11 +235,11 @@ export function useTimer() { /** * Updating the task status to "In Progress" when the timer is started. */ - if (activeTeamTaskRef.current && activeTeamTaskRef.current.status !== "in progress") { + if (activeTeamTaskRef.current && activeTeamTaskRef.current.status !== "in-progress") { updateTask( { ...activeTeamTaskRef.current, - status: "in progress", + status: "in-progress", }, taskId.current, ) @@ -251,7 +261,7 @@ export function useTimer() { tenantId, taskId: activeTask?.id, logType: "TRACKED", - source: "MOBILE", + source: timerStatusRef.current.lastLog.source || TimerSource.MOBILE, tags: [], } diff --git a/apps/mobile/app/services/interfaces/ITimer.ts b/apps/mobile/app/services/interfaces/ITimer.ts index 055e034de..5b8322dc3 100644 --- a/apps/mobile/app/services/interfaces/ITimer.ts +++ b/apps/mobile/app/services/interfaces/ITimer.ts @@ -7,7 +7,7 @@ export interface ITimer { startedAt: string stoppedAt: string logType: string - source: string + source: TimerSource description: any reason: any isBillable: boolean @@ -22,6 +22,16 @@ export interface ITimer { isEdited: boolean } +export enum TimerSource { + "MOBILE" = "MOBILE", + "BROWSER" = "BROWSER", + "DESKTOP" = "DESKTOP", + "BROWSER_EXTENSION" = "BROWSER_EXTENSION", + "HUBSTAFF" = "HUBSTAFF", + "UPWORK" = "UPWORK", + "TEAMS" = "TEAMS", +} + export interface ITimerStatus { duration: number lastLog?: ITimer @@ -45,7 +55,7 @@ export type ITimerTimeslotParams = { organizationId: string employeeId: string logType: "TRACKED" - source: "MOBILE" + source: TimerSource tenantId: string duration?: number recordedAt?: Date | string @@ -53,7 +63,7 @@ export type ITimerTimeslotParams = { } export type ITimerStatusParams = { - source?: "MOBILE" + source?: TimerSource tenantId: string organizationId: string } @@ -63,7 +73,7 @@ export type ITimerParams = { tenantId: string taskId: string logType: "TRACKED" - source: "MOBILE" + source: TimerSource tags: any[] } diff --git a/apps/web/app/hooks/auth/useEmailVerifyToken.ts b/apps/web/app/hooks/auth/useEmailVerifyToken.ts index 3a5ef789a..83d7ebb95 100644 --- a/apps/web/app/hooks/auth/useEmailVerifyToken.ts +++ b/apps/web/app/hooks/auth/useEmailVerifyToken.ts @@ -1,7 +1,7 @@ import { verifyUserEmailByTokenAPI } from '@app/services/client/api'; import { AxiosError } from 'axios'; import { useRouter } from 'next/router'; -import { useEffect, useRef, useState } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; import { useQuery } from '../useQuery'; export function useEmailVerifyToken() { @@ -17,23 +17,20 @@ export function useEmailVerifyToken() { /** * Verify Email by token request */ - const verifyEmailRequest = ({ - email, - token - }: { - email: string; - token: string; - }) => { - queryCall(email, token) - .then(() => { - window.location.replace('/'); - }) - .catch((err: AxiosError) => { - if (err.response?.status === 400) { - setErrors((err.response?.data as any)?.errors || {}); - } - }); - }; + const verifyEmailRequest = useCallback( + ({ email, token }: { email: string; token: string }) => { + queryCall(email, token) + .then(() => { + window.location.replace('/'); + }) + .catch((err: AxiosError) => { + if (err.response?.status === 400) { + setErrors((err.response?.data as any)?.errors || {}); + } + }); + }, + [queryCall] + ); /** * Verify token immediately if email and token were passed from url @@ -47,7 +44,7 @@ export function useEmailVerifyToken() { loginFromQuery.current = true; } - }, [query]); + }, [query, verifyEmailRequest]); return { errors, diff --git a/apps/web/app/hooks/features/useAuthTeamTasks.ts b/apps/web/app/hooks/features/useAuthTeamTasks.ts index adab97889..05e48f629 100644 --- a/apps/web/app/hooks/features/useAuthTeamTasks.ts +++ b/apps/web/app/hooks/features/useAuthTeamTasks.ts @@ -1,12 +1,11 @@ import { IUser } from '@app/interfaces'; -import { tasksByTeamState, tasksStatisticsState } from '@app/stores'; +import { tasksByTeamState } from '@app/stores'; import { useMemo } from 'react'; import { useRecoilValue } from 'recoil'; import { useOrganizationTeams } from './useOrganizationTeams'; export function useAuthTeamTasks(user: IUser | undefined) { const tasks = useRecoilValue(tasksByTeamState); - const statTasks = useRecoilValue(tasksStatisticsState); const { activeTeam } = useOrganizationTeams(); const currentMember = activeTeam?.members.find( @@ -27,16 +26,19 @@ export function useAuthTeamTasks(user: IUser | undefined) { }); }, [tasks, user]); - const totalTodayTasks = - currentMember?.totalTodayTasks && currentMember?.totalTodayTasks.length - ? currentMember?.totalTodayTasks.map((task) => task.id) - : []; + const totalTodayTasks = useMemo( + () => + currentMember?.totalTodayTasks && currentMember?.totalTodayTasks.length + ? currentMember?.totalTodayTasks.map((task) => task.id) + : [], + [currentMember] + ); const workedTasks = useMemo(() => { return tasks.filter((tsk) => { return totalTodayTasks.includes(tsk.id); }); - }, [statTasks, tasks, totalTodayTasks]); + }, [tasks, totalTodayTasks]); return { assignedTasks, diff --git a/apps/web/app/hooks/features/useEmployee.ts b/apps/web/app/hooks/features/useEmployee.ts index 0358da9f0..191047554 100644 --- a/apps/web/app/hooks/features/useEmployee.ts +++ b/apps/web/app/hooks/features/useEmployee.ts @@ -29,11 +29,15 @@ export const useEmployee = () => { setWorkingEmployeesEmail(items.map((item) => item.user?.email || '')); } }); - }, [getWorkingEmployeeQueryCall]); + }, [ + getWorkingEmployeeQueryCall, + setWorkingEmployees, + setWorkingEmployeesEmail + ]); useEffect(() => { getWorkingEmployee(); - }, []); + }, [getWorkingEmployee]); return { getWorkingEmployeeQueryCall, diff --git a/apps/web/app/hooks/features/useIssueTypes.ts b/apps/web/app/hooks/features/useIssueTypes.ts index 9e6fdb35b..dc5fb5da9 100644 --- a/apps/web/app/hooks/features/useIssueTypes.ts +++ b/apps/web/app/hooks/features/useIssueTypes.ts @@ -51,7 +51,14 @@ export function useIssueType() { setIssueTypes(res?.data?.data?.items || []); return res; }); - }, [activeTeamId, firstLoad]); + }, [ + activeTeamId, + firstLoad, + queryCall, + setIssueTypes, + user?.employee?.organizationId, + user?.tenantId + ]); const createIssueType = useCallback( (data: IIssueTypesCreate) => { @@ -78,9 +85,11 @@ export function useIssueType() { [ createQueryCall, - createIssueTypeLoading, - deleteIssueTypeLoading, - activeTeamId + activeTeamId, + queryCall, + setIssueTypes, + user?.employee?.organizationId, + user?.tenantId ] ); @@ -100,14 +109,7 @@ export function useIssueType() { }); } }, - [ - deleteQueryCall, - issueTypes.length, - createIssueTypeLoading, - deleteIssueTypeLoading, - user, - activeTeamId - ] + [deleteQueryCall, user, activeTeamId, queryCall, setIssueTypes] ); const editIssueType = useCallback( @@ -128,7 +130,7 @@ export function useIssueType() { }); } }, - [editIssueTypeLoading, user, activeTeamId] + [user, activeTeamId, editQueryCall, queryCall, setIssueTypes] ); return { diff --git a/apps/web/app/hooks/features/useLinkedTasks.ts b/apps/web/app/hooks/features/useLinkedTasks.ts index 7bb58ee93..319ea0987 100644 --- a/apps/web/app/hooks/features/useLinkedTasks.ts +++ b/apps/web/app/hooks/features/useLinkedTasks.ts @@ -16,7 +16,7 @@ export function useLinkedTasks(task?: ITeamTask | null) { if (task?.id) { loadRelatedTasks(task?.id).then((tasks) => setTasks(tasks)); } - }, [task?.id]); + }, [task?.id, loadRelatedTasks]); return { tasks, diff --git a/apps/web/app/hooks/features/useOTRefreshInterval.ts b/apps/web/app/hooks/features/useOTRefreshInterval.ts index e7ecaf32c..1247221be 100644 --- a/apps/web/app/hooks/features/useOTRefreshInterval.ts +++ b/apps/web/app/hooks/features/useOTRefreshInterval.ts @@ -34,5 +34,5 @@ export function useOTRefreshInterval( return () => clearInterval(id); } - }, [delay, publicTeam]); + }, [delay, publicTeam, callbackRef, interval, setOTRefreshIntervalState]); } diff --git a/apps/web/app/hooks/features/useOrganizationTeams.ts b/apps/web/app/hooks/features/useOrganizationTeams.ts index 897c1781f..d80ed3036 100644 --- a/apps/web/app/hooks/features/useOrganizationTeams.ts +++ b/apps/web/app/hooks/features/useOrganizationTeams.ts @@ -164,7 +164,7 @@ function useUpdateOrganizationTeam() { setTeamsUpdate(res.data); }); }, - [] + [queryCall, setTeamsUpdate] ); return { updateOrganizationTeam, loading }; @@ -308,8 +308,7 @@ export function useOrganizationTeams() { setActiveTeamId, setIsTeamMember, setTeams, - setTeamsUpdate, - teams + teamsRef ]); /** @@ -358,7 +357,12 @@ export function useOrganizationTeams() { return res; }); }, - [loadTeamsData, removeUserFromAllTeamQueryCall] + [ + loadTeamsData, + removeUserFromAllTeamQueryCall, + refreshToken, + updateUserFromAPI + ] ); return { diff --git a/apps/web/app/hooks/features/useRefreshInterval.ts b/apps/web/app/hooks/features/useRefreshInterval.ts index dab7a60df..8b798db26 100644 --- a/apps/web/app/hooks/features/useRefreshInterval.ts +++ b/apps/web/app/hooks/features/useRefreshInterval.ts @@ -22,5 +22,5 @@ export function useRefreshInterval( return () => clearInterval(id); } - }, [delay]); + }, [delay, callbackRef, params]); } diff --git a/apps/web/app/hooks/features/useRequestToJoinTeam.ts b/apps/web/app/hooks/features/useRequestToJoinTeam.ts index 24dd754d2..34f9a578d 100644 --- a/apps/web/app/hooks/features/useRequestToJoinTeam.ts +++ b/apps/web/app/hooks/features/useRequestToJoinTeam.ts @@ -44,7 +44,7 @@ export const useRequestToJoinTeam = () => { return getRequestToJoinQueryCall().then((res) => { setRequestToJoin(res.data.items); }); - }, []); + }, [getRequestToJoinQueryCall, setRequestToJoin]); const requestToJoinTeam = useCallback( (data: IRequestToJoinCreate) => { @@ -73,11 +73,11 @@ export const useRequestToJoinTeam = () => { const acceptRejectRequestToJoin = useCallback( (id: string, action: IRequestToJoinActionEnum) => { - acceptRejectRequestToJoinQueryCall(id, action).then((res) => { + acceptRejectRequestToJoinQueryCall(id, action).then(() => { getRequestToJoin(); }); }, - [acceptRejectRequestToJoinQueryCall] + [acceptRejectRequestToJoinQueryCall, getRequestToJoin] ); return { diff --git a/apps/web/app/hooks/features/useRolePermissions.ts b/apps/web/app/hooks/features/useRolePermissions.ts index fda954b47..4aba69011 100644 --- a/apps/web/app/hooks/features/useRolePermissions.ts +++ b/apps/web/app/hooks/features/useRolePermissions.ts @@ -42,7 +42,11 @@ export const useRolePermissions = () => { } }); }, - [getRolePermissionsQueryCall] + [ + getRolePermissionsQueryCall, + setRolePermissionsFormated, + setrolePermissions + ] ); const updateRolePermission = useCallback( @@ -62,7 +66,13 @@ export const useRolePermissions = () => { setrolePermissions(tempRoles); }); }, - [rolePermissions] + [ + rolePermissions, + rolePermissionsFormated, + setRolePermissionsFormated, + setrolePermissions, + updateRoleQueryCall + ] ); return { diff --git a/apps/web/app/hooks/features/useRoles.ts b/apps/web/app/hooks/features/useRoles.ts index 727b9dd0d..0065a9930 100644 --- a/apps/web/app/hooks/features/useRoles.ts +++ b/apps/web/app/hooks/features/useRoles.ts @@ -28,7 +28,7 @@ export const useRoles = () => { setRoles(response.data.items); } }); - }, [getRolesQueryCall]); + }, [getRolesQueryCall, setRoles]); const createRole = useCallback( async (role: IRole) => { @@ -36,7 +36,7 @@ export const useRoles = () => { setRoles([response.data, ...roles]); }); }, - [getRolesQueryCall, roles] + [roles, createRoleQueryCall, setRoles] ); const updateRole = useCallback( @@ -51,7 +51,7 @@ export const useRoles = () => { setRoles(tempRoles); }); }, - [getRolesQueryCall, roles] + [roles, setRoles, updateRoleQueryCall] ); const deleteRole = useCallback( @@ -60,7 +60,7 @@ export const useRoles = () => { setRoles(roles.filter((role) => role.id !== id)); }); }, - [getRolesQueryCall, roles] + [deleteRoleQueryCall, setRoles, roles] ); return { diff --git a/apps/web/app/hooks/features/useTaskLabels.ts b/apps/web/app/hooks/features/useTaskLabels.ts index 06136b773..d92041cf2 100644 --- a/apps/web/app/hooks/features/useTaskLabels.ts +++ b/apps/web/app/hooks/features/useTaskLabels.ts @@ -56,13 +56,13 @@ export function useTaskLabels() { return res; }); - }, [user, activeTeamId, setTaskLabels, taskLabels]); + }, [user, activeTeamId, setTaskLabels, taskLabels, queryCall]); useEffect(() => { if (!firstLoad) return; loadTaskLabels(); - }, [activeTeamId, firstLoad]); + }, [activeTeamId, firstLoad, loadTaskLabels]); const createTaskLabels = useCallback( (data: ITaskLabelsCreate) => { @@ -90,13 +90,7 @@ export function useTaskLabels() { } }, - [ - createQueryCall, - createTaskLabelsLoading, - deleteTaskLabelsLoading, - user, - activeTeamId - ] + [createQueryCall, user, activeTeamId, queryCall, setTaskLabels] ); const deleteTaskLabels = useCallback( @@ -115,13 +109,7 @@ export function useTaskLabels() { }); } }, - [ - deleteQueryCall, - taskLabels.length, - createTaskLabelsLoading, - deleteTaskLabelsLoading, - user - ] + [deleteQueryCall, user, activeTeamId, queryCall, setTaskLabels] ); const editTaskLabels = useCallback( @@ -140,11 +128,10 @@ export function useTaskLabels() { }); } }, - [editTaskLabelsLoading, user] + [user, activeTeamId, editQueryCall, queryCall, setTaskLabels] ); return { - // loadTaskStatus, loading: taskLabelsFetching, taskLabels, taskLabelsFetching, diff --git a/apps/web/app/hooks/features/useTaskPriorities.ts b/apps/web/app/hooks/features/useTaskPriorities.ts index 6d34b1b8e..d002c550f 100644 --- a/apps/web/app/hooks/features/useTaskPriorities.ts +++ b/apps/web/app/hooks/features/useTaskPriorities.ts @@ -59,13 +59,13 @@ export function useTaskPriorities() { return res; }); - }, [user, activeTeamId, setTaskPriorities, taskPriorities]); + }, [user, activeTeamId, setTaskPriorities, taskPriorities, queryCall]); useEffect(() => { if (!firstLoad) return; loadTaskPriorities(); - }, [activeTeamId, firstLoad]); + }, [activeTeamId, firstLoad, loadTaskPriorities]); const createTaskPriorities = useCallback( (data: ITaskPrioritiesCreate) => { @@ -79,13 +79,7 @@ export function useTaskPriorities() { } }, - [ - createQueryCall, - createTaskPrioritiesLoading, - deleteTaskPrioritiesLoading, - user, - activeTeamId - ] + [createQueryCall, user, activeTeamId] ); const deleteTaskPriorities = useCallback( @@ -104,14 +98,7 @@ export function useTaskPriorities() { }); } }, - [ - deleteQueryCall, - taskPriorities.length, - createTaskPrioritiesLoading, - deleteTaskPrioritiesLoading, - user, - activeTeamId - ] + [deleteQueryCall, user, activeTeamId, queryCall, setTaskPriorities] ); const editTaskPriorities = useCallback( @@ -130,7 +117,7 @@ export function useTaskPriorities() { }); } }, - [editTaskPrioritiesLoading, user, activeTeamId] + [user, activeTeamId, editQueryCall, queryCall, setTaskPriorities] ); return { diff --git a/apps/web/app/hooks/features/useTaskRelatedIssueType.ts b/apps/web/app/hooks/features/useTaskRelatedIssueType.ts index 3ffe4414b..a2488fa6c 100644 --- a/apps/web/app/hooks/features/useTaskRelatedIssueType.ts +++ b/apps/web/app/hooks/features/useTaskRelatedIssueType.ts @@ -60,12 +60,18 @@ export function useTaskRelatedIssueType() { } return res; }); - }, [user, activeTeamId, setTaskRelatedIssueType, taskRelatedIssueType]); + }, [ + user, + activeTeamId, + setTaskRelatedIssueType, + taskRelatedIssueType, + queryCall + ]); useEffect(() => { if (!firstLoad) return; loadTaskRelatedIssueTypeData(); - }, [activeTeamId, firstLoad]); + }, [activeTeamId, firstLoad, loadTaskRelatedIssueTypeData]); const createTaskRelatedIssueType = useCallback( (data: ITaskRelatedIssueTypeCreate) => { @@ -79,12 +85,7 @@ export function useTaskRelatedIssueType() { } }, - [ - createQueryCall, - createTaskRelatedIssueTypeLoading, - deleteTaskRelatedIssueTypeLoading, - activeTeamId - ] + [createQueryCall, activeTeamId, user] ); const deleteTaskRelatedIssueType = useCallback( @@ -103,20 +104,11 @@ export function useTaskRelatedIssueType() { }); } }, - [ - deleteQueryCall, - taskRelatedIssueType.length, - createTaskRelatedIssueTypeLoading, - deleteTaskRelatedIssueTypeLoading, - user, - activeTeamId - ] + [deleteQueryCall, user, activeTeamId, queryCall, setTaskRelatedIssueType] ); const editTaskRelatedIssueType = useCallback( (id: string, data: ITaskRelatedIssueTypeCreate) => { - console.log(user); - if (user?.tenantId) { return editQueryCall(id, data, user?.tenantId || '').then((res) => { queryCall( @@ -131,7 +123,7 @@ export function useTaskRelatedIssueType() { }); } }, - [editTaskRelatedIssueTypeLoading, user, activeTeamId] + [user, activeTeamId, setTaskRelatedIssueType, editQueryCall, queryCall] ); return { diff --git a/apps/web/app/hooks/features/useTaskSizes.ts b/apps/web/app/hooks/features/useTaskSizes.ts index 22206f4b7..9108268b5 100644 --- a/apps/web/app/hooks/features/useTaskSizes.ts +++ b/apps/web/app/hooks/features/useTaskSizes.ts @@ -56,13 +56,13 @@ export function useTaskSizes() { return res; }); - }, [user, activeTeamId, setTaskSizes, taskSizes]); + }, [user, activeTeamId, setTaskSizes, taskSizes, queryCall]); useEffect(() => { if (!firstLoad) return; loadTaskSizes(); - }, [activeTeamId, firstLoad]); + }, [activeTeamId, firstLoad, loadTaskSizes]); const createTaskSizes = useCallback( (data: ITaskSizesCreate) => { @@ -76,13 +76,7 @@ export function useTaskSizes() { } }, - [ - createQueryCall, - createTaskSizesLoading, - deleteTaskSizesLoading, - user, - activeTeamId - ] + [createQueryCall, user, activeTeamId] ); const deleteTaskSizes = useCallback( @@ -101,14 +95,7 @@ export function useTaskSizes() { }); } }, - [ - deleteQueryCall, - taskSizes.length, - createTaskSizesLoading, - deleteTaskSizesLoading, - user, - activeTeamId - ] + [deleteQueryCall, user, activeTeamId, queryCall, setTaskSizes] ); const editTaskSizes = useCallback( @@ -127,7 +114,7 @@ export function useTaskSizes() { }); } }, - [editTaskSizesLoading, user, activeTeamId] + [user, activeTeamId, editQueryCall, queryCall, setTaskSizes] ); return { diff --git a/apps/web/app/hooks/features/useTaskStatistics.ts b/apps/web/app/hooks/features/useTaskStatistics.ts index 8441f7d81..718aded7f 100644 --- a/apps/web/app/hooks/features/useTaskStatistics.ts +++ b/apps/web/app/hooks/features/useTaskStatistics.ts @@ -21,7 +21,6 @@ import { useSyncRef } from '../useSyncRef'; import { Nullable } from '@app/interfaces'; import { useRefreshInterval } from './useRefreshInterval'; import { useOrganizationTeams } from './useOrganizationTeams'; -import { useAuthenticateUser } from './useAuthenticateUser'; export function useTaskStatistics(addSeconds = 0) { const [statActiveTask, setStatActiveTask] = useRecoilState( @@ -37,10 +36,6 @@ export function useTaskStatistics(addSeconds = 0) { useFirstLoad(); const { activeTeam } = useOrganizationTeams(); - const { user } = useAuthenticateUser(); - const currentMember = activeTeam?.members?.find( - (member) => member?.employeeId === user?.employee?.id - ); // Refs const initialLoad = useRef(false); @@ -53,30 +48,36 @@ export function useTaskStatistics(addSeconds = 0) { /** * Get employee all tasks statistics (API Call) */ - const getTasksStatsData = useCallback((employeeId?: string) => { - tasksTimesheetStatisticsAPI(employeeId).then(({ data }) => { - setStatTasks({ - all: data.global || [], - today: data.today || [] + const getTasksStatsData = useCallback( + (employeeId?: string) => { + tasksTimesheetStatisticsAPI(employeeId).then(({ data }) => { + setStatTasks({ + all: data.global || [], + today: data.today || [] + }); }); - }); - }, []); + }, + [setStatTasks] + ); const getAllTasksStatsData = useCallback(() => { allTaskTimesheetStatisticsAPI().then(({ data }) => { setAllTaskStatistics(data); }); - }, []); + }, [setAllTaskStatistics]); /** * Get task timesheet statistics */ - const getTaskStat = useCallback((task: Nullable) => { - const stats = statTasksRef.current; - return { - taskTotalStat: stats.all.find((t) => t.id === task?.id), - taskDailyStat: stats.today.find((t) => t.id === task?.id) - }; - }, []); + const getTaskStat = useCallback( + (task: Nullable) => { + const stats = statTasksRef.current; + return { + taskTotalStat: stats.all.find((t) => t.id === task?.id), + taskDailyStat: stats.today.find((t) => t.id === task?.id) + }; + }, + [statTasksRef] + ); /** * Get statistics of the active tasks fresh (API Call) @@ -94,8 +95,9 @@ export function useTaskStatistics(addSeconds = 0) { setTasksFetching(false); }); return promise; - }, []); + }, [setStatActiveTask, setTasksFetching]); + // eslint-disable-next-line react-hooks/exhaustive-deps const debounceLoadActiveTaskStat = useCallback( debounce(getActiveTaskStatData, 100), [] @@ -110,7 +112,7 @@ export function useTaskStatistics(addSeconds = 0) { initialLoad.current = true; }); } - }, [firstLoad]); + }, [firstLoad, getActiveTaskStatData]); /** * Get fresh statistic of the active task @@ -119,7 +121,7 @@ export function useTaskStatistics(addSeconds = 0) { if (firstLoad && initialLoad.current) { debounceLoadActiveTaskStat(); } - }, [firstLoad, timerStatus, activeTeamTask?.id]); + }, [firstLoad, timerStatus, activeTeamTask?.id, debounceLoadActiveTaskStat]); /** * set null to active team stats when active team or active task are changed @@ -131,7 +133,7 @@ export function useTaskStatistics(addSeconds = 0) { total: null }); } - }, [firstLoad, activeTeamTask?.id]); + }, [firstLoad, activeTeamTask?.id, setStatActiveTask]); /** * Get task estimation in @@ -141,20 +143,23 @@ export function useTaskStatistics(addSeconds = 0) { * @param addSeconds * @returns */ - const getEstimation = ( - timeSheet: Nullable, - _task: Nullable, - addSeconds: number, - estimate = 0 - ) => - Math.min( - Math.floor( - (((_task?.totalWorkedTime || timeSheet?.duration || 0) + addSeconds) * - 100) / - (estimate || _task?.estimate || 0) + const getEstimation = useCallback( + ( + timeSheet: Nullable, + _task: Nullable, + addSeconds: number, + estimate = 0 + ) => + Math.min( + Math.floor( + (((_task?.totalWorkedTime || timeSheet?.duration || 0) + addSeconds) * + 100) / + (estimate || _task?.estimate || 0) + ), + 100 ), - 100 - ); + [] + ); const activeTaskEstimation = useMemo(() => { let totalWorkedTasksTimer = 0; @@ -174,7 +179,7 @@ export function useTaskStatistics(addSeconds = 0) { totalWorkedTasksTimer, activeTeamTask?.estimate || 0 ); - }, [activeTeam, activeTeamTask, currentMember]); + }, [activeTeam, activeTeamTask, getEstimation]); const activeTaskDailyEstimation = activeTeamTask && activeTeamTask.estimate diff --git a/apps/web/app/hooks/features/useTaskStatus.ts b/apps/web/app/hooks/features/useTaskStatus.ts index 7f30fe15f..33a004e94 100644 --- a/apps/web/app/hooks/features/useTaskStatus.ts +++ b/apps/web/app/hooks/features/useTaskStatus.ts @@ -59,7 +59,7 @@ export function useTaskStatus() { useEffect(() => { if (!firstLoad) return; loadTaskStatusData(); - }, [activeTeamId, firstLoad]); + }, [loadTaskStatusData, firstLoad]); const createTaskStatus = useCallback( (data: ITaskStatusCreate) => { @@ -73,12 +73,7 @@ export function useTaskStatus() { } }, - [ - createQueryCall, - createTaskStatusLoading, - deleteTaskStatusLoading, - activeTeamId - ] + [createQueryCall, activeTeamId, user] ); const deleteTaskStatus = useCallback( @@ -97,14 +92,7 @@ export function useTaskStatus() { }); } }, - [ - deleteQueryCall, - taskStatus.length, - createTaskStatusLoading, - deleteTaskStatusLoading, - user, - activeTeamId - ] + [deleteQueryCall, user, activeTeamId, queryCall, setTaskStatus] ); const editTaskStatus = useCallback( @@ -123,7 +111,7 @@ export function useTaskStatus() { }); } }, - [editTaskStatusLoading, user, activeTeamId] + [user, activeTeamId, editQueryCall, queryCall, setTaskStatus] ); return { diff --git a/apps/web/app/hooks/features/useTaskVersion.ts b/apps/web/app/hooks/features/useTaskVersion.ts index f4a97d13c..b3c182dae 100644 --- a/apps/web/app/hooks/features/useTaskVersion.ts +++ b/apps/web/app/hooks/features/useTaskVersion.ts @@ -1,3 +1,4 @@ +/* eslint-disable react-hooks/exhaustive-deps */ import { ITaskVersionCreate } from '@app/interfaces'; import { createTaskVersionAPI, diff --git a/apps/web/app/hooks/features/useTeamInvitations.ts b/apps/web/app/hooks/features/useTeamInvitations.ts index ebc56007f..299b7d7c5 100644 --- a/apps/web/app/hooks/features/useTeamInvitations.ts +++ b/apps/web/app/hooks/features/useTeamInvitations.ts @@ -56,12 +56,15 @@ export function useTeamInvitations() { loading: acceptRejectMyInvitationsLoading } = useQuery(acceptRejectMyInvitationsAPI); - const inviteUser = useCallback((email: string, name: string) => { - return inviteQueryCall({ email, name }).then((res) => { - setTeamInvitations(res.data?.items || []); - return res; - }); - }, []); + const inviteUser = useCallback( + (email: string, name: string) => { + return inviteQueryCall({ email, name }).then((res) => { + setTeamInvitations(res.data?.items || []); + return res; + }); + }, + [inviteQueryCall, setTeamInvitations] + ); useEffect(() => { if (activeTeamId && firstLoad && isTeamManager) { @@ -69,30 +72,36 @@ export function useTeamInvitations() { setTeamInvitations(res.data?.items || []); }); } - }, [activeTeamId, firstLoad, isTeamManager]); + }, [activeTeamId, firstLoad, isTeamManager, queryCall, setTeamInvitations]); useEffect(() => { if (firstLoad) { setFetchingInvitations(loading); } - }, [loading, firstLoad]); + }, [loading, firstLoad, setFetchingInvitations]); - const removeTeamInvitation = useCallback((invitationId: string) => { - removeInviteQueryCall(invitationId).then((res) => { - setTeamInvitations(res.data?.items || []); - }); - }, []); + const removeTeamInvitation = useCallback( + (invitationId: string) => { + removeInviteQueryCall(invitationId).then((res) => { + setTeamInvitations(res.data?.items || []); + }); + }, + [removeInviteQueryCall, setTeamInvitations] + ); - const resendTeamInvitation = useCallback((invitationId: string) => { - resendInviteQueryCall(invitationId); - }, []); + const resendTeamInvitation = useCallback( + (invitationId: string) => { + resendInviteQueryCall(invitationId); + }, + [resendInviteQueryCall] + ); const myInvitations = useCallback(() => { myInvitationsQueryCall().then((res) => { setMyInvitationsList(res.data.items); return res.data; }); - }, [myInvitationsQueryCall]); + }, [myInvitationsQueryCall, setMyInvitationsList]); const removeMyInvitation = useCallback( (id: string) => { setMyInvitationsList( @@ -119,7 +128,12 @@ export function useTeamInvitations() { return res.data; }); }, - [acceptRejectMyInvitationsQueryCall, myInvitationsList] + [ + acceptRejectMyInvitationsQueryCall, + myInvitationsList, + refreshToken, + setMyInvitationsList + ] ); return { diff --git a/apps/web/app/hooks/features/useTeamMemberCard.ts b/apps/web/app/hooks/features/useTeamMemberCard.ts index c1a819a2a..814ae5d24 100644 --- a/apps/web/app/hooks/features/useTeamMemberCard.ts +++ b/apps/web/app/hooks/features/useTeamMemberCard.ts @@ -100,7 +100,14 @@ export function useTeamMemberCard( } return responseTask; - }, [activeTeamTask, isAuthUser, authUser, member, tasks, publicTeam]); + }, [ + isAuthUser, + member, + tasks, + publicTeam, + allTaskStatistics, + setActiveUserTaskCookieCb + ]); /** * Give the manager role to the member @@ -159,7 +166,7 @@ export function useTeamMemberCard( .filter((r) => r.employee.id !== employeeId) .map((r) => r.employee.id) }); - }, [updateOrganizationTeam, member, activeTeamRef]); + }, [updateOrganizationTeam, member, activeTeamRef, deleteEmployeeFromTasks]); /** * Returns all tasks not assigned to the member diff --git a/apps/web/app/hooks/features/useTimer.ts b/apps/web/app/hooks/features/useTimer.ts index a8a8269b3..aeb9637a4 100644 --- a/apps/web/app/hooks/features/useTimer.ts +++ b/apps/web/app/hooks/features/useTimer.ts @@ -14,7 +14,6 @@ import { syncTimerAPI } from '@app/services/client/api/timer'; import { - activeTaskStatisticsState, localTimerStatusState, timeCounterIntervalState, timeCounterState, @@ -62,7 +61,6 @@ function useLocalTimeCounter( const [timeCounter, setTimeCounter] = useRecoilState(timeCounterState); // in millisencods const [timerSeconds, setTimerSeconds] = useRecoilState(timerSecondsState); - const activeTaskStat = useRecoilValue(activeTaskStatisticsState); // active task statistics status // Refs const timerStatusRef = useSyncRef(timerStatus); @@ -74,10 +72,13 @@ function useLocalTimeCounter( localStorage.setItem(LOCAL_TIMER_STORAGE_KEY, JSON.stringify(status)); }, []); - const updateLocalTimerStatus = useCallback((status: ILocalTimerStatus) => { - updateLocalStorage(status); // the order is important (first update localstorage, then update the store state) - setLocalTimerStatus(status); - }, []); + const updateLocalTimerStatus = useCallback( + (status: ILocalTimerStatus) => { + updateLocalStorage(status); // the order is important (first update localstorage, then update the store state) + setLocalTimerStatus(status); + }, + [updateLocalStorage, setLocalTimerStatus] + ); const getLocalCounterStatus = useCallback(() => { let data: ILocalTimerStatus | null = null; @@ -112,7 +113,14 @@ function useLocalTimeCounter( lastTaskId: timerStatus.lastLog?.taskId || null }); } - }, [firstLoad, timerStatus]); + }, [ + firstLoad, + timerStatus, + + getLocalCounterStatus, + setLocalTimerStatus, + updateLocalTimerStatus + ]); // THis is form constant update of the progress line timerSecondsRef.current = useMemo(() => { @@ -124,20 +132,20 @@ function useLocalTimeCounter( return 0; } return timerSecondsRef.current; - }, [seconds, activeTaskStat, firstLoad]); + }, [seconds, firstLoad, timerStatusRef]); useEffect(() => { if (firstLoad) { timerSecondsRef.current = 0; setTimerSeconds(0); } - }, [activeTeamTask?.id, firstLoad]); + }, [activeTeamTask?.id, setTimerSeconds, firstLoad, timerSecondsRef]); useEffect(() => { if (firstLoad) { setTimerSeconds(timerSecondsRef.current); } - }, [timerSecondsRef.current, firstLoad]); + }, [setTimerSeconds, firstLoad]); // Time Counter useEffect(() => { @@ -153,7 +161,13 @@ function useLocalTimeCounter( } else { setTimeCounter(0); } - }, [localTimerStatus, firstLoad]); + }, [ + localTimerStatus, + firstLoad, + setTimeCounter, + setTimeCounterInterval, + timeCounterIntervalRef + ]); return { updateLocalTimerStatus, @@ -198,7 +212,6 @@ export function useTimer() { (!!activeTeamTask && activeTeamTask.status !== 'closed') || // If timer is running at some other source and user may or may not have selected the task timerStatusRef.current?.lastLog?.source !== TimerSource.TEAMS; - const syncTimerInterval = useRef(null); // Local time status const { timeCounter, updateLocalTimerStatus, timerSeconds } = @@ -218,7 +231,7 @@ export function useTimer() { return res; }); }, - [timerStatus] + [timerStatus, setTimerStatus, queryCall] ); const toggleTimer = useCallback( @@ -232,7 +245,7 @@ export function useTimer() { return res; }); }, - [timerStatus] + [timerStatus, toggleQueryCall, setTimerStatus] ); const syncTimer = useCallback(() => { @@ -251,11 +264,11 @@ export function useTimer() { if (firstLoad) { setTimerStatusFetching(loading); } - }, [loading, firstLoad]); + }, [loading, firstLoad, setTimerStatusFetching]); useEffect(() => { setTimerStatusFetching(stopTimerLoading); - }, [stopTimerLoading]); + }, [stopTimerLoading, setTimerStatusFetching]); // Start timer const startTimer = useCallback(async () => { @@ -304,7 +317,6 @@ export function useTimer() { return promise; }, [ - taskId.current, activeTeamTaskRef, timerStatus, updateOrganizationTeamEmployee, @@ -331,7 +343,13 @@ export function useTimer() { ).then((res) => { res.data && !isEqual(timerStatus, res.data) && setTimerStatus(res.data); }); - }, [taskId.current, syncTimerInterval.current, timerStatus]); + }, [ + timerStatus, + setTimerStatus, + stopTimerQueryCall, + taskId, + updateLocalTimerStatus + ]); // If active team changes then stop the timer useEffect(() => { @@ -350,7 +368,7 @@ export function useTimer() { if (activeTeamId) { lastActiveTeamId.current = activeTeamId; } - }, [firstLoad, activeTeamId]); + }, [firstLoad, activeTeamId, stopTimer, timerStatusRef]); // If active task changes then stop the timer useEffect(() => { @@ -371,7 +389,7 @@ export function useTimer() { if (taskId) { lastActiveTaskId.current = taskId; } - }, [firstLoad, activeTeamTask?.id]); + }, [firstLoad, activeTeamTask?.id, stopTimer, timerStatusRef]); return { timeCounter, diff --git a/apps/web/app/hooks/features/useUser.ts b/apps/web/app/hooks/features/useUser.ts index 2c4151693..71887b14a 100644 --- a/apps/web/app/hooks/features/useUser.ts +++ b/apps/web/app/hooks/features/useUser.ts @@ -19,7 +19,7 @@ export const useUser = () => { return res; }); } - }, [user]); + }, [user, deleteQueryCall, logOut]); const resetUser = useCallback(() => { if (user) { @@ -28,7 +28,7 @@ export const useUser = () => { return res; }); } - }, [user]); + }, [user, resetQueryCall, logOut]); return { deleteUser, diff --git a/apps/web/app/hooks/useOutsideClick.ts b/apps/web/app/hooks/useOutsideClick.ts index 6f26964c4..2197db30b 100644 --- a/apps/web/app/hooks/useOutsideClick.ts +++ b/apps/web/app/hooks/useOutsideClick.ts @@ -12,7 +12,9 @@ export function useOutsideClick(onClickOuSide?: Func) { useEffect(() => { const onBodyClick = (ev: MouseEvent) => { if (!targetEl.current) return; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const el = targetEl.current!; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const tnode = ev.target! as Node; if ( @@ -31,11 +33,14 @@ export function useOutsideClick(onClickOuSide?: Func) { return () => { document.body.removeEventListener('click', onBodyClick); }; - }, []); - - const onOutsideClick = useCallback((func: Func) => { - onClickOuSideRef.current = func; - }, []); + }, [onClickOuSideRef]); + + const onOutsideClick = useCallback( + (func: Func) => { + onClickOuSideRef.current = func; + }, + [onClickOuSideRef] + ); const ignoreElementRef = useCallback((el: any) => { refs.current.push(el); diff --git a/apps/web/app/hooks/useQuery.ts b/apps/web/app/hooks/useQuery.ts index b2bd224a2..b8a459670 100644 --- a/apps/web/app/hooks/useQuery.ts +++ b/apps/web/app/hooks/useQuery.ts @@ -17,6 +17,7 @@ export function useQuery Promise>( setLoading(false); }); return promise; + // eslint-disable-next-line react-hooks/exhaustive-deps }, []) as T; return { queryCall, loading, infiniteLoading }; diff --git a/apps/web/app/services/server/requests/issue-type.ts b/apps/web/app/services/server/requests/issue-type.ts index 8c4fbbf98..028e16690 100644 --- a/apps/web/app/services/server/requests/issue-type.ts +++ b/apps/web/app/services/server/requests/issue-type.ts @@ -52,7 +52,7 @@ export function deleteIssueTypesRequest({ }); } -export function getIssueTypesListRequest( +export function getIssueTypesListRequest( { organizationId, tenantId, diff --git a/apps/web/app/services/server/requests/languages.ts b/apps/web/app/services/server/requests/languages.ts index fad203130..c705017d6 100644 --- a/apps/web/app/services/server/requests/languages.ts +++ b/apps/web/app/services/server/requests/languages.ts @@ -1,6 +1,6 @@ import { serverFetch } from '../fetch'; -export function getLanguageListRequest( +export function getLanguageListRequest( { is_system, tenantId }: { is_system: boolean; tenantId: string }, bearer_token: string ) { diff --git a/apps/web/app/services/server/requests/task-labels.ts b/apps/web/app/services/server/requests/task-labels.ts index 07e590eda..92eb8592e 100644 --- a/apps/web/app/services/server/requests/task-labels.ts +++ b/apps/web/app/services/server/requests/task-labels.ts @@ -52,7 +52,7 @@ export function deleteTaskLabelsRequest({ }); } -export function getTaskLabelsListRequest( +export function getTaskLabelsListRequest( { organizationId, tenantId, diff --git a/apps/web/app/services/server/requests/task-priorities.ts b/apps/web/app/services/server/requests/task-priorities.ts index db12d0ea3..f180c14f8 100644 --- a/apps/web/app/services/server/requests/task-priorities.ts +++ b/apps/web/app/services/server/requests/task-priorities.ts @@ -55,7 +55,7 @@ export function deleteTaskPrioritiesRequest({ }); } -export function getTaskPrioritiesListRequest( +export function getTaskPrioritiesListRequest( { organizationId, tenantId, diff --git a/apps/web/app/services/server/requests/task-related-issue-type.ts b/apps/web/app/services/server/requests/task-related-issue-type.ts index 7d2c13862..ddd2b3046 100644 --- a/apps/web/app/services/server/requests/task-related-issue-type.ts +++ b/apps/web/app/services/server/requests/task-related-issue-type.ts @@ -55,9 +55,7 @@ export function deleteTaskRelatedIssueTypeRequest({ }); } -export function getTaskRelatedIssueTypeListRequest< - ITaskRelatedIssueTypeItemList ->( +export function getTaskRelatedIssueTypeListRequest( { organizationId, tenantId, diff --git a/apps/web/app/services/server/requests/task-sizes.ts b/apps/web/app/services/server/requests/task-sizes.ts index 87fe55f05..6b74d7151 100644 --- a/apps/web/app/services/server/requests/task-sizes.ts +++ b/apps/web/app/services/server/requests/task-sizes.ts @@ -52,7 +52,7 @@ export function deleteTaskSizesRequest({ }); } -export function getTaskSizesListRequest( +export function getTaskSizesListRequest( { organizationId, tenantId, diff --git a/apps/web/app/services/server/requests/task-version.ts b/apps/web/app/services/server/requests/task-version.ts index ed3d458a2..43e2a153a 100644 --- a/apps/web/app/services/server/requests/task-version.ts +++ b/apps/web/app/services/server/requests/task-version.ts @@ -52,7 +52,7 @@ export function deleteTaskVersionRequest({ }); } -export function getTaskVersionListRequest( +export function getTaskVersionListRequest( { organizationId, tenantId, diff --git a/apps/web/app/services/server/requests/taskStatus.ts b/apps/web/app/services/server/requests/taskStatus.ts index 989f34f52..3a4a20249 100644 --- a/apps/web/app/services/server/requests/taskStatus.ts +++ b/apps/web/app/services/server/requests/taskStatus.ts @@ -52,7 +52,7 @@ export function deleteTaskStatusRequest({ }); } -export function getTaskStatusListRequest( +export function getTaskStatusListRequest( { organizationId, tenantId, diff --git a/apps/web/components/shared/collaborate/index.tsx b/apps/web/components/shared/collaborate/index.tsx index 0c3c50b92..243e6585e 100644 --- a/apps/web/components/shared/collaborate/index.tsx +++ b/apps/web/components/shared/collaborate/index.tsx @@ -2,6 +2,7 @@ import { imgTitle } from '@app/helpers'; import { useAuthenticateUser, useCollaborative, + useModal, useOrganizationTeams } from '@app/hooks'; import { IUser } from '@app/interfaces'; @@ -46,6 +47,7 @@ const Collaborate = () => { } = useCollaborative(); const { analytics } = useJitsu(); const { trans } = useTranslation(); + const { isOpen, closeModal, openModal } = useModal(); const { user } = useAuthenticateUser(); const { activeTeam } = useOrganizationTeams(); @@ -84,9 +86,9 @@ const Collaborate = () => { return (
- + + onClick={() => { analytics.track('click-collaborate', { context: { email: user?.email, @@ -94,8 +96,10 @@ const Collaborate = () => { tenant: user?.tenant?.name, tenantId: user?.tenant?.id } - }) - } + }); + + isOpen ? closeModal() : openModal(); + }} className={clsxm( 'flex flex-row items-center justify-center py-3.5 px-4 gap-3 rounded-xl outline-none', 'bg-primary dark:bg-primary-light text-white text-sm', @@ -229,7 +233,10 @@ const Collaborate = () => {