Feat/filter activity inbox (#1032)

* Move files

* Add filtering for tasks inbox

* Add filter dropdown for single entity

* Minor

* Fill empty button

* Refine logic for filter dropdown

* remove log

* Fix unwanted change

* Set current user as default filter

* Add avatar on filter

* Improve initialization of assignee filter

* Add story for Tasks page

* Add more stories

* Add sotry with no tasks

* Improve dates

* Enh tests

---------

Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
Emilien Chauvet
2023-08-02 21:36:16 +02:00
committed by GitHub
parent 2128d44212
commit 4252a0a2c3
28 changed files with 601 additions and 189 deletions

View File

@ -29,17 +29,32 @@ export function parseDate(dateToParse: Date | string | number) {
return formattedDate.setLocale(DEFAULT_DATE_LOCALE);
}
export function beautifyExactDate(dateToBeautify: Date | string | number) {
try {
const parsedDate = parseDate(dateToBeautify);
function isSameDay(a: DateTime, b: DateTime): boolean {
return a.hasSame(b, 'day') && a.hasSame(b, 'month') && a.hasSame(b, 'year');
}
return parsedDate.toFormat('DD · T');
function formatDate(dateToFormat: Date | string | number, format: string) {
try {
const parsedDate = parseDate(dateToFormat);
return parsedDate.toFormat(format);
} catch (error) {
logError(error);
return '';
}
}
export function beautifyExactDateTime(dateToBeautify: Date | string | number) {
const isToday = isSameDay(parseDate(dateToBeautify), DateTime.local());
const dateFormat = isToday ? 'T' : 'DD · T';
return formatDate(dateToBeautify, dateFormat);
}
export function beautifyExactDate(dateToBeautify: Date | string | number) {
const isToday = isSameDay(parseDate(dateToBeautify), DateTime.local());
const dateFormat = isToday ? "'Today'" : 'DD';
return formatDate(dateToBeautify, dateFormat);
}
export function beautifyPastDateRelativeToNow(
pastDate: Date | string | number,
) {