diff --git a/apps/app/components/project/SendProjectInvitationModal.tsx b/apps/app/components/project/SendProjectInvitationModal.tsx index 7bac94fa2..0c0485803 100644 --- a/apps/app/components/project/SendProjectInvitationModal.tsx +++ b/apps/app/components/project/SendProjectInvitationModal.tsx @@ -51,7 +51,13 @@ const SendProjectInvitationModal: React.FC = ({ isOpen, setIsOpen, member const { data: people } = useSWR( activeWorkspace ? WORKSPACE_MEMBERS(activeWorkspace.slug) : null, - activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null + activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null, + { + onErrorRetry(err, _, __, revalidate, revalidateOpts) { + if (err?.status === 403) return; + setTimeout(() => revalidate(revalidateOpts), 5000); + }, + } ); const { diff --git a/apps/app/components/project/issues/BoardView/SingleBoard.tsx b/apps/app/components/project/issues/BoardView/SingleBoard.tsx index d3fca633e..6a55a761d 100644 --- a/apps/app/components/project/issues/BoardView/SingleBoard.tsx +++ b/apps/app/components/project/issues/BoardView/SingleBoard.tsx @@ -42,8 +42,8 @@ type Props = { > >; bgColor?: string; - stateId?: string; - createdBy?: string; + stateId: string | null; + createdBy: string | null; }; const SingleBoard: React.FC = ({ @@ -109,7 +109,7 @@ const SingleBoard: React.FC = ({

= ({ setIsIssueOpen(true); if (selectedGroup !== null) setPreloadedData({ - state: stateId, + state: stateId !== null ? stateId : undefined, [selectedGroup]: groupTitle, actionType: "createIssue", }); @@ -201,10 +201,12 @@ const SingleBoard: React.FC = ({ ? "text-xs text-black" : key === "priority" ? `text-xs bg-gray-200 px-2 py-1 mt-2 flex items-center gap-x-1 rounded w-min whitespace-nowrap capitalize font-medium ${ - childIssue.priority === "high" + childIssue.priority === "urgent" ? "bg-red-100 text-red-600" + : childIssue.priority === "high" + ? "bg-orange-100 text-orange-600" : childIssue.priority === "medium" - ? "bg-orange-100 text-orange-500" + ? "bg-yellow-100 text-yellow-500" : childIssue.priority === "low" ? "bg-green-100 text-green-500" : "hidden" @@ -224,7 +226,7 @@ const SingleBoard: React.FC = ({ : "None"} )} - {key === "target_date" && ( + {key === "due_date" && ( <> = ({ setIsIssueOpen(true); if (selectedGroup !== null) { setPreloadedData({ - state: stateId, + state: stateId !== null ? stateId : undefined, [selectedGroup]: groupTitle, actionType: "createIssue", }); diff --git a/apps/app/components/project/issues/BoardView/index.tsx b/apps/app/components/project/issues/BoardView/index.tsx index 010b9cbdc..fe69a091e 100644 --- a/apps/app/components/project/issues/BoardView/index.tsx +++ b/apps/app/components/project/issues/BoardView/index.tsx @@ -197,9 +197,10 @@ const BoardView: React.FC = ({ properties, selectedGroup, groupedByIssues selectedGroup={selectedGroup} groupTitle={singleGroup} createdBy={ - members - ? members?.find((m) => m.member.id === singleGroup)?.member.first_name - : undefined + selectedGroup === "created_by" + ? members?.find((m) => m.member.id === singleGroup)?.member + .first_name ?? "loading..." + : null } groupedByIssues={groupedByIssues} index={index} @@ -208,8 +209,8 @@ const BoardView: React.FC = ({ properties, selectedGroup, groupedByIssues setPreloadedData={setPreloadedData} stateId={ selectedGroup === "state_detail.name" - ? states?.find((s) => s.name === singleGroup)?.id - : undefined + ? states?.find((s) => s.name === singleGroup)?.id ?? null + : null } bgColor={ selectedGroup === "state_detail.name" diff --git a/apps/app/components/project/issues/ListView/index.tsx b/apps/app/components/project/issues/ListView/index.tsx index 5bbe2ea84..625fd0689 100644 --- a/apps/app/components/project/issues/ListView/index.tsx +++ b/apps/app/components/project/issues/ListView/index.tsx @@ -384,7 +384,7 @@ const ListView: React.FC = ({ )} - ) : (key as keyof Properties) === "target_date" ? ( + ) : (key as keyof Properties) === "due_date" ? ( {issue.target_date ? renderShortNumericDateFormat(issue.target_date) @@ -440,4 +440,4 @@ const ListView: React.FC = ({ ); }; -export default ListView; \ No newline at end of file +export default ListView; diff --git a/apps/app/lib/hoc/withAuthWrapper.tsx b/apps/app/lib/hoc/withAuthWrapper.tsx index e14b63b7b..50e56c2ec 100644 --- a/apps/app/lib/hoc/withAuthWrapper.tsx +++ b/apps/app/lib/hoc/withAuthWrapper.tsx @@ -4,7 +4,7 @@ import type { NextPage } from "next"; // redirect import redirect from "lib/redirect"; -const withAuth = (WrappedComponent: NextPage) => { +const withAuth = (WrappedComponent: NextPage, getBackToSameRoute: boolean = true) => { const Wrapper: NextPage = (props) => { return ; }; @@ -17,7 +17,8 @@ const withAuth = (WrappedComponent: NextPage) => { const token = cookies?.split("accessToken=")?.[1]?.split(";")?.[0]; if (!token) { - redirect(ctx, "/signin"); + if (getBackToSameRoute) redirect(ctx, "/signin?next=" + ctx?.asPath); + else redirect(ctx, "/signin"); } const pageProps = diff --git a/apps/app/lib/hooks/useIssuesFilter.tsx b/apps/app/lib/hooks/useIssuesFilter.tsx index 4573f0214..3ebf1a2c7 100644 --- a/apps/app/lib/hooks/useIssuesFilter.tsx +++ b/apps/app/lib/hooks/useIssuesFilter.tsx @@ -78,6 +78,10 @@ const useIssuesFilter = (projectIssues?: IssueResponse) => { } } + if (groupByProperty === "priority" && orderBy === "priority") { + setOrderBy(null); + } + return { groupedByIssues, issueView, diff --git a/apps/app/lib/hooks/useIssuesProperties.tsx b/apps/app/lib/hooks/useIssuesProperties.tsx index 068af7a79..518b204a6 100644 --- a/apps/app/lib/hooks/useIssuesProperties.tsx +++ b/apps/app/lib/hooks/useIssuesProperties.tsx @@ -16,7 +16,7 @@ const initialValues: Properties = { assignee: true, priority: false, start_date: false, - target_date: false, + due_date: false, cycle: false, }; diff --git a/apps/app/pages/projects/[projectId]/issues/index.tsx b/apps/app/pages/projects/[projectId]/issues/index.tsx index 62cd3cab6..ce153b4db 100644 --- a/apps/app/pages/projects/[projectId]/issues/index.tsx +++ b/apps/app/pages/projects/[projectId]/issues/index.tsx @@ -87,10 +87,18 @@ const ProjectIssues: NextPage = () => { ); const { data: members } = useSWR( - activeWorkspace && activeProject ? PROJECT_MEMBERS : null, + activeWorkspace && activeProject + ? PROJECT_MEMBERS(activeWorkspace.slug, activeProject.id) + : null, activeWorkspace && activeProject ? () => projectService.projectMembers(activeWorkspace.slug, activeProject.id) - : null + : null, + { + onErrorRetry(err, _, __, revalidate, revalidateOpts) { + if (err?.status === 403) return; + setTimeout(() => revalidate(revalidateOpts), 5000); + }, + } ); const { @@ -173,7 +181,7 @@ const ProjectIssues: NextPage = () => { View @@ -195,7 +203,7 @@ const ProjectIssues: NextPage = () => { leaveFrom="opacity-100 translate-y-0" leaveTo="opacity-0 translate-y-1" > - +
diff --git a/apps/app/pages/projects/[projectId]/members.tsx b/apps/app/pages/projects/[projectId]/members.tsx index 9d80d0ab1..f6d0ec9b4 100644 --- a/apps/app/pages/projects/[projectId]/members.tsx +++ b/apps/app/pages/projects/[projectId]/members.tsx @@ -53,7 +53,13 @@ const ProjectMembers: NextPage = () => { activeWorkspace && projectId ? PROJECT_MEMBERS(projectId as string) : null, activeWorkspace && projectId ? () => projectService.projectMembers(activeWorkspace.slug, projectId as any) - : null + : null, + { + onErrorRetry(err, _, __, revalidate, revalidateOpts) { + if (err?.status === 403) return; + setTimeout(() => revalidate(revalidateOpts), 5000); + }, + } ); const { data: projectInvitations, mutate: mutateInvitations } = useSWR( activeWorkspace && projectId ? PROJECT_INVITATIONS : null, diff --git a/apps/app/pages/projects/[projectId]/settings.tsx b/apps/app/pages/projects/[projectId]/settings.tsx index 0e205348f..264ec1b3a 100644 --- a/apps/app/pages/projects/[projectId]/settings.tsx +++ b/apps/app/pages/projects/[projectId]/settings.tsx @@ -79,7 +79,13 @@ const ProjectSettings: NextPage = () => { const { data: people } = useSWR( activeWorkspace ? WORKSPACE_MEMBERS(activeWorkspace.slug) : null, - activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null + activeWorkspace ? () => workspaceService.workspaceMembers(activeWorkspace.slug) : null, + { + onErrorRetry(err, _, __, revalidate, revalidateOpts) { + if (err?.status === 403) return; + setTimeout(() => revalidate(revalidateOpts), 5000); + }, + } ); useEffect(() => { @@ -541,4 +547,4 @@ const ProjectSettings: NextPage = () => { ); }; -export default ProjectSettings; \ No newline at end of file +export default ProjectSettings; diff --git a/apps/app/pages/signin.tsx b/apps/app/pages/signin.tsx index 1d3a33a98..79fe5bff2 100644 --- a/apps/app/pages/signin.tsx +++ b/apps/app/pages/signin.tsx @@ -43,8 +43,14 @@ const SignIn: NextPage = () => { async (res: any) => { await mutateUser(); await mutateWorkspaces(); - if (res.user.is_onboarded) router.push("/"); - else router.push("/invitations"); + const nextLocation = router.asPath.split("?next=")[1]; + + if (nextLocation) { + router.push(nextLocation as string); + } else { + if (res.user.is_onboarded) router.push("/"); + else router.push("/invitations"); + } }, [mutateUser, mutateWorkspaces, router] ); diff --git a/apps/app/types/issues.d.ts b/apps/app/types/issues.d.ts index 5d174dde2..19f05e680 100644 --- a/apps/app/types/issues.d.ts +++ b/apps/app/types/issues.d.ts @@ -102,7 +102,7 @@ export type Properties = { assignee: boolean; priority: boolean; start_date: boolean; - target_date: boolean; + due_date: boolean; cycle: boolean; };