From f286ea1bdc69b7946643e330ac70c50a6ccdc431 Mon Sep 17 00:00:00 2001 From: David Arranz Date: Mon, 26 Aug 2024 16:28:44 +0200 Subject: [PATCH] . --- client/package.json | 3 +- .../components/CatalogPickerDataTable.tsx | 4 +- .../app/quotes/components/QuotesDataTable.tsx | 1 - .../editors/CatalogPickerDialog.tsx | 60 ++++++++++++++----- .../editors/QuoteDetailsCardEditor.tsx | 2 +- client/src/locales/en.json | 3 +- client/src/locales/es.json | 3 +- client/src/ui/index.ts | 2 +- client/src/ui/toaster.tsx | 2 +- 9 files changed, 55 insertions(+), 25 deletions(-) diff --git a/client/package.json b/client/package.json index c7a19e0..a15715e 100644 --- a/client/package.json +++ b/client/package.json @@ -70,7 +70,8 @@ "react-wrap-balancer": "^1.1.1", "recharts": "^2.12.7", "slugify": "^1.6.6", - "use-debounce": "^10.0.3" + "use-debounce": "^10.0.3", + "vaul": "^0.9.1" }, "devDependencies": { "@tanstack/react-query-devtools": "^5.51.23", diff --git a/client/src/app/quotes/components/CatalogPickerDataTable.tsx b/client/src/app/quotes/components/CatalogPickerDataTable.tsx index f388dff..99f8674 100644 --- a/client/src/app/quotes/components/CatalogPickerDataTable.tsx +++ b/client/src/app/quotes/components/CatalogPickerDataTable.tsx @@ -62,9 +62,7 @@ export const CatalogPickerDataTable = ({ onSelect }: { onSelect: (data: unknown) }} > - - {t("common.add")} - + {t("common.add")} ), }, diff --git a/client/src/app/quotes/components/QuotesDataTable.tsx b/client/src/app/quotes/components/QuotesDataTable.tsx index 2f703a5..9a74fa7 100644 --- a/client/src/app/quotes/components/QuotesDataTable.tsx +++ b/client/src/app/quotes/components/QuotesDataTable.tsx @@ -225,7 +225,6 @@ export const QuotesDataTable = ({ }, [data, table]); const handleFinishDownload = useCallback(() => { - console.log("Download success!!"); toast({ description: t("quotes.downloading_dialog.toast_success"), }); diff --git a/client/src/app/quotes/components/editors/CatalogPickerDialog.tsx b/client/src/app/quotes/components/editors/CatalogPickerDialog.tsx index 49f85f7..f926725 100644 --- a/client/src/app/quotes/components/editors/CatalogPickerDialog.tsx +++ b/client/src/app/quotes/components/editors/CatalogPickerDialog.tsx @@ -6,9 +6,16 @@ import { DialogFooter, DialogHeader, DialogTitle, + Drawer, + DrawerClose, + DrawerContent, + DrawerDescription, + DrawerFooter, + DrawerHeader, + DrawerTitle, } from "@/ui"; -import { DataTableProvider } from "@/lib/hooks"; +import { DataTableProvider, useMediaQuery } from "@/lib/hooks"; import { t } from "i18next"; import { CatalogPickerDataTable } from "../CatalogPickerDataTable"; @@ -21,23 +28,46 @@ export const CatalogPickerDialog = ({ onOpenChange: (open: boolean) => void; onSelect: (data: unknown) => void; }) => { + const isDesktop = useMediaQuery("(min-width: 768px)"); + + if (isDesktop) { + return ( + + + + {t("quotes.catalog_picker_dialog.title")} + {t("quotes.catalog_picker_dialog.description")} + + + + + + + + + + + ); + } + return ( - - - - {t("quotes.catalog_picker_dialog.title")} - {t("quotes.catalog_picker_dialog.description")} - + + + + {t("quotes.catalog_picker_dialog.title")} + {t("quotes.catalog_picker_dialog.description")} + - - - - - - + + + + + + + ); }; diff --git a/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx b/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx index 011f87e..b58d2fd 100644 --- a/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx +++ b/client/src/app/quotes/components/editors/QuoteDetailsCardEditor.tsx @@ -203,7 +203,7 @@ export const QuoteDetailsCardEditor = ({ unit_price: article.retail_price, }); toast({ - title: "Artículo del catálog añadido:", + title: t("quotes.catalog_picker_dialog.toast_article_added"), description: article.description, }); }, diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 8c208b6..5f35925 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -192,7 +192,8 @@ }, "catalog_picker_dialog": { "title": "Select catalog items", - "description": "To complete your quote, you can add items from the catalog." + "description": "To complete your quote, you can add items from the catalog.", + "toast_article_added": "Catalog item added:" }, "status": { "draft": "Draft" diff --git a/client/src/locales/es.json b/client/src/locales/es.json index bd891de..dc36921 100644 --- a/client/src/locales/es.json +++ b/client/src/locales/es.json @@ -188,7 +188,8 @@ }, "catalog_picker_dialog": { "title": "Seleccionar artículos del catálogo", - "description": "Para rellenar su cotización, puede añadir artículos del catálogo." + "description": "Para rellenar su cotización, puede añadir artículos del catálogo.", + "toast_article_added": "Artículo del catálogo añadido:" }, "status": { "draft": "Borrador" diff --git a/client/src/ui/index.ts b/client/src/ui/index.ts index d74dcca..ad8c435 100644 --- a/client/src/ui/index.ts +++ b/client/src/ui/index.ts @@ -15,6 +15,7 @@ export * from "./collapsible"; export * from "./command"; export * from "./context-menu"; export * from "./dialog"; +export * from "./drawer"; export * from "./dropdown-menu"; export * from "./form"; export * from "./hover-card"; @@ -43,4 +44,3 @@ export * from "./toaster"; export * from "./toggle"; export * from "./toggle-group"; export * from "./tooltip"; - diff --git a/client/src/ui/toaster.tsx b/client/src/ui/toaster.tsx index 3542717..ba17c72 100644 --- a/client/src/ui/toaster.tsx +++ b/client/src/ui/toaster.tsx @@ -17,7 +17,7 @@ export function Toaster() { return (
- {title && º{title}} + {title && {title}} {description && {description}}
{action}