@@ -5,10 +5,8 @@ import {
55 ChevronUpIcon ,
66 ExclamationTriangleIcon ,
77 LightBulbIcon ,
8- MagnifyingGlassIcon ,
98 UserPlusIcon ,
109 VideoCameraIcon ,
11- XMarkIcon ,
1210} from "@heroicons/react/20/solid" ;
1311import { json , type MetaFunction } from "@remix-run/node" ;
1412import { Link , useFetcher , useRevalidator } from "@remix-run/react" ;
@@ -38,7 +36,6 @@ import { Callout } from "~/components/primitives/Callout";
3836import { formatDateTime } from "~/components/primitives/DateTime" ;
3937import { Dialog , DialogContent , DialogHeader , DialogTitle } from "~/components/primitives/Dialog" ;
4038import { Header2 , Header3 } from "~/components/primitives/Headers" ;
41- import { Input } from "~/components/primitives/Input" ;
4239import { NavBar , PageAccessories , PageTitle } from "~/components/primitives/PageHeader" ;
4340import { Paragraph } from "~/components/primitives/Paragraph" ;
4441import { PopoverMenuItem } from "~/components/primitives/Popover" ;
@@ -50,6 +47,7 @@ import {
5047 ResizablePanelGroup ,
5148 collapsibleHandleClassName ,
5249} from "~/components/primitives/Resizable" ;
50+ import { SearchInput } from "~/components/primitives/SearchInput" ;
5351import { Spinner } from "~/components/primitives/Spinner" ;
5452import { StepNumber } from "~/components/primitives/StepNumber" ;
5553import {
@@ -62,7 +60,6 @@ import {
6260 TableHeaderCell ,
6361 TableRow ,
6462} from "~/components/primitives/Table" ;
65- import { ShortcutKey } from "~/components/primitives/ShortcutKey" ;
6663import { SimpleTooltip } from "~/components/primitives/Tooltip" ;
6764import TooltipPortal from "~/components/primitives/TooltipPortal" ;
6865import { TaskFileName } from "~/components/runs/v3/TaskPath" ;
@@ -76,6 +73,7 @@ import { useEventSource } from "~/hooks/useEventSource";
7673import { useFuzzyFilter } from "~/hooks/useFuzzyFilter" ;
7774import { useOrganization } from "~/hooks/useOrganizations" ;
7875import { useProject } from "~/hooks/useProject" ;
76+ import { useSearchParams } from "~/hooks/useSearchParam" ;
7977import { findProjectBySlug } from "~/models/project.server" ;
8078import { findEnvironmentBySlug } from "~/models/runtimeEnvironment.server" ;
8179import {
@@ -89,7 +87,6 @@ import {
8987 uiPreferencesStorage ,
9088} from "~/services/preferences/uiPreferences.server" ;
9189import { requireUserId } from "~/services/session.server" ;
92- import { motion } from "framer-motion" ;
9390import { cn } from "~/utils/cn" ;
9491import {
9592 docsPath ,
@@ -177,9 +174,11 @@ export default function Page() {
177174 const environment = useEnvironment ( ) ;
178175 const { tasks, activity, runningStats, durations, usefulLinksPreference } =
179176 useTypedLoaderData < typeof loader > ( ) ;
180- const { filterText, setFilterText, filteredItems } = useFuzzyFilter < TaskListItem > ( {
177+ const { value } = useSearchParams ( ) ;
178+ const { filteredItems } = useFuzzyFilter < TaskListItem > ( {
181179 items : tasks ,
182180 keys : [ "slug" , "filePath" , "triggerSource" ] ,
181+ filterText : value ( "search" ) ?? "" ,
183182 } ) ;
184183
185184 const hasTasks = tasks . length > 0 ;
@@ -245,12 +244,7 @@ export default function Page() {
245244 { tasks . length === 0 ? < UserHasNoTasks /> : null }
246245 < div className = "max-h-full overflow-hidden" >
247246 < div className = "flex items-center justify-between gap-1 p-2" >
248- < AnimatedSearchField
249- value = { filterText }
250- onChange = { setFilterText }
251- placeholder = "Search tasks…"
252- autoFocus
253- />
247+ < SearchInput placeholder = "Search tasks…" autoFocus />
254248 { ! showUsefulLinks && (
255249 < Button
256250 variant = "secondary/small"
@@ -868,73 +862,3 @@ function FailedToLoadStats() {
868862 ) ;
869863}
870864
871- function AnimatedSearchField ( {
872- value,
873- onChange,
874- placeholder,
875- autoFocus,
876- } : {
877- value : string ;
878- onChange : ( value : string ) => void ;
879- placeholder ?: string ;
880- autoFocus ?: boolean ;
881- } ) {
882- const [ isFocused , setIsFocused ] = useState ( false ) ;
883-
884- return (
885- < motion . div
886- initial = { { width : "auto" } }
887- animate = { { width : isFocused && value . length > 0 ? "24rem" : "auto" } }
888- transition = { { type : "spring" , stiffness : 300 , damping : 30 } }
889- className = "relative h-6 min-w-52"
890- >
891- < Input
892- type = "text"
893- variant = "secondary-small"
894- placeholder = { placeholder }
895- value = { value }
896- onChange = { ( e ) => onChange ( e . target . value ) }
897- fullWidth
898- autoFocus = { autoFocus }
899- className = { cn ( isFocused && "placeholder:text-text-dimmed/70" ) }
900- onFocus = { ( ) => setIsFocused ( true ) }
901- onBlur = { ( ) => setIsFocused ( false ) }
902- onKeyDown = { ( e ) => {
903- if ( e . key === "Escape" ) {
904- e . stopPropagation ( ) ;
905- onChange ( "" ) ;
906- e . currentTarget . blur ( ) ;
907- }
908- } }
909- icon = { < MagnifyingGlassIcon className = "size-4 text-text-bright" /> }
910- accessory = {
911- value . length > 0 ? (
912- < SimpleTooltip
913- asChild
914- button = {
915- < button
916- type = "button"
917- onPointerDown = { ( e ) => {
918- e . preventDefault ( ) ;
919- onChange ( "" ) ;
920- } }
921- className = "-mr-1 flex size-4.5 items-center justify-center rounded-[2px] border border-text-dimmed/40 text-text-dimmed transition hover:bg-charcoal-600 hover:text-text-bright"
922- >
923- < XMarkIcon className = "size-3" />
924- </ button >
925- }
926- content = {
927- < div className = "flex items-center gap-1" >
928- < span className = "text-text-dimmed" > Clear field</ span >
929- < ShortcutKey shortcut = { { key : "esc" } } variant = "small" />
930- </ div >
931- }
932- className = "px-2 py-1.5 text-xs"
933- disableHoverableContent
934- />
935- ) : undefined
936- }
937- />
938- </ motion . div >
939- ) ;
940- }
0 commit comments