From cf1357553a23df47f5932a4215e8ba3cfa01c6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?= Date: Wed, 17 Dec 2025 00:33:46 -0300 Subject: [PATCH] update search command --- .../async-combobox.tsx | 117 ++++++++++-------- .../routes/_.$orgid.enrollments.add/route.tsx | 55 +++++--- 2 files changed, 103 insertions(+), 69 deletions(-) diff --git a/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.add/async-combobox.tsx b/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.add/async-combobox.tsx index b083545..4b1cf93 100644 --- a/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.add/async-combobox.tsx +++ b/apps/admin.saladeaula.digital/app/routes/_.$orgid.enrollments.add/async-combobox.tsx @@ -1,4 +1,4 @@ -import { useRequest, useToggle } from 'ahooks' +import { useBoolean, useRequest, useToggle } from 'ahooks' import { CheckIcon, UserIcon, XIcon, AlertTriangleIcon } from 'lucide-react' import { formatCPF } from '@brazilian-utils/brazilian-utils' @@ -29,18 +29,21 @@ import { Button } from '@repo/ui/components/ui/button' interface AsyncComboboxProps { value: any title: string + placeholder?: string onChange: (props: any) => void onSearch: (search: string) => Promise error?: any } export function AsyncCombobox({ title, + placeholder, value, onSearch, onChange, error }: AsyncComboboxProps) { const [open, { set }] = useToggle() + const [searched, { setTrue }] = useBoolean() const { data = [], loading, @@ -48,7 +51,8 @@ export function AsyncCombobox({ } = useRequest(onSearch, { manual: true, debounceWait: 300, - defaultParams: [''] + defaultParams: [''], + onSuccess: setTrue }) return ( @@ -72,7 +76,7 @@ export function AsyncCombobox({ + + + {/* Force rerender to reset the scroll position */} + Nenhum resultado encontrado. {filtered @@ -439,7 +459,7 @@ function FacetedFilter({ interface ScheduledForInputProps { value?: Date - onChange?: (value: any) => void + onChange?: (value: Date | undefined) => void } function ScheduledForInput({ value, onChange }: ScheduledForInputProps) { @@ -459,15 +479,17 @@ function ScheduledForInput({ value, onChange }: ScheduledForInputProps) { placeholder="Imediatamente" value={displayValue} /> + + {selected && (