From 1df1e34c21ca5b2e57ef73bfded4894c456e79ab Mon Sep 17 00:00:00 2001 From: SylvainP1 <5533467-SylvainP1@users.noreply.replit.com> Date: Tue, 14 Apr 2026 08:19:30 +0000 Subject: [PATCH] Add optional description field for time entries and improve button accessibility Update API and frontend to include an optional description field for time entries and move the quick entry button to the sidebar for better visibility. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 55837015-10e9-4be9-b857-7f5e6be73772 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 734a5162-3dd4-4103-b626-ee12b22fd002 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1cc377db-7ea0-49f2-97ce-c3e87e0228cc/55837015-10e9-4be9-b857-7f5e6be73772/1SIrmNK Replit-Helium-Checkpoint-Created: true --- artifacts/api-server/src/routes/quickEntry.ts | 6 ++-- .../cra-app/src/components/layout/layout.tsx | 6 +--- .../cra-app/src/components/layout/sidebar.tsx | 7 ++++- .../cra-app/src/components/quick-entry.tsx | 31 ++++++++++++++++--- .../src/generated/api.schemas.ts | 1 + lib/api-spec/openapi.yaml | 3 ++ lib/api-zod/src/generated/api.ts | 1 + .../src/generated/types/quickAddTimeBody.ts | 1 + lib/db/src/schema/timeEntries.ts | 3 +- 9 files changed, 45 insertions(+), 14 deletions(-) diff --git a/artifacts/api-server/src/routes/quickEntry.ts b/artifacts/api-server/src/routes/quickEntry.ts index 5e64a89..9257bde 100644 --- a/artifacts/api-server/src/routes/quickEntry.ts +++ b/artifacts/api-server/src/routes/quickEntry.ts @@ -15,7 +15,7 @@ router.post("/quick-entry", async (req, res): Promise => { return; } - const { projectId, hours, collaborator } = parsed.data; + const { projectId, hours, collaborator, description } = parsed.data; const rawDate = parsed.data.date; const dateStr = rawDate instanceof Date ? rawDate.toISOString().split("T")[0] @@ -87,14 +87,14 @@ router.post("/quick-entry", async (req, res): Promise => { } else { [entry] = await db .update(timeEntriesTable) - .set({ hours }) + .set({ hours, description: description ?? existing.description }) .where(eq(timeEntriesTable.id, existing.id)) .returning(); } } else if (hours > 0) { [entry] = await db .insert(timeEntriesTable) - .values({ timesheetLineId: line.id, date: dateStr, hours }) + .values({ timesheetLineId: line.id, date: dateStr, hours, description: description ?? null }) .returning(); } else { entry = { id: 0, timesheetLineId: line.id, date: dateStr, hours: 0 }; diff --git a/artifacts/cra-app/src/components/layout/layout.tsx b/artifacts/cra-app/src/components/layout/layout.tsx index aa42483..31f2c2e 100644 --- a/artifacts/cra-app/src/components/layout/layout.tsx +++ b/artifacts/cra-app/src/components/layout/layout.tsx @@ -1,17 +1,13 @@ import { AppSidebar } from "./sidebar"; -import { QuickEntryButton } from "@/components/quick-entry"; export function AppLayout({ children }: { children: React.ReactNode }) { return (
-
+
{children}
-
- -
); diff --git a/artifacts/cra-app/src/components/layout/sidebar.tsx b/artifacts/cra-app/src/components/layout/sidebar.tsx index 21c4484..e4654fa 100644 --- a/artifacts/cra-app/src/components/layout/sidebar.tsx +++ b/artifacts/cra-app/src/components/layout/sidebar.tsx @@ -1,6 +1,7 @@ import { Link, useLocation } from "wouter"; -import { LayoutDashboard, Clock, FolderKanban, Settings } from "lucide-react"; +import { LayoutDashboard, Clock, FolderKanban, Zap } from "lucide-react"; import { cn } from "@/lib/utils"; +import { QuickEntryButton } from "@/components/quick-entry"; const navItems = [ { @@ -51,6 +52,10 @@ export function AppSidebar() { ); })} + +
+ +
diff --git a/artifacts/cra-app/src/components/quick-entry.tsx b/artifacts/cra-app/src/components/quick-entry.tsx index 2be13f0..5b5d6e1 100644 --- a/artifacts/cra-app/src/components/quick-entry.tsx +++ b/artifacts/cra-app/src/components/quick-entry.tsx @@ -25,6 +25,7 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import { Textarea } from "@/components/ui/textarea"; import { useToast } from "@/hooks/use-toast"; import { Zap, Clock, Check } from "lucide-react"; import { format } from "date-fns"; @@ -38,14 +39,14 @@ export function QuickEntryButton() { return ( <> - + ); @@ -61,6 +62,7 @@ function QuickEntryDialog({ const [projectId, setProjectId] = useState(""); const [date, setDate] = useState(format(new Date(), "yyyy-MM-dd")); const [hours, setHours] = useState(1); + const [description, setDescription] = useState(""); const [success, setSuccess] = useState(false); const [lastEntry, setLastEntry] = useState<{ projectName: string; @@ -92,6 +94,7 @@ function QuickEntryDialog({ date, hours, collaborator: COLLABORATOR, + description: description.trim() || undefined, }, }, { @@ -133,6 +136,7 @@ function QuickEntryDialog({ setSuccess(false); setProjectId(""); setHours(1); + setDescription(""); setDate(format(new Date(), "yyyy-MM-dd")); onOpenChange(false); }; @@ -141,6 +145,7 @@ function QuickEntryDialog({ setSuccess(false); setProjectId(""); setHours(1); + setDescription(""); }; const activeProjects = projects?.filter((p) => p.isActive) ?? []; @@ -258,9 +263,22 @@ function QuickEntryDialog({
+
+ +