forked from github/plane
feat: created on and updated on column added in spreadsheet view (#1454)
* feat: created on and updated on column added in spreadsheet view * fix: build fix * refactor: simplify logic --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
This commit is contained in:
parent
353c85120f
commit
7868bfa2b1
@ -270,9 +270,16 @@ export const IssuesFilterView: React.FC = () => {
|
|||||||
if (key === "estimate" && !isEstimateActive) return null;
|
if (key === "estimate" && !isEstimateActive) return null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(issueView === "spreadsheet" && key === "attachment_count") ||
|
issueView === "spreadsheet" &&
|
||||||
(issueView === "spreadsheet" && key === "link") ||
|
(key === "attachment_count" ||
|
||||||
(issueView === "spreadsheet" && key === "sub_issue_count")
|
key === "link" ||
|
||||||
|
key === "sub_issue_count")
|
||||||
|
)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (
|
||||||
|
issueView !== "spreadsheet" &&
|
||||||
|
(key === "created_on" || key === "updated_on")
|
||||||
)
|
)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ import {
|
|||||||
import { ICurrentUserResponse, IIssue, ISubIssueResponse, Properties, UserAuth } from "types";
|
import { ICurrentUserResponse, IIssue, ISubIssueResponse, Properties, UserAuth } from "types";
|
||||||
// helper
|
// helper
|
||||||
import { copyTextToClipboard } from "helpers/string.helper";
|
import { copyTextToClipboard } from "helpers/string.helper";
|
||||||
|
import { renderLongDetailDateFormat } from "helpers/date-time.helper";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
issue: IIssue;
|
issue: IIssue;
|
||||||
@ -345,6 +346,16 @@ export const SingleSpreadsheetIssue: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{properties.created_on && (
|
||||||
|
<div className="flex items-center text-xs cursor-default text-brand-secondary text-center p-2 group-hover:bg-brand-surface-2 border-brand-base">
|
||||||
|
{renderLongDetailDateFormat(issue.created_at)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{properties.updated_on && (
|
||||||
|
<div className="flex items-center text-xs cursor-default text-brand-secondary text-center p-2 group-hover:bg-brand-surface-2 border-brand-base">
|
||||||
|
{renderLongDetailDateFormat(issue.updated_at)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -123,7 +123,9 @@ export const SpreadsheetColumns: React.FC<Props> = ({ columnData, gridTemplateCo
|
|||||||
<Icon iconName="east" className="text-sm" />
|
<Icon iconName="east" className="text-sm" />
|
||||||
<span>Z</span>
|
<span>Z</span>
|
||||||
</>
|
</>
|
||||||
) : col.propertyName === "due_date" ? (
|
) : col.propertyName === "due_date" ||
|
||||||
|
col.propertyName === "created_on" ||
|
||||||
|
col.propertyName === "updated_on" ? (
|
||||||
<>
|
<>
|
||||||
<span className="relative flex items-center h-6 w-6">
|
<span className="relative flex items-center h-6 w-6">
|
||||||
<Icon
|
<Icon
|
||||||
|
@ -59,4 +59,20 @@ export const SPREADSHEET_COLUMN = [
|
|||||||
ascendingOrder: "estimate_point",
|
ascendingOrder: "estimate_point",
|
||||||
descendingOrder: "-estimate_point",
|
descendingOrder: "-estimate_point",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
propertyName: "created_on",
|
||||||
|
colName: "Created On",
|
||||||
|
colSize: "144px",
|
||||||
|
icon: CalendarDaysIcon,
|
||||||
|
ascendingOrder: "-created_at",
|
||||||
|
descendingOrder: "created_at",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
propertyName: "updated_on",
|
||||||
|
colName: "Updated On",
|
||||||
|
colSize: "144px",
|
||||||
|
icon: CalendarDaysIcon,
|
||||||
|
ascendingOrder: "-updated_at",
|
||||||
|
descendingOrder: "updated_at",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
@ -18,6 +18,13 @@ export const renderShortNumericDateFormat = (date: string | Date) =>
|
|||||||
month: "short",
|
month: "short",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const renderLongDetailDateFormat = (date: string | Date) =>
|
||||||
|
new Date(date).toLocaleDateString("en-UK", {
|
||||||
|
day: "numeric",
|
||||||
|
month: "long",
|
||||||
|
year: "numeric",
|
||||||
|
});
|
||||||
|
|
||||||
export const findHowManyDaysLeft = (date: string | Date) => {
|
export const findHowManyDaysLeft = (date: string | Date) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const eventDate = new Date(date);
|
const eventDate = new Date(date);
|
||||||
|
@ -18,6 +18,8 @@ const initialValues: Properties = {
|
|||||||
attachment_count: false,
|
attachment_count: false,
|
||||||
link: false,
|
link: false,
|
||||||
estimate: false,
|
estimate: false,
|
||||||
|
created_on: false,
|
||||||
|
updated_on: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => {
|
const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => {
|
||||||
@ -96,6 +98,8 @@ const useIssuesProperties = (workspaceSlug?: string, projectId?: string) => {
|
|||||||
attachment_count: properties.attachment_count,
|
attachment_count: properties.attachment_count,
|
||||||
link: properties.link,
|
link: properties.link,
|
||||||
estimate: properties.estimate,
|
estimate: properties.estimate,
|
||||||
|
created_on: properties.created_on,
|
||||||
|
updated_on: properties.updated_on,
|
||||||
};
|
};
|
||||||
|
|
||||||
return [newProperties, updateIssueProperties] as const;
|
return [newProperties, updateIssueProperties] as const;
|
||||||
|
@ -19,6 +19,8 @@ const initialValues: Properties = {
|
|||||||
attachment_count: false,
|
attachment_count: false,
|
||||||
link: false,
|
link: false,
|
||||||
estimate: false,
|
estimate: false,
|
||||||
|
created_on: false,
|
||||||
|
updated_on: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const useMyIssuesProperties = (workspaceSlug?: string) => {
|
const useMyIssuesProperties = (workspaceSlug?: string) => {
|
||||||
@ -92,6 +94,8 @@ const useMyIssuesProperties = (workspaceSlug?: string) => {
|
|||||||
attachment_count: properties.attachment_count,
|
attachment_count: properties.attachment_count,
|
||||||
link: properties.link,
|
link: properties.link,
|
||||||
estimate: properties.estimate,
|
estimate: properties.estimate,
|
||||||
|
created_on: properties.created_on,
|
||||||
|
updated_on: properties.updated_on,
|
||||||
};
|
};
|
||||||
|
|
||||||
return [newProperties, updateIssueProperties] as const;
|
return [newProperties, updateIssueProperties] as const;
|
||||||
|
2
apps/app/types/issues.d.ts
vendored
2
apps/app/types/issues.d.ts
vendored
@ -188,6 +188,8 @@ export type Properties = {
|
|||||||
link: boolean;
|
link: boolean;
|
||||||
attachment_count: boolean;
|
attachment_count: boolean;
|
||||||
estimate: boolean;
|
estimate: boolean;
|
||||||
|
created_on: boolean;
|
||||||
|
updated_on: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IIssueLabels {
|
export interface IIssueLabels {
|
||||||
|
2
apps/app/types/workspace.d.ts
vendored
2
apps/app/types/workspace.d.ts
vendored
@ -45,6 +45,8 @@ export type Properties = {
|
|||||||
link: boolean;
|
link: boolean;
|
||||||
attachment_count: boolean;
|
attachment_count: boolean;
|
||||||
estimate: boolean;
|
estimate: boolean;
|
||||||
|
created_on: boolean;
|
||||||
|
updated_on: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IWorkspaceMember {
|
export interface IWorkspaceMember {
|
||||||
|
Loading…
Reference in New Issue
Block a user