feat: make the web app installable and rework the app shell

Add a Vite PWA (`vite-plugin-pwa`): manifest, icons and an `autoUpdate`
service worker, plus an install prompt so the app can be added to the
home screen.

Rework the shell for mobile: mount the bottom navigation bar and the
install prompt in the authenticated layout, hide the sidebar trigger
below `md`, and add a sign-out card to Settings. Drop the placeholder
Tasks page together with its unused shadcn table and the
`@tanstack/react-table` dependency, and remove the in-app router/query
dev tools.
This commit is contained in:
Jose Selesan
2026-10-16 15:44:20 -03:00
parent 4035a4bf20
commit 370e3022c8
19 changed files with 777 additions and 272 deletions

View File

@@ -0,0 +1,42 @@
import { DownloadIcon, SmartphoneIcon, XIcon } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useInstallPrompt } from '@/hooks/use-install-prompt'
export function InstallPrompt() {
const { visible, canInstall, needsManualInstructions, install, dismiss } = useInstallPrompt()
if (!visible) return null
return (
<div className="fixed inset-x-0 bottom-0 z-40 px-3 pb-[calc(4.75rem+env(safe-area-inset-bottom))] md:left-auto md:right-4 md:max-w-md md:px-4 md:pb-4">
<div className="bg-card shadow-lg border rounded-xl p-3 flex items-center gap-3 w-full">
<div className="bg-primary/10 text-primary rounded-lg p-2">
{needsManualInstructions ? (
<SmartphoneIcon className="size-4" />
) : (
<DownloadIcon className="size-4" />
)}
</div>
<div className="min-w-0 flex-1">
<p className="text-sm font-medium">Instalar Superlist</p>
<p className="text-xs text-muted-foreground">
{needsManualInstructions
? 'Toca Compartir y luego «Añadir a pantalla de inicio».'
: 'Añádela a tu pantalla de inicio para usarla como una app.'}
</p>
</div>
<div className="flex items-center gap-1">
{canInstall && (
<Button size="sm" onClick={install}>
Instalar
</Button>
)}
<Button size="icon-sm" variant="ghost" aria-label="Cerrar" onClick={dismiss}>
<XIcon className="size-3.5" />
</Button>
</div>
</div>
</div>
)
}

View File

@@ -8,7 +8,6 @@ import { SidebarTrigger } from '@/components/ui/sidebar'
function titleFor(pathname: string) {
if (pathname === '/') return 'Panel'
if (pathname.startsWith('/lists')) return 'Listas'
if (pathname.startsWith('/tasks')) return 'Tareas'
if (pathname.startsWith('/settings')) return 'Ajustes'
return 'Superlist'
}
@@ -20,7 +19,7 @@ export function AppHeader() {
return (
<header className="bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 flex h-16 shrink-0 items-center gap-2 border-b backdrop-blur">
<div className="flex w-full items-center gap-2 px-4">
<SidebarTrigger className="-ml-1" />
<SidebarTrigger className="-ml-1 hidden md:inline-flex" />
<Separator orientation="vertical" className="mr-2 h-4" />
<h1 className="truncate text-sm font-medium">{title}</h1>
<div className="ml-auto flex items-center gap-1">

View File

@@ -1,6 +1,6 @@
import { Link, useRouterState } from '@tanstack/react-router'
import type { LucideIcon } from 'lucide-react'
import { HomeIcon, ListTodoIcon, SettingsIcon, ShoppingCartIcon } from 'lucide-react'
import { HomeIcon, SettingsIcon, ShoppingCartIcon } from 'lucide-react'
import { focusNewItemInput } from '@/components/items/create-item-form'
import { NavUser } from '@/components/layout/nav-user'
@@ -26,7 +26,6 @@ type NavItem = {
const NAV_ITEMS: NavItem[] = [
{ title: 'Principal', to: '/', icon: HomeIcon },
{ title: 'Listas', to: '/lists', icon: ShoppingCartIcon },
{ title: 'Tareas', to: '/tasks', icon: ListTodoIcon },
{ title: 'Ajustes', to: '/settings', icon: SettingsIcon },
]

View File

@@ -1,88 +0,0 @@
'use client'
import { cn } from 'cn'
import * as React from 'react'
function Table({ className, ...props }: React.ComponentProps<'table'>) {
return (
<div data-slot="table-container" className="relative w-full overflow-x-auto">
<table
data-slot="table"
className={cn('w-full caption-bottom text-sm', className)}
{...props}
/>
</div>
)
}
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
return <thead data-slot="table-header" className={cn('[&_tr]:border-b', className)} {...props} />
}
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
return (
<tbody
data-slot="table-body"
className={cn('[&_tr:last-child]:border-0', className)}
{...props}
/>
)
}
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
return (
<tfoot
data-slot="table-footer"
className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
{...props}
/>
)
}
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
return (
<tr
data-slot="table-row"
className={cn(
'border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted',
className,
)}
{...props}
/>
)
}
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
return (
<th
data-slot="table-head"
className={cn(
'h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0',
className,
)}
{...props}
/>
)
}
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
return (
<td
data-slot="table-cell"
className={cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)}
{...props}
/>
)
}
function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
return (
<caption
data-slot="table-caption"
className={cn('mt-4 text-sm text-muted-foreground', className)}
{...props}
/>
)
}
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow }