-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #349 from IFRCGo/project/2023-dec-release
2023 December Release
- Loading branch information
Showing
80 changed files
with
2,329 additions
and
919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/components/Table/ColumnShortcuts/TimelineHeader/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import DateOutput from '#components/DateOutput'; | ||
import { _cs } from '@togglecorp/fujs'; | ||
|
||
import HeaderCell, { HeaderCellProps } from '../../HeaderCell'; | ||
|
||
import styles from './styles.module.css'; | ||
|
||
export interface Props extends HeaderCellProps { | ||
className?: string; | ||
dateRange: { | ||
start: Date, | ||
end: Date, | ||
} | undefined; | ||
} | ||
|
||
function TimelineHeader(props: Props) { | ||
const { | ||
className, | ||
dateRange, | ||
...otherProps | ||
} = props; | ||
|
||
return ( | ||
<HeaderCell | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...otherProps} | ||
className={_cs(styles.timelineHeader, className)} | ||
titleClassName={styles.title} | ||
title={( | ||
<> | ||
<DateOutput | ||
value={dateRange?.start} | ||
/> | ||
<DateOutput | ||
value={dateRange?.end} | ||
/> | ||
</> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
export default TimelineHeader; |
7 changes: 7 additions & 0 deletions
7
src/components/Table/ColumnShortcuts/TimelineHeader/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.timeline-header { | ||
.title { | ||
display: flex; | ||
flex-grow: 1; | ||
justify-content: space-between; | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
src/components/Table/ColumnShortcuts/TimelineItem/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { _cs, isNotDefined } from '@togglecorp/fujs'; | ||
|
||
import Tooltip from '#components/Tooltip'; | ||
import TextOutput from '#components/TextOutput'; | ||
|
||
import { type DateLike, isValidDate } from '#utils/common'; | ||
|
||
import styles from './styles.module.css'; | ||
|
||
export interface Props { | ||
className?: string; | ||
startDate: DateLike | null | undefined; | ||
endDate: DateLike | null | undefined; | ||
dateRange: { | ||
start: Date, | ||
end: Date, | ||
} | undefined; | ||
} | ||
|
||
function TimelineItem(props: Props) { | ||
const { | ||
className, | ||
startDate, | ||
endDate, | ||
dateRange, | ||
} = props; | ||
|
||
if (isNotDefined(dateRange)) { | ||
return null; | ||
} | ||
|
||
if (!isValidDate(startDate)) { | ||
return null; | ||
} | ||
|
||
if (!isValidDate(endDate)) { | ||
return null; | ||
} | ||
|
||
const domainWidth = dateRange.end.getTime() - dateRange.start.getTime(); | ||
|
||
const start = 1 - (dateRange.end.getTime() - new Date(startDate).getTime()) / domainWidth; | ||
const end = (dateRange.end.getTime() - new Date(endDate).getTime()) / domainWidth; | ||
|
||
const today = 1 - (dateRange.end.getTime() - new Date().getTime()) / domainWidth; | ||
|
||
return ( | ||
<> | ||
<div className={_cs(styles.timelineItem, className)}> | ||
<div className={styles.startDateMarker} /> | ||
<div className={styles.endDateMarker} /> | ||
<div | ||
className={styles.todayMarker} | ||
style={{ | ||
left: `${100 * today}%`, | ||
}} | ||
/> | ||
<div | ||
className={styles.timelineProgress} | ||
style={{ | ||
left: `${100 * start}%`, | ||
right: `${100 * end}%`, | ||
}} | ||
/> | ||
</div> | ||
<Tooltip | ||
description={( | ||
<> | ||
<TextOutput | ||
valueType="date" | ||
// FIXME: use translation | ||
label="Start Date" | ||
value={startDate} | ||
/> | ||
<TextOutput | ||
// FIXME: use translation | ||
label="End Date" | ||
value={endDate} | ||
valueType="date" | ||
/> | ||
</> | ||
)} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
export default TimelineItem; |
36 changes: 36 additions & 0 deletions
36
src/components/Table/ColumnShortcuts/TimelineItem/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.timeline-item { | ||
position: absolute; | ||
top: 0; | ||
left: var(--go-ui-spacing-sm); | ||
width: calc(100% - 2 * var(--go-ui-spacing-sm)); | ||
height: 100%; | ||
|
||
.timeline-progress { | ||
position: absolute; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
border-radius: 0.25em; | ||
background-color: var(--go-ui-color-primary-red); | ||
height: 0.5rem; | ||
} | ||
|
||
.today-marker { | ||
position: absolute; | ||
border-left: var(--go-ui-width-separator-sm) dashed var(--go-ui-color-primary-blue); | ||
height: 100%; | ||
} | ||
|
||
.start-date-marker { | ||
position: absolute; | ||
left: 0; | ||
border-left: var(--go-ui-width-separator-sm) dashed var(--go-ui-color-separator); | ||
height: 100%; | ||
} | ||
|
||
.end-date-marker { | ||
position: absolute; | ||
right: 0; | ||
border-left: var(--go-ui-width-separator-sm) dashed var(--go-ui-color-separator); | ||
height: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,7 @@ | |
.expansion-indicator-cell-container { | ||
position: relative; | ||
} | ||
|
||
.timeline-cell-container { | ||
position: relative; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.