From b1cf2fdd184e585115f52e4f3689ddabf6a7d254 Mon Sep 17 00:00:00 2001 From: David Arranz Date: Thu, 29 Aug 2024 16:59:33 +0200 Subject: [PATCH] . --- client/src/app/StartPage.tsx | 2 +- client/src/app/dashboard/index.tsx | 422 +----------------- .../app/quotes/components/QuotesDataTable.tsx | 1 + client/src/app/quotes/edit.tsx | 10 +- client/src/components/Layout/LayoutHeader.tsx | 8 +- .../Layout/components/UserButton.tsx | 22 +- .../src/lib/axios/createAxiosAuthActions.ts | 2 +- client/src/lib/hooks/useAuth/useLogin.tsx | 8 +- 8 files changed, 29 insertions(+), 446 deletions(-) diff --git a/client/src/app/StartPage.tsx b/client/src/app/StartPage.tsx index a28f291..528e0c2 100644 --- a/client/src/app/StartPage.tsx +++ b/client/src/app/StartPage.tsx @@ -21,5 +21,5 @@ export const StartPage = () => { ); } - return ; + return ; }; diff --git a/client/src/app/dashboard/index.tsx b/client/src/app/dashboard/index.tsx index 5c2c84b..0eebc10 100644 --- a/client/src/app/dashboard/index.tsx +++ b/client/src/app/dashboard/index.tsx @@ -1,49 +1,6 @@ -import { - ChevronLeft, - ChevronRight, - Copy, - CreditCard, - File, - ListFilter, - MoreVertical, - Truck, -} from "lucide-react"; - import { Layout, LayoutContent, LayoutHeader } from "@/components"; import { useGetProfile } from "@/lib/hooks"; -import { - Badge, - Button, - Card, - CardContent, - CardDescription, - CardFooter, - CardHeader, - CardTitle, - DropdownMenu, - DropdownMenuCheckboxItem, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuTrigger, - Pagination, - PaginationContent, - PaginationItem, - Progress, - Separator, - Skeleton, - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, - Tabs, - TabsContent, - TabsList, - TabsTrigger, -} from "@/ui"; +import { Skeleton } from "@/ui"; import { t } from "i18next"; import { useNavigate } from "react-router-dom"; @@ -64,383 +21,6 @@ export const DashboardPage = () => { ) : ( )} - -
-
-
- - - Tus Cotizaciones - - Introducing Our Dynamic Orders Dashboard for Seamless Management and Insightful - Analysis. - - - - - - - - - This Week - $1,329 - - -
+25% from last week
-
- - - -
- - - This Month - $5,329 - - -
+10% from last month
-
- - - -
-
- -
- - Week - Month - Year - -
- - - - - - Filter by - - Fulfilled - Declined - Refunded - - - -
-
- - - - Orders - Recent orders from your store. - - - - - - Customer - Type - Status - Date - Amount - - - - - -
Liam Johnson
-
- liam@example.com -
-
- Sale - - - Fulfilled - - - 2023-06-23 - $250.00 -
- - -
Olivia Smith
-
- olivia@example.com -
-
- Refund - - - Declined - - - 2023-06-24 - $150.00 -
- - -
Noah Williams
-
- noah@example.com -
-
- Subscription - - - Fulfilled - - - 2023-06-25 - $350.00 -
- - -
Emma Brown
-
- emma@example.com -
-
- Sale - - - Fulfilled - - - 2023-06-26 - $450.00 -
- - -
Liam Johnson
-
- liam@example.com -
-
- Sale - - - Fulfilled - - - 2023-06-23 - $250.00 -
- - -
Liam Johnson
-
- liam@example.com -
-
- Sale - - - Fulfilled - - - 2023-06-23 - $250.00 -
- - -
Olivia Smith
-
- olivia@example.com -
-
- Refund - - - Declined - - - 2023-06-24 - $150.00 -
- - -
Emma Brown
-
- emma@example.com -
-
- Sale - - - Fulfilled - - - 2023-06-26 - $450.00 -
-
-
-
-
-
-
-
-
- - -
- - Order Oe31b70H - - - Date: November 23, 2023 -
-
- - - - - - - Edit - Export - - Trash - - -
-
- -
-
Order Details
-
    -
  • - - Glimmer Lamps x 2 - - $250.00 -
  • -
  • - - Aqua Filters x 1 - - $49.00 -
  • -
- -
    -
  • - Subtotal - $299.00 -
  • -
  • - Shipping - $5.00 -
  • -
  • - Tax - $25.00 -
  • -
  • - Total - $329.00 -
  • -
-
- -
-
-
Shipping Information
-
- Liam Johnson - 1234 Main St. - Anytown, CA 12345 -
-
-
-
Billing Information
-
Same as shipping address
-
-
- -
-
Customer Information
-
-
-
Customer
-
Liam Johnson
-
-
-
Email
-
- liam@acme.com -
-
-
-
Phone
-
- +1 234 567 890 -
-
-
-
- -
-
Payment Information
-
-
-
- - Visa -
-
**** **** **** 4532
-
-
-
-
- -
- Updated -
- - - - - - - - - - -
-
-
-
); diff --git a/client/src/app/quotes/components/QuotesDataTable.tsx b/client/src/app/quotes/components/QuotesDataTable.tsx index b54eb2c..b1052f3 100644 --- a/client/src/app/quotes/components/QuotesDataTable.tsx +++ b/client/src/app/quotes/components/QuotesDataTable.tsx @@ -39,6 +39,7 @@ export const QuotesDataTable = ({ status?: string; preview?: boolean; }) => { + const location = useLocation(); const navigate = useNavigate(); const { toast } = useToast(); diff --git a/client/src/app/quotes/edit.tsx b/client/src/app/quotes/edit.tsx index dd88315..7d07603 100644 --- a/client/src/app/quotes/edit.tsx +++ b/client/src/app/quotes/edit.tsx @@ -236,6 +236,14 @@ export const QuoteEdit = () => { return () => unsubscribe(); }, [watch, getValues, setValue]); + const handleClose = () => { + navigate("/quotes", { + state: { + id: quoteId, + }, + }); + }; + if (isSubmitting || isPending) { return ; } @@ -264,7 +272,7 @@ export const QuoteEdit = () => { label={t("common.close")} variant='secondary' size='sm' - onClick={() => navigate("/quotes")} + onClick={handleClose} /> { Uecko - { )} > - + */} { Uecko - + {/* - + */} diff --git a/client/src/components/Layout/components/UserButton.tsx b/client/src/components/Layout/components/UserButton.tsx index e53cf93..c5396b2 100644 --- a/client/src/components/Layout/components/UserButton.tsx +++ b/client/src/components/Layout/components/UserButton.tsx @@ -7,23 +7,17 @@ import { DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, - DropdownMenuShortcut, DropdownMenuTrigger, } from "@/ui"; import { t } from "i18next"; -import { - CircleUserIcon, - LogOutIcon, - MessageCircleQuestionIcon, - SettingsIcon, - UserIcon, -} from "lucide-react"; +import { CircleUserIcon, LogOutIcon, SettingsIcon } from "lucide-react"; import { SyntheticEvent, useState } from "react"; import { useNavigate } from "react-router-dom"; export const UserButton = () => { const [userMenuOpened, setUserMenuOpened] = useState(false); const navigate = useNavigate(); + const { openDialog: openLogoutDialog, DialogComponent: LogoutDialog } = useCustomDialog({ title: t("main_menu.logout_dialog.title"), description: t("main_menu.logout_dialog.description"), @@ -33,6 +27,7 @@ export const UserButton = () => { navigate("/logout"); }, }); + const { data, status } = useGetProfile(); const openUserMenu = (event: SyntheticEvent) => { @@ -64,25 +59,24 @@ export const UserButton = () => { {t("main_menu.user.my_account")} - + {/* {t("main_menu.user.profile")} ⇧⌘P - - + */} + navigate("/settings")}> {t("main_menu.user.settings")} - + {/* {t("main_menu.user.support")} - + */} openLogoutDialog()}> {t("main_menu.user.logout")} - ⇧⌘Q {LogoutDialog} diff --git a/client/src/lib/axios/createAxiosAuthActions.ts b/client/src/lib/axios/createAxiosAuthActions.ts index 1a37819..ac32658 100644 --- a/client/src/lib/axios/createAxiosAuthActions.ts +++ b/client/src/lib/axios/createAxiosAuthActions.ts @@ -24,7 +24,7 @@ export const createAxiosAuthActions = ( return { success: true, data, - redirectTo: "/home", + redirectTo: "/quotes", }; } catch (error) { return { diff --git a/client/src/lib/hooks/useAuth/useLogin.tsx b/client/src/lib/hooks/useAuth/useLogin.tsx index d64e538..ff6b88c 100644 --- a/client/src/lib/hooks/useAuth/useLogin.tsx +++ b/client/src/lib/hooks/useAuth/useLogin.tsx @@ -2,11 +2,12 @@ import { AuthActionResponse, useAuth } from "@/lib/hooks"; import { ILogin_DTO } from "@shared/contexts"; import { UseMutationOptions, useMutation } from "@tanstack/react-query"; import { useNavigate } from "react-router-dom"; -import { toast } from "react-toastify"; +import { useToast } from "@/ui/use-toast"; import { useQueryKey } from "../useQueryKey"; export const useLogin = (params?: UseMutationOptions) => { + const { toast } = useToast(); const { onSuccess, onError, ...restParams } = params || {}; const keys = useQueryKey(); const { login } = useAuth(); @@ -18,8 +19,7 @@ export const useLogin = (params?: UseMutationOptions { const { success, redirectTo } = data; if (success && redirectTo) { - console.log("redirect to /home"); - navigate(redirectTo || "/home", { replace: false }); + navigate(redirectTo || "/quotes", { replace: false }); } if (onSuccess) { onSuccess(data, variables, context); @@ -29,7 +29,7 @@ export const useLogin = (params?: UseMutationOptions