Repository navigation
Sample Redux Store
Irene Martinez edited this page Mar 19, 2024
·
3 revisions
{
entities: {
nowPlaying: { // State for player to function
isPlaying: false,
trackIndex: 0,
queue: [ // Ordered song objects
{
id: 9,
name: "Alicia Keys",
numListeners: 36907065,
photoUrl: "https://versify-dev.s3.amazonaws.com/images/artists/avatar-alicia-keys.jpeg",
source: "artist",
},
...
],
queueSources: [
// Stores the path from which the song was queued, implementing parallel indexing to queue array
"/playlist/4", ...
],
},
playlists:[ // Ordered playlist objects rendered on the sidebar
{
"id": 59,
"title": "Untitled Playlist #14"
},
...
],
artists: [ // Ordered artist objects rendered on the homepage
{
id: 9,
name: "Alicia Keys",
numListeners: 35586647,
photoUrl: "https://versify-dev....jpeg",
},
{
id: 11,
name: "Burna Boy",
numListeners: 36907065,
photoUrl: "https://versify-dev....jpeg",
},
...
],
albums: [ // Ordered album objects if currently rendering an Artist view
{
albumPhotoUrl: "https://versify-dev....jpeg",
id: 6,
title: "KEYS",
year: 2021
}
],
songs: { // Ordered song objects if currently rendering a view with a song index, eg. Album or Playlist view
allSongs: [ // ALL ordered song objects by this artist – Artist View requires separation of allSongs & collabSongs
{
id: 9,
title: "Like Water (Originals)",
songArtist: {id: 9, name: 'Alicia Keys'},
albumId: 6,
...
}
],
collabSongs: [], // Ordered collab objects with this artist
},
currentItem: { // This is the item currently being viewed, eg. Artist view or Album view. In this case, it is an Artist view
id: 9,
name: "Alicia Keys",
numListeners: 36907065,
photoUrl: "https://versify-dev....jpeg",
source: "artist",
},
users: { // Info of user who is currently logged in
1: { id: 1, username: 'userdemo' }
}
},
ux: { // Playlist modals/dropdowns are controlled by UX slice of state
playlistNavDropdown: { isOpen: false },
playlistEditModal: { isOpen: false },
},
session: { // ID of current user
id: user.id
},
errors: { // Errors, if any, that would need to be rendered on the current page for the user
session: ['Could not log in'],
playlist: ['Could not create playlist'],
}
}