[WEB-2442] feat: Revamp Timeline Layout (#5915)

* chore: added issue relations in issue listing

* chore: added pagination for issue detail endpoint

* chore: bulk date update endpoint

* chore: appended the target date

* chore: issue relation new types defined

* fix: order by and issue filters

* fix: passed order by in pagination

* chore: changed the key for issue dates

* Revamp Timeline Layout

* fix block dragging

* minor ui fixes

* improve auto scroll UX

* remove unused import

* fix timeline layout heights

* modify base timeline store

* Segregate issue relation types

---------

Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
This commit is contained in:
rahulramesha 2024-10-28 18:03:31 +05:30 committed by GitHub
parent f986bd83fd
commit a88a39fb1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
112 changed files with 2918 additions and 2641 deletions

View file

@ -13,13 +13,13 @@ import isNumber from "lodash/isNumber";
export const renderFormattedDate = (
date: string | Date | undefined | null,
formatToken: string = "MMM dd, yyyy"
): string | null => {
): string | undefined => {
// Parse the date to check if it is valid
const parsedDate = getDate(date);
// return if undefined
if (!parsedDate) return null;
if (!parsedDate) return;
// Check if the parsed date is valid before formatting
if (!isValid(parsedDate)) return null; // Return null for invalid dates
if (!isValid(parsedDate)) return; // Return null for invalid dates
let formattedDate;
try {
// Format the date in the format provided or default format (MMM dd, yyyy)
@ -55,13 +55,13 @@ export const renderFormattedDateWithoutYear = (date: string | Date): string => {
* @param {Date | string} date
* @example renderFormattedPayloadDate("Jan 01, 20224") // "2024-01-01"
*/
export const renderFormattedPayloadDate = (date: Date | string | undefined | null): string | null => {
export const renderFormattedPayloadDate = (date: Date | string | undefined | null): string | undefined => {
// Parse the date to check if it is valid
const parsedDate = getDate(date);
// return if undefined
if (!parsedDate) return null;
if (!parsedDate) return;
// Check if the parsed date is valid before formatting
if (!isValid(parsedDate)) return null; // Return null for invalid dates
if (!isValid(parsedDate)) return; // Return null for invalid dates
// Format the date in payload format (yyyy-mm-dd)
const formattedDate = format(parsedDate, "yyyy-MM-dd");
return formattedDate;
@ -120,6 +120,25 @@ export const findTotalDaysInRange = (
return inclusive ? diffInDays + 1 : diffInDays;
};
/**
* Add number of days to the provided date and return a resulting new date
* @param startDate
* @param numberOfDays
* @returns
*/
export const addDaysToDate = (startDate: Date | string | undefined | null, numberOfDays: number) => {
// Parse the dates to check if they are valid
const parsedStartDate = getDate(startDate);
// return if undefined
if (!parsedStartDate) return;
const newDate = new Date(parsedStartDate);
newDate.setDate(newDate.getDate() + numberOfDays);
return newDate;
};
/**
* @returns {number} number of days left from today
* @description Returns number of days left from today

View file

@ -174,9 +174,10 @@ export const shouldHighlightIssueDueDate = (
export const getIssueBlocksStructure = (block: TIssue): IGanttBlock => ({
data: block,
id: block?.id,
name: block?.name,
sort_order: block?.sort_order,
start_date: getDate(block?.start_date),
target_date: getDate(block?.target_date),
start_date: block?.start_date ?? undefined,
target_date: block?.target_date ?? undefined,
});
export function getChangedIssuefields(formData: Partial<TIssue>, dirtyFields: { [key: string]: boolean | undefined }) {