@devvistatech/devvista-kit 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/LICENSE +7 -0
- package/README.md +15 -0
- package/app/about/page.tsx +306 -0
- package/app/adRequest/page.tsx +550 -0
- package/app/analytics/page.tsx +347 -0
- package/app/api/about/route.ts +307 -0
- package/app/api/adRequest/route.ts +568 -0
- package/app/api/analytics/[reportType]/route.ts +338 -0
- package/app/api/bio/route.ts +314 -0
- package/app/api/blog/route.ts +307 -0
- package/app/api/chat/route.ts +15 -0
- package/app/api/contact/route.ts +410 -0
- package/app/api/contacts/route.ts +225 -0
- package/app/api/files/route.ts +430 -0
- package/app/api/gallery-data/route.ts +661 -0
- package/app/api/schedule/route.ts +456 -0
- package/app/api/sync-user/route.ts +114 -0
- package/app/api/trial-request/route.ts +298 -0
- package/app/blog/[id]/page.tsx +281 -0
- package/app/blog/page.tsx +217 -0
- package/app/constants/about.ts +49 -0
- package/app/constants/adRequest.ts +114 -0
- package/app/constants/contact.ts +41 -0
- package/app/constants/faq.ts +46 -0
- package/app/constants/gallery.ts +43 -0
- package/app/constants/page.ts +70 -0
- package/app/constants/schedule.ts +72 -0
- package/app/contact/page.tsx +285 -0
- package/app/faq/page.tsx +192 -0
- package/app/favicon.ico +0 -0
- package/app/gallery/page.tsx +320 -0
- package/app/globals.css +58 -0
- package/app/layout.tsx +62 -0
- package/app/page.tsx +339 -0
- package/app/schedule/page.tsx +661 -0
- package/bin/init.js +187 -0
- package/components/addOns/functional/BioEditor.tsx +430 -0
- package/components/addOns/functional/CalendlyWidget.tsx +101 -0
- package/components/addOns/functional/ClassList.tsx +146 -0
- package/components/addOns/functional/ClassPopup.tsx +399 -0
- package/components/addOns/functional/ContactForm.tsx +285 -0
- package/components/addOns/functional/FileUploader.tsx +293 -0
- package/components/addOns/functional/ImageDescCarousel.tsx +821 -0
- package/components/addOns/functional/NewUserAnalytics.tsx +101 -0
- package/components/addOns/functional/ScheduleCarousel.tsx +172 -0
- package/components/addOns/functional/aboutSections/AboutSection.tsx +571 -0
- package/components/addOns/functional/aboutSections/constants/aboutSection.ts +66 -0
- package/components/addOns/functional/blogSections/BlogDashboard.tsx +185 -0
- package/components/addOns/functional/blogSections/BlogFormPopUp.tsx +555 -0
- package/components/addOns/functional/blogSections/BlogList.tsx +149 -0
- package/components/addOns/functional/blogSections/BlogSidebar.tsx +59 -0
- package/components/addOns/functional/blogSections/constants/blogDashboard.ts +29 -0
- package/components/addOns/functional/blogSections/constants/blogFormPopUp.ts +98 -0
- package/components/addOns/functional/blogSections/constants/blogList.ts +23 -0
- package/components/addOns/functional/blogSections/constants/blogSidebar.ts +16 -0
- package/components/addOns/functional/contactsDashboard/ContactsDashboard.tsx +348 -0
- package/components/addOns/functional/contactsDashboard/constants/contactsDashboard.ts +71 -0
- package/components/addOns/functional/galleries/GalleryComplex.tsx +908 -0
- package/components/addOns/functional/galleries/GallerySimple.tsx +604 -0
- package/components/addOns/functional/galleries/constants/galleryComplex.ts +105 -0
- package/components/addOns/functional/galleries/constants/gallerySimple.ts +75 -0
- package/components/addOns/functional/schedules/ScheduleGridOne.tsx +263 -0
- package/components/addOns/functional/schedules/ScheduleGridTwo.tsx +295 -0
- package/components/addOns/functional/schedules/ScheduleGridTwoBasic.tsx +289 -0
- package/components/addOns/functional/schedules/SchedulerForm.tsx +429 -0
- package/components/addOns/functional/schedules/constants/ScheduleGridTwo.ts +41 -0
- package/components/addOns/functional/schedules/constants/ScheduleGridTwoBasic.ts +41 -0
- package/components/addOns/functional/schedules/constants/SchedulerForm.ts +66 -0
- package/components/addOns/functional/schedules/constants/scheduleGridOne.ts +55 -0
- package/components/addOns/non-functional/AnnouncementBanner.tsx +47 -0
- package/components/addOns/non-functional/FeaturesSection.tsx +63 -0
- package/components/addOns/non-functional/HeroSection.tsx +143 -0
- package/components/addOns/non-functional/IconBubble.tsx +50 -0
- package/components/addOns/non-functional/SampleCarousel.tsx +205 -0
- package/components/addOns/non-functional/Testimonials.tsx +336 -0
- package/components/addOns/non-functional/ThreeSetGallery.tsx +64 -0
- package/components/addOns/non-functional/aboutSections/AboutSection.tsx +63 -0
- package/components/addOns/non-functional/aboutSections/constants/aboutSection.ts +25 -0
- package/components/addOns/non-functional/imageCarousels/ProductSlider.tsx +118 -0
- package/components/addOns/non-functional/imageCarousels/ProgramCarousel.tsx +233 -0
- package/components/addOns/non-functional/imageCarousels/constants/programCarousel.ts +40 -0
- package/components/addOns/non-functional/imageCarousels/constants/programSlider.ts +37 -0
- package/components/addOns/non-functional/spinner.tsx +22 -0
- package/components/footers/footer.tsx +454 -0
- package/components/navBars/navbar.tsx +311 -0
- package/components/other/accordion.tsx +58 -0
- package/components/other/admin-menu.tsx +69 -0
- package/components/other/alert-dialog.tsx +141 -0
- package/components/other/alert.tsx +59 -0
- package/components/other/aspect-ratio.tsx +7 -0
- package/components/other/avatar.tsx +50 -0
- package/components/other/badge.tsx +36 -0
- package/components/other/breadcrumb.tsx +115 -0
- package/components/other/button.tsx +733 -0
- package/components/other/calendar.tsx +66 -0
- package/components/other/card.tsx +86 -0
- package/components/other/carousel.tsx +275 -0
- package/components/other/chart.tsx +363 -0
- package/components/other/checkbox.tsx +30 -0
- package/components/other/collapsible.tsx +11 -0
- package/components/other/command.tsx +155 -0
- package/components/other/context-menu.tsx +200 -0
- package/components/other/dialog.tsx +122 -0
- package/components/other/drawer.tsx +118 -0
- package/components/other/dropdown-menu.tsx +200 -0
- package/components/other/form.tsx +179 -0
- package/components/other/hover-card.tsx +29 -0
- package/components/other/input-otp.tsx +71 -0
- package/components/other/input.tsx +25 -0
- package/components/other/label.tsx +26 -0
- package/components/other/login-popup.tsx +0 -0
- package/components/other/menubar.tsx +236 -0
- package/components/other/mobile-icon.tsx +22 -0
- package/components/other/navigation-menu.tsx +128 -0
- package/components/other/pagination.tsx +117 -0
- package/components/other/popover.tsx +31 -0
- package/components/other/progress.tsx +28 -0
- package/components/other/radio-group.tsx +44 -0
- package/components/other/resizable.tsx +45 -0
- package/components/other/scroll-area.tsx +48 -0
- package/components/other/select.tsx +160 -0
- package/components/other/separator.tsx +31 -0
- package/components/other/sheet.tsx +140 -0
- package/components/other/signup-popup.tsx +0 -0
- package/components/other/skeleton.tsx +15 -0
- package/components/other/slider.tsx +28 -0
- package/components/other/social-icons.tsx +40 -0
- package/components/other/sonner.tsx +31 -0
- package/components/other/switch.tsx +29 -0
- package/components/other/table.tsx +117 -0
- package/components/other/tabs.tsx +55 -0
- package/components/other/textarea.tsx +24 -0
- package/components/other/toast.tsx +123 -0
- package/components/other/toaster.tsx +35 -0
- package/components/other/toggle-group.tsx +61 -0
- package/components/other/toggle.tsx +45 -0
- package/components/other/tooltip.tsx +30 -0
- package/components/theme-provider.tsx +9 -0
- package/components/types.ts +22 -0
- package/dist/.next/types/app/api/about/route.js +52 -0
- package/dist/.next/types/app/api/blog/route.js +52 -0
- package/dist/.next/types/app/api/files/route.js +52 -0
- package/dist/.next/types/app/api/schedule/route.js +52 -0
- package/dist/.next/types/app/api/sync-user/route.js +52 -0
- package/dist/.next/types/app/layout.js +22 -0
- package/dist/.next/types/app/page.js +22 -0
- package/dist/app/about/page.jsx +259 -0
- package/dist/app/adRequest/page.jsx +531 -0
- package/dist/app/analytics/page.jsx +298 -0
- package/dist/app/api/about/route.js +285 -0
- package/dist/app/api/adRequest/route.js +440 -0
- package/dist/app/api/analytics/[reportType]/route.js +346 -0
- package/dist/app/api/bio/route.js +293 -0
- package/dist/app/api/blog/route.js +366 -0
- package/dist/app/api/chat/route.js +58 -0
- package/dist/app/api/contact/route.js +163 -0
- package/dist/app/api/contacts/route.js +234 -0
- package/dist/app/api/files/route.js +444 -0
- package/dist/app/api/gallery-data/route.js +642 -0
- package/dist/app/api/schedule/route.js +461 -0
- package/dist/app/api/sync-user/route.js +174 -0
- package/dist/app/api/trial-request/route.js +165 -0
- package/dist/app/blog/[id]/page.jsx +307 -0
- package/dist/app/blog/page.jsx +210 -0
- package/dist/app/constants/about.js +32 -0
- package/dist/app/constants/adRequest.js +113 -0
- package/dist/app/constants/contact.js +40 -0
- package/dist/app/constants/faq.js +36 -0
- package/dist/app/constants/gallery.js +42 -0
- package/dist/app/constants/page.js +69 -0
- package/dist/app/constants/schedule.js +71 -0
- package/dist/app/contact/page.jsx +119 -0
- package/dist/app/faq/page.jsx +97 -0
- package/dist/app/gallery/page.jsx +280 -0
- package/dist/app/layout.jsx +45 -0
- package/dist/app/page.jsx +324 -0
- package/dist/app/schedule/page.jsx +500 -0
- package/dist/components/addOns/functional/BioEditor.jsx +175 -0
- package/dist/components/addOns/functional/CalendlyWidget.jsx +61 -0
- package/dist/components/addOns/functional/ClassList.jsx +158 -0
- package/dist/components/addOns/functional/ClassPopup.jsx +300 -0
- package/dist/components/addOns/functional/ContactForm.jsx +219 -0
- package/dist/components/addOns/functional/FileUploader.jsx +222 -0
- package/dist/components/addOns/functional/ImageDescCarousel.jsx +464 -0
- package/dist/components/addOns/functional/NewUserAnalytics.jsx +71 -0
- package/dist/components/addOns/functional/ScheduleCarousel.jsx +68 -0
- package/dist/components/addOns/functional/aboutSections/AboutSection.jsx +369 -0
- package/dist/components/addOns/functional/aboutSections/constants/aboutSection.js +65 -0
- package/dist/components/addOns/functional/blogSections/BlogDashboard.jsx +111 -0
- package/dist/components/addOns/functional/blogSections/BlogFormPopUp.jsx +465 -0
- package/dist/components/addOns/functional/blogSections/BlogList.jsx +170 -0
- package/dist/components/addOns/functional/blogSections/BlogSidebar.jsx +35 -0
- package/dist/components/addOns/functional/blogSections/constants/blogDashboard.js +28 -0
- package/dist/components/addOns/functional/blogSections/constants/blogFormPopUp.js +97 -0
- package/dist/components/addOns/functional/blogSections/constants/blogList.js +22 -0
- package/dist/components/addOns/functional/blogSections/constants/blogSidebar.js +15 -0
- package/dist/components/addOns/functional/contactsDashboard/ContactsDashboard.jsx +323 -0
- package/dist/components/addOns/functional/contactsDashboard/constants/contactsDashboard.js +70 -0
- package/dist/components/addOns/functional/galleries/GalleryComplex.jsx +586 -0
- package/dist/components/addOns/functional/galleries/GallerySimple.jsx +385 -0
- package/dist/components/addOns/functional/galleries/constants/galleryComplex.js +104 -0
- package/dist/components/addOns/functional/galleries/constants/gallerySimple.js +74 -0
- package/dist/components/addOns/functional/schedules/ScheduleGridOne.jsx +167 -0
- package/dist/components/addOns/functional/schedules/ScheduleGridTwo.jsx +100 -0
- package/dist/components/addOns/functional/schedules/ScheduleGridTwoBasic.jsx +97 -0
- package/dist/components/addOns/functional/schedules/SchedulerForm.jsx +188 -0
- package/dist/components/addOns/functional/schedules/constants/ScheduleGridTwo.js +40 -0
- package/dist/components/addOns/functional/schedules/constants/ScheduleGridTwoBasic.js +40 -0
- package/dist/components/addOns/functional/schedules/constants/SchedulerForm.js +65 -0
- package/dist/components/addOns/functional/schedules/constants/scheduleGridOne.js +54 -0
- package/dist/components/addOns/non-functional/AnnouncementBanner.jsx +24 -0
- package/dist/components/addOns/non-functional/FeaturesSection.jsx +38 -0
- package/dist/components/addOns/non-functional/HeroSection.jsx +71 -0
- package/dist/components/addOns/non-functional/IconBubble.jsx +36 -0
- package/dist/components/addOns/non-functional/SampleCarousel.jsx +114 -0
- package/dist/components/addOns/non-functional/Testimonials.jsx +177 -0
- package/dist/components/addOns/non-functional/ThreeSetGallery.jsx +40 -0
- package/dist/components/addOns/non-functional/aboutSections/AboutSection.jsx +35 -0
- package/dist/components/addOns/non-functional/aboutSections/constants/aboutSection.js +24 -0
- package/dist/components/addOns/non-functional/imageCarousels/ProductSlider.jsx +80 -0
- package/dist/components/addOns/non-functional/imageCarousels/ProgramCarousel.jsx +155 -0
- package/dist/components/addOns/non-functional/imageCarousels/constants/programCarousel.js +39 -0
- package/dist/components/addOns/non-functional/imageCarousels/constants/programSlider.js +36 -0
- package/dist/components/addOns/non-functional/spinner.jsx +13 -0
- package/dist/components/footers/footer.jsx +219 -0
- package/dist/components/navBars/navbar.jsx +158 -0
- package/dist/components/other/accordion.jsx +40 -0
- package/dist/components/other/admin-menu.jsx +34 -0
- package/dist/components/other/alert-dialog.jsx +64 -0
- package/dist/components/other/alert.jsx +41 -0
- package/dist/components/other/aspect-ratio.jsx +4 -0
- package/dist/components/other/avatar.jsx +31 -0
- package/dist/components/other/badge.jsx +32 -0
- package/dist/components/other/breadcrumb.jsx +57 -0
- package/dist/components/other/button.jsx +321 -0
- package/dist/components/other/calendar.jsx +43 -0
- package/dist/components/other/card.jsx +44 -0
- package/dist/components/other/carousel.jsx +140 -0
- package/dist/components/other/chart.jsx +182 -0
- package/dist/components/other/checkbox.jsx +26 -0
- package/dist/components/other/collapsible.jsx +6 -0
- package/dist/components/other/command.jsx +68 -0
- package/dist/components/other/context-menu.jsx +88 -0
- package/dist/components/other/dialog.jsx +60 -0
- package/dist/components/other/drawer.jsx +60 -0
- package/dist/components/other/dropdown-menu.jsx +90 -0
- package/dist/components/other/form.jsx +89 -0
- package/dist/components/other/hover-card.jsx +23 -0
- package/dist/components/other/input-otp.jsx +46 -0
- package/dist/components/other/input.jsx +19 -0
- package/dist/components/other/label.jsx +23 -0
- package/dist/components/other/login-popup.jsx +1 -0
- package/dist/components/other/menubar.jsx +96 -0
- package/dist/components/other/mobile-icon.jsx +11 -0
- package/dist/components/other/navigation-menu.jsx +62 -0
- package/dist/components/other/pagination.jsx +63 -0
- package/dist/components/other/popover.jsx +25 -0
- package/dist/components/other/progress.jsx +23 -0
- package/dist/components/other/radio-group.jsx +31 -0
- package/dist/components/other/resizable.jsx +29 -0
- package/dist/components/other/scroll-area.jsx +36 -0
- package/dist/components/other/select.jsx +83 -0
- package/dist/components/other/separator.jsx +21 -0
- package/dist/components/other/sheet.jsx +74 -0
- package/dist/components/other/signup-popup.jsx +1 -0
- package/dist/components/other/skeleton.jsx +17 -0
- package/dist/components/other/slider.jsx +26 -0
- package/dist/components/other/social-icons.jsx +15 -0
- package/dist/components/other/sonner.jsx +27 -0
- package/dist/components/other/switch.jsx +23 -0
- package/dist/components/other/table.jsx +56 -0
- package/dist/components/other/tabs.jsx +32 -0
- package/dist/components/other/textarea.jsx +19 -0
- package/dist/components/other/toast.jsx +58 -0
- package/dist/components/other/toaster.jsx +31 -0
- package/dist/components/other/toggle-group.jsx +41 -0
- package/dist/components/other/toggle.jsx +39 -0
- package/dist/components/other/tooltip.jsx +24 -0
- package/dist/components/theme-provider.jsx +18 -0
- package/dist/components/types.js +1 -0
- package/dist/hooks/use-toast.js +135 -0
- package/dist/lib/auth-context.jsx +144 -0
- package/dist/lib/google-analytics.jsx +148 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/verify-user.js +142 -0
- package/dist/middleware.js +32 -0
- package/dist/tailwind.config.js +86 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/hooks/use-toast.ts +188 -0
- package/lib/auth-context.tsx +131 -0
- package/lib/google-analytics.tsx +98 -0
- package/lib/utils.ts +6 -0
- package/lib/verify-user.ts +118 -0
- package/middleware.ts +35 -0
- package/next.config.js +10 -0
- package/package.json +116 -0
- package/postcss.config.js +6 -0
- package/public/images/FitStop.png +0 -0
- package/public/images/classes/bodyblast.JPG +0 -0
- package/public/images/classes/cardioxtrain.JPG +0 -0
- package/public/images/classes/combo.JPG +0 -0
- package/public/images/classes/flexiblefriday.JPG +0 -0
- package/public/images/classes/freestyle.jpg +0 -0
- package/public/images/classes/noclasses.jpg +0 -0
- package/public/images/classes/seniorstretch.JPG +0 -0
- package/public/images/classes/stretch.JPG +0 -0
- package/public/images/classes/zoomba.JPG +0 -0
- package/public/images/fitstoproom1.jpg +0 -0
- package/public/images/fitstoproom2.jpg +0 -0
- package/public/images/gallery/021-1024x768.jpg +0 -0
- package/public/images/gallery/023-1024x768.jpg +0 -0
- package/public/images/gallery/027-1024x768.jpg +0 -0
- package/public/images/gallery/029-1024x768.jpg +0 -0
- package/public/images/gallery/030-1024x768.jpg +0 -0
- package/public/images/gallery/042-1024x768.jpg +0 -0
- package/public/images/gallery/049-1024x768.jpg +0 -0
- package/public/images/gallery/073-1024x768.jpg +0 -0
- package/public/images/gallery/108-300x225.jpg +0 -0
- package/public/images/gallery/109-300x225.jpg +0 -0
- package/public/images/gallery/116.jpg +0 -0
- package/public/images/gallery/123-1-1024x768.jpg +0 -0
- package/public/images/gallery/133.jpg +0 -0
- package/public/images/gallery/142-1.jpg +0 -0
- package/public/images/gallery/143.jpg +0 -0
- package/public/images/gallery/145-1-1024x768.jpg +0 -0
- package/public/images/gallery/151-1024x768.jpg +0 -0
- package/public/images/gallery/166-300x225.jpg +0 -0
- package/public/images/gallery/175.jpg +0 -0
- package/public/images/gallery/183-1024x768.jpg +0 -0
- package/public/images/gallery/311.JPG +0 -0
- package/public/images/gallery/413-1.jpg +0 -0
- package/public/images/gallery/Cathys-Fit-Stop-Holiday-Party-0003-1024x683.jpg +0 -0
- package/public/images/gallery/Cathys-Fit-Stop-Holiday-Party-0076-1024x683.jpg +0 -0
- package/public/images/gallery/Cathys-Fit-Stop-Holiday-Party-0171-1024x683.jpg +0 -0
- package/public/images/gallery/DSCN0233-1024x768.jpg +0 -0
- package/public/images/gallery/DSCN0245-1-1024x768.jpg +0 -0
- package/public/images/gallery/Fitstopgirls2.jpg +0 -0
- package/public/images/gallery/GrandOpening2009.JPG +0 -0
- package/public/images/gallery/IMG_1937.JPG +0 -0
- package/public/images/gallery/IMG_1950-20.jpg +0 -0
- package/public/images/gallery/IMG_2112.JPG +0 -0
- package/public/images/gallery/IMG_2229.JPG +0 -0
- package/public/images/gallery/IMG_2272.JPG +0 -0
- package/public/images/gallery/IMG_2336.JPG +0 -0
- package/public/images/gallery/IMG_2367.JPG +0 -0
- package/public/images/gallery/IMG_2520.jpg +0 -0
- package/public/images/gallery/IMG_2564.jpg +0 -0
- package/public/images/gallery/IMG_3678.jpg +0 -0
- package/public/images/gallery/IMG_3744.jpg +0 -0
- package/public/images/gallery/IMG_3745.jpg +0 -0
- package/public/images/gallery/IMG_6383.jpg +0 -0
- package/public/images/gallery/Jillian-8-Months-2338-1024x683.jpg +0 -0
- package/public/images/gallery/Kathys-Fit-Stop-0032-1024x675.jpg +0 -0
- package/public/images/gallery/LaurieinPlank.jpeg +0 -0
- package/public/images/gallery/May2017032.JPG +0 -0
- package/public/images/gallery/clubpic10.jpg +0 -0
- package/public/images/gallery/clubpic15.jpg +0 -0
- package/public/images/gallery/clubpic2.jpg +0 -0
- package/public/images/gallery/clubpic3.jpg +0 -0
- package/public/images/gallery/clubpic4.jpg +0 -0
- package/public/images/gallery/clubpic5.jpg +0 -0
- package/public/images/gallery/clubpic6.jpg +0 -0
- package/public/images/gallery/clubpic7.jpg +0 -0
- package/public/images/gallery/clubpic8.jpg +0 -0
- package/public/images/gallery/clubpic9.jpg +0 -0
- package/public/images/gallery/z014-1024x768.jpg +0 -0
- package/public/images/gallery/z019-1-1024x768.jpg +0 -0
- package/public/images/kathy_faq-300x132.jpg +0 -0
- package/public/images/kathyportrait.jpg +0 -0
- package/public/images/kristiportrait.jpg +0 -0
- package/public/images/maincoverbackground.JPG +0 -0
- package/public/images/videos/FitStopLoopVideo.mp4 +0 -0
- package/public/images/weights.jpg +0 -0
- package/public/pdf/FitStop-Forum-April-2025.pdf +0 -0
- package/tailwind.config.ts +89 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
4
|
+
import { Card } from "@/components/other/card";
|
|
5
|
+
import Spinner from "@/components/addOns/non-functional/spinner";
|
|
6
|
+
import { motion } from "framer-motion";
|
|
7
|
+
import { useAuth as useClerkAuth, useSession } from "@clerk/nextjs";
|
|
8
|
+
import { useStrapiAuth } from "@/lib/auth-context";
|
|
9
|
+
import { Bar } from "react-chartjs-2";
|
|
10
|
+
import {
|
|
11
|
+
Chart as ChartJS,
|
|
12
|
+
CategoryScale,
|
|
13
|
+
LinearScale,
|
|
14
|
+
BarElement,
|
|
15
|
+
Title,
|
|
16
|
+
Tooltip,
|
|
17
|
+
Legend,
|
|
18
|
+
} from "chart.js";
|
|
19
|
+
import { debounce } from "lodash";
|
|
20
|
+
import { CONTACTS_DASHBOARD } from "./constants/contactsDashboard";
|
|
21
|
+
|
|
22
|
+
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
|
|
23
|
+
|
|
24
|
+
interface Contact {
|
|
25
|
+
id: number;
|
|
26
|
+
documentId: string;
|
|
27
|
+
name: string;
|
|
28
|
+
lastName: string;
|
|
29
|
+
email: string;
|
|
30
|
+
phone: string;
|
|
31
|
+
subject: string;
|
|
32
|
+
message: string;
|
|
33
|
+
submissionDate: string;
|
|
34
|
+
rawSubmissionDate: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ContactsDashboard: React.FC = () => {
|
|
38
|
+
const { isSignedIn, userId } = useClerkAuth();
|
|
39
|
+
const { session } = useSession();
|
|
40
|
+
const { user, authLoading, error: authError, checkSession } = useStrapiAuth();
|
|
41
|
+
const [contacts, setContacts] = useState<Contact[]>([]);
|
|
42
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
43
|
+
const [error, setError] = useState<string | null>(null);
|
|
44
|
+
const [visibleRows, setVisibleRows] = useState(3);
|
|
45
|
+
const [selectedYear, setSelectedYear] = useState<number | "all">("all");
|
|
46
|
+
const [availableYears, setAvailableYears] = useState<number[]>([]);
|
|
47
|
+
const [retryCount, setRetryCount] = useState(0);
|
|
48
|
+
const maxRetries = 3;
|
|
49
|
+
|
|
50
|
+
const contactsPerRow = 3;
|
|
51
|
+
const totalRows = Math.ceil(contacts.length / contactsPerRow);
|
|
52
|
+
|
|
53
|
+
const debouncedCheckSession = useCallback(
|
|
54
|
+
debounce(async () => {
|
|
55
|
+
await checkSession();
|
|
56
|
+
}, 3000),
|
|
57
|
+
[checkSession]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const fetchContacts = async () => {
|
|
61
|
+
try {
|
|
62
|
+
setIsLoading(true);
|
|
63
|
+
const token = await session?.getToken();
|
|
64
|
+
|
|
65
|
+
if (!token) {
|
|
66
|
+
throw new Error(CONTACTS_DASHBOARD.ERRORS.NO_TOKEN);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const response = await fetch("/api/contacts", {
|
|
70
|
+
headers: {
|
|
71
|
+
"Content-Type": "application/json",
|
|
72
|
+
Authorization: `Bearer ${token}`,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
const errorData = await response.json();
|
|
78
|
+
throw new Error(errorData.error || CONTACTS_DASHBOARD.ERRORS.FETCH_FAILED.replace("${response.status}", response.status.toString()));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const result = await response.json();
|
|
82
|
+
|
|
83
|
+
const fetchedContacts: Contact[] = (result.data || []).map((contact: any) => ({
|
|
84
|
+
id: contact.id || 0,
|
|
85
|
+
documentId: contact.documentId || "",
|
|
86
|
+
name: contact.name || "Unknown",
|
|
87
|
+
lastName: contact.lastName || "Unknown",
|
|
88
|
+
email: contact.email || "N/A",
|
|
89
|
+
phone: contact.phone || "N/A",
|
|
90
|
+
subject: contact.subject || "No Subject",
|
|
91
|
+
message: contact.message || "No Message",
|
|
92
|
+
submissionDate: contact.submissionDate
|
|
93
|
+
? new Date(contact.submissionDate).toLocaleString("en-US", {
|
|
94
|
+
dateStyle: "medium",
|
|
95
|
+
timeStyle: "short",
|
|
96
|
+
})
|
|
97
|
+
: "N/A",
|
|
98
|
+
rawSubmissionDate: contact.submissionDate || "",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const validContacts = fetchedContacts.filter(
|
|
102
|
+
(contact) =>
|
|
103
|
+
contact.name !== "Unknown" ||
|
|
104
|
+
contact.lastName !== "Unknown" ||
|
|
105
|
+
contact.email !== "N/A" ||
|
|
106
|
+
contact.phone !== "N/A" ||
|
|
107
|
+
contact.subject !== "No Subject" ||
|
|
108
|
+
contact.message !== "No Message"
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const sortedContacts = validContacts.sort((a, b) =>
|
|
112
|
+
b.rawSubmissionDate
|
|
113
|
+
? new Date(b.rawSubmissionDate).getTime() - new Date(a.rawSubmissionDate).getTime()
|
|
114
|
+
: 0
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const years = Array.from(
|
|
118
|
+
new Set(
|
|
119
|
+
validContacts
|
|
120
|
+
.filter((contact) => contact.rawSubmissionDate)
|
|
121
|
+
.map((contact) => new Date(contact.rawSubmissionDate).getFullYear())
|
|
122
|
+
)
|
|
123
|
+
).sort((a, b) => b - a);
|
|
124
|
+
|
|
125
|
+
setAvailableYears(years);
|
|
126
|
+
setContacts(sortedContacts);
|
|
127
|
+
if (validContacts.length === 0 && fetchedContacts.length > 0) {
|
|
128
|
+
setError(CONTACTS_DASHBOARD.ERRORS.NO_VALID_CONTACTS);
|
|
129
|
+
}
|
|
130
|
+
} catch (err) {
|
|
131
|
+
setError(err instanceof Error ? err.message : CONTACTS_DASHBOARD.ERRORS.UNKNOWN_ERROR);
|
|
132
|
+
console.error("ContactsDashboard: Fetch error", err);
|
|
133
|
+
} finally {
|
|
134
|
+
setIsLoading(false);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const attemptFetch = async () => {
|
|
140
|
+
if (authLoading) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!isSignedIn || !user) {
|
|
145
|
+
setError(authError || CONTACTS_DASHBOARD.ERRORS.UNAUTHORIZED);
|
|
146
|
+
setIsLoading(false);
|
|
147
|
+
if (retryCount < maxRetries) {
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
setRetryCount((prev) => Math.min(prev + 1, maxRetries));
|
|
150
|
+
debouncedCheckSession();
|
|
151
|
+
}, Math.min(Math.pow(2, retryCount) * 1000, 10000));
|
|
152
|
+
}
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
setRetryCount(0);
|
|
157
|
+
fetchContacts();
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
attemptFetch();
|
|
161
|
+
}, [isSignedIn, user, authLoading, authError, retryCount, debouncedCheckSession]);
|
|
162
|
+
|
|
163
|
+
const getChartData = () => {
|
|
164
|
+
const uniqueEmails = new Set<string>();
|
|
165
|
+
const uniqueContacts = contacts.filter((contact) => {
|
|
166
|
+
if (contact.email === "N/A" || uniqueEmails.has(contact.email)) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
uniqueEmails.add(contact.email);
|
|
170
|
+
return true;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const filteredContacts =
|
|
174
|
+
selectedYear === "all"
|
|
175
|
+
? uniqueContacts
|
|
176
|
+
: uniqueContacts.filter(
|
|
177
|
+
(contact) =>
|
|
178
|
+
contact.rawSubmissionDate &&
|
|
179
|
+
new Date(contact.rawSubmissionDate).getFullYear() === selectedYear
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const leadsByMonth = Array(12).fill(0);
|
|
183
|
+
filteredContacts.forEach((contact) => {
|
|
184
|
+
if (contact.rawSubmissionDate) {
|
|
185
|
+
const month = new Date(contact.rawSubmissionDate).getMonth();
|
|
186
|
+
leadsByMonth[month]++;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
labels: CONTACTS_DASHBOARD.UI.MONTH_LABELS,
|
|
192
|
+
datasets: [
|
|
193
|
+
{
|
|
194
|
+
label: "New Leads",
|
|
195
|
+
data: leadsByMonth,
|
|
196
|
+
backgroundColor: "rgba(59, 130, 246, 0.5)",
|
|
197
|
+
borderColor: "rgba(59, 130, 246, 1)",
|
|
198
|
+
borderWidth: 1,
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const chartOptions = {
|
|
205
|
+
responsive: true,
|
|
206
|
+
plugins: {
|
|
207
|
+
legend: { position: "top" as const },
|
|
208
|
+
title: { display: true, text: CONTACTS_DASHBOARD.UI.CHART_TITLE },
|
|
209
|
+
},
|
|
210
|
+
scales: {
|
|
211
|
+
y: { beginAtZero: true, title: { display: true, text: CONTACTS_DASHBOARD.UI.Y_AXIS_TITLE } },
|
|
212
|
+
x: { title: { display: true, text: CONTACTS_DASHBOARD.UI.X_AXIS_TITLE } },
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const handleShowMore = () => {
|
|
217
|
+
setVisibleRows((prev) => prev + 3);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const handleCloseAll = () => {
|
|
221
|
+
setVisibleRows(3);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
if (authLoading || isLoading) {
|
|
225
|
+
return <Spinner />;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (error || authError) {
|
|
229
|
+
return (
|
|
230
|
+
<div className="bg-red-900/50 border-l-4 border-red-600 p-4 rounded-lg backdrop-blur-sm text-center">
|
|
231
|
+
<p className="text-red-300">{error || authError}</p>
|
|
232
|
+
<button
|
|
233
|
+
onClick={async () => {
|
|
234
|
+
setIsLoading(true);
|
|
235
|
+
setError(null);
|
|
236
|
+
setRetryCount(0);
|
|
237
|
+
await debouncedCheckSession();
|
|
238
|
+
await fetchContacts();
|
|
239
|
+
}}
|
|
240
|
+
className="mt-2 bg-blue-600 text-white px-3 py-1 rounded-lg hover:bg-blue-500"
|
|
241
|
+
>
|
|
242
|
+
{CONTACTS_DASHBOARD.BUTTONS.RETRY_BUTTON}
|
|
243
|
+
</button>
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return (
|
|
249
|
+
<section className="bg-gradient-to-br from-blue-600/80 to-gray-800/80 backdrop-blur-md rounded-2xl shadow-lg p-6 border border-blue-500/30 hover:border-blue-400/50 transition-all">
|
|
250
|
+
<motion.h2
|
|
251
|
+
initial={{ opacity: 0, y: -20 }}
|
|
252
|
+
animate={{ opacity: 1, y: 0 }}
|
|
253
|
+
className="text-2xl font-bold text-blue-200 mb-6"
|
|
254
|
+
>
|
|
255
|
+
{CONTACTS_DASHBOARD.UI.SECTION_HEADING}
|
|
256
|
+
</motion.h2>
|
|
257
|
+
|
|
258
|
+
<div className="mb-8">
|
|
259
|
+
<div className="flex justify-between items-center mb-4">
|
|
260
|
+
<h3 className="text-lg font-semibold text-blue-200">{CONTACTS_DASHBOARD.UI.CHART_SUBHEADING}</h3>
|
|
261
|
+
<div>
|
|
262
|
+
<label htmlFor="yearFilter" className="text-gray-200 mr-2">
|
|
263
|
+
{CONTACTS_DASHBOARD.UI.YEAR_FILTER_LABEL}
|
|
264
|
+
</label>
|
|
265
|
+
<select
|
|
266
|
+
id="yearFilter"
|
|
267
|
+
value={selectedYear}
|
|
268
|
+
onChange={(e) => setSelectedYear(e.target.value === "all" ? "all" : Number(e.target.value))}
|
|
269
|
+
className="bg-gray-800 text-gray-200 border border-gray-700 rounded px-2 py-1"
|
|
270
|
+
>
|
|
271
|
+
<option value="all">{CONTACTS_DASHBOARD.UI.ALL_YEARS_OPTION}</option>
|
|
272
|
+
{availableYears.map((year) => (
|
|
273
|
+
<option key={year} value={year}>
|
|
274
|
+
{year}
|
|
275
|
+
</option>
|
|
276
|
+
))}
|
|
277
|
+
</select>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
<div className="bg-gray-800/50 p-4 rounded-lg">
|
|
281
|
+
<Bar data={getChartData()} options={chartOptions} />
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<div>
|
|
286
|
+
{contacts.length === 0 ? (
|
|
287
|
+
<p className="text-gray-400 text-center py-4">{CONTACTS_DASHBOARD.UI.NO_CONTACTS_MESSAGE}</p>
|
|
288
|
+
) : (
|
|
289
|
+
<>
|
|
290
|
+
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
291
|
+
{contacts.slice(0, visibleRows * contactsPerRow).map((contact) => (
|
|
292
|
+
<Card
|
|
293
|
+
key={contact.documentId}
|
|
294
|
+
className="bg-gray-800/50 backdrop-blur-md border border-gray-700/50 rounded-2xl p-6 flex flex-col"
|
|
295
|
+
>
|
|
296
|
+
<h3 className="text-xl font-bold text-blue-200 mb-3">
|
|
297
|
+
{contact.name} {contact.lastName}
|
|
298
|
+
</h3>
|
|
299
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
300
|
+
<strong>{CONTACTS_DASHBOARD.UI.EMAIL_LABEL}</strong>{" "}
|
|
301
|
+
<a href={`mailto:${contact.email}`} className="text-blue-300 hover:underline">
|
|
302
|
+
{contact.email}
|
|
303
|
+
</a>
|
|
304
|
+
</p>
|
|
305
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
306
|
+
<strong>{CONTACTS_DASHBOARD.UI.PHONE_LABEL}</strong>{" "}
|
|
307
|
+
<a href={`tel:${contact.phone}`} className="text-blue-300 hover:underline">
|
|
308
|
+
{contact.phone}
|
|
309
|
+
</a>
|
|
310
|
+
</p>
|
|
311
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
312
|
+
<strong>{CONTACTS_DASHBOARD.UI.SUBJECT_LABEL}</strong> {contact.subject}
|
|
313
|
+
</p>
|
|
314
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
315
|
+
<strong>{CONTACTS_DASHBOARD.UI.MESSAGE_LABEL}</strong> {contact.message}
|
|
316
|
+
</p>
|
|
317
|
+
<p className="text-gray-200 font-medium">
|
|
318
|
+
<strong>{CONTACTS_DASHBOARD.UI.SUBMITTED_LABEL}</strong> {contact.submissionDate}
|
|
319
|
+
</p>
|
|
320
|
+
</Card>
|
|
321
|
+
))}
|
|
322
|
+
</div>
|
|
323
|
+
<div className="flex gap-4 mt-4">
|
|
324
|
+
{visibleRows < totalRows && (
|
|
325
|
+
<button
|
|
326
|
+
onClick={handleShowMore}
|
|
327
|
+
className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition"
|
|
328
|
+
>
|
|
329
|
+
{CONTACTS_DASHBOARD.BUTTONS.SHOW_MORE_BUTTON}
|
|
330
|
+
</button>
|
|
331
|
+
)}
|
|
332
|
+
{visibleRows > 3 && (
|
|
333
|
+
<button
|
|
334
|
+
onClick={handleCloseAll}
|
|
335
|
+
className="bg-gray-500 text-white px-4 py-2 rounded hover:bg-gray-600 transition"
|
|
336
|
+
>
|
|
337
|
+
{CONTACTS_DASHBOARD.BUTTONS.CLOSE_ALL_BUTTON}
|
|
338
|
+
</button>
|
|
339
|
+
)}
|
|
340
|
+
</div>
|
|
341
|
+
</>
|
|
342
|
+
)}
|
|
343
|
+
</div>
|
|
344
|
+
</section>
|
|
345
|
+
);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export default ContactsDashboard;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// components/addOns/functional/contactsDashboard/constants/ContactsDashboard.ts
|
|
2
|
+
// Constants for hardcoded text in ContactsDashboard.tsx, organized by purpose
|
|
3
|
+
|
|
4
|
+
export const CONTACTS_DASHBOARD = {
|
|
5
|
+
// UI Text for ContactsDashboard
|
|
6
|
+
UI: {
|
|
7
|
+
// Section heading
|
|
8
|
+
SECTION_HEADING: "Contact Submissions",
|
|
9
|
+
// Subheading for chart section
|
|
10
|
+
CHART_SUBHEADING: "Leads Overview",
|
|
11
|
+
// Label for year filter select
|
|
12
|
+
YEAR_FILTER_LABEL: "Filter by Year:",
|
|
13
|
+
// Option in year filter select
|
|
14
|
+
ALL_YEARS_OPTION: "All Years",
|
|
15
|
+
// Chart title
|
|
16
|
+
CHART_TITLE: "New Leads by Month (Unique Emails)",
|
|
17
|
+
// Chart y-axis title
|
|
18
|
+
Y_AXIS_TITLE: "Number of Leads",
|
|
19
|
+
// Chart x-axis title
|
|
20
|
+
X_AXIS_TITLE: "Month",
|
|
21
|
+
// Chart month labels
|
|
22
|
+
MONTH_LABELS: [
|
|
23
|
+
"Jan",
|
|
24
|
+
"Feb",
|
|
25
|
+
"Mar",
|
|
26
|
+
"Apr",
|
|
27
|
+
"May",
|
|
28
|
+
"Jun",
|
|
29
|
+
"Jul",
|
|
30
|
+
"Aug",
|
|
31
|
+
"Sep",
|
|
32
|
+
"Oct",
|
|
33
|
+
"Nov",
|
|
34
|
+
"Dec",
|
|
35
|
+
],
|
|
36
|
+
// Text when no contacts exist
|
|
37
|
+
NO_CONTACTS_MESSAGE: "No valid contact submissions found.",
|
|
38
|
+
// Label for email field
|
|
39
|
+
EMAIL_LABEL: "Email:",
|
|
40
|
+
// Label for phone field
|
|
41
|
+
PHONE_LABEL: "Phone:",
|
|
42
|
+
// Label for subject field
|
|
43
|
+
SUBJECT_LABEL: "Subject:",
|
|
44
|
+
// Label for message field
|
|
45
|
+
MESSAGE_LABEL: "Message:",
|
|
46
|
+
// Label for submission date field
|
|
47
|
+
SUBMITTED_LABEL: "Submitted:",
|
|
48
|
+
},
|
|
49
|
+
// Button Text for ContactsDashboard
|
|
50
|
+
BUTTONS: {
|
|
51
|
+
// Retry button text
|
|
52
|
+
RETRY_BUTTON: "Retry",
|
|
53
|
+
// Show More button text
|
|
54
|
+
SHOW_MORE_BUTTON: "Show More",
|
|
55
|
+
// Close All button text
|
|
56
|
+
CLOSE_ALL_BUTTON: "Close All",
|
|
57
|
+
},
|
|
58
|
+
// Error Messages for ContactsDashboard
|
|
59
|
+
ERRORS: {
|
|
60
|
+
// Error when token is missing
|
|
61
|
+
NO_TOKEN: "No JWT token found from Clerk",
|
|
62
|
+
// Error when fetch fails with status code
|
|
63
|
+
FETCH_FAILED: "Failed to fetch contacts: ${response.status}",
|
|
64
|
+
// Generic error for fetch
|
|
65
|
+
UNKNOWN_ERROR: "An unknown error occurred",
|
|
66
|
+
// Error when not signed in
|
|
67
|
+
UNAUTHORIZED: "Unauthorized: Please log in to view the contacts dashboard",
|
|
68
|
+
// Error when all contacts are invalid
|
|
69
|
+
NO_VALID_CONTACTS: "No valid contact submissions found. All entries have incomplete data.",
|
|
70
|
+
},
|
|
71
|
+
};
|