From 79a45b141f377614ebd564ef30e7602907097ef0 Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Tue, 17 Jun 2025 20:20:48 -0400 Subject: [PATCH] Fixes --- backend/src/models/task.rs | 9 ++---- frontend/src/components/ui/folder-picker.tsx | 34 ++++++++++++++++---- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/backend/src/models/task.rs b/backend/src/models/task.rs index 47176054..36c61d99 100644 --- a/backend/src/models/task.rs +++ b/backend/src/models/task.rs @@ -200,11 +200,10 @@ impl Task { } pub async fn delete(pool: &SqlitePool, id: Uuid, project_id: Uuid) -> Result { - let project_id_str = project_id.to_string(); let result = sqlx::query!( "DELETE FROM tasks WHERE id = $1 AND project_id = $2", id, - project_id_str + project_id ) .execute(pool) .await?; @@ -216,12 +215,10 @@ impl Task { id: Uuid, project_id: Uuid, ) -> Result { - let id_str = id.to_string(); - let project_id_str = project_id.to_string(); let result = sqlx::query!( "SELECT id FROM tasks WHERE id = $1 AND project_id = $2", - id_str, - project_id_str + id, + project_id ) .fetch_optional(pool) .await?; diff --git a/frontend/src/components/ui/folder-picker.tsx b/frontend/src/components/ui/folder-picker.tsx index 853539d8..3a908426 100644 --- a/frontend/src/components/ui/folder-picker.tsx +++ b/frontend/src/components/ui/folder-picker.tsx @@ -1,9 +1,9 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect, useMemo } from 'react' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog' import { Alert, AlertDescription } from '@/components/ui/alert' -import { Folder, FolderOpen, File, AlertCircle, Home, ChevronUp } from 'lucide-react' +import { Folder, FolderOpen, File, AlertCircle, Home, ChevronUp, Search } from 'lucide-react' import { makeRequest } from '@/lib/api' import { DirectoryEntry } from 'shared/types' @@ -29,6 +29,14 @@ export function FolderPicker({ const [loading, setLoading] = useState(false) const [error, setError] = useState('') const [manualPath, setManualPath] = useState(value) + const [searchTerm, setSearchTerm] = useState('') + + const filteredEntries = useMemo(() => { + if (!searchTerm.trim()) return entries + return entries.filter(entry => + entry.name.toLowerCase().includes(searchTerm.toLowerCase()) + ) + }, [entries, searchTerm]) useEffect(() => { if (open) { @@ -113,7 +121,7 @@ export function FolderPicker({ return ( - + {title} {description} @@ -146,6 +154,20 @@ export function FolderPicker({ + {/* Search input */} +
+
Search current directory:
+
+ + setSearchTerm(e.target.value)} + placeholder="Filter folders and files..." + className="pl-10" + /> +
+
+ {/* Navigation */}