Skip to content

Commit e2e85c7

Browse files
committed
fix(unified-notes): add date range for the created and modified date
1 parent 55ae4b3 commit e2e85c7

File tree

3 files changed

+84
-59
lines changed

3 files changed

+84
-59
lines changed

src/components/Navbar/index.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { IoChevronDown } from 'react-icons/io5';
2-
import { Button } from '@ifrc-go/ui';
31
import { _cs } from '@togglecorp/fujs';
42

53
import Heading from '#components/Heading';
@@ -23,10 +21,6 @@ function Navbar(props: Props) {
2321
<Heading level={5}>
2422
Unified Notes
2523
</Heading>
26-
<Button
27-
name={undefined}
28-
icons={<IoChevronDown />}
29-
/>
3024
</PageContainer>
3125

3226
</nav>

src/views/Home/index.tsx

Lines changed: 71 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ export function Component() {
5959
setPage,
6060
setFilterField,
6161
} = useFilterState<{
62-
createdAt?: string;
63-
lastChangeAt?: string;
62+
createdAtLte?: string;
63+
createdAtGte?: string;
64+
lastChangeAtLte?: string;
65+
lastChangeAtGte?: string;
6466
search?: string;
6567
title?: string;
6668
}>({
@@ -126,8 +128,10 @@ export function Component() {
126128
page_size: PAGE_SIZE,
127129
search: debouncedSearch,
128130
title: debouncedTitle,
129-
created_at__lte: filter.createdAt,
130-
last_change_at__lte: filter.lastChangeAt,
131+
created_at__lte: filter.createdAtLte,
132+
created_at__gte: filter.createdAtGte,
133+
last_change_at__lte: filter.lastChangeAtLte,
134+
last_change_at__gte: filter.lastChangeAtGte,
131135
created_by: debouncedCreatedBy,
132136
order_by: ordering,
133137
order_as_desc: orderingByDesc,
@@ -138,8 +142,10 @@ export function Component() {
138142
ordering,
139143
debouncedCreatedBy,
140144
page,
141-
filter.createdAt,
142-
filter.lastChangeAt,
145+
filter.createdAtLte,
146+
filter.createdAtGte,
147+
filter.lastChangeAtLte,
148+
filter.lastChangeAtGte,
143149
]);
144150

145151
const {
@@ -167,49 +173,66 @@ export function Component() {
167173
heading="All Notes"
168174
headingLevel={5}
169175
showHeader
176+
headingDescriptionContainerClassName={styles.headerDescription}
170177
headingDescription={(
171-
<div className={styles.filters}>
172-
<TextInput
173-
name="search"
174-
label="Search"
175-
onChange={setSearchText}
176-
value={searchText}
177-
icons={
178-
<IoSearchOutline />
179-
}
180-
/>
181-
<TextInput
182-
name="title"
183-
label="Title"
184-
onChange={setTitleText}
185-
value={titleText}
186-
icons={
187-
<IoSearchOutline />
188-
}
189-
/>
190-
<SelectInput
191-
name="createdBy"
192-
label="Author"
193-
placeholder="All Authors"
194-
value={createdByValue}
195-
onChange={setCreatedByValue}
196-
keySelector={usersListKeySelector}
197-
labelSelector={labelSelector}
198-
options={usersResponse}
199-
/>
200-
<DateInput
201-
name="createdAt"
202-
label="Created date"
203-
value={filter.createdAt}
204-
onChange={setFilterField}
205-
/>
206-
<DateInput
207-
name="lastChangeAt"
208-
label="Modified date"
209-
value={filter.lastChangeAt}
210-
onChange={setFilterField}
211-
/>
212-
</div>
178+
<>
179+
<div className={styles.filters}>
180+
<TextInput
181+
name="search"
182+
label="Search"
183+
onChange={setSearchText}
184+
value={searchText}
185+
icons={
186+
<IoSearchOutline />
187+
}
188+
/>
189+
<TextInput
190+
name="title"
191+
label="Title"
192+
onChange={setTitleText}
193+
value={titleText}
194+
icons={
195+
<IoSearchOutline />
196+
}
197+
/>
198+
<SelectInput
199+
name="createdBy"
200+
label="Author"
201+
placeholder="All Authors"
202+
value={createdByValue}
203+
onChange={setCreatedByValue}
204+
keySelector={usersListKeySelector}
205+
labelSelector={labelSelector}
206+
options={usersResponse}
207+
/>
208+
</div>
209+
<div className={styles.filters}>
210+
<DateInput
211+
name="createdAtGte"
212+
label="Created start date"
213+
value={filter.createdAtGte}
214+
onChange={setFilterField}
215+
/>
216+
<DateInput
217+
name="createdAtLte"
218+
label="Created end date"
219+
value={filter.createdAtLte}
220+
onChange={setFilterField}
221+
/>
222+
<DateInput
223+
name="lastChangeAtGte"
224+
label="Modified start date"
225+
value={filter.lastChangeAtLte}
226+
onChange={setFilterField}
227+
/>
228+
<DateInput
229+
name="lastChangeAtLte"
230+
label="Modified end date"
231+
value={filter.lastChangeAtGte}
232+
onChange={setFilterField}
233+
/>
234+
</div>
235+
</>
213236
)}
214237
footerActions={(
215238
<Pager

src/views/Home/styles.module.css

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
.filters{
2-
display:flex;
3-
justify-content: space-between;
1+
.header-description {
2+
display: flex;
3+
flex-direction: column;
4+
gap: var(--un-spacing-lg);
5+
6+
.filters{
7+
display:flex;
8+
gap: var(--un-spacing-lg);
9+
}
410
}
11+
512
.table {
613
background-color: var(--un-color-background);
714
width: 100%;
@@ -12,8 +19,9 @@
1219
font-weight: var(--un-font-weight-bold);
1320
}
1421
}
15-
}
16-
}
22+
}
23+
}
24+
1725
.url-action{
1826
width: 0;
1927
text-decoration: none;

0 commit comments

Comments
 (0)