diff --git a/apps/app/components/common/board-view/single-issue.tsx b/apps/app/components/common/board-view/single-issue.tsx index 5ce4ff0c0..3fde79ae1 100644 --- a/apps/app/components/common/board-view/single-issue.tsx +++ b/apps/app/components/common/board-view/single-issue.tsx @@ -228,7 +228,7 @@ const SingleIssue: React.FC = ({ )} - {properties.target_date && ( + {properties.due_date && (
= ({
{issue.target_date && (issue.target_date < new Date().toISOString() - ? `Target date has passed by ${findHowManyDaysLeft(issue.target_date)} days` + ? `Due date has passed by ${findHowManyDaysLeft(issue.target_date)} days` : findHowManyDaysLeft(issue.target_date) <= 3 - ? `Target date is in ${findHowManyDaysLeft(issue.target_date)} days` - : "Target date")} + ? `Due date is in ${findHowManyDaysLeft(issue.target_date)} days` + : "Due date")}
diff --git a/apps/app/components/project/cycles/list-view/index.tsx b/apps/app/components/project/cycles/list-view/index.tsx index 1ad8fa8a9..8c34e3109 100644 --- a/apps/app/components/project/cycles/list-view/index.tsx +++ b/apps/app/components/project/cycles/list-view/index.tsx @@ -218,7 +218,7 @@ const CyclesListView: React.FC = ({ )} - {properties.target_date && ( + {properties.due_date && (
= ({ ? renderShortNumericDateFormat(issue.target_date) : "N/A"}
-
- Target date -
+
Due date
{renderShortNumericDateFormat(issue.target_date ?? "")}
{issue.target_date && (issue.target_date < new Date().toISOString() - ? `Target date has passed by ${findHowManyDaysLeft( + ? `Due date has passed by ${findHowManyDaysLeft( issue.target_date )} days` : findHowManyDaysLeft(issue.target_date) <= 3 - ? `Target date is in ${findHowManyDaysLeft( + ? `Due date is in ${findHowManyDaysLeft( issue.target_date )} days` - : "Target date")} + : "Due date")}
diff --git a/apps/app/components/project/issues/list-view/index.tsx b/apps/app/components/project/issues/list-view/index.tsx index 6758a1205..9d3dadc18 100644 --- a/apps/app/components/project/issues/list-view/index.tsx +++ b/apps/app/components/project/issues/list-view/index.tsx @@ -310,7 +310,7 @@ const ListView: React.FC = ({ )} - {properties.target_date && ( + {properties.due_date && (
= ({
{issue.target_date && (issue.target_date < new Date().toISOString() - ? `Target date has passed by ${findHowManyDaysLeft( + ? `Due date has passed by ${findHowManyDaysLeft( issue.target_date )} days` : findHowManyDaysLeft(issue.target_date) <= 3 - ? `Target date is in ${findHowManyDaysLeft( + ? `Due date is in ${findHowManyDaysLeft( issue.target_date )} days` - : "Target date")} + : "Due date")}
diff --git a/apps/app/lib/hooks/useIssuesProperties.tsx b/apps/app/lib/hooks/useIssuesProperties.tsx index 223eafe2a..e509a6f16 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, children_count: false, }; @@ -26,7 +26,7 @@ const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => { const { user } = useUser(); - const { data: issueProperties } = useSWR( + const { data: issueProperties, mutate: mutateIssueProperties } = useSWR( workspaceSlug && projectId ? ISSUE_PROPERTIES_ENDPOINT(workspaceSlug, projectId) : null, workspaceSlug && projectId ? () => issueServices.getIssueProperties(workspaceSlug, projectId) @@ -56,6 +56,14 @@ const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => { (key: keyof Properties) => { if (!workspaceSlug || !projectId || !issueProperties || !user) return; setProperties((prev) => ({ ...prev, [key]: !prev[key] })); + mutateIssueProperties( + (prev) => + ({ + ...prev, + properties: { ...prev?.properties, [key]: !prev?.properties?.[key] }, + } as IssuePriorities), + false + ); if (Object.keys(issueProperties).length > 0) { issueServices.patchIssueProperties(workspaceSlug, projectId, issueProperties.id, { properties: { @@ -71,23 +79,19 @@ const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => { }); } }, - [workspaceSlug, projectId, issueProperties, user] + [workspaceSlug, projectId, issueProperties, user, mutateIssueProperties] ); - const newProperties = Object.keys(properties).reduce((obj: any, key) => { - if ( - key !== "children" && - key !== "name" && - key !== "parent" && - key !== "project" && - key !== "description" && - key !== "attachments" && - key !== "sequence_id" - ) { - obj[key] = properties[key as keyof Properties]; - } - return obj; - }, {}); + const newProperties: Properties = { + key: properties.key, + state: properties.state, + assignee: properties.assignee, + priority: properties.priority, + start_date: properties.start_date, + due_date: properties.due_date, + cycle: properties.cycle, + children_count: properties.children_count, + }; return [newProperties, updateIssueProperties] as const; }; diff --git a/apps/app/lib/hooks/useMyIssueFilter.tsx b/apps/app/lib/hooks/useMyIssueFilter.tsx index da8055a5f..019d0fa99 100644 --- a/apps/app/lib/hooks/useMyIssueFilter.tsx +++ b/apps/app/lib/hooks/useMyIssueFilter.tsx @@ -16,7 +16,7 @@ const initialValues: Properties = { assignee: true, priority: false, start_date: false, - target_date: false, + due_date: false, cycle: false, children_count: false, }; diff --git a/apps/app/pages/me/my-issues.tsx b/apps/app/pages/me/my-issues.tsx index 1a7b2f78b..3b6802ec6 100644 --- a/apps/app/pages/me/my-issues.tsx +++ b/apps/app/pages/me/my-issues.tsx @@ -398,7 +398,7 @@ const MyIssues: NextPage = () => { )} - {properties.target_date && ( + {properties.due_date && (
{ : "N/A"}
- Target date + Due date
{renderShortNumericDateFormat(issue.target_date ?? "")} @@ -423,14 +423,14 @@ const MyIssues: NextPage = () => {
{issue.target_date && (issue.target_date < new Date().toISOString() - ? `Target date has passed by ${findHowManyDaysLeft( + ? `Due date has passed by ${findHowManyDaysLeft( issue.target_date )} days` : findHowManyDaysLeft(issue.target_date) <= 3 - ? `Target date is in ${findHowManyDaysLeft( + ? `Due date is in ${findHowManyDaysLeft( issue.target_date )} days` - : "Target date")} + : "Due date")}
diff --git a/apps/app/types/issues.d.ts b/apps/app/types/issues.d.ts index 685623424..2ffb77f2d 100644 --- a/apps/app/types/issues.d.ts +++ b/apps/app/types/issues.d.ts @@ -130,7 +130,7 @@ export type Properties = { assignee: boolean; priority: boolean; start_date: boolean; - target_date: boolean; + due_date: boolean; cycle: boolean; children_count: boolean; };