Favorites and the question libraries in one place. Card and Table views with the choice remembered, sort by last used / created / name / size with a direction control, a count line, and a search over name and date. Favorites leads as a fixed row: it is the one shelf nobody made and everybody has, so it cannot be renamed or deleted. Sorted by when each was last used, not when it was made — the order things were created in is nobody's mental model of their own shelf. A library nobody has opened falls back to its age, because it is newer to the learner than it is to the database. That needed `user_collections.last_used_at`: null on every existing row, since backfilling from created_at would invent a use that never happened. A shelf opens in place rather than linking away. The obvious link would have been /questions?collection=N, and there is no page there that reads it — the old bank browser was dismantled — so the card would have led nowhere. Questions can be taken back out from the open shelf, and any shelf can be sat as a session through the existing explicit_ids builder. The ⋯ menu moved out of QuizPage into components/MoreMenu; the player keeps its own look and its own children through className props. It no longer closes on any click inside, which the player's feedback form and share dialog were relying on by accident. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN
27 lines
800 B
Python
27 lines
800 B
Python
"""Remember when a collection was last opened.
|
|
|
|
A list of libraries sorted by when they were made is a list in the order you
|
|
happened to create things, which is not the order anyone looks for them in.
|
|
"Last used" is, and it is the default sort on the collections page.
|
|
|
|
Null on every existing row: we did not record it before, and backfilling from
|
|
`created_at` would invent a use that never happened.
|
|
|
|
Revision ID: f2a3b4c5d6e7
|
|
Revises: e1f2a3b4c5d6
|
|
"""
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "f2a3b4c5d6e7"
|
|
down_revision = "e1f2a3b4c5d6"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column("user_collections", sa.Column("last_used_at", sa.DateTime(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_column("user_collections", "last_used_at")
|