From 55b02274942a9219b79c45ab1e8393ceaa88ea32 Mon Sep 17 00:00:00 2001
From: Kendall Garner <17521368+kgarner7@users.noreply.github.com>
Date: Fri, 23 Dec 2022 03:44:07 +0000
Subject: [PATCH] Add Date Added column in Album and Song lists (#2055)
---
ui/src/album/AlbumList.js | 21 +++++++++++++--------
ui/src/album/AlbumTableView.js | 3 +++
ui/src/i18n/en.json | 8 +++++---
ui/src/song/SongList.js | 2 ++
4 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/ui/src/album/AlbumList.js b/ui/src/album/AlbumList.js
index fe3175190..09446fb6a 100644
--- a/ui/src/album/AlbumList.js
+++ b/ui/src/album/AlbumList.js
@@ -94,14 +94,19 @@ const AlbumList = (props) => {
// Workaround to force album columns to appear the first time.
// See https://github.com/navidrome/navidrome/pull/923#issuecomment-833004842
// TODO: Find a better solution
- useSetToggleableFields('album', [
- 'artist',
- 'songCount',
- 'playCount',
- 'year',
- 'duration',
- 'rating',
- ])
+ useSetToggleableFields(
+ 'album',
+ [
+ 'artist',
+ 'songCount',
+ 'playCount',
+ 'year',
+ 'duration',
+ 'rating',
+ 'createdAt',
+ ],
+ ['createdAt']
+ )
// If it does not have filter/sort params (usually coming from Menu),
// reload with correct filter/sort params
diff --git a/ui/src/album/AlbumTableView.js b/ui/src/album/AlbumTableView.js
index 92b89841c..6d7fa43a0 100644
--- a/ui/src/album/AlbumTableView.js
+++ b/ui/src/album/AlbumTableView.js
@@ -3,6 +3,7 @@ import {
Datagrid,
DatagridBody,
DatagridRow,
+ DateField,
NumberField,
TextField,
} from 'react-admin'
@@ -102,12 +103,14 @@ const AlbumTableView = ({
className={classes.ratingField}
/>
),
+ createdAt: isDesktop && ,
}
}, [classes.ratingField, isDesktop])
const columns = useSelectedFields({
resource: 'album',
columns: toggleableFields,
+ defaultOff: ['createdAt'],
})
return isXsmall ? (
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 955152900..0eb574188 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -25,7 +25,8 @@
"rating": "Rating",
"quality": "Quality",
"bpm": "BPM",
- "playDate": "Last Played"
+ "playDate": "Last Played",
+ "createdAt": "Date added"
},
"actions": {
"addToQueue": "Play Later",
@@ -51,7 +52,8 @@
"year": "Year",
"updatedAt": "Updated at",
"comment": "Comment",
- "rating": "Rating"
+ "rating": "Rating",
+ "createdAt": "Date added"
},
"actions": {
"playAll": "Play",
@@ -400,4 +402,4 @@
"toggle_love": "Add this track to favourites"
}
}
-}
+}
\ No newline at end of file
diff --git a/ui/src/song/SongList.js b/ui/src/song/SongList.js
index 8fbe7ded6..2275da4dc 100644
--- a/ui/src/song/SongList.js
+++ b/ui/src/song/SongList.js
@@ -139,6 +139,7 @@ const SongList = (props) => {
bpm: isDesktop && ,
genre: ,
comment: ,
+ createdAt: ,
}
}, [isDesktop, classes.ratingField])
@@ -152,6 +153,7 @@ const SongList = (props) => {
'albumArtist',
'genre',
'comment',
+ 'createdAt',
],
})