From 13940ca834b28e1f971e07848df337e595c47902 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Sat, 7 Mar 2026 00:05:32 -0500 Subject: [PATCH] mobile dash layout provided; other styling inconsistencies corrected across views, scss & _applets.html template partial --- src/apps/dashboard/views.py | 27 +++++++++++++++++-- src/functional_tests/my_lists_page.py | 7 ++++- src/functional_tests/test_my_lists.py | 4 +-- src/static_src/scss/_dashboard.scss | 6 +++++ src/static_src/scss/_palette-picker.scss | 6 ++--- .../apps/dashboard/_partials/_applets.html | 18 +++++++------ src/templates/core/base.html | 1 - 7 files changed, 52 insertions(+), 17 deletions(-) diff --git a/src/apps/dashboard/views.py b/src/apps/dashboard/views.py index 17c1e91..3ef1a65 100644 --- a/src/apps/dashboard/views.py +++ b/src/apps/dashboard/views.py @@ -1,5 +1,6 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required +from django.db.models import Max, Q from django.http import HttpResponse, HttpResponseForbidden from django.shortcuts import redirect, render @@ -17,6 +18,16 @@ PALETTES = [ ] +def _recent_lists(user, limit=3): + return ( + List + .objects + .filter(Q(owner=user) | Q(shared_with=user)) + .annotate(last_item=Max('item__id')) + .order_by('-last_item') + .distinct()[:limit] + ) + def _applet_context(user): ua_map = {ua.applet_id: ua.visible for ua in user.user_applets.all()} applets = {a.slug: a for a in Applet.objects.all()} @@ -26,10 +37,16 @@ def _applet_context(user): if slug in applets ] + def home_page(request): - context = {"form": ItemForm(), "palettes": PALETTES, "page_class": "page-dashboard"} + context = { + "form": ItemForm(), + "palettes": PALETTES, + "page_class": "page-dashboard", + } if request.user.is_authenticated: context["applets"] = _applet_context(request.user) + context["recent_lists"] = _recent_lists(request.user) return render(request, "apps/dashboard/home.html", context) def new_list(request): @@ -42,9 +59,14 @@ def new_list(request): form.save(for_list=nulist) return redirect(nulist) else: - context = {"form": form, "palettes": PALETTES, "page_class": "page-dashboard"} + context = { + "form": form, + "palettes": PALETTES, + "page_class": "page-dashboard", + } if request.user.is_authenticated: context["applets"] = _applet_context(request.user) + context["recent_lists"] = _recent_lists(request.user) return render(request, "apps/dashboard/home.html", context) def view_list(request, list_id): @@ -116,5 +138,6 @@ def toggle_applets(request): "applets": _applet_context(request.user), "palettes": PALETTES, "form": ItemForm(), + "recent_lists": _recent_lists(request.user), }) return redirect("home") diff --git a/src/functional_tests/my_lists_page.py b/src/functional_tests/my_lists_page.py index e467a60..af0b0bc 100644 --- a/src/functional_tests/my_lists_page.py +++ b/src/functional_tests/my_lists_page.py @@ -1,5 +1,7 @@ from selenium.webdriver.common.by import By +from apps.lyric.models import User + class MyListsPage: def __init__(self, test): @@ -7,7 +9,10 @@ class MyListsPage: def go_to_my_lists_page(self, email): self.test.browser.get(self.test.live_server_url) - self.test.browser.find_element(By.LINK_TEXT, "My lists").click() + user = User.objects.get(email=email) + self.test.browser.get( + self.test.live_server_url + f'/dashboard/users/{user.id}/' + ) self.test.wait_for( lambda: self.test.assertIn( email, diff --git a/src/functional_tests/test_my_lists.py b/src/functional_tests/test_my_lists.py index 979b37c..a09b53b 100644 --- a/src/functional_tests/test_my_lists.py +++ b/src/functional_tests/test_my_lists.py @@ -3,6 +3,7 @@ from selenium.webdriver.common.by import By from .base import FunctionalTest from .list_page import ListPage from .my_lists_page import MyListsPage +from apps.lyric.models import User class MyListsTest(FunctionalTest): @@ -30,11 +31,10 @@ class MyListsTest(FunctionalTest): list_page.add_list_item("Ribbon of death") second_list_url = self.browser.current_url - self.browser.find_element(By.LINK_TEXT, "My lists").click() + MyListsPage(self).go_to_my_lists_page("disco@test.io") self.wait_for( lambda: self.browser.find_element(By.LINK_TEXT, "Ribbon of death") ) - MyListsPage(self).go_to_my_lists_page("disco@test.io") self.browser.find_element(By.CSS_SELECTOR, "#id_logout").click() self.wait_for( diff --git a/src/static_src/scss/_dashboard.scss b/src/static_src/scss/_dashboard.scss index 1d6f1ce..f4c5386 100644 --- a/src/static_src/scss/_dashboard.scss +++ b/src/static_src/scss/_dashboard.scss @@ -119,6 +119,12 @@ body.page-dashboard { } } + + @container (max-width: 480px) { + section { + grid-column: span 12; + } + } } @media (max-height: 500px) { diff --git a/src/static_src/scss/_palette-picker.scss b/src/static_src/scss/_palette-picker.scss index ce35d6b..ce6d866 100644 --- a/src/static_src/scss/_palette-picker.scss +++ b/src/static_src/scss/_palette-picker.scss @@ -25,10 +25,10 @@ border-radius: 0.5rem; background: linear-gradient( to bottom, - rgba(var(--priUser), 1) 0%, - rgba(var(--priUser), 1) 33%, + rgba(var(--terUser), 1) 0%, rgba(var(--terUser), 1) 33%, - rgba(var(--terUser), 1) 66%, + rgba(var(--priUser), 1) 33%, + rgba(var(--priUser), 1) 66%, rgba(var(--quiUser), 1) 66%, rgba(var(--quiUser), 1) 100% ); diff --git a/src/templates/apps/dashboard/_partials/_applets.html b/src/templates/apps/dashboard/_partials/_applets.html index ec8ea02..8f32a40 100644 --- a/src/templates/apps/dashboard/_partials/_applets.html +++ b/src/templates/apps/dashboard/_partials/_applets.html @@ -38,15 +38,17 @@ id="id_applet_my_lists" style="--applet-cols: {{ entry.applet.grid_cols }}; --applet-rows: {{ entry.applet.grid_rows }};" > + My lists: + {% for list in user.lists.all %} -
  • - {{ list.name }} -
  • - {% endfor %} - {% for list in user.shared_lists.all %} -
  • - {{ list.name }} -
  • {% endfor %} {% elif entry.applet.slug == "username" %} diff --git a/src/templates/core/base.html b/src/templates/core/base.html index 69bb5d5..d158a79 100644 --- a/src/templates/core/base.html +++ b/src/templates/core/base.html @@ -24,7 +24,6 @@

    Welcome, Earthman

    {% if user.email %} - My lists Logged in as {{ user|display_name }}
    {% csrf_token %}