feat: always focus the item input when tapping Inicio

This commit is contained in:
Jose Selesan
2026-10-16 14:53:21 -03:00
parent 4ed6432f60
commit 4035a4bf20
4 changed files with 99 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { Link, useRouterState } from '@tanstack/react-router'
import type { LucideIcon } from 'lucide-react'
import { HomeIcon, ListTodoIcon, SettingsIcon, ShoppingCartIcon } from 'lucide-react'
import { focusNewItemInput } from '@/components/items/create-item-form'
import { NavUser } from '@/components/layout/nav-user'
import {
Sidebar,
@@ -43,7 +44,7 @@ export function AppSidebar() {
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<Link to="/">
<Link to="/" onClick={() => focusNewItemInput(pathname)}>
<div className="bg-primary text-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg text-sm font-semibold">
SL
</div>
@@ -68,7 +69,10 @@ export function AppSidebar() {
isActive={isActive(pathname, item.to)}
tooltip={item.title}
>
<Link to={item.to}>
<Link
to={item.to}
onClick={item.to === '/' ? () => focusNewItemInput(pathname) : undefined}
>
<item.icon />
<span>{item.title}</span>
</Link>