1 import { fromUnixTime, isToday } from 'date-fns';
2 import { c } from 'ttag';
4 import type { DriveFileRevision } from '../../store';
5 import RevisionListItem from './RevisionListItem';
6 import type { CategorizedRevisions } from './getCategorizedRevisions';
9 currentRevision: DriveFileRevision;
10 categorizedRevisions: CategorizedRevisions;
13 const RevisionList = ({ currentRevision, categorizedRevisions }: Props) => {
14 const currentRevisionFormat = isToday(fromUnixTime(currentRevision.createTime)) ? 'time' : 'date';
16 <ul className="unstyled">
17 <li data-testid="current-revision">
18 <span className="text-lg text-semibold revisions-modal-list-title--current">{c('Info')
19 .t`Current version`}</span>
21 <ul className="unstyled my-4 ml-4">
22 <RevisionListItem formatType={currentRevisionFormat} revision={currentRevision} isCurrent />
25 {!!categorizedRevisions.size ? (
28 <hr className="mb-5 revisions-modal-list-separator" />
30 {[...categorizedRevisions.entries()].map(([key, revisionCategory]) => {
32 <li data-testid="previous-revisions" key={key}>
33 <span className="text-lg text-semibold color-weak">{revisionCategory.title}</span>
34 <ul className="unstyled my-3 ml-4">
35 {revisionCategory.list.map((revision) => (
38 formatType={key === 'today' || key === 'yesterday' ? 'time' : 'date'}
52 export default RevisionList;