Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const SORT_PROPERTIES = [
'sizeBytes',
'dateAdded',
'dateFinished',
'dateActive',
] as const;

interface SortDropdownProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const ICONS: Partial<Record<TorrentListColumn, JSX.Element>> = {
downRate: <DownloadThick />,
directory: <FolderClosedSolid />,
hash: <Hash />,
dateActive: <Clock />,
dateAdded: <Calendar />,
dateCreated: <CalendarCreated />,
dateFinished: <CalendarFinished />,
Expand All @@ -60,6 +61,10 @@ const BooleanCell: FC<{value: boolean}> = observer(({value}: {value: boolean}) =
const DateCell: FC<{date: number}> = observer(({date}: {date: number}) => {
const {i18n} = useLingui();

if (date === 0) {
return null;
}

return <span>{i18n.date(new Date(date * 1000))}</span>;
});

Expand Down Expand Up @@ -114,6 +119,8 @@ export interface TorrentListCellContentProps {
const DefaultTorrentListCellContent: FC<TorrentListCellContentProps> = observer(
({torrent, column}: TorrentListCellContentProps) => {
switch (column) {
case 'dateActive':
return <DateCell date={torrent[column]} />;
case 'dateAdded':
return <DateCell date={torrent[column]} />;
case 'dateCreated':
Expand Down
1 change: 1 addition & 0 deletions client/src/javascript/constants/SortDirections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const SortDirections: Record<string, 'asc' | 'desc'> = {
dateAdded: 'desc',
dateFinished: 'desc',
dateActive: 'desc',
downRate: 'desc',
downTotal: 'desc',
upRate: 'desc',
Expand Down
1 change: 1 addition & 0 deletions client/src/javascript/constants/TorrentListColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const TorrentListColumns = {
isPrivate: 'torrents.properties.is.private',
message: 'torrents.properties.tracker.message',
trackerURIs: 'torrents.properties.trackers',
dateActive: 'torrents.properties.date.active',
} as const;

export default TorrentListColumns;
Expand Down
1 change: 1 addition & 0 deletions client/src/javascript/i18n/strings/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@
"torrents.move.data.label": "Move data",
"torrents.move.heading": "Set Torrent Location",
"torrents.properties.comment": "Comment",
"torrents.properties.date.active": "Last Activity",
"torrents.properties.date.added": "Added",
"torrents.properties.date.created": "Created",
"torrents.properties.date.finished": "Finished",
Expand Down
2 changes: 2 additions & 0 deletions shared/constants/defaultFloodSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const defaultFloodSettings: Readonly<FloodSettings> = {
{id: 'sizeBytes', visible: true},
{id: 'peers', visible: true},
{id: 'seeds', visible: true},
{id: 'dateActive', visible: false},
{id: 'dateAdded', visible: true},
{id: 'dateCreated', visible: false},
{id: 'dateFinished', visible: false},
Expand All @@ -40,6 +41,7 @@ const defaultFloodSettings: Readonly<FloodSettings> = {
sizeBytes: 100,
peers: 100,
seeds: 100,
dateActive: 100,
dateAdded: 100,
dateCreated: 100,
dateFinished: 100,
Expand Down