From 9452535a9f4f9bfa9c035f7cb62099cf1f0b9533 Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Fri, 27 Mar 2026 18:10:17 +0100 Subject: [PATCH] feat: implement NotePopover component for managing user notes and integrate it into UsersTable and RichiesteTable --- .../src/components/notePopover.tsx | 71 +++++++++ .../src/components/servizio/annuncio_card.tsx | 105 ++++++++++++- .../src/components/tables/richieste-table.tsx | 146 ++++++++---------- .../src/components/tables/users-table.tsx | 57 +++++-- apps/infoalloggi/src/lib/tableUtils.ts | 28 ++++ .../src/server/controllers/user.controller.ts | 20 ++- 6 files changed, 328 insertions(+), 99 deletions(-) create mode 100644 apps/infoalloggi/src/components/notePopover.tsx create mode 100644 apps/infoalloggi/src/lib/tableUtils.ts diff --git a/apps/infoalloggi/src/components/notePopover.tsx b/apps/infoalloggi/src/components/notePopover.tsx new file mode 100644 index 0000000..eb31edc --- /dev/null +++ b/apps/infoalloggi/src/components/notePopover.tsx @@ -0,0 +1,71 @@ +import { NotebookPen } from "lucide-react"; +import { useState } from "react"; +import LoadingButton from "~/components/custom_ui/loading-button"; +import { Button } from "~/components/ui/button"; +import { + Popover, + PopoverContent, + PopoverDescription, + PopoverHeader, + PopoverTitle, + PopoverTrigger, +} from "~/components/ui/popover"; +import { Textarea } from "~/components/ui/textarea"; +import type { UsersId } from "~/schemas/public/Users"; + +export const NotePopover = ({ + userId, + note, + mutate, + isPending, +}: { + userId: UsersId; + note: string | null; + mutate: (data: { id: UsersId; data: { note: string | null } }) => void; + isPending: boolean; +}) => { + const [newNote, setNewNote] = useState(note); + + return ( + + +
+ + {note && note.trim().length > 0 && ( + + + + )} +
+
+ + + Annunci Inseriti + Desc + +
+