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

@ -3,6 +3,7 @@ import { DateTime } from 'luxon';
import {
beautifyExactDate,
beautifyExactDateTime,
beautifyPastDateAbsolute,
beautifyPastDateRelativeToNow,
DEFAULT_DATE_LOCALE,
@ -12,14 +13,46 @@ import { logError } from '../logError';
jest.mock('~/utils/logError');
describe('beautifyExactDate', () => {
it('should return the correct relative date', () => {
describe('beautifyExactDateTime', () => {
it('should return the date in the correct format with time', () => {
const mockDate = '2023-01-01T12:13:24';
const actualDate = new Date(mockDate);
const expected = DateTime.fromJSDate(actualDate)
.setLocale(DEFAULT_DATE_LOCALE)
.toFormat('DD · T');
const result = beautifyExactDateTime(mockDate);
expect(result).toEqual(expected);
});
it('should return the time in the correct format for a datetime that is today', () => {
const todayString = DateTime.local().toISODate();
const mockDate = `${todayString}T12:13:24`;
const actualDate = new Date(mockDate);
const expected = DateTime.fromJSDate(actualDate)
.setLocale(DEFAULT_DATE_LOCALE)
.toFormat('T');
const result = beautifyExactDateTime(mockDate);
expect(result).toEqual(expected);
});
});
describe('beautifyExactDate', () => {
it('should return the past date in the correct format without time', () => {
const mockDate = '2023-01-01T12:13:24';
const actualDate = new Date(mockDate);
const expected = DateTime.fromJSDate(actualDate)
.setLocale(DEFAULT_DATE_LOCALE)
.toFormat('DD');
const result = beautifyExactDate(mockDate);
expect(result).toEqual(expected);
});
it('should return "Today" if the date is today', () => {
const todayString = DateTime.local().toISODate();
const mockDate = `${todayString}T12:13:24`;
const expected = 'Today';
const result = beautifyExactDate(mockDate);
expect(result).toEqual(expected);
});