From 922a281c232cb20e007ca15a47f797c11d1fc342 Mon Sep 17 00:00:00 2001 From: Stivenjs Date: Thu, 8 May 2025 11:48:16 -0500 Subject: [PATCH 1/3] refactor(layouts): reorganize layout and component structure for better maintainability Consolidated layout files under a unified structure, moving from `(with-navbar)` and `(without-navbar)` to `(main-layout)` and `(setup-layout)`. Updated related components and hooks to reflect this change. Additionally, refactored custom hooks and schemas into a more organized `ui` and `zod-schemas` directory structure. This improves code readability and maintainability while reducing redundancy. --- .../anim/cancel-animation.json | 0 .../account-settings/anim/not-found.json | 0 .../anim/success-animation.json | 0 .../components/AccountSettings.tsx | 10 +++---- .../components/ActiveSessions.tsx | 2 +- .../components/CancellationDialog.tsx | 0 .../components/ChangeEmailDialog.tsx | 6 ++-- .../components/ChangePasswordDialog.tsx | 4 +-- .../components/EditProfileDialog.tsx | 8 +++--- .../components/PaymentSettings.tsx | 8 +++--- .../account-settings/components/SideBar.tsx | 0 .../components/SubscriptionCard.tsx | 0 .../components/UserAvatar.tsx | 2 +- .../hooks/useDeviceSessions.ts | 0 .../hooks/usePasswordManagement.ts | 0 .../hooks/useUpdateProfilePicture.ts | 0 .../hooks/useUserAttributes.ts | 0 .../account-settings/page.tsx | 10 +++---- .../landing/components/AboutUs.tsx | 0 .../landing/components/DocsLanding.tsx | 22 +++++++-------- .../landing/components/DropshippingIntro.tsx | 0 .../landing/components/FashionSlider.tsx | 0 .../landing/components/Feature.tsx | 0 .../landing/components/FirstView.tsx | 0 .../landing/components/Footer.tsx | 0 .../landing/components/LogoCarousell.tsx | 0 .../landing/components/MarqueeLogos.tsx | 0 .../landing/components/NavBar.tsx | 8 +++--- .../landing/components/Platform.tsx | 0 .../landing/components/StepGuide.tsx | 0 .../landing/components/Testimonials.tsx | 0 .../landing/components/UserMenu.tsx | 0 .../landing/components/navigation.ts | 0 .../layout.tsx | 2 +- app/{(with-navbar) => (main-layout)}/page.tsx | 2 +- .../pricing/components/FAQItem.tsx | 0 .../pricing/components/FAQSection.tsx | 0 .../pricing/components/FeatureComparison.tsx | 0 .../pricing/components/PricingCard.tsx | 8 +++--- .../pricing/components/plans.ts | 0 .../pricing/page.tsx | 12 ++++---- .../components/SubscriptionSuccess.tsx | 2 +- .../components/WelcomeScreen.tsx | 0 .../subscription-success/page.tsx | 6 ++-- .../terms/components/LegalDocuments.tsx | 0 .../terms/components/legal-content.json | 0 .../terms/page.tsx | 2 +- .../components/AdditionalSettings.tsx | 0 .../BackgroundGradientAnimation.tsx | 0 .../components/MultiStepLoader.tsx | 0 .../first-steps/components/PersonalInfo.tsx | 0 .../first-steps/components/StoreInfo.tsx | 2 +- .../first-steps/data/selling-options.json | 0 .../first-steps/hooks/useApiKeyEncryption.ts | 0 .../hooks/useStoreNameValidator.ts | 0 .../first-steps/hooks/useUserStoreData.ts | 0 .../first-steps/page.tsx | 16 +++++------ .../layout.tsx | 0 .../login/AuthForm.tsx | 8 +++--- .../login/components/AuthClient.tsx | 4 +-- .../login/components/ImageSlider.tsx | 0 .../forgot-password/ForgotPasswordForm.tsx | 2 +- .../login/components/sing-in/SignInForm.tsx | 4 +-- .../login/components/sing-up/SignUpForm.tsx | 4 +-- .../verification-form/VerificationForm.tsx | 4 +-- .../login/hooks/SignIn.ts | 0 .../login/hooks/signUp.ts | 0 .../login/hooks/updatePlan.ts | 0 .../login/hooks/useResetPassword.ts | 0 .../login/page.tsx | 2 +- .../my-store/components/StoreSelector.tsx | 2 +- .../my-store/hooks/useUserStores.ts | 0 .../my-store/page.tsx | 4 +-- app/not-found.tsx | 2 +- .../ai-chat/{ai-input.tsx => AiInput.tsx} | 2 +- app/store/components/ai-chat/ChatTrigger.tsx | 28 ++++++------------- .../components/ai-chat/GradientSparkles.tsx | 22 +++++++++++---- .../components/ai-chat/RefinedAiAssistant.tsx | 8 +++--- .../app-integration/AppIntegrationPage.tsx | 2 +- .../app-integration/ConnectModal.tsx | 6 ++-- .../components/domains/ChangeDomainDialog.tsx | 2 +- .../components/domains/DomainManagement.tsx | 2 +- .../domains/EditStoreProfileDialog.tsx | 9 ++++-- .../domains/utils/storeProfileUtils.ts | 2 +- app/store/components/payments/ApiKeyModal.tsx | 6 +++- .../components/payments/PaymentSettings.tsx | 4 +-- .../product-management/ProductForm.tsx | 4 +-- .../collection-form/form-page.tsx | 4 +-- .../collection-form/product-section.tsx | 2 +- .../sections/attributes-section.tsx | 2 +- .../sections/basic-info-section.tsx | 2 +- .../sections/images-section.tsx | 2 +- .../sections/price-suggestion-panel.tsx | 2 +- .../sections/pricing-inventory-section.tsx | 2 +- .../sections/pricing-section.tsx | 2 +- .../sections/publication-section.tsx | 2 +- .../product-management/utils/productUtils.ts | 2 +- .../components/sidebar/AppAccessGuard.tsx | 2 +- app/store/components/sidebar/app-sidebar.tsx | 4 +-- app/store/components/sidebar/nav-apps.tsx | 3 +- app/store/components/sidebar/nav-main.tsx | 2 +- app/store/components/sidebar/nav-user.tsx | 4 +-- .../components/store-config/LogoUploader.tsx | 4 +-- .../components/store-config/ThemePreview.tsx | 2 +- .../components/store-setup/EcommerceSetup.tsx | 4 +-- .../components/store-setup/PricingDrawer.tsx | 10 +++---- app/store/hooks/useS3Images.ts | 2 +- app/store/hooks/useStore.ts | 2 +- components/ui/sidebar.tsx | 2 +- components/ui/toaster.tsx | 2 +- components/ui/toasts.tsx | 2 +- .../core}/storeDataStore.ts | 0 .../core}/useSubscriptionStore.ts | 0 {zustand-states => context/core}/userStore.ts | 0 {hooks/auth => context/hooks}/useAuth.ts | 4 +-- hooks/{ => ui}/use-auto-resize-textare.tsx | 0 hooks/{ => ui}/use-media-query.ts | 0 hooks/{ => ui}/use-mobile.tsx | 0 hooks/{ => ui}/use-toast.ts | 0 .../use-toast.ts => ui/use-toasts.ts} | 0 .../{ => ui}/use-unsaved-changes-warning.tsx | 0 lib/{schemas => zod-schemas}/api-keys.ts | 0 lib/{schemas => zod-schemas}/email-change.ts | 0 lib/{schemas => zod-schemas}/first-step.ts | 0 .../password-change.ts | 0 .../product-schema.ts | 0 lib/{schemas => zod-schemas}/schemas.ts | 0 .../store-profile-schema.ts | 0 test/unit/components/StoreSelector.test.tsx | 4 +-- test/unit/hooks/SignIn.test.ts | 2 +- test/unit/hooks/signUp.test.ts | 2 +- test/unit/hooks/useResetPassword.test.ts | 2 +- 132 files changed, 176 insertions(+), 170 deletions(-) rename app/{(with-navbar) => (main-layout)}/account-settings/anim/cancel-animation.json (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/anim/not-found.json (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/anim/success-animation.json (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/AccountSettings.tsx (96%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/ActiveSessions.tsx (99%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/CancellationDialog.tsx (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/ChangeEmailDialog.tsx (97%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/ChangePasswordDialog.tsx (97%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/EditProfileDialog.tsx (95%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/PaymentSettings.tsx (95%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/SideBar.tsx (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/SubscriptionCard.tsx (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/components/UserAvatar.tsx (97%) rename app/{(with-navbar) => (main-layout)}/account-settings/hooks/useDeviceSessions.ts (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/hooks/usePasswordManagement.ts (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/hooks/useUpdateProfilePicture.ts (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/hooks/useUserAttributes.ts (100%) rename app/{(with-navbar) => (main-layout)}/account-settings/page.tsx (88%) rename app/{(with-navbar) => (main-layout)}/landing/components/AboutUs.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/DocsLanding.tsx (58%) rename app/{(with-navbar) => (main-layout)}/landing/components/DropshippingIntro.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/FashionSlider.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/Feature.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/FirstView.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/Footer.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/LogoCarousell.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/MarqueeLogos.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/NavBar.tsx (97%) rename app/{(with-navbar) => (main-layout)}/landing/components/Platform.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/StepGuide.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/Testimonials.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/UserMenu.tsx (100%) rename app/{(with-navbar) => (main-layout)}/landing/components/navigation.ts (100%) rename app/{(with-navbar) => (main-layout)}/layout.tsx (87%) rename app/{(with-navbar) => (main-layout)}/page.tsx (95%) rename app/{(with-navbar) => (main-layout)}/pricing/components/FAQItem.tsx (100%) rename app/{(with-navbar) => (main-layout)}/pricing/components/FAQSection.tsx (100%) rename app/{(with-navbar) => (main-layout)}/pricing/components/FeatureComparison.tsx (100%) rename app/{(with-navbar) => (main-layout)}/pricing/components/PricingCard.tsx (97%) rename app/{(with-navbar) => (main-layout)}/pricing/components/plans.ts (100%) rename app/{(with-navbar) => (main-layout)}/pricing/page.tsx (78%) rename app/{(with-navbar) => (main-layout)}/subscription-success/components/SubscriptionSuccess.tsx (98%) rename app/{(with-navbar) => (main-layout)}/subscription-success/components/WelcomeScreen.tsx (100%) rename app/{(with-navbar) => (main-layout)}/subscription-success/page.tsx (76%) rename app/{(with-navbar) => (main-layout)}/terms/components/LegalDocuments.tsx (100%) rename app/{(with-navbar) => (main-layout)}/terms/components/legal-content.json (100%) rename app/{(with-navbar) => (main-layout)}/terms/page.tsx (85%) rename app/{(without-navbar) => (setup-layout)}/first-steps/components/AdditionalSettings.tsx (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/components/BackgroundGradientAnimation.tsx (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/components/MultiStepLoader.tsx (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/components/PersonalInfo.tsx (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/components/StoreInfo.tsx (98%) rename app/{(without-navbar) => (setup-layout)}/first-steps/data/selling-options.json (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/hooks/useApiKeyEncryption.ts (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/hooks/useStoreNameValidator.ts (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/hooks/useUserStoreData.ts (100%) rename app/{(without-navbar) => (setup-layout)}/first-steps/page.tsx (95%) rename app/{(without-navbar) => (setup-layout)}/layout.tsx (100%) rename app/{(without-navbar) => (setup-layout)}/login/AuthForm.tsx (94%) rename app/{(without-navbar) => (setup-layout)}/login/components/AuthClient.tsx (69%) rename app/{(without-navbar) => (setup-layout)}/login/components/ImageSlider.tsx (100%) rename app/{(without-navbar) => (setup-layout)}/login/components/forgot-password/ForgotPasswordForm.tsx (99%) rename app/{(without-navbar) => (setup-layout)}/login/components/sing-in/SignInForm.tsx (97%) rename app/{(without-navbar) => (setup-layout)}/login/components/sing-up/SignUpForm.tsx (97%) rename app/{(without-navbar) => (setup-layout)}/login/components/verification-form/VerificationForm.tsx (97%) rename app/{(without-navbar) => (setup-layout)}/login/hooks/SignIn.ts (100%) rename app/{(without-navbar) => (setup-layout)}/login/hooks/signUp.ts (100%) rename app/{(without-navbar) => (setup-layout)}/login/hooks/updatePlan.ts (100%) rename app/{(without-navbar) => (setup-layout)}/login/hooks/useResetPassword.ts (100%) rename app/{(without-navbar) => (setup-layout)}/login/page.tsx (50%) rename app/{(without-navbar) => (setup-layout)}/my-store/components/StoreSelector.tsx (98%) rename app/{(without-navbar) => (setup-layout)}/my-store/hooks/useUserStores.ts (100%) rename app/{(without-navbar) => (setup-layout)}/my-store/page.tsx (70%) rename app/store/components/ai-chat/{ai-input.tsx => AiInput.tsx} (98%) rename {zustand-states => context/core}/storeDataStore.ts (100%) rename {zustand-states => context/core}/useSubscriptionStore.ts (100%) rename {zustand-states => context/core}/userStore.ts (100%) rename {hooks/auth => context/hooks}/useAuth.ts (97%) rename hooks/{ => ui}/use-auto-resize-textare.tsx (100%) rename hooks/{ => ui}/use-media-query.ts (100%) rename hooks/{ => ui}/use-mobile.tsx (100%) rename hooks/{ => ui}/use-toast.ts (100%) rename hooks/{custom-toast/use-toast.ts => ui/use-toasts.ts} (100%) rename hooks/{ => ui}/use-unsaved-changes-warning.tsx (100%) rename lib/{schemas => zod-schemas}/api-keys.ts (100%) rename lib/{schemas => zod-schemas}/email-change.ts (100%) rename lib/{schemas => zod-schemas}/first-step.ts (100%) rename lib/{schemas => zod-schemas}/password-change.ts (100%) rename lib/{schemas => zod-schemas}/product-schema.ts (100%) rename lib/{schemas => zod-schemas}/schemas.ts (100%) rename lib/{schemas => zod-schemas}/store-profile-schema.ts (100%) diff --git a/app/(with-navbar)/account-settings/anim/cancel-animation.json b/app/(main-layout)/account-settings/anim/cancel-animation.json similarity index 100% rename from app/(with-navbar)/account-settings/anim/cancel-animation.json rename to app/(main-layout)/account-settings/anim/cancel-animation.json diff --git a/app/(with-navbar)/account-settings/anim/not-found.json b/app/(main-layout)/account-settings/anim/not-found.json similarity index 100% rename from app/(with-navbar)/account-settings/anim/not-found.json rename to app/(main-layout)/account-settings/anim/not-found.json diff --git a/app/(with-navbar)/account-settings/anim/success-animation.json b/app/(main-layout)/account-settings/anim/success-animation.json similarity index 100% rename from app/(with-navbar)/account-settings/anim/success-animation.json rename to app/(main-layout)/account-settings/anim/success-animation.json diff --git a/app/(with-navbar)/account-settings/components/AccountSettings.tsx b/app/(main-layout)/account-settings/components/AccountSettings.tsx similarity index 96% rename from app/(with-navbar)/account-settings/components/AccountSettings.tsx rename to app/(main-layout)/account-settings/components/AccountSettings.tsx index bb9eb424..b1954682 100644 --- a/app/(with-navbar)/account-settings/components/AccountSettings.tsx +++ b/app/(main-layout)/account-settings/components/AccountSettings.tsx @@ -1,7 +1,7 @@ import { useState } from 'react' import { Pencil, BadgeCheck } from 'lucide-react' import { Button } from '@/components/ui/button' -import { EditProfileDialog } from '@/app/(with-navbar)/account-settings/components/EditProfileDialog' +import { EditProfileDialog } from '@/app/(main-layout)/account-settings/components/EditProfileDialog' import { AlertDialog, AlertDialogAction, @@ -16,10 +16,10 @@ import { Amplify } from 'aws-amplify' import { deleteUser } from 'aws-amplify/auth' import { useRouter } from 'next/navigation' import { LoadingIndicator } from '@/components/ui/loading-indicator' -import { UserAvatar } from '@/app/(with-navbar)/account-settings/components/UserAvatar' -import { ChangePasswordDialog } from '@/app/(with-navbar)/account-settings/components/ChangePasswordDialog' -import { ChangeEmailDialog } from '@/app/(with-navbar)/account-settings/components/ChangeEmailDialog' -import useUserStore from '@/zustand-states/userStore' +import { UserAvatar } from '@/app/(main-layout)/account-settings/components/UserAvatar' +import { ChangePasswordDialog } from '@/app/(main-layout)/account-settings/components/ChangePasswordDialog' +import { ChangeEmailDialog } from '@/app/(main-layout)/account-settings/components/ChangeEmailDialog' +import useUserStore from '@/context/core/userStore' import outputs from '@/amplify_outputs.json' import CustomToolTip from '@/components/ui/custom-tooltip' diff --git a/app/(with-navbar)/account-settings/components/ActiveSessions.tsx b/app/(main-layout)/account-settings/components/ActiveSessions.tsx similarity index 99% rename from app/(with-navbar)/account-settings/components/ActiveSessions.tsx rename to app/(main-layout)/account-settings/components/ActiveSessions.tsx index df33ff2c..3281254a 100644 --- a/app/(with-navbar)/account-settings/components/ActiveSessions.tsx +++ b/app/(main-layout)/account-settings/components/ActiveSessions.tsx @@ -24,7 +24,7 @@ import { Shield, } from 'lucide-react' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' -import { useDeviceSessions } from '@/app/(with-navbar)/account-settings/hooks/useDeviceSessions' +import { useDeviceSessions } from '@/app/(main-layout)/account-settings/hooks/useDeviceSessions' export function ActiveSessions() { // Se utiliza el hook para obtener la información de las sesiones diff --git a/app/(with-navbar)/account-settings/components/CancellationDialog.tsx b/app/(main-layout)/account-settings/components/CancellationDialog.tsx similarity index 100% rename from app/(with-navbar)/account-settings/components/CancellationDialog.tsx rename to app/(main-layout)/account-settings/components/CancellationDialog.tsx diff --git a/app/(with-navbar)/account-settings/components/ChangeEmailDialog.tsx b/app/(main-layout)/account-settings/components/ChangeEmailDialog.tsx similarity index 97% rename from app/(with-navbar)/account-settings/components/ChangeEmailDialog.tsx rename to app/(main-layout)/account-settings/components/ChangeEmailDialog.tsx index b9191c22..624e5746 100644 --- a/app/(with-navbar)/account-settings/components/ChangeEmailDialog.tsx +++ b/app/(main-layout)/account-settings/components/ChangeEmailDialog.tsx @@ -10,11 +10,11 @@ import { DialogTitle, } from '@/components/ui/dialog' import { Input } from '@/components/ui/input' -import { useUserAttributes } from '@/app/(with-navbar)/account-settings/hooks/useUserAttributes' -import { emailSchema, verificationCodeSchema } from '@/lib/schemas/email-change' +import { useUserAttributes } from '@/app/(main-layout)/account-settings/hooks/useUserAttributes' +import { emailSchema, verificationCodeSchema } from '@/lib/zod-schemas/email-change' import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' -import { useToast } from '@/hooks/custom-toast/use-toast' +import { useToast } from '@/hooks/ui/use-toasts' import { Toast } from '@/components/ui/toasts' import type { z } from 'zod' import { OTPInput, type SlotProps } from 'input-otp' diff --git a/app/(with-navbar)/account-settings/components/ChangePasswordDialog.tsx b/app/(main-layout)/account-settings/components/ChangePasswordDialog.tsx similarity index 97% rename from app/(with-navbar)/account-settings/components/ChangePasswordDialog.tsx rename to app/(main-layout)/account-settings/components/ChangePasswordDialog.tsx index 5afe3419..f8206329 100644 --- a/app/(with-navbar)/account-settings/components/ChangePasswordDialog.tsx +++ b/app/(main-layout)/account-settings/components/ChangePasswordDialog.tsx @@ -2,7 +2,7 @@ import { useState } from 'react' import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' -import { passwordSchema, PasswordFormValues } from '@/lib/schemas/password-change' +import { passwordSchema, PasswordFormValues } from '@/lib/zod-schemas/password-change' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { @@ -13,7 +13,7 @@ import { FormLabel, FormMessage, } from '@/components/ui/form' -import usePasswordManagement from '@/app/(with-navbar)/account-settings/hooks/usePasswordManagement' +import usePasswordManagement from '@/app/(main-layout)/account-settings/hooks/usePasswordManagement' import { Eye, EyeOff } from 'lucide-react' import { Loader } from '@/components/ui/loader' diff --git a/app/(with-navbar)/account-settings/components/EditProfileDialog.tsx b/app/(main-layout)/account-settings/components/EditProfileDialog.tsx similarity index 95% rename from app/(with-navbar)/account-settings/components/EditProfileDialog.tsx rename to app/(main-layout)/account-settings/components/EditProfileDialog.tsx index 34fb2e45..334530d8 100644 --- a/app/(with-navbar)/account-settings/components/EditProfileDialog.tsx +++ b/app/(main-layout)/account-settings/components/EditProfileDialog.tsx @@ -14,12 +14,12 @@ import { Input } from '@/components/ui/input' import { Textarea } from '@/components/ui/textarea' import { Button } from '@/components/ui/button' import { useEffect } from 'react' -import { useUserAttributes } from '@/app/(with-navbar)/account-settings/hooks/useUserAttributes' +import { useUserAttributes } from '@/app/(main-layout)/account-settings/hooks/useUserAttributes' import { Loader } from '@/components/ui/loader' -import { useToast } from '@/hooks/custom-toast/use-toast' +import { useToast } from '@/hooks/ui/use-toasts' import { Toast } from '@/components/ui/toasts' -import { formSchema } from '@/lib/schemas/email-change' -import useAuthStore from '@/zustand-states/userStore' +import { formSchema } from '@/lib/zod-schemas/email-change' +import useAuthStore from '@/context/core/userStore' interface EditProfileDialogProps { open: boolean diff --git a/app/(with-navbar)/account-settings/components/PaymentSettings.tsx b/app/(main-layout)/account-settings/components/PaymentSettings.tsx similarity index 95% rename from app/(with-navbar)/account-settings/components/PaymentSettings.tsx rename to app/(main-layout)/account-settings/components/PaymentSettings.tsx index ed14bcdf..42b868c3 100644 --- a/app/(with-navbar)/account-settings/components/PaymentSettings.tsx +++ b/app/(main-layout)/account-settings/components/PaymentSettings.tsx @@ -1,12 +1,12 @@ import { Suspense, useState, useEffect } from 'react' import { Button } from '@/components/ui/button' -import { useSubscriptionStore } from '@/zustand-states/useSubscriptionStore' +import { useSubscriptionStore } from '@/context/core/useSubscriptionStore' import { post } from 'aws-amplify/api' -import { SubscriptionCard } from '@/app/(with-navbar)/account-settings/components/SubscriptionCard' +import { SubscriptionCard } from '@/app/(main-layout)/account-settings/components/SubscriptionCard' import { Card, CardHeader, CardTitle, CardDescription } from '@/components/ui/card' -import { CancellationDialog } from '@/app/(with-navbar)/account-settings/components/CancellationDialog' +import { CancellationDialog } from '@/app/(main-layout)/account-settings/components/CancellationDialog' import { Loader } from '@/components/ui/loader' -import useUserStore from '@/zustand-states/userStore' +import useUserStore from '@/context/core/userStore' import Link from 'next/link' function SubscriptionLoader() { diff --git a/app/(with-navbar)/account-settings/components/SideBar.tsx b/app/(main-layout)/account-settings/components/SideBar.tsx similarity index 100% rename from app/(with-navbar)/account-settings/components/SideBar.tsx rename to app/(main-layout)/account-settings/components/SideBar.tsx diff --git a/app/(with-navbar)/account-settings/components/SubscriptionCard.tsx b/app/(main-layout)/account-settings/components/SubscriptionCard.tsx similarity index 100% rename from app/(with-navbar)/account-settings/components/SubscriptionCard.tsx rename to app/(main-layout)/account-settings/components/SubscriptionCard.tsx diff --git a/app/(with-navbar)/account-settings/components/UserAvatar.tsx b/app/(main-layout)/account-settings/components/UserAvatar.tsx similarity index 97% rename from app/(with-navbar)/account-settings/components/UserAvatar.tsx rename to app/(main-layout)/account-settings/components/UserAvatar.tsx index 0d635a76..cbc6cf7f 100644 --- a/app/(with-navbar)/account-settings/components/UserAvatar.tsx +++ b/app/(main-layout)/account-settings/components/UserAvatar.tsx @@ -2,7 +2,7 @@ import { useState, useRef } from 'react' import { ImagePlus } from 'lucide-react' import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { cn } from '@/lib/utils' -import { useUpdateProfilePicture } from '@/app/(with-navbar)/account-settings/hooks/useUpdateProfilePicture' +import { useUpdateProfilePicture } from '@/app/(main-layout)/account-settings/hooks/useUpdateProfilePicture' import { Amplify } from 'aws-amplify' import outputs from '@/amplify_outputs.json' diff --git a/app/(with-navbar)/account-settings/hooks/useDeviceSessions.ts b/app/(main-layout)/account-settings/hooks/useDeviceSessions.ts similarity index 100% rename from app/(with-navbar)/account-settings/hooks/useDeviceSessions.ts rename to app/(main-layout)/account-settings/hooks/useDeviceSessions.ts diff --git a/app/(with-navbar)/account-settings/hooks/usePasswordManagement.ts b/app/(main-layout)/account-settings/hooks/usePasswordManagement.ts similarity index 100% rename from app/(with-navbar)/account-settings/hooks/usePasswordManagement.ts rename to app/(main-layout)/account-settings/hooks/usePasswordManagement.ts diff --git a/app/(with-navbar)/account-settings/hooks/useUpdateProfilePicture.ts b/app/(main-layout)/account-settings/hooks/useUpdateProfilePicture.ts similarity index 100% rename from app/(with-navbar)/account-settings/hooks/useUpdateProfilePicture.ts rename to app/(main-layout)/account-settings/hooks/useUpdateProfilePicture.ts diff --git a/app/(with-navbar)/account-settings/hooks/useUserAttributes.ts b/app/(main-layout)/account-settings/hooks/useUserAttributes.ts similarity index 100% rename from app/(with-navbar)/account-settings/hooks/useUserAttributes.ts rename to app/(main-layout)/account-settings/hooks/useUserAttributes.ts diff --git a/app/(with-navbar)/account-settings/page.tsx b/app/(main-layout)/account-settings/page.tsx similarity index 88% rename from app/(with-navbar)/account-settings/page.tsx rename to app/(main-layout)/account-settings/page.tsx index d25c75ed..caf226d7 100644 --- a/app/(with-navbar)/account-settings/page.tsx +++ b/app/(main-layout)/account-settings/page.tsx @@ -1,14 +1,14 @@ 'use client' -import { Sidebar } from '@/app/(with-navbar)/account-settings/components/SideBar' -import { AccountSettings } from '@/app/(with-navbar)/account-settings/components/AccountSettings' -import { PaymentSettings } from '@/app/(with-navbar)/account-settings/components/PaymentSettings' -import { ActiveSessions } from '@/app/(with-navbar)/account-settings/components/ActiveSessions' +import { Sidebar } from '@/app/(main-layout)/account-settings/components/SideBar' +import { AccountSettings } from '@/app/(main-layout)/account-settings/components/AccountSettings' +import { PaymentSettings } from '@/app/(main-layout)/account-settings/components/PaymentSettings' +import { ActiveSessions } from '@/app/(main-layout)/account-settings/components/ActiveSessions' import { useState, useEffect, Suspense } from 'react' import { Loader } from '@/components/ui/loader' import { Amplify } from 'aws-amplify' import { useSearchParams } from 'next/navigation' -import useUserStore from '@/zustand-states/userStore' +import useUserStore from '@/context/core/userStore' import outputs from '@/amplify_outputs.json' Amplify.configure(outputs) diff --git a/app/(with-navbar)/landing/components/AboutUs.tsx b/app/(main-layout)/landing/components/AboutUs.tsx similarity index 100% rename from app/(with-navbar)/landing/components/AboutUs.tsx rename to app/(main-layout)/landing/components/AboutUs.tsx diff --git a/app/(with-navbar)/landing/components/DocsLanding.tsx b/app/(main-layout)/landing/components/DocsLanding.tsx similarity index 58% rename from app/(with-navbar)/landing/components/DocsLanding.tsx rename to app/(main-layout)/landing/components/DocsLanding.tsx index 2d79ce81..e9b1cb85 100644 --- a/app/(with-navbar)/landing/components/DocsLanding.tsx +++ b/app/(main-layout)/landing/components/DocsLanding.tsx @@ -1,14 +1,14 @@ -import { DropshippingIntro } from '@/app/(with-navbar)/landing/components/DropshippingIntro' -import { Platform } from '@/app/(with-navbar)/landing/components/Platform' -import { Footer } from '@/app/(with-navbar)/landing/components/Footer' -import { StepGuide } from '@/app/(with-navbar)/landing/components/StepGuide' -import { FirstView } from '@/app/(with-navbar)/landing/components/FirstView' -import { AboutUs } from '@/app/(with-navbar)/landing/components/AboutUs' -import { FashionSlider } from '@/app/(with-navbar)/landing/components/FashionSlider' -import { Feature } from '@/app/(with-navbar)/landing/components/Feature' -import { Testimonials } from '@/app/(with-navbar)/landing/components/Testimonials' -import { MarqueeLogos } from '@/app/(with-navbar)/landing/components/MarqueeLogos' -import { LogoCarousell } from '@/app/(with-navbar)/landing/components/LogoCarousell' +import { DropshippingIntro } from '@/app/(main-layout)/landing/components/DropshippingIntro' +import { Platform } from '@/app/(main-layout)/landing/components/Platform' +import { Footer } from '@/app/(main-layout)/landing/components/Footer' +import { StepGuide } from '@/app/(main-layout)/landing/components/StepGuide' +import { FirstView } from '@/app/(main-layout)/landing/components/FirstView' +import { AboutUs } from '@/app/(main-layout)/landing/components/AboutUs' +import { FashionSlider } from '@/app/(main-layout)/landing/components/FashionSlider' +import { Feature } from '@/app/(main-layout)/landing/components/Feature' +import { Testimonials } from '@/app/(main-layout)/landing/components/Testimonials' +import { MarqueeLogos } from '@/app/(main-layout)/landing/components/MarqueeLogos' +import { LogoCarousell } from '@/app/(main-layout)/landing/components/LogoCarousell' import outputs from '@/amplify_outputs.json' import { Amplify } from 'aws-amplify' diff --git a/app/(with-navbar)/landing/components/DropshippingIntro.tsx b/app/(main-layout)/landing/components/DropshippingIntro.tsx similarity index 100% rename from app/(with-navbar)/landing/components/DropshippingIntro.tsx rename to app/(main-layout)/landing/components/DropshippingIntro.tsx diff --git a/app/(with-navbar)/landing/components/FashionSlider.tsx b/app/(main-layout)/landing/components/FashionSlider.tsx similarity index 100% rename from app/(with-navbar)/landing/components/FashionSlider.tsx rename to app/(main-layout)/landing/components/FashionSlider.tsx diff --git a/app/(with-navbar)/landing/components/Feature.tsx b/app/(main-layout)/landing/components/Feature.tsx similarity index 100% rename from app/(with-navbar)/landing/components/Feature.tsx rename to app/(main-layout)/landing/components/Feature.tsx diff --git a/app/(with-navbar)/landing/components/FirstView.tsx b/app/(main-layout)/landing/components/FirstView.tsx similarity index 100% rename from app/(with-navbar)/landing/components/FirstView.tsx rename to app/(main-layout)/landing/components/FirstView.tsx diff --git a/app/(with-navbar)/landing/components/Footer.tsx b/app/(main-layout)/landing/components/Footer.tsx similarity index 100% rename from app/(with-navbar)/landing/components/Footer.tsx rename to app/(main-layout)/landing/components/Footer.tsx diff --git a/app/(with-navbar)/landing/components/LogoCarousell.tsx b/app/(main-layout)/landing/components/LogoCarousell.tsx similarity index 100% rename from app/(with-navbar)/landing/components/LogoCarousell.tsx rename to app/(main-layout)/landing/components/LogoCarousell.tsx diff --git a/app/(with-navbar)/landing/components/MarqueeLogos.tsx b/app/(main-layout)/landing/components/MarqueeLogos.tsx similarity index 100% rename from app/(with-navbar)/landing/components/MarqueeLogos.tsx rename to app/(main-layout)/landing/components/MarqueeLogos.tsx diff --git a/app/(with-navbar)/landing/components/NavBar.tsx b/app/(main-layout)/landing/components/NavBar.tsx similarity index 97% rename from app/(with-navbar)/landing/components/NavBar.tsx rename to app/(main-layout)/landing/components/NavBar.tsx index 22d80287..12a5bfb3 100644 --- a/app/(with-navbar)/landing/components/NavBar.tsx +++ b/app/(main-layout)/landing/components/NavBar.tsx @@ -15,13 +15,13 @@ import { NavigationMenuList, NavigationMenuTrigger, } from '@/components/ui/navigation-menu' -import { useAuth } from '@/hooks/auth/useAuth' +import { useAuth } from '@/context/hooks/useAuth' import { signOut } from 'aws-amplify/auth' import { useRouter } from 'next/navigation' -import { UserMenu } from '@/app/(with-navbar)/landing/components/UserMenu' +import { UserMenu } from '@/app/(main-layout)/landing/components/UserMenu' import { Skeleton } from '@/components/ui/skeleton' -import { navItems } from '@/app/(with-navbar)/landing/components/navigation' -import useUserStore from '@/zustand-states/userStore' +import { navItems } from '@/app/(main-layout)/landing/components/navigation' +import useUserStore from '@/context/core/userStore' import outputs from '@/amplify_outputs.json' Amplify.configure(outputs) diff --git a/app/(with-navbar)/landing/components/Platform.tsx b/app/(main-layout)/landing/components/Platform.tsx similarity index 100% rename from app/(with-navbar)/landing/components/Platform.tsx rename to app/(main-layout)/landing/components/Platform.tsx diff --git a/app/(with-navbar)/landing/components/StepGuide.tsx b/app/(main-layout)/landing/components/StepGuide.tsx similarity index 100% rename from app/(with-navbar)/landing/components/StepGuide.tsx rename to app/(main-layout)/landing/components/StepGuide.tsx diff --git a/app/(with-navbar)/landing/components/Testimonials.tsx b/app/(main-layout)/landing/components/Testimonials.tsx similarity index 100% rename from app/(with-navbar)/landing/components/Testimonials.tsx rename to app/(main-layout)/landing/components/Testimonials.tsx diff --git a/app/(with-navbar)/landing/components/UserMenu.tsx b/app/(main-layout)/landing/components/UserMenu.tsx similarity index 100% rename from app/(with-navbar)/landing/components/UserMenu.tsx rename to app/(main-layout)/landing/components/UserMenu.tsx diff --git a/app/(with-navbar)/landing/components/navigation.ts b/app/(main-layout)/landing/components/navigation.ts similarity index 100% rename from app/(with-navbar)/landing/components/navigation.ts rename to app/(main-layout)/landing/components/navigation.ts diff --git a/app/(with-navbar)/layout.tsx b/app/(main-layout)/layout.tsx similarity index 87% rename from app/(with-navbar)/layout.tsx rename to app/(main-layout)/layout.tsx index 6da5dfec..e53c3f51 100644 --- a/app/(with-navbar)/layout.tsx +++ b/app/(main-layout)/layout.tsx @@ -1,4 +1,4 @@ -import { Navbar } from '@/app/(with-navbar)/landing/components/NavBar' +import { Navbar } from '@/app/(main-layout)/landing/components/NavBar' import outputs from '@/amplify_outputs.json' import { Amplify } from 'aws-amplify' diff --git a/app/(with-navbar)/page.tsx b/app/(main-layout)/page.tsx similarity index 95% rename from app/(with-navbar)/page.tsx rename to app/(main-layout)/page.tsx index a7196006..8cf9cbc7 100644 --- a/app/(with-navbar)/page.tsx +++ b/app/(main-layout)/page.tsx @@ -5,7 +5,7 @@ import { getCurrentUser, fetchUserAttributes } from 'aws-amplify/auth' import { ConsoleLogger, Hub } from 'aws-amplify/utils' import { Amplify } from 'aws-amplify' import 'aws-amplify/auth/enable-oauth-listener' -import DocsLanding from '@/app/(with-navbar)/landing/components/DocsLanding' +import DocsLanding from '@/app/(main-layout)/landing/components/DocsLanding' import outputs from '@/amplify_outputs.json' Amplify.configure(outputs) diff --git a/app/(with-navbar)/pricing/components/FAQItem.tsx b/app/(main-layout)/pricing/components/FAQItem.tsx similarity index 100% rename from app/(with-navbar)/pricing/components/FAQItem.tsx rename to app/(main-layout)/pricing/components/FAQItem.tsx diff --git a/app/(with-navbar)/pricing/components/FAQSection.tsx b/app/(main-layout)/pricing/components/FAQSection.tsx similarity index 100% rename from app/(with-navbar)/pricing/components/FAQSection.tsx rename to app/(main-layout)/pricing/components/FAQSection.tsx diff --git a/app/(with-navbar)/pricing/components/FeatureComparison.tsx b/app/(main-layout)/pricing/components/FeatureComparison.tsx similarity index 100% rename from app/(with-navbar)/pricing/components/FeatureComparison.tsx rename to app/(main-layout)/pricing/components/FeatureComparison.tsx diff --git a/app/(with-navbar)/pricing/components/PricingCard.tsx b/app/(main-layout)/pricing/components/PricingCard.tsx similarity index 97% rename from app/(with-navbar)/pricing/components/PricingCard.tsx rename to app/(main-layout)/pricing/components/PricingCard.tsx index 38bbc725..05a6b2f9 100644 --- a/app/(with-navbar)/pricing/components/PricingCard.tsx +++ b/app/(main-layout)/pricing/components/PricingCard.tsx @@ -5,12 +5,12 @@ import { Button } from '@/components/ui/button' import { post } from 'aws-amplify/api' import { LoadingIndicator } from '@/components/ui/loading-indicator' import { useRouter } from 'next/navigation' -import { useToast } from '@/hooks/custom-toast/use-toast' +import { useToast } from '@/hooks/ui/use-toasts' import { Toast } from '@/components/ui/toasts' -import { useAuth } from '@/hooks/auth/useAuth' -import useUserStore from '@/zustand-states/userStore' -import outputs from '@/amplify_outputs.json' +import { useAuth } from '@/context/hooks/useAuth' import { Amplify } from 'aws-amplify' +import useUserStore from '@/context/core/userStore' +import outputs from '@/amplify_outputs.json' Amplify.configure(outputs) const existingConfig = Amplify.getConfig() diff --git a/app/(with-navbar)/pricing/components/plans.ts b/app/(main-layout)/pricing/components/plans.ts similarity index 100% rename from app/(with-navbar)/pricing/components/plans.ts rename to app/(main-layout)/pricing/components/plans.ts diff --git a/app/(with-navbar)/pricing/page.tsx b/app/(main-layout)/pricing/page.tsx similarity index 78% rename from app/(with-navbar)/pricing/page.tsx rename to app/(main-layout)/pricing/page.tsx index 3e8d11e0..ddac5bf0 100644 --- a/app/(with-navbar)/pricing/page.tsx +++ b/app/(main-layout)/pricing/page.tsx @@ -2,14 +2,14 @@ import { useEffect } from 'react' import { motion } from 'framer-motion' -import { PricingCard } from '@/app/(with-navbar)/pricing/components/PricingCard' -import { Footer } from '@/app/(with-navbar)/landing/components/Footer' -import { FAQSection } from '@/app/(with-navbar)/pricing/components/FAQSection' -import { faqItems } from '@/app/(with-navbar)/pricing/components/FAQItem' +import { PricingCard } from '@/app/(main-layout)/pricing/components/PricingCard' +import { Footer } from '@/app/(main-layout)/landing/components/Footer' +import { FAQSection } from '@/app/(main-layout)/pricing/components/FAQSection' +import { faqItems } from '@/app/(main-layout)/pricing/components/FAQItem' import { Amplify } from 'aws-amplify' -import { FeatureComparison } from '@/app/(with-navbar)/pricing/components/FeatureComparison' +import { FeatureComparison } from '@/app/(main-layout)/pricing/components/FeatureComparison' import outputs from '@/amplify_outputs.json' -import { plans } from '@/app/(with-navbar)/pricing/components/plans' +import { plans } from '@/app/(main-layout)/pricing/components/plans' Amplify.configure(outputs) const existingConfig = Amplify.getConfig() diff --git a/app/(with-navbar)/subscription-success/components/SubscriptionSuccess.tsx b/app/(main-layout)/subscription-success/components/SubscriptionSuccess.tsx similarity index 98% rename from app/(with-navbar)/subscription-success/components/SubscriptionSuccess.tsx rename to app/(main-layout)/subscription-success/components/SubscriptionSuccess.tsx index acd41477..78506c47 100644 --- a/app/(with-navbar)/subscription-success/components/SubscriptionSuccess.tsx +++ b/app/(main-layout)/subscription-success/components/SubscriptionSuccess.tsx @@ -2,7 +2,7 @@ import { motion } from 'framer-motion' import { ArrowRight, Check, Sparkles, Zap } from 'lucide-react' -import { Footer } from '@/app/(with-navbar)/landing/components/Footer' +import { Footer } from '@/app/(main-layout)/landing/components/Footer' import Link from 'next/link' interface SubscriptionSuccessProps { diff --git a/app/(with-navbar)/subscription-success/components/WelcomeScreen.tsx b/app/(main-layout)/subscription-success/components/WelcomeScreen.tsx similarity index 100% rename from app/(with-navbar)/subscription-success/components/WelcomeScreen.tsx rename to app/(main-layout)/subscription-success/components/WelcomeScreen.tsx diff --git a/app/(with-navbar)/subscription-success/page.tsx b/app/(main-layout)/subscription-success/page.tsx similarity index 76% rename from app/(with-navbar)/subscription-success/page.tsx rename to app/(main-layout)/subscription-success/page.tsx index 17ff9aba..38b77296 100644 --- a/app/(with-navbar)/subscription-success/page.tsx +++ b/app/(main-layout)/subscription-success/page.tsx @@ -1,9 +1,9 @@ 'use client' import { useState } from 'react' -import { WelcomeScreen } from '@/app/(with-navbar)/subscription-success/components/WelcomeScreen' -import { SubscriptionSuccess } from '@/app/(with-navbar)/subscription-success/components/SubscriptionSuccess' -import useUserStore from '@/zustand-states/userStore' +import { WelcomeScreen } from '@/app/(main-layout)/subscription-success/components/WelcomeScreen' +import { SubscriptionSuccess } from '@/app/(main-layout)/subscription-success/components/SubscriptionSuccess' +import useUserStore from '@/context/core/userStore' export default function SubscriptionSuccessPage() { const [showContent, setShowContent] = useState(false) diff --git a/app/(with-navbar)/terms/components/LegalDocuments.tsx b/app/(main-layout)/terms/components/LegalDocuments.tsx similarity index 100% rename from app/(with-navbar)/terms/components/LegalDocuments.tsx rename to app/(main-layout)/terms/components/LegalDocuments.tsx diff --git a/app/(with-navbar)/terms/components/legal-content.json b/app/(main-layout)/terms/components/legal-content.json similarity index 100% rename from app/(with-navbar)/terms/components/legal-content.json rename to app/(main-layout)/terms/components/legal-content.json diff --git a/app/(with-navbar)/terms/page.tsx b/app/(main-layout)/terms/page.tsx similarity index 85% rename from app/(with-navbar)/terms/page.tsx rename to app/(main-layout)/terms/page.tsx index c74a967e..d1ce686d 100644 --- a/app/(with-navbar)/terms/page.tsx +++ b/app/(main-layout)/terms/page.tsx @@ -1,4 +1,4 @@ -import { LegalDocuments } from '@/app/(with-navbar)/terms/components/LegalDocuments' +import { LegalDocuments } from '@/app/(main-layout)/terms/components/LegalDocuments' import type { Metadata } from 'next' export const metadata: Metadata = { diff --git a/app/(without-navbar)/first-steps/components/AdditionalSettings.tsx b/app/(setup-layout)/first-steps/components/AdditionalSettings.tsx similarity index 100% rename from app/(without-navbar)/first-steps/components/AdditionalSettings.tsx rename to app/(setup-layout)/first-steps/components/AdditionalSettings.tsx diff --git a/app/(without-navbar)/first-steps/components/BackgroundGradientAnimation.tsx b/app/(setup-layout)/first-steps/components/BackgroundGradientAnimation.tsx similarity index 100% rename from app/(without-navbar)/first-steps/components/BackgroundGradientAnimation.tsx rename to app/(setup-layout)/first-steps/components/BackgroundGradientAnimation.tsx diff --git a/app/(without-navbar)/first-steps/components/MultiStepLoader.tsx b/app/(setup-layout)/first-steps/components/MultiStepLoader.tsx similarity index 100% rename from app/(without-navbar)/first-steps/components/MultiStepLoader.tsx rename to app/(setup-layout)/first-steps/components/MultiStepLoader.tsx diff --git a/app/(without-navbar)/first-steps/components/PersonalInfo.tsx b/app/(setup-layout)/first-steps/components/PersonalInfo.tsx similarity index 100% rename from app/(without-navbar)/first-steps/components/PersonalInfo.tsx rename to app/(setup-layout)/first-steps/components/PersonalInfo.tsx diff --git a/app/(without-navbar)/first-steps/components/StoreInfo.tsx b/app/(setup-layout)/first-steps/components/StoreInfo.tsx similarity index 98% rename from app/(without-navbar)/first-steps/components/StoreInfo.tsx rename to app/(setup-layout)/first-steps/components/StoreInfo.tsx index c2f83726..cb646934 100644 --- a/app/(without-navbar)/first-steps/components/StoreInfo.tsx +++ b/app/(setup-layout)/first-steps/components/StoreInfo.tsx @@ -10,7 +10,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { useStoreNameValidator } from '@/app/(without-navbar)/first-steps/hooks/useStoreNameValidator' +import { useStoreNameValidator } from '@/app/(setup-layout)/first-steps/hooks/useStoreNameValidator' import { Amplify } from 'aws-amplify' import outputs from '@/amplify_outputs.json' diff --git a/app/(without-navbar)/first-steps/data/selling-options.json b/app/(setup-layout)/first-steps/data/selling-options.json similarity index 100% rename from app/(without-navbar)/first-steps/data/selling-options.json rename to app/(setup-layout)/first-steps/data/selling-options.json diff --git a/app/(without-navbar)/first-steps/hooks/useApiKeyEncryption.ts b/app/(setup-layout)/first-steps/hooks/useApiKeyEncryption.ts similarity index 100% rename from app/(without-navbar)/first-steps/hooks/useApiKeyEncryption.ts rename to app/(setup-layout)/first-steps/hooks/useApiKeyEncryption.ts diff --git a/app/(without-navbar)/first-steps/hooks/useStoreNameValidator.ts b/app/(setup-layout)/first-steps/hooks/useStoreNameValidator.ts similarity index 100% rename from app/(without-navbar)/first-steps/hooks/useStoreNameValidator.ts rename to app/(setup-layout)/first-steps/hooks/useStoreNameValidator.ts diff --git a/app/(without-navbar)/first-steps/hooks/useUserStoreData.ts b/app/(setup-layout)/first-steps/hooks/useUserStoreData.ts similarity index 100% rename from app/(without-navbar)/first-steps/hooks/useUserStoreData.ts rename to app/(setup-layout)/first-steps/hooks/useUserStoreData.ts diff --git a/app/(without-navbar)/first-steps/page.tsx b/app/(setup-layout)/first-steps/page.tsx similarity index 95% rename from app/(without-navbar)/first-steps/page.tsx rename to app/(setup-layout)/first-steps/page.tsx index e74bfc8f..e92084ac 100644 --- a/app/(without-navbar)/first-steps/page.tsx +++ b/app/(setup-layout)/first-steps/page.tsx @@ -4,22 +4,22 @@ import { useState, useEffect } from 'react' import { ArrowRight, Store, User, Settings, InfoIcon } from 'lucide-react' import { AnimatePresence, motion } from 'framer-motion' import { Button } from '@/components/ui/button' -import { BackgroundGradientAnimation } from '@/app/(without-navbar)/first-steps/components/BackgroundGradientAnimation' -import { useUserStoreData } from '@/app/(without-navbar)/first-steps/hooks/useUserStoreData' -import { MultiStepLoader } from '@/app/(without-navbar)/first-steps/components/MultiStepLoader' +import { BackgroundGradientAnimation } from '@/app/(setup-layout)/first-steps/components/BackgroundGradientAnimation' +import { useUserStoreData } from '@/app/(setup-layout)/first-steps/hooks/useUserStoreData' +import { MultiStepLoader } from '@/app/(setup-layout)/first-steps/components/MultiStepLoader' import Image from 'next/image' -import PersonalInfo from '@/app/(without-navbar)/first-steps/components/PersonalInfo' -import StoreInfo from '@/app/(without-navbar)/first-steps/components/StoreInfo' -import AdditionalSettings from '@/app/(without-navbar)/first-steps/components/AdditionalSettings' +import PersonalInfo from '@/app/(setup-layout)/first-steps/components/PersonalInfo' +import StoreInfo from '@/app/(setup-layout)/first-steps/components/StoreInfo' +import AdditionalSettings from '@/app/(setup-layout)/first-steps/components/AdditionalSettings' import { personalInfoSchema, storeInfoSchema, additionalSettingsSchema, -} from '@/lib/schemas/first-step' +} from '@/lib/zod-schemas/first-step' import { useAuthUser } from '@/hooks/auth/useAuthUser' import { v4 as uuidv4 } from 'uuid' import { routes } from '@/utils/routes' -import { useApiKeyEncryption } from '@/app/(without-navbar)/first-steps/hooks/useApiKeyEncryption' +import { useApiKeyEncryption } from '@/app/(setup-layout)/first-steps/hooks/useApiKeyEncryption' import sellingOptions from '@/app/(without-navbar)/first-steps/data/selling-options.json' export default function FirstStepsPage() { diff --git a/app/(without-navbar)/layout.tsx b/app/(setup-layout)/layout.tsx similarity index 100% rename from app/(without-navbar)/layout.tsx rename to app/(setup-layout)/layout.tsx diff --git a/app/(without-navbar)/login/AuthForm.tsx b/app/(setup-layout)/login/AuthForm.tsx similarity index 94% rename from app/(without-navbar)/login/AuthForm.tsx rename to app/(setup-layout)/login/AuthForm.tsx index 7393b30a..7e16369a 100644 --- a/app/(without-navbar)/login/AuthForm.tsx +++ b/app/(setup-layout)/login/AuthForm.tsx @@ -4,10 +4,10 @@ import Image from 'next/image' import { useState, useCallback } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { Button } from '@/components/ui/button' -import { SignInForm } from '@/app/(without-navbar)/login/components/sing-in/SignInForm' -import { SignUpForm } from '@/app/(without-navbar)/login/components/sing-up/SignUpForm' -import { ForgotPasswordForm } from '@/app/(without-navbar)/login/components/forgot-password/ForgotPasswordForm' -import { VerificationForm } from '@/app/(without-navbar)/login/components/verification-form/VerificationForm' +import { SignInForm } from '@/app/(setup-layout)/login/components/sing-in/SignInForm' +import { SignUpForm } from '@/app/(setup-layout)/login/components/sing-up/SignUpForm' +import { ForgotPasswordForm } from '@/app/(setup-layout)/login/components/forgot-password/ForgotPasswordForm' +import { VerificationForm } from '@/app/(setup-layout)/login/components/verification-form/VerificationForm' import { signInWithRedirect } from 'aws-amplify/auth' type AuthState = 'signin' | 'signup' | 'forgot-password' | 'verification' diff --git a/app/(without-navbar)/login/components/AuthClient.tsx b/app/(setup-layout)/login/components/AuthClient.tsx similarity index 69% rename from app/(without-navbar)/login/components/AuthClient.tsx rename to app/(setup-layout)/login/components/AuthClient.tsx index 2c46a8ea..a685df85 100644 --- a/app/(without-navbar)/login/components/AuthClient.tsx +++ b/app/(setup-layout)/login/components/AuthClient.tsx @@ -1,5 +1,5 @@ -import { AuthForm } from '@/app/(without-navbar)/login/AuthForm' -import ImageSlider from '@/app/(without-navbar)/login/components/ImageSlider' +import { AuthForm } from '@/app/(setup-layout)/login/AuthForm' +import ImageSlider from '@/app/(setup-layout)/login/components/ImageSlider' const LoginPage = () => { return ( diff --git a/app/(without-navbar)/login/components/ImageSlider.tsx b/app/(setup-layout)/login/components/ImageSlider.tsx similarity index 100% rename from app/(without-navbar)/login/components/ImageSlider.tsx rename to app/(setup-layout)/login/components/ImageSlider.tsx diff --git a/app/(without-navbar)/login/components/forgot-password/ForgotPasswordForm.tsx b/app/(setup-layout)/login/components/forgot-password/ForgotPasswordForm.tsx similarity index 99% rename from app/(without-navbar)/login/components/forgot-password/ForgotPasswordForm.tsx rename to app/(setup-layout)/login/components/forgot-password/ForgotPasswordForm.tsx index fa3613ba..3ec648b1 100644 --- a/app/(without-navbar)/login/components/forgot-password/ForgotPasswordForm.tsx +++ b/app/(setup-layout)/login/components/forgot-password/ForgotPasswordForm.tsx @@ -21,7 +21,7 @@ import { confirmResetPasswordSchema, type ForgotPasswordFormData, type ConfirmResetPasswordFormData, -} from '@/lib/schemas/schemas' +} from '@/lib/zod-schemas/schemas' import { OTPInput, type SlotProps } from 'input-otp' import { cn } from '@/lib/utils' diff --git a/app/(without-navbar)/login/components/sing-in/SignInForm.tsx b/app/(setup-layout)/login/components/sing-in/SignInForm.tsx similarity index 97% rename from app/(without-navbar)/login/components/sing-in/SignInForm.tsx rename to app/(setup-layout)/login/components/sing-in/SignInForm.tsx index faa19e87..cf8b7f6d 100644 --- a/app/(without-navbar)/login/components/sing-in/SignInForm.tsx +++ b/app/(setup-layout)/login/components/sing-in/SignInForm.tsx @@ -16,8 +16,8 @@ import { } from '@/components/ui/form' import { Input } from '@/components/ui/input' import { Checkbox } from '@/components/ui/checkbox' -import { signInSchema, type SignInFormData } from '@/lib/schemas/schemas' -import { useAuth } from '@/app/(without-navbar)/login/hooks/SignIn' +import { signInSchema, type SignInFormData } from '@/lib/zod-schemas/schemas' +import { useAuth } from '@/app/(setup-layout)/login/hooks/SignIn' interface SignInFormProps { onForgotPassword: () => void diff --git a/app/(without-navbar)/login/components/sing-up/SignUpForm.tsx b/app/(setup-layout)/login/components/sing-up/SignUpForm.tsx similarity index 97% rename from app/(without-navbar)/login/components/sing-up/SignUpForm.tsx rename to app/(setup-layout)/login/components/sing-up/SignUpForm.tsx index 1e6557e1..e885a993 100644 --- a/app/(without-navbar)/login/components/sing-up/SignUpForm.tsx +++ b/app/(setup-layout)/login/components/sing-up/SignUpForm.tsx @@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { Eye, EyeOff } from 'lucide-react' import { Loader } from '@/components/ui/loader' -import { handleSignUp } from '@/app/(without-navbar)/login/hooks/signUp' +import { handleSignUp } from '@/app/(setup-layout)/login/hooks/signUp' import { Button } from '@/components/ui/button' import { Form, @@ -16,7 +16,7 @@ import { FormMessage, } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import { signUpSchema, type SignUpFormData } from '@/lib/schemas/schemas' +import { signUpSchema, type SignUpFormData } from '@/lib/zod-schemas/schemas' import Link from 'next/link' interface SignUpFormProps { diff --git a/app/(without-navbar)/login/components/verification-form/VerificationForm.tsx b/app/(setup-layout)/login/components/verification-form/VerificationForm.tsx similarity index 97% rename from app/(without-navbar)/login/components/verification-form/VerificationForm.tsx rename to app/(setup-layout)/login/components/verification-form/VerificationForm.tsx index d3ff3616..3397fda3 100644 --- a/app/(without-navbar)/login/components/verification-form/VerificationForm.tsx +++ b/app/(setup-layout)/login/components/verification-form/VerificationForm.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import { Loader } from '@/components/ui/loader' import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' -import { handleConfirmSignUp } from '@/app/(without-navbar)/login/hooks/signUp' +import { handleConfirmSignUp } from '@/app/(setup-layout)/login/hooks/signUp' import { signIn } from 'aws-amplify/auth' import { Button } from '@/components/ui/button' import { @@ -15,7 +15,7 @@ import { FormLabel, FormMessage, } from '@/components/ui/form' -import { verificationSchema, type VerificationFormData } from '@/lib/schemas/schemas' +import { verificationSchema, type VerificationFormData } from '@/lib/zod-schemas/schemas' import { OTPInput, type SlotProps } from 'input-otp' import { cn } from '@/lib/utils' diff --git a/app/(without-navbar)/login/hooks/SignIn.ts b/app/(setup-layout)/login/hooks/SignIn.ts similarity index 100% rename from app/(without-navbar)/login/hooks/SignIn.ts rename to app/(setup-layout)/login/hooks/SignIn.ts diff --git a/app/(without-navbar)/login/hooks/signUp.ts b/app/(setup-layout)/login/hooks/signUp.ts similarity index 100% rename from app/(without-navbar)/login/hooks/signUp.ts rename to app/(setup-layout)/login/hooks/signUp.ts diff --git a/app/(without-navbar)/login/hooks/updatePlan.ts b/app/(setup-layout)/login/hooks/updatePlan.ts similarity index 100% rename from app/(without-navbar)/login/hooks/updatePlan.ts rename to app/(setup-layout)/login/hooks/updatePlan.ts diff --git a/app/(without-navbar)/login/hooks/useResetPassword.ts b/app/(setup-layout)/login/hooks/useResetPassword.ts similarity index 100% rename from app/(without-navbar)/login/hooks/useResetPassword.ts rename to app/(setup-layout)/login/hooks/useResetPassword.ts diff --git a/app/(without-navbar)/login/page.tsx b/app/(setup-layout)/login/page.tsx similarity index 50% rename from app/(without-navbar)/login/page.tsx rename to app/(setup-layout)/login/page.tsx index 9892653b..06da97d6 100644 --- a/app/(without-navbar)/login/page.tsx +++ b/app/(setup-layout)/login/page.tsx @@ -1,6 +1,6 @@ 'use client' -import AuthClient from '@/app/(without-navbar)/login/components/AuthClient' +import AuthClient from '@/app/(setup-layout)/login/components/AuthClient' export default function LoginPage() { return diff --git a/app/(without-navbar)/my-store/components/StoreSelector.tsx b/app/(setup-layout)/my-store/components/StoreSelector.tsx similarity index 98% rename from app/(without-navbar)/my-store/components/StoreSelector.tsx rename to app/(setup-layout)/my-store/components/StoreSelector.tsx index 68ff2b95..2e14da44 100644 --- a/app/(without-navbar)/my-store/components/StoreSelector.tsx +++ b/app/(setup-layout)/my-store/components/StoreSelector.tsx @@ -4,7 +4,7 @@ import { Suspense } from 'react' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Button } from '@/components/ui/button' import { PlusCircle } from 'lucide-react' -import { getUserStores } from '@/app/(without-navbar)/my-store/hooks/useUserStores' +import { getUserStores } from '@/app/(setup-layout)/my-store/hooks/useUserStores' import { useAuthUser } from '@/hooks/auth/useAuthUser' import { motion, AnimatePresence } from 'framer-motion' import { Loader } from '@/components/ui/loader' diff --git a/app/(without-navbar)/my-store/hooks/useUserStores.ts b/app/(setup-layout)/my-store/hooks/useUserStores.ts similarity index 100% rename from app/(without-navbar)/my-store/hooks/useUserStores.ts rename to app/(setup-layout)/my-store/hooks/useUserStores.ts diff --git a/app/(without-navbar)/my-store/page.tsx b/app/(setup-layout)/my-store/page.tsx similarity index 70% rename from app/(without-navbar)/my-store/page.tsx rename to app/(setup-layout)/my-store/page.tsx index 3071f1e7..ede6a0cb 100644 --- a/app/(without-navbar)/my-store/page.tsx +++ b/app/(setup-layout)/my-store/page.tsx @@ -1,8 +1,8 @@ 'use client' import { useEffect } from 'react' -import { StoreSelector } from '@/app/(without-navbar)/my-store/components/StoreSelector' -import { BackgroundGradientAnimation } from '@/app/(without-navbar)/first-steps/components/BackgroundGradientAnimation' +import { StoreSelector } from '@/app/(setup-layout)/my-store/components/StoreSelector' +import { BackgroundGradientAnimation } from '@/app/(setup-layout)/first-steps/components/BackgroundGradientAnimation' export default function MyStorePage() { useEffect(() => { diff --git a/app/not-found.tsx b/app/not-found.tsx index 307334de..b95a3ef8 100644 --- a/app/not-found.tsx +++ b/app/not-found.tsx @@ -1,7 +1,7 @@ 'use client' import AnimatedGradientBackground from '@/components/ui/animated-gradient-background' -import notFound from '@/app/(with-navbar)/account-settings/anim/not-found.json' +import notFound from '@/app/(main-layout)/account-settings/anim/not-found.json' import dynamic from 'next/dynamic' import Link from 'next/link' diff --git a/app/store/components/ai-chat/ai-input.tsx b/app/store/components/ai-chat/AiInput.tsx similarity index 98% rename from app/store/components/ai-chat/ai-input.tsx rename to app/store/components/ai-chat/AiInput.tsx index 6c5356a2..a19ba958 100644 --- a/app/store/components/ai-chat/ai-input.tsx +++ b/app/store/components/ai-chat/AiInput.tsx @@ -5,7 +5,7 @@ import { useState } from 'react' import { Textarea } from '@/components/ui/textarea' import { motion, AnimatePresence } from 'framer-motion' import { cn } from '@/lib/utils' -import { useAutoResizeTextarea } from '@/hooks/use-auto-resize-textare' +import { useAutoResizeTextarea } from '@/hooks/ui/use-auto-resize-textare' interface AIInputWithSearchProps { id?: string diff --git a/app/store/components/ai-chat/ChatTrigger.tsx b/app/store/components/ai-chat/ChatTrigger.tsx index fd64c138..263bbcd9 100644 --- a/app/store/components/ai-chat/ChatTrigger.tsx +++ b/app/store/components/ai-chat/ChatTrigger.tsx @@ -1,31 +1,21 @@ import { useState } from 'react' -import { MessageSquare } from 'lucide-react' import { Button } from '@/components/ui/button' import { RefinedAIAssistantSheet } from '@/app/store/components/ai-chat/RefinedAiAssistant' -import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' +import { GradientSparkles } from '@/app/store/components/ai-chat/GradientSparkles' export function ChatTrigger() { const [isOpen, setIsOpen] = useState(false) return ( <> - - - - - - -

Asistente AI

-
-
-
+ diff --git a/app/store/components/ai-chat/GradientSparkles.tsx b/app/store/components/ai-chat/GradientSparkles.tsx index e261e6d4..093aa6fd 100644 --- a/app/store/components/ai-chat/GradientSparkles.tsx +++ b/app/store/components/ai-chat/GradientSparkles.tsx @@ -1,16 +1,26 @@ import { Sparkles } from 'lucide-react' +import { cn } from '@/lib/utils' -export function GradientSparkles() { +type GradientSparklesProps = { + className?: string +} + +export function GradientSparkles({ className }: GradientSparklesProps) { return ( - + - {/* Indigo-500 */} - {/* Purple-500 */} - {/* Pink-500 */} + + + - + ) } diff --git a/app/store/components/ai-chat/RefinedAiAssistant.tsx b/app/store/components/ai-chat/RefinedAiAssistant.tsx index 48ae644c..133588c7 100644 --- a/app/store/components/ai-chat/RefinedAiAssistant.tsx +++ b/app/store/components/ai-chat/RefinedAiAssistant.tsx @@ -5,10 +5,10 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sh import { useAutoScroll } from '@/app/store/components/ai-chat/hooks/useAutoScroll' import { MessageLoading } from '@/app/store/components/ai-chat/MessageLoading' import { TypingMessage } from '@/app/store/components/ai-chat/TypingMessage' -import { AIInputWithSearch } from '@/app/store/components/ai-chat/ai-input' -import { useChat } from './hooks/useChat' +import { AIInputWithSearch } from '@/app/store/components/ai-chat/AiInput' +import { useChat } from '@/app/store/components/ai-chat/hooks/useChat' import { Button } from '@/components/ui/button' -import { useMediaQuery } from '@/hooks/use-media-query' +import { useMediaQuery } from '@/hooks/ui/use-media-query' import { GradientSparkles } from '@/app/store/components/ai-chat/GradientSparkles' import Orb from '@/app/store/components/ai-chat/Orb' @@ -117,7 +117,7 @@ export function RefinedAIAssistantSheet({ open, onOpenChange }: RefinedAIAssista
{user?.nickName} diff --git a/app/store/components/store-config/LogoUploader.tsx b/app/store/components/store-config/LogoUploader.tsx index 97aa0698..84e60b28 100644 --- a/app/store/components/store-config/LogoUploader.tsx +++ b/app/store/components/store-config/LogoUploader.tsx @@ -16,8 +16,8 @@ import Image from 'next/image' import { Upload, ImageIcon } from 'lucide-react' import { Loader } from '@/components/ui/loader' import { useLogoUpload } from '@/app/store/hooks/useLogoUpload' -import { useUserStoreData } from '@/app/(without-navbar)/first-steps/hooks/useUserStoreData' -import useStoreDataStore from '@/zustand-states/storeDataStore' +import { useUserStoreData } from '@/app/(setup-layout)/first-steps/hooks/useUserStoreData' +import useStoreDataStore from '@/context/core/storeDataStore' export function LogoUploader() { const [logoPreview, setLogoPreview] = useState(null) diff --git a/app/store/components/store-config/ThemePreview.tsx b/app/store/components/store-config/ThemePreview.tsx index c66f461a..3b7628d0 100644 --- a/app/store/components/store-config/ThemePreview.tsx +++ b/app/store/components/store-config/ThemePreview.tsx @@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button' import { Card } from '@/components/ui/card' import { MoreHorizontal } from 'lucide-react' import { LogoUploader } from '@/app/store/components/store-config/LogoUploader' -import useStoreDataStore from '@/zustand-states/storeDataStore' +import useStoreDataStore from '@/context/core/storeDataStore' import Link from 'next/link' import Image from 'next/image' import { useState } from 'react' diff --git a/app/store/components/store-setup/EcommerceSetup.tsx b/app/store/components/store-setup/EcommerceSetup.tsx index 9ddba6ab..2e6b3d2a 100644 --- a/app/store/components/store-setup/EcommerceSetup.tsx +++ b/app/store/components/store-setup/EcommerceSetup.tsx @@ -13,11 +13,11 @@ import { } from '@/components/ui/accordion' import { useParams, usePathname } from 'next/navigation' import { getStoreId } from '@/utils/store-utils' -import { useUserStoreData } from '@/app/(without-navbar)/first-steps/hooks/useUserStoreData' +import { useUserStoreData } from '@/app/(setup-layout)/first-steps/hooks/useUserStoreData' import { PricingDrawer } from '@/app/store/components/store-setup/PricingDrawer' import { Amplify } from 'aws-amplify' import outputs from '@/amplify_outputs.json' -import useStoreDataStore from '@/zustand-states/storeDataStore' +import useStoreDataStore from '@/context/core/storeDataStore' Amplify.configure(outputs) const existingConfig = Amplify.getConfig() diff --git a/app/store/components/store-setup/PricingDrawer.tsx b/app/store/components/store-setup/PricingDrawer.tsx index 393feb51..dfa50d32 100644 --- a/app/store/components/store-setup/PricingDrawer.tsx +++ b/app/store/components/store-setup/PricingDrawer.tsx @@ -7,18 +7,18 @@ import { DrawerHeader, DrawerTitle, } from '@/components/ui/drawer' -import { plans } from '@/app/(with-navbar)/pricing/components/plans' -import { FAQSection } from '@/app/(with-navbar)/pricing/components/FAQSection' -import { faqItems } from '@/app/(with-navbar)/pricing/components/FAQItem' +import { plans } from '@/app/(main-layout)/pricing/components/plans' +import { FAQSection } from '@/app/(main-layout)/pricing/components/FAQSection' +import { faqItems } from '@/app/(main-layout)/pricing/components/FAQItem' import { ScrollArea } from '@/components/ui/scroll-area' import { Amplify } from 'aws-amplify' import { post } from 'aws-amplify/api' -import useUserStore from '@/zustand-states/userStore' +import useUserStore from '@/context/core/userStore' import outputs from '@/amplify_outputs.json' import { useState, useEffect } from 'react' import { useRouter } from 'next/navigation' import { LoadingIndicator } from '@/components/ui/loading-indicator' -import { useToast } from '@/hooks/custom-toast/use-toast' +import { useToast } from '@/hooks/ui/use-toasts' import { Toast } from '@/components/ui/toasts' Amplify.configure(outputs) diff --git a/app/store/hooks/useS3Images.ts b/app/store/hooks/useS3Images.ts index 816b92cf..863422a0 100644 --- a/app/store/hooks/useS3Images.ts +++ b/app/store/hooks/useS3Images.ts @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react' import { post } from 'aws-amplify/api' -import useStoreDataStore from '@/zustand-states/storeDataStore' +import useStoreDataStore from '@/context/core/storeDataStore' export interface S3Image { key: string diff --git a/app/store/hooks/useStore.ts b/app/store/hooks/useStore.ts index 19da23b8..59b32465 100644 --- a/app/store/hooks/useStore.ts +++ b/app/store/hooks/useStore.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import useStoreDataStore from '@/zustand-states/storeDataStore' +import useStoreDataStore from '@/context/core/storeDataStore' interface UseStoreReturn { store: any diff --git a/components/ui/sidebar.tsx b/components/ui/sidebar.tsx index 972c1cf1..e685eace 100644 --- a/components/ui/sidebar.tsx +++ b/components/ui/sidebar.tsx @@ -5,7 +5,7 @@ import { Slot } from '@radix-ui/react-slot' import { VariantProps, cva } from 'class-variance-authority' import { Menu } from 'lucide-react' -import { useIsMobile } from '@/hooks/use-mobile' +import { useIsMobile } from '@/hooks/ui/use-mobile' import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' diff --git a/components/ui/toaster.tsx b/components/ui/toaster.tsx index f8945aba..b5d2f57f 100644 --- a/components/ui/toaster.tsx +++ b/components/ui/toaster.tsx @@ -1,4 +1,4 @@ -import { useToast } from '@/hooks/use-toast' +import { useToast } from '@/hooks/ui/use-toast' import { Toast, ToastClose, diff --git a/components/ui/toasts.tsx b/components/ui/toasts.tsx index f96bc2ba..553cb192 100644 --- a/components/ui/toasts.tsx +++ b/components/ui/toasts.tsx @@ -2,7 +2,7 @@ import { motion, AnimatePresence } from 'framer-motion' import { AlertCircle, CheckCircle, Info, X } from 'lucide-react' -import type { Toast as ToastType } from '@/hooks/custom-toast/use-toast' +import type { Toast as ToastType } from '@/hooks/ui/use-toasts' import { createPortal } from 'react-dom' const variants = { diff --git a/zustand-states/storeDataStore.ts b/context/core/storeDataStore.ts similarity index 100% rename from zustand-states/storeDataStore.ts rename to context/core/storeDataStore.ts diff --git a/zustand-states/useSubscriptionStore.ts b/context/core/useSubscriptionStore.ts similarity index 100% rename from zustand-states/useSubscriptionStore.ts rename to context/core/useSubscriptionStore.ts diff --git a/zustand-states/userStore.ts b/context/core/userStore.ts similarity index 100% rename from zustand-states/userStore.ts rename to context/core/userStore.ts diff --git a/hooks/auth/useAuth.ts b/context/hooks/useAuth.ts similarity index 97% rename from hooks/auth/useAuth.ts rename to context/hooks/useAuth.ts index 25f9012d..1ea3a5f5 100644 --- a/hooks/auth/useAuth.ts +++ b/context/hooks/useAuth.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' import { fetchAuthSession } from 'aws-amplify/auth' -import useAuthStore from '@/zustand-states/userStore' +import useAuthStore from '@/context/core/userStore' /** * Hook personalizado para manejar la autenticación del usuario. @@ -14,7 +14,7 @@ import useAuthStore from '@/zustand-states/userStore' * const { user, loading } = useAuthStore() // Obtiene el estado desde el store * * if (loading) { - * return + * return * } * ``` */ diff --git a/hooks/use-auto-resize-textare.tsx b/hooks/ui/use-auto-resize-textare.tsx similarity index 100% rename from hooks/use-auto-resize-textare.tsx rename to hooks/ui/use-auto-resize-textare.tsx diff --git a/hooks/use-media-query.ts b/hooks/ui/use-media-query.ts similarity index 100% rename from hooks/use-media-query.ts rename to hooks/ui/use-media-query.ts diff --git a/hooks/use-mobile.tsx b/hooks/ui/use-mobile.tsx similarity index 100% rename from hooks/use-mobile.tsx rename to hooks/ui/use-mobile.tsx diff --git a/hooks/use-toast.ts b/hooks/ui/use-toast.ts similarity index 100% rename from hooks/use-toast.ts rename to hooks/ui/use-toast.ts diff --git a/hooks/custom-toast/use-toast.ts b/hooks/ui/use-toasts.ts similarity index 100% rename from hooks/custom-toast/use-toast.ts rename to hooks/ui/use-toasts.ts diff --git a/hooks/use-unsaved-changes-warning.tsx b/hooks/ui/use-unsaved-changes-warning.tsx similarity index 100% rename from hooks/use-unsaved-changes-warning.tsx rename to hooks/ui/use-unsaved-changes-warning.tsx diff --git a/lib/schemas/api-keys.ts b/lib/zod-schemas/api-keys.ts similarity index 100% rename from lib/schemas/api-keys.ts rename to lib/zod-schemas/api-keys.ts diff --git a/lib/schemas/email-change.ts b/lib/zod-schemas/email-change.ts similarity index 100% rename from lib/schemas/email-change.ts rename to lib/zod-schemas/email-change.ts diff --git a/lib/schemas/first-step.ts b/lib/zod-schemas/first-step.ts similarity index 100% rename from lib/schemas/first-step.ts rename to lib/zod-schemas/first-step.ts diff --git a/lib/schemas/password-change.ts b/lib/zod-schemas/password-change.ts similarity index 100% rename from lib/schemas/password-change.ts rename to lib/zod-schemas/password-change.ts diff --git a/lib/schemas/product-schema.ts b/lib/zod-schemas/product-schema.ts similarity index 100% rename from lib/schemas/product-schema.ts rename to lib/zod-schemas/product-schema.ts diff --git a/lib/schemas/schemas.ts b/lib/zod-schemas/schemas.ts similarity index 100% rename from lib/schemas/schemas.ts rename to lib/zod-schemas/schemas.ts diff --git a/lib/schemas/store-profile-schema.ts b/lib/zod-schemas/store-profile-schema.ts similarity index 100% rename from lib/schemas/store-profile-schema.ts rename to lib/zod-schemas/store-profile-schema.ts diff --git a/test/unit/components/StoreSelector.test.tsx b/test/unit/components/StoreSelector.test.tsx index 8afabe82..2ef8a84e 100644 --- a/test/unit/components/StoreSelector.test.tsx +++ b/test/unit/components/StoreSelector.test.tsx @@ -1,8 +1,8 @@ import { render, screen } from '@testing-library/react' import '@testing-library/jest-dom' -import { StoreSelector } from '@/app/(without-navbar)/my-store/components/StoreSelector' +import { StoreSelector } from '@/app/(setup-layout)/my-store/components/StoreSelector' import { useAuthUser } from '@/hooks/auth/useAuthUser' -import { getUserStores } from '@/app/(without-navbar)/my-store/hooks/useUserStores' +import { getUserStores } from '@/app/(setup-layout)/my-store/hooks/useUserStores' jest.mock('@/hooks/auth/useAuthUser', () => ({ useAuthUser: jest.fn(), diff --git a/test/unit/hooks/SignIn.test.ts b/test/unit/hooks/SignIn.test.ts index 3d4ffec6..567a879b 100644 --- a/test/unit/hooks/SignIn.test.ts +++ b/test/unit/hooks/SignIn.test.ts @@ -1,5 +1,5 @@ import { renderHook, act } from '@testing-library/react' -import { useAuth } from '@/app/(without-navbar)/login/hooks/SignIn' +import { useAuth } from '@/app/(setup-layout)/login/hooks/SignIn' import { signIn, resendSignUpCode } from 'aws-amplify/auth' // Mock de los módulos de AWS Amplify diff --git a/test/unit/hooks/signUp.test.ts b/test/unit/hooks/signUp.test.ts index 89a625a3..a2a9b62b 100644 --- a/test/unit/hooks/signUp.test.ts +++ b/test/unit/hooks/signUp.test.ts @@ -1,4 +1,4 @@ -import { handleSignUp, handleConfirmSignUp } from '@/app/(without-navbar)/login/hooks/signUp' +import { handleSignUp, handleConfirmSignUp } from '@/app/(setup-layout)/login/hooks/signUp' import { signUp, confirmSignUp } from 'aws-amplify/auth' // Mock de los módulos de AWS Amplify diff --git a/test/unit/hooks/useResetPassword.test.ts b/test/unit/hooks/useResetPassword.test.ts index ad48f506..fd17de7f 100644 --- a/test/unit/hooks/useResetPassword.test.ts +++ b/test/unit/hooks/useResetPassword.test.ts @@ -1,5 +1,5 @@ import { renderHook, act } from '@testing-library/react' -import { useResetPassword } from '@/app/(without-navbar)/login/hooks/useResetPassword' +import { useResetPassword } from '@/app/(setup-layout)/login/hooks/useResetPassword' import { resetPassword } from 'aws-amplify/auth' // Mock del módulo de AWS Amplify From dd5b972d0bacc1ab958a9f5464528b90a2abb884 Mon Sep 17 00:00:00 2001 From: Stivenjs Date: Thu, 8 May 2025 12:17:37 -0500 Subject: [PATCH 2/3] refactor(test): update mock path and remove unused variable Update the mock path in StoreSelector test to reflect the correct directory structure. Remove the unused `aws_region` variable in `useProductImageUpload` hook to clean up the code. --- app/store/hooks/useProductImageUpload.ts | 1 - test/unit/components/StoreSelector.test.tsx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/store/hooks/useProductImageUpload.ts b/app/store/hooks/useProductImageUpload.ts index f8ee0614..9e650f33 100644 --- a/app/store/hooks/useProductImageUpload.ts +++ b/app/store/hooks/useProductImageUpload.ts @@ -17,7 +17,6 @@ export function useProductImageUpload() { // Obtener el bucket correcto para imágenes de productos const productBucket = outputs.storage.buckets.find(bucket => bucket.name === 'productsImages') - const aws_region = outputs.auth.aws_region if (!productBucket) { throw new Error('There is no bucket for product images') diff --git a/test/unit/components/StoreSelector.test.tsx b/test/unit/components/StoreSelector.test.tsx index 2ef8a84e..0ea6212e 100644 --- a/test/unit/components/StoreSelector.test.tsx +++ b/test/unit/components/StoreSelector.test.tsx @@ -8,7 +8,7 @@ jest.mock('@/hooks/auth/useAuthUser', () => ({ useAuthUser: jest.fn(), })) -jest.mock('@/app/(without-navbar)/my-store/hooks/useUserStores', () => ({ +jest.mock('@/app/(setup-layout)/my-store/hooks/useUserStores', () => ({ getUserStores: jest.fn(), })) From 567fbf1426e321865c6517b179fc843db43127a0 Mon Sep 17 00:00:00 2001 From: Stivenjs Date: Thu, 8 May 2025 13:54:01 -0500 Subject: [PATCH 3/3] refactor: update subscription store and fix animation paths - Fix animation file paths in CancellationDialog to match new directory structure - Optimize subscription store to avoid duplicate requests by tracking the last username - Simplify PaymentSettings component by removing unused ErrorFallback and adjusting useEffect dependencies --- .../components/CancellationDialog.tsx | 4 ++-- .../components/PaymentSettings.tsx | 17 +++-------------- context/core/useSubscriptionStore.ts | 11 +++++++++-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/(main-layout)/account-settings/components/CancellationDialog.tsx b/app/(main-layout)/account-settings/components/CancellationDialog.tsx index c0490f0c..47409ad5 100644 --- a/app/(main-layout)/account-settings/components/CancellationDialog.tsx +++ b/app/(main-layout)/account-settings/components/CancellationDialog.tsx @@ -14,8 +14,8 @@ import { AlertDialogFooter, } from '@/components/ui/alert-dialog' import { Button } from '@/components/ui/button' -import cancelAnimation from '@/app/(with-navbar)/account-settings/anim/cancel-animation.json' -import successAnimation from '@/app/(with-navbar)/account-settings/anim/success-animation.json' +import cancelAnimation from '@/app/(main-layout)/account-settings/anim/cancel-animation.json' +import successAnimation from '@/app/(main-layout)/account-settings/anim/success-animation.json' interface CancellationDialogProps { onCancel: () => Promise diff --git a/app/(main-layout)/account-settings/components/PaymentSettings.tsx b/app/(main-layout)/account-settings/components/PaymentSettings.tsx index 42b868c3..00a328cc 100644 --- a/app/(main-layout)/account-settings/components/PaymentSettings.tsx +++ b/app/(main-layout)/account-settings/components/PaymentSettings.tsx @@ -11,8 +11,9 @@ import Link from 'next/link' function SubscriptionLoader() { const { subscriptionResource } = useSubscriptionStore() - const subscription = subscriptionResource.read() + const subscription = subscriptionResource?.read() const [isSubmitting, setIsSubmitting] = useState(false) + const { user } = useUserStore() const cognitoUsername = user?.cognitoUsername @@ -134,18 +135,6 @@ function SubscriptionLoader() { ) } -// Componente de fallback para errores -function ErrorFallback() { - return ( - - - Error al cargar la suscripción - Por favor, intenta de nuevo más tarde. - - - ) -} - // Componente principal export function PaymentSettings() { const { setCognitoUsername } = useSubscriptionStore() @@ -156,7 +145,7 @@ export function PaymentSettings() { if (user?.cognitoUsername) { setCognitoUsername(user.cognitoUsername) } - }, [user?.cognitoUsername, setCognitoUsername]) + }, [user]) return (
diff --git a/context/core/useSubscriptionStore.ts b/context/core/useSubscriptionStore.ts index 87d6d715..a49aebd1 100644 --- a/context/core/useSubscriptionStore.ts +++ b/context/core/useSubscriptionStore.ts @@ -32,6 +32,7 @@ function createResource() { let result: MinimalSubscription | null = null let error: Error | null = null let suspender: Promise | null = null + let lastUsername: string | null = null return { read() { @@ -46,6 +47,12 @@ function createResource() { preload(username: string) { if (!username) return + // Evitar peticiones duplicadas si el username no ha cambiado y ya hay una petición en curso + if (username === lastUsername && (status === 'success' || suspender)) { + return + } + + lastUsername = username status = 'pending' suspender = fetchSubscriptionData(username) .then(data => { @@ -102,9 +109,9 @@ async function fetchSubscriptionData(username: string): Promise((set, get) => { - const subscriptionResource = createResource() +const subscriptionResource = createResource() +export const useSubscriptionStore = create((set, get) => { return { cognitoUsername: null, subscription: null,