feat: Enhance sidebar functionality and favorite albums feature

- Updated GitHub workflows to include additional metadata in labels for Docker images.
- Modified Dockerfile to copy README.md into the app directory for documentation purposes.
- Added favorite albums functionality in the album page, allowing users to mark albums as favorites.
- Improved AudioPlayer component to save playback position more frequently.
- Refactored sidebar component to include a favorites section and improved navigation.
- Introduced useFavoriteAlbums hook to manage favorite albums state and local storage.
- Updated settings page to allow users to toggle sidebar visibility.
This commit is contained in:
2025-07-09 21:39:16 +00:00
committed by GitHub
parent 53bbbe1801
commit 4cc59b4c1f
9 changed files with 488 additions and 240 deletions

View File

@@ -116,7 +116,7 @@ export const AudioPlayer: React.FC = () => {
useEffect(() => {
const audioCurrent = audioRef.current;
return () => {
if (audioCurrent && currentTrack && audioCurrent.currentTime > 10) {
if (audioCurrent && currentTrack && audioCurrent.currentTime > 5) {
localStorage.setItem('navidrome-current-track-time', audioCurrent.currentTime.toString());
}
};
@@ -134,12 +134,12 @@ export const AudioPlayer: React.FC = () => {
// Notify scrobbler about new track
onTrackStart(currentTrack);
// Check for saved timestamp (only restore if more than 10 seconds in)
// Check for saved timestamp (only restore if more than 5 seconds in)
const savedTime = localStorage.getItem('navidrome-current-track-time');
if (savedTime) {
const time = parseFloat(savedTime);
// Only restore if we were at least 10 seconds in and not near the end
if (time > 10 && time < (currentTrack.duration - 30)) {
// Only restore if we were at least 5 seconds in and not near the end
if (time > 5 && time < (currentTrack.duration - 15)) {
const restorePosition = () => {
if (audioCurrent.readyState >= 2) { // HAVE_CURRENT_DATA
audioCurrent.currentTime = time;
@@ -181,9 +181,9 @@ export const AudioPlayer: React.FC = () => {
if (audioCurrent && currentTrack) {
setProgress((audioCurrent.currentTime / audioCurrent.duration) * 100);
// Save current time every 30 seconds, but only if we've moved forward significantly
// Save current time every 10 seconds, but only if we've moved forward significantly
const currentTime = audioCurrent.currentTime;
if (Math.abs(currentTime - lastSavedTime) >= 30 && currentTime > 10) {
if (Math.abs(currentTime - lastSavedTime) >= 10 && currentTime > 5) {
localStorage.setItem('navidrome-current-track-time', currentTime.toString());
lastSavedTime = currentTime;
}