feat(web): green, warm-paper theme with a matching dark mode
- New light palette (warm off-white background, white cards, grocery green
primary) and a green-tinted charcoal dark mode; larger radius.
- Items render as one grouped card; bought items live in a collapsible
"Comprados · N" card with a muted header.
- Pill-shaped add-item input (shadcn input-group) with a round add button.
- Progress summary ("N pendientes · M comprados" + bar) above the input.
- Active bottom-nav item uses the primary color with a dot.
- theme-color metas and PWA manifest follow the new background.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
|
||||
/>
|
||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
|
||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#0a0a0a" />
|
||||
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f9f8f5" />
|
||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#0f1411" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { ListItem } from '@superlist/shared'
|
||||
import { ChevronDownIcon } from 'lucide-react'
|
||||
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
|
||||
import type { useUpdateItem } from '@/hooks/use-items'
|
||||
|
||||
@@ -13,30 +14,31 @@ type BoughtItemListProps = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapsible "Comprados hoy" section below the pending items. Expanded by
|
||||
* default so marking an item visibly moves it down; the user can fold it.
|
||||
* Tapping an item here un-buys it and it returns to the pending list.
|
||||
* Collapsible "Comprados" card below the pending items. Expanded by default so
|
||||
* marking an item visibly moves it down; the user can fold it. Tapping an item
|
||||
* here un-buys it and it returns to the pending list.
|
||||
*/
|
||||
export function BoughtItemList({ items, updateItem, savingIds }: BoughtItemListProps) {
|
||||
return (
|
||||
<Collapsible defaultOpen>
|
||||
<CollapsibleTrigger className="group flex w-full items-center gap-1.5 py-1 text-left">
|
||||
<ChevronDownIcon className="text-muted-foreground size-4 transition-transform group-data-[state=closed]:-rotate-90" />
|
||||
<span className="text-muted-foreground text-sm font-medium">Comprados hoy</span>
|
||||
<span className="text-muted-foreground text-sm">({items.length})</span>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<ul className="flex flex-col gap-2 pt-2">
|
||||
{items.map((item) => (
|
||||
<ItemRow
|
||||
key={item.id}
|
||||
item={item}
|
||||
updateItem={updateItem}
|
||||
isSaving={savingIds.includes(item.id)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</CollapsibleContent>
|
||||
<Collapsible defaultOpen asChild>
|
||||
<Card className="gap-0 py-0">
|
||||
<CollapsibleTrigger className="group bg-muted text-muted-foreground hover:text-foreground flex w-full items-center gap-3 px-4 py-3 text-left transition-colors">
|
||||
<ChevronDownIcon className="size-5 transition-transform group-data-[state=closed]:-rotate-90" />
|
||||
<span className="text-base">Comprados · {items.length}</span>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<ul className="divide-y">
|
||||
{items.map((item) => (
|
||||
<ItemRow
|
||||
key={item.id}
|
||||
item={item}
|
||||
updateItem={updateItem}
|
||||
isSaving={savingIds.includes(item.id)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</CollapsibleContent>
|
||||
</Card>
|
||||
</Collapsible>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { zodResolver } from '@hookform/resolvers/zod'
|
||||
import { PlusIcon } from 'lucide-react'
|
||||
import { PlusIcon, SearchIcon } from 'lucide-react'
|
||||
import { useForm } from 'react-hook-form'
|
||||
import { z } from 'zod'
|
||||
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Field, FieldError } from '@/components/ui/field'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupButton,
|
||||
InputGroupInput,
|
||||
} from '@/components/ui/input-group'
|
||||
import { useCreateItem } from '@/hooks/use-items'
|
||||
import { ApiError } from '@/lib/api-client'
|
||||
|
||||
@@ -70,23 +74,36 @@ export function CreateItemForm({ listId, autoFocus = false }: CreateItemFormProp
|
||||
})
|
||||
|
||||
return (
|
||||
<form onSubmit={onSubmit} className="flex items-start gap-2">
|
||||
<Field className="flex-1" data-invalid={!!form.formState.errors.name}>
|
||||
<Input
|
||||
id={NEW_ITEM_INPUT_ID}
|
||||
aria-label="Nuevo artículo"
|
||||
autoComplete="off"
|
||||
placeholder="Añade un artículo…"
|
||||
autoFocus={autoFocus}
|
||||
{...form.register('name')}
|
||||
/>
|
||||
<FieldError errors={[form.formState.errors.name]} />
|
||||
<form onSubmit={onSubmit}>
|
||||
<Field data-invalid={!!form.formState.errors.name}>
|
||||
<InputGroup className="bg-card h-14 rounded-full shadow-xs dark:bg-card">
|
||||
<InputGroupAddon className="pl-5">
|
||||
<SearchIcon className="size-5" />
|
||||
</InputGroupAddon>
|
||||
<InputGroupInput
|
||||
id={NEW_ITEM_INPUT_ID}
|
||||
aria-label="Nuevo artículo"
|
||||
aria-invalid={!!form.formState.errors.name}
|
||||
autoComplete="off"
|
||||
placeholder="Añadir un artículo…"
|
||||
autoFocus={autoFocus}
|
||||
className="text-base"
|
||||
{...form.register('name')}
|
||||
/>
|
||||
<InputGroupAddon align="inline-end" className="pr-2">
|
||||
<InputGroupButton
|
||||
type="submit"
|
||||
variant="default"
|
||||
size="icon-sm"
|
||||
aria-label="Agregar"
|
||||
className="size-10 rounded-full"
|
||||
>
|
||||
<PlusIcon className="size-5" strokeWidth={2.5} />
|
||||
</InputGroupButton>
|
||||
</InputGroupAddon>
|
||||
</InputGroup>
|
||||
<FieldError errors={[form.formState.errors.name]} className="px-5" />
|
||||
</Field>
|
||||
|
||||
<Button type="submit">
|
||||
<PlusIcon />
|
||||
Agregar
|
||||
</Button>
|
||||
</form>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { ShoppingBasketIcon } from 'lucide-react'
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
||||
import { Card, CardContent } from '@/components/ui/card'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { useItems, usePendingItemUpdates, useUpdateItem } from '@/hooks/use-items'
|
||||
import { useListEvents } from '@/hooks/use-list-events'
|
||||
@@ -19,7 +18,7 @@ type ItemListProps = {
|
||||
|
||||
/**
|
||||
* Items loaded from the API, pending ones first. Tapping an item marks it as
|
||||
* bought; bought items move to a collapsible "Comprados hoy" section below
|
||||
* bought; bought items move to a collapsible "Comprados" card below
|
||||
* and are only shown on the day they were bought.
|
||||
*/
|
||||
export function ItemList({ listId }: ItemListProps) {
|
||||
@@ -75,25 +74,24 @@ export function ItemList({ listId }: ItemListProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex flex-col gap-4">
|
||||
{pending.length > 0 && (
|
||||
<ul className="flex flex-col gap-2">
|
||||
{pending.map((item) => (
|
||||
<ItemRow
|
||||
key={item.id}
|
||||
item={item}
|
||||
updateItem={updateItem}
|
||||
isSaving={savingIds.includes(item.id)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<Card className="py-0">
|
||||
<ul className="divide-y">
|
||||
{pending.map((item) => (
|
||||
<ItemRow
|
||||
key={item.id}
|
||||
item={item}
|
||||
updateItem={updateItem}
|
||||
isSaving={savingIds.includes(item.id)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{boughtToday.length > 0 && (
|
||||
<>
|
||||
{pending.length > 0 && <Separator className="mt-2" />}
|
||||
<BoughtItemList items={boughtToday} updateItem={updateItem} savingIds={savingIds} />
|
||||
</>
|
||||
<BoughtItemList items={boughtToday} updateItem={updateItem} savingIds={savingIds} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { ListItem } from '@superlist/shared'
|
||||
import { CheckIcon } from 'lucide-react'
|
||||
|
||||
import { refocusNewItemInput } from '@/components/items/create-item-form'
|
||||
import { Card, CardContent } from '@/components/ui/card'
|
||||
import { isOptimisticItem, type useUpdateItem } from '@/hooks/use-items'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
@@ -13,49 +12,45 @@ type ItemRowProps = {
|
||||
isSaving: boolean
|
||||
}
|
||||
|
||||
/** A single item row: tapping it toggles its bought state. */
|
||||
/** A single item row inside a grouped card: tapping it toggles its bought state. */
|
||||
export function ItemRow({ item, updateItem, isSaving }: ItemRowProps) {
|
||||
return (
|
||||
<li>
|
||||
<Card>
|
||||
<CardContent className="p-0">
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={item.completed}
|
||||
// A placeholder has no server id yet, so it cannot be toggled.
|
||||
disabled={isSaving || isOptimisticItem(item)}
|
||||
onClick={() => {
|
||||
updateItem.mutate({ itemId: item.id, completed: !item.completed })
|
||||
// Back to the input, so the next item can be typed right away.
|
||||
refocusNewItemInput()
|
||||
}}
|
||||
className="flex w-full cursor-pointer items-center gap-3 p-3 text-left disabled:cursor-default disabled:opacity-60"
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'flex size-5 shrink-0 items-center justify-center rounded-full border',
|
||||
item.completed
|
||||
? 'bg-primary text-primary-foreground border-primary'
|
||||
: 'border-muted-foreground/40 text-transparent',
|
||||
)}
|
||||
aria-hidden
|
||||
>
|
||||
<CheckIcon className="size-3" />
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
'min-w-0 flex-1 truncate',
|
||||
item.completed && 'text-muted-foreground line-through',
|
||||
)}
|
||||
>
|
||||
{item.name}
|
||||
</span>
|
||||
{item.quantity && (
|
||||
<span className="text-muted-foreground shrink-0 text-sm">{item.quantity}</span>
|
||||
)}
|
||||
</button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={item.completed}
|
||||
// A placeholder has no server id yet, so it cannot be toggled.
|
||||
disabled={isSaving || isOptimisticItem(item)}
|
||||
onClick={() => {
|
||||
updateItem.mutate({ itemId: item.id, completed: !item.completed })
|
||||
// Back to the input, so the next item can be typed right away.
|
||||
refocusNewItemInput()
|
||||
}}
|
||||
className="hover:bg-muted/50 focus-visible:bg-muted/50 flex w-full cursor-pointer items-center gap-4 px-4 py-3.5 text-left outline-none transition-colors disabled:cursor-default disabled:opacity-60"
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'flex size-6 shrink-0 items-center justify-center rounded-full border-[1.5px] transition-colors',
|
||||
item.completed
|
||||
? 'bg-primary text-primary-foreground border-primary'
|
||||
: 'border-muted-foreground/45 text-transparent',
|
||||
)}
|
||||
aria-hidden
|
||||
>
|
||||
<CheckIcon className="size-3.5" strokeWidth={3} />
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
'min-w-0 flex-1 truncate text-base',
|
||||
item.completed && 'text-muted-foreground line-through',
|
||||
)}
|
||||
>
|
||||
{item.name}
|
||||
</span>
|
||||
{item.quantity && (
|
||||
<span className="text-muted-foreground shrink-0 text-sm">{item.quantity}</span>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
39
apps/web/src/components/items/list-progress.tsx
Normal file
39
apps/web/src/components/items/list-progress.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Progress } from '@/components/ui/progress'
|
||||
import { useItems } from '@/hooks/use-items'
|
||||
import { useToday } from '@/hooks/use-today'
|
||||
import { splitItems } from '@/lib/items'
|
||||
|
||||
type ListProgressProps = {
|
||||
listId: string
|
||||
}
|
||||
|
||||
/**
|
||||
* "4 pendientes · 7 comprados" plus a bar for today's progress. Reads the items
|
||||
* query the list already loads, so it adds no request; renders nothing until
|
||||
* the items are in or when the list is empty.
|
||||
*/
|
||||
export function ListProgress({ listId }: ListProgressProps) {
|
||||
const { data: items } = useItems(listId)
|
||||
const today = useToday()
|
||||
|
||||
if (!items) return null
|
||||
|
||||
const { pending, boughtToday } = splitItems(items, today)
|
||||
const total = pending.length + boughtToday.length
|
||||
|
||||
if (total === 0) return null
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
<p className="text-muted-foreground">
|
||||
{pending.length} {pending.length === 1 ? 'pendiente' : 'pendientes'} · {boughtToday.length}{' '}
|
||||
{boughtToday.length === 1 ? 'comprado' : 'comprados'}
|
||||
</p>
|
||||
<Progress
|
||||
value={(boughtToday.length / total) * 100}
|
||||
aria-label="Progreso de la compra"
|
||||
className="h-2"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,7 @@ export function BottomNav() {
|
||||
|
||||
return (
|
||||
<footer className="fixed inset-x-0 bottom-0 z-30 border-t bg-background/95 supports-[backdrop-filter]:bg-background/60 backdrop-blur md:hidden pb-[env(safe-area-inset-bottom)]">
|
||||
<nav className="mx-auto flex h-16 max-w-lg items-center justify-around px-2">
|
||||
<nav className="mx-auto flex h-18 max-w-lg items-center justify-around px-2">
|
||||
{NAV_ITEMS.map((item) => {
|
||||
const active = isNavItemActive(pathname, item.to)
|
||||
|
||||
@@ -20,12 +20,15 @@ export function BottomNav() {
|
||||
onClick={item.to === '/' ? () => focusNewItemInput(pathname) : undefined}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
className={cn(
|
||||
'flex flex-col items-center gap-1 rounded-md px-3 py-1.5 text-xs transition-colors',
|
||||
active ? 'text-foreground' : 'text-muted-foreground hover:text-foreground',
|
||||
'relative flex flex-col items-center gap-1 rounded-md px-3 py-1.5 text-xs transition-colors',
|
||||
active ? 'text-primary font-medium' : 'text-muted-foreground hover:text-foreground',
|
||||
)}
|
||||
>
|
||||
<item.icon className="size-5" />
|
||||
<span>{item.title}</span>
|
||||
{active && (
|
||||
<span className="bg-primary absolute -bottom-1 size-1 rounded-full" aria-hidden />
|
||||
)}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
|
||||
142
apps/web/src/components/ui/input-group.tsx
Normal file
142
apps/web/src/components/ui/input-group.tsx
Normal file
@@ -0,0 +1,142 @@
|
||||
import { cva, type VariantProps } from 'class-variance-authority'
|
||||
import { cn } from 'cn'
|
||||
import * as React from 'react'
|
||||
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Textarea } from '@/components/ui/textarea'
|
||||
|
||||
function InputGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
||||
return (
|
||||
<div
|
||||
data-slot="input-group"
|
||||
role="group"
|
||||
className={cn(
|
||||
'group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const inputGroupAddonVariants = cva(
|
||||
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
||||
{
|
||||
variants: {
|
||||
align: {
|
||||
'inline-start': 'order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]',
|
||||
'inline-end': 'order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]',
|
||||
'block-start':
|
||||
'order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2',
|
||||
'block-end':
|
||||
'order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
align: 'inline-start',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
function InputGroupAddon({
|
||||
className,
|
||||
align = 'inline-start',
|
||||
...props
|
||||
}: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>) {
|
||||
return (
|
||||
<div
|
||||
role="group"
|
||||
data-slot="input-group-addon"
|
||||
data-align={align}
|
||||
className={cn(inputGroupAddonVariants({ align }), className)}
|
||||
onClick={(e) => {
|
||||
if ((e.target as HTMLElement).closest('button')) {
|
||||
return
|
||||
}
|
||||
e.currentTarget.parentElement?.querySelector('input')?.focus()
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const inputGroupButtonVariants = cva('flex items-center gap-2 text-sm shadow-none', {
|
||||
variants: {
|
||||
size: {
|
||||
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
||||
sm: '',
|
||||
'icon-xs': 'size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0',
|
||||
'icon-sm': 'size-8 p-0 has-[>svg]:p-0',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
size: 'xs',
|
||||
},
|
||||
})
|
||||
|
||||
function InputGroupButton({
|
||||
className,
|
||||
type = 'button',
|
||||
variant = 'ghost',
|
||||
size = 'xs',
|
||||
...props
|
||||
}: Omit<React.ComponentProps<typeof Button>, 'size'> &
|
||||
VariantProps<typeof inputGroupButtonVariants>) {
|
||||
return (
|
||||
<Button
|
||||
type={type}
|
||||
data-size={size}
|
||||
variant={variant}
|
||||
className={cn(inputGroupButtonVariants({ size }), className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function InputGroupText({ className, ...props }: React.ComponentProps<'span'>) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function InputGroupInput({ className, ...props }: React.ComponentProps<'input'>) {
|
||||
return (
|
||||
<Input
|
||||
data-slot="input-group-control"
|
||||
className={cn(
|
||||
'flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function InputGroupTextarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
||||
return (
|
||||
<Textarea
|
||||
data-slot="input-group-control"
|
||||
className={cn(
|
||||
'flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
InputGroupButton,
|
||||
InputGroupInput,
|
||||
InputGroupText,
|
||||
InputGroupTextarea,
|
||||
}
|
||||
28
apps/web/src/components/ui/progress.tsx
Normal file
28
apps/web/src/components/ui/progress.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { cn } from 'cn'
|
||||
import { Progress as ProgressPrimitive } from 'radix-ui'
|
||||
import * as React from 'react'
|
||||
|
||||
function Progress({
|
||||
className,
|
||||
value,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
||||
return (
|
||||
<ProgressPrimitive.Root
|
||||
data-slot="progress"
|
||||
className={cn(
|
||||
'relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ProgressPrimitive.Indicator
|
||||
data-slot="progress-indicator"
|
||||
className="size-full flex-1 bg-primary transition-all"
|
||||
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
||||
/>
|
||||
</ProgressPrimitive.Root>
|
||||
)
|
||||
}
|
||||
|
||||
export { Progress }
|
||||
@@ -49,72 +49,74 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
/* Warm paper background, white cards and a grocery green as the accent. */
|
||||
--background: oklch(0.982 0.004 91);
|
||||
--foreground: oklch(0.17 0.005 90);
|
||||
--card: oklch(0.997 0.002 91);
|
||||
--card-foreground: oklch(0.17 0.005 90);
|
||||
--popover: oklch(0.997 0.002 91);
|
||||
--popover-foreground: oklch(0.17 0.005 90);
|
||||
--primary: oklch(0.52 0.13 147);
|
||||
--primary-foreground: oklch(0.99 0.01 147);
|
||||
--secondary: oklch(0.95 0.007 91);
|
||||
--secondary-foreground: oklch(0.24 0.005 90);
|
||||
--muted: oklch(0.95 0.007 91);
|
||||
--muted-foreground: oklch(0.52 0.008 90);
|
||||
--accent: oklch(0.94 0.025 147);
|
||||
--accent-foreground: oklch(0.36 0.09 147);
|
||||
--destructive: oklch(0.577 0.215 27.325);
|
||||
--border: oklch(0.915 0.007 91);
|
||||
--input: oklch(0.9 0.008 91);
|
||||
--ring: oklch(0.52 0.13 147);
|
||||
--chart-1: oklch(0.52 0.13 147);
|
||||
--chart-2: oklch(0.65 0.13 150);
|
||||
--chart-3: oklch(0.75 0.12 85);
|
||||
--chart-4: oklch(0.6 0.12 45);
|
||||
--chart-5: oklch(0.45 0.05 200);
|
||||
--radius: 0.875rem;
|
||||
--sidebar: oklch(0.97 0.005 91);
|
||||
--sidebar-foreground: oklch(0.17 0.005 90);
|
||||
--sidebar-primary: oklch(0.52 0.13 147);
|
||||
--sidebar-primary-foreground: oklch(0.99 0.01 147);
|
||||
--sidebar-accent: oklch(0.94 0.025 147);
|
||||
--sidebar-accent-foreground: oklch(0.36 0.09 147);
|
||||
--sidebar-border: oklch(0.915 0.007 91);
|
||||
--sidebar-ring: oklch(0.52 0.13 147);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
/* Deep green-tinted charcoal; the green is lifted so it reads on dark. */
|
||||
--background: oklch(0.165 0.008 155);
|
||||
--foreground: oklch(0.95 0.006 95);
|
||||
--card: oklch(0.21 0.01 155);
|
||||
--card-foreground: oklch(0.95 0.006 95);
|
||||
--popover: oklch(0.23 0.01 155);
|
||||
--popover-foreground: oklch(0.95 0.006 95);
|
||||
--primary: oklch(0.72 0.16 148);
|
||||
--primary-foreground: oklch(0.2 0.04 150);
|
||||
--secondary: oklch(0.26 0.01 155);
|
||||
--secondary-foreground: oklch(0.95 0.006 95);
|
||||
--muted: oklch(0.255 0.01 155);
|
||||
--muted-foreground: oklch(0.7 0.012 120);
|
||||
--accent: oklch(0.3 0.045 150);
|
||||
--accent-foreground: oklch(0.88 0.08 148);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
--border: oklch(1 0 0 / 9%);
|
||||
--input: oklch(1 0 0 / 14%);
|
||||
--ring: oklch(0.72 0.16 148);
|
||||
--chart-1: oklch(0.72 0.16 148);
|
||||
--chart-2: oklch(0.62 0.13 150);
|
||||
--chart-3: oklch(0.8 0.12 85);
|
||||
--chart-4: oklch(0.7 0.12 45);
|
||||
--chart-5: oklch(0.65 0.06 200);
|
||||
--sidebar: oklch(0.19 0.009 155);
|
||||
--sidebar-foreground: oklch(0.95 0.006 95);
|
||||
--sidebar-primary: oklch(0.72 0.16 148);
|
||||
--sidebar-primary-foreground: oklch(0.2 0.04 150);
|
||||
--sidebar-accent: oklch(0.3 0.045 150);
|
||||
--sidebar-accent-foreground: oklch(0.88 0.08 148);
|
||||
--sidebar-border: oklch(1 0 0 / 9%);
|
||||
--sidebar-ring: oklch(0.72 0.16 148);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { PlusIcon, ShoppingCartIcon } from 'lucide-react'
|
||||
|
||||
import { CreateItemForm } from '@/components/items/create-item-form'
|
||||
import { ItemList } from '@/components/items/item-list'
|
||||
import { ListProgress } from '@/components/items/list-progress'
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Card, CardContent } from '@/components/ui/card'
|
||||
@@ -51,6 +52,8 @@ function HomePage() {
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-2xl flex-col gap-4 md:gap-6">
|
||||
<ListProgress listId={primaryList.id} />
|
||||
|
||||
<CreateItemForm listId={primaryList.id} autoFocus />
|
||||
|
||||
<ItemList listId={primaryList.id} />
|
||||
|
||||
@@ -2,6 +2,7 @@ import { createFileRoute } from '@tanstack/react-router'
|
||||
|
||||
import { CreateItemForm } from '@/components/items/create-item-form'
|
||||
import { ItemList } from '@/components/items/item-list'
|
||||
import { ListProgress } from '@/components/items/list-progress'
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
|
||||
import { Skeleton } from '@/components/ui/skeleton'
|
||||
import { itemsQueryOptions } from '@/hooks/use-items'
|
||||
@@ -49,6 +50,8 @@ function ListItemsPage() {
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-2xl flex-col gap-4 md:gap-6">
|
||||
<ListProgress listId={list.id} />
|
||||
|
||||
<CreateItemForm listId={list.id} autoFocus />
|
||||
|
||||
<ItemList listId={list.id} />
|
||||
|
||||
@@ -30,8 +30,8 @@ export default defineConfig({
|
||||
scope: '/',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
theme_color: '#ffffff',
|
||||
background_color: '#ffffff',
|
||||
theme_color: '#f9f8f5',
|
||||
background_color: '#f9f8f5',
|
||||
icons: [
|
||||
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
|
||||
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png' },
|
||||
|
||||
Reference in New Issue
Block a user