feat(lists): pin lists with an icon and a live pending badge
Each member can pin up to four lists and pick an icon for them (per-user settings on shopping_list_members, PATCH /api/lists/:listId/preferences). Pinned lists stay visible with their pending count, kept live over each list's SSE stream: a chip bar above the bottom nav on mobile and a "Fijadas" group in the sidebar on desktop. GET /api/lists now returns pendingCount, isPinned and icon. The page padding, install prompt and dictation button now read --bottom-nav-height, which grows with the pinned bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,47 @@
|
||||
* and the web app consumes them, so they live here instead of being duplicated.
|
||||
*/
|
||||
|
||||
import { z } from 'zod'
|
||||
|
||||
export type ListRole = 'owner' | 'collaborator'
|
||||
|
||||
/**
|
||||
* Icons a user can give a list (keys of lucide icons). The web app maps each key
|
||||
* to its component; the API only validates the key.
|
||||
*/
|
||||
export const LIST_ICONS = [
|
||||
'shopping-cart',
|
||||
'carrot',
|
||||
'apple',
|
||||
'house',
|
||||
'trees',
|
||||
'park',
|
||||
'beef',
|
||||
'fish',
|
||||
'milk',
|
||||
'croissant',
|
||||
'wine',
|
||||
'pill',
|
||||
'baby',
|
||||
'dog',
|
||||
'shirt',
|
||||
'hammer',
|
||||
'gift',
|
||||
] as const
|
||||
|
||||
export const ListIconSchema = z.enum(LIST_ICONS)
|
||||
|
||||
export type ListIcon = (typeof LIST_ICONS)[number]
|
||||
|
||||
/** Most lists a user can pin to the always-visible bar. */
|
||||
export const MAX_PINNED_LISTS = 4
|
||||
|
||||
/** Body of `PATCH /lists/:listId/preferences` (per-user settings of a list). */
|
||||
export type UpdateListPreferencesRequest = {
|
||||
isPinned?: boolean
|
||||
icon?: ListIcon | null
|
||||
}
|
||||
|
||||
export type InvitationStatus = 'pending' | 'accepted' | 'revoked' | 'expired'
|
||||
|
||||
/** A member of a list, as seen in the list detail. */
|
||||
@@ -26,6 +65,12 @@ export type ShoppingListSummary = {
|
||||
name: string
|
||||
role: ListRole
|
||||
isPrimary: boolean
|
||||
/** Per user: pinned to the always-visible bar. */
|
||||
isPinned: boolean
|
||||
/** Per user: icon chosen for the list, `null` to show its initial. */
|
||||
icon: ListIcon | null
|
||||
/** Items not bought yet. */
|
||||
pendingCount: number
|
||||
memberCount: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
@@ -37,6 +82,8 @@ export type ShoppingListDetail = {
|
||||
name: string
|
||||
role: ListRole
|
||||
isPrimary: boolean
|
||||
isPinned: boolean
|
||||
icon: ListIcon | null
|
||||
members: ListMember[]
|
||||
invitations: ListInvitation[]
|
||||
createdAt: string
|
||||
|
||||
Reference in New Issue
Block a user