]> littlesong.place Git - littlesongplace.git/commitdiff
Add playlist type to UI, add song instructions
authorChris Fulljames <christianfulljames@gmail.com>
Sun, 16 Feb 2025 13:40:20 +0000 (08:40 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Sun, 16 Feb 2025 13:40:20 +0000 (08:40 -0500)
main.py
static/styles.css
templates/playlist.html
templates/profile.html

diff --git a/main.py b/main.py
index 86987b2cfdc175b0955524d1754f8047ff550f59..93e5c52be290e57c67b34e8d4866075383f981ce 100644 (file)
--- a/main.py
+++ b/main.py
@@ -157,9 +157,9 @@ def users_profile(profile_username):
     userid = session.get("userid", None)
     show_private = userid == profile_userid
     if show_private:
-        plist_data = query_db("select * from playlists where userid = ?", [profile_userid])
+        plist_data = query_db("select * from playlists where userid = ? order by created desc", [profile_userid])
     else:
-        plist_data = query_db("select * from playlists where userid = ? and private = 0", [profile_userid])
+        plist_data = query_db("select * from playlists where userid = ? and private = 0 order by created desc", [profile_userid])
 
     # Get songs for current profile
     songs = Song.get_all_for_userid(profile_userid)
index 54aeb80917a427a3f704df2ce97557c75dabc08b..bf0eef16701581aecbca5db0bf25757064f8510e 100644 (file)
@@ -228,6 +228,10 @@ input[type=file] {
     margin: 10px 0px;
 }
 
+.playlist-type {
+    opacity: 50%;
+}
+
 .draggable-song {
     box-shadow: 0px 0px 5px 0px;
     border-radius: 10px;
index 15e2d6e7a5e8c91042745dc5cf04b98387a12f37..2a8088d738bc433a2235db89eb165236f2d545c9 100644 (file)
@@ -6,7 +6,14 @@
 
 <h1>{{ name }}</h1>
 
-<p>Playlist by <a href="/users/{{ username }}" class="profile-link">{{ username }}</a></p>
+<p>
+Playlist by <a href="/users/{{ username }}" class="profile-link">{{ username }}</a>
+{% if session["userid"] == userid -%}
+<span class="playlist-type">
+[{% if private %}Private{% else %}Public{% endif %}]
+</span>
+{%- endif %}
+</p>
 
 {% if session["userid"] == userid -%}
 <p class="playlist-actions">
@@ -141,4 +148,8 @@ function deletePlaylist() {
 </div>
 {%- endif %}
 
+{% if not songs -%}
+<p>This playlist doesn't have any songs yet.  To add songs to the playlist, expand song details and use the "Add to Playlist..." dropdown.</p>
+{%- endif %}
+
 {%- endblock %}
index f9ae7f50f89414d192293c4104b087eb3bd409e5..0186d8b25417c398539d8c323b644fba67aeea35 100644 (file)
     {% for plist in playlists -%}
     <div class="playlist-list-entry">
         <a class="playlist-name" href="/playlists/{{ plist['playlistid'] }}">{{ plist['name'] }}</a>
+        <!-- Only show playlist type to owner, everyone else only sees public playlists -->
+        {% if session["userid"] == userid -%}
+        <span class="playlist-type">
+        [{% if plist['private'] %}Private{% else %}Public{% endif %}]
+        </span>
+        {%- endif %}
     </div>
     {%- endfor %}
 </div>