@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,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/other/card";
|
|
5
|
+
import { BLOG_SIDEBAR } from "./constants/blogSidebar";
|
|
6
|
+
export default function BlogSidebar(_a) {
|
|
7
|
+
var posts = _a.posts, currentPostId = _a.currentPostId;
|
|
8
|
+
var otherPosts = posts
|
|
9
|
+
.filter(function (post) { return post.id !== currentPostId; })
|
|
10
|
+
.sort(function (a, b) { return new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime(); })
|
|
11
|
+
.slice(0, 5);
|
|
12
|
+
return (<Card className="w-full max-w-xs min-h-[300px] rounded-2xl border border-gray-700/50 bg-gray-800/50 backdrop-blur-md shadow-lg hover:border-blue-500/50 transition-colors">
|
|
13
|
+
<CardHeader className="pb-4">
|
|
14
|
+
<CardTitle className="text-lg font-bold text-white">{BLOG_SIDEBAR.UI.CARD_TITLE}</CardTitle>
|
|
15
|
+
</CardHeader>
|
|
16
|
+
<CardContent className="p-6">
|
|
17
|
+
{otherPosts.length > 0 ? (<ul className="space-y-4">
|
|
18
|
+
{otherPosts.map(function (post) { return (<li key={post.id}>
|
|
19
|
+
<Link href={"/blog/".concat(post.id)} className="text-gray-200 hover:text-blue-400 transition-colors">
|
|
20
|
+
<span className="font-medium text-blue-300 block truncate">
|
|
21
|
+
{post.title}
|
|
22
|
+
</span>
|
|
23
|
+
<div className="text-sm text-white">
|
|
24
|
+
{new Date(post.publishedAt).toLocaleDateString("en-US", {
|
|
25
|
+
year: "numeric",
|
|
26
|
+
month: "long",
|
|
27
|
+
day: "numeric",
|
|
28
|
+
})}
|
|
29
|
+
</div>
|
|
30
|
+
</Link>
|
|
31
|
+
</li>); })}
|
|
32
|
+
</ul>) : (<p className="text-gray-400 text-sm font-medium">{BLOG_SIDEBAR.UI.NO_POSTS_MESSAGE}</p>)}
|
|
33
|
+
</CardContent>
|
|
34
|
+
</Card>);
|
|
35
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// components/addOns/functional/blogSections/constants/blogDashboard.ts
|
|
2
|
+
// Constants for hardcoded text in BlogDashboard.tsx, organized by purpose
|
|
3
|
+
export var BLOG_DASHBOARD = {
|
|
4
|
+
// UI Text for BlogDashboard
|
|
5
|
+
UI: {
|
|
6
|
+
// Card title
|
|
7
|
+
CARD_TITLE: "Blog Posts",
|
|
8
|
+
// Card description
|
|
9
|
+
CARD_DESCRIPTION: "View and manage your recent blog posts",
|
|
10
|
+
// Success message for blog post submission
|
|
11
|
+
SUCCESS_MESSAGE: "Blog post submitted successfully!",
|
|
12
|
+
// Text when no blog posts exist
|
|
13
|
+
NO_POSTS_MESSAGE: "No blog posts yet",
|
|
14
|
+
// Subtext when no blog posts exist
|
|
15
|
+
NO_POSTS_SUBTEXT: "Submit your first blog post to get started",
|
|
16
|
+
},
|
|
17
|
+
// Button Text for BlogDashboard
|
|
18
|
+
BUTTONS: {
|
|
19
|
+
// AddButton text
|
|
20
|
+
ADD_BUTTON: "Add New Post",
|
|
21
|
+
// EditButton aria-label template
|
|
22
|
+
EDIT_BUTTON_ARIA: "Edit ${post.title}",
|
|
23
|
+
// TrashButton aria-label template
|
|
24
|
+
DELETE_BUTTON_ARIA: "Delete ${post.title}",
|
|
25
|
+
},
|
|
26
|
+
// Error Messages for BlogDashboard
|
|
27
|
+
ERRORS: {}, // No direct errors in JSX
|
|
28
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// components/addOns/functional/blogSections/constants/blogFormPopUp.ts
|
|
2
|
+
// Constants for hardcoded text in BlogFormPopUp.tsx, organized by purpose
|
|
3
|
+
export var BLOG_FORM_POP_UP = {
|
|
4
|
+
// UI Text for BlogFormPopUp
|
|
5
|
+
UI: {
|
|
6
|
+
// Modal heading when editing
|
|
7
|
+
EDIT_MODAL_HEADING: "Edit Blog Post",
|
|
8
|
+
// Modal heading when adding
|
|
9
|
+
ADD_MODAL_HEADING: "Add New Blog Post",
|
|
10
|
+
// Label for title input
|
|
11
|
+
TITLE_LABEL: "Title",
|
|
12
|
+
// Placeholder for title input
|
|
13
|
+
TITLE_PLACEHOLDER: "Enter post title",
|
|
14
|
+
// Title character and word count template
|
|
15
|
+
TITLE_COUNT_TEXT: "${titleCharCount}/50 characters, ${titleWordCount} words",
|
|
16
|
+
// Label for author input
|
|
17
|
+
AUTHOR_LABEL: "Author",
|
|
18
|
+
// Label for description textarea
|
|
19
|
+
DESCRIPTION_LABEL: "Description",
|
|
20
|
+
// Placeholder for description textarea
|
|
21
|
+
DESCRIPTION_PLACEHOLDER: "Enter post description",
|
|
22
|
+
// Description character and word count template
|
|
23
|
+
DESCRIPTION_COUNT_TEXT: "${descriptionCharCount}/1500 characters, ${descriptionWordCount} words",
|
|
24
|
+
// ToggleButton text when keywords are shown
|
|
25
|
+
HIDE_KEYWORDS_BUTTON: "Hide Keywords",
|
|
26
|
+
// ToggleButton text when keywords are hidden
|
|
27
|
+
SHOW_KEYWORDS_BUTTON: "Show SEO Keywords",
|
|
28
|
+
// SEO keywords for form
|
|
29
|
+
SEO_KEYWORDS: [
|
|
30
|
+
"fitness training",
|
|
31
|
+
"gym workout plans",
|
|
32
|
+
"strength exercises",
|
|
33
|
+
"cardio routines",
|
|
34
|
+
"weight loss tips",
|
|
35
|
+
"muscle building",
|
|
36
|
+
"home workouts",
|
|
37
|
+
"personal trainer",
|
|
38
|
+
"fitness motivation",
|
|
39
|
+
"healthy lifestyle",
|
|
40
|
+
"gym equipment",
|
|
41
|
+
"bodybuilding tips",
|
|
42
|
+
"HIIT workouts",
|
|
43
|
+
"nutrition for fitness",
|
|
44
|
+
"exercise routines",
|
|
45
|
+
],
|
|
46
|
+
// Aria-label for keyword list items
|
|
47
|
+
KEYWORD_ARIA: "Insert keyword: ${keyword}",
|
|
48
|
+
// Chatbot heading
|
|
49
|
+
CHATBOT_HEADING: "AI Chatbot is coming soon!",
|
|
50
|
+
// Chatbot input placeholder
|
|
51
|
+
CHATBOT_PLACEHOLDER: "Ask for suggestions...",
|
|
52
|
+
// Delete confirmation modal heading
|
|
53
|
+
DELETE_MODAL_HEADING: "Confirm Deletion",
|
|
54
|
+
// Delete confirmation message
|
|
55
|
+
DELETE_CONFIRMATION_TEXT: "Are you sure you want to delete the post "${postToDelete.title}"? This action cannot be undone.",
|
|
56
|
+
// System prompt for chatbot
|
|
57
|
+
CHATBOT_SYSTEM_PROMPT: "You are an AI assistant helping with blog writing and SEO optimization. You are aware of the current blog post's title: \"${formData.title}\", description: \"${formData.description}\", and the following SEO keywords: ${seoKeywords.join(', ')}. Provide suggestions to improve the blog post's SEO, such as keyword usage, content structure, or meta descriptions. Respond concisely and relevantly to user queries.",
|
|
58
|
+
},
|
|
59
|
+
// Button Text for BlogFormPopUp
|
|
60
|
+
BUTTONS: {
|
|
61
|
+
// UpdateButton text when loading
|
|
62
|
+
SAVING_BUTTON: "Saving...",
|
|
63
|
+
// UpdateButton text when editing
|
|
64
|
+
UPDATE_BUTTON: "Update",
|
|
65
|
+
// UpdateButton text when adding
|
|
66
|
+
SUBMIT_BUTTON: "Submit",
|
|
67
|
+
// CancelButton text
|
|
68
|
+
CANCEL_BUTTON: "Cancel",
|
|
69
|
+
// ChatToggleButton aria-label when open
|
|
70
|
+
CLOSE_CHATBOT_ARIA: "Close AI chatbot",
|
|
71
|
+
// ChatToggleButton aria-label when closed
|
|
72
|
+
OPEN_CHATBOT_ARIA: "Open AI chatbot",
|
|
73
|
+
// DeleteButton text when loading
|
|
74
|
+
DELETING_BUTTON: "Deleting...",
|
|
75
|
+
// DeleteButton text
|
|
76
|
+
DELETE_BUTTON: "Delete",
|
|
77
|
+
},
|
|
78
|
+
// Error Messages for BlogFormPopUp
|
|
79
|
+
ERRORS: {
|
|
80
|
+
// Error when textarea is not initialized
|
|
81
|
+
TEXTAREA_NOT_INITIALIZED: "Text area not initialized",
|
|
82
|
+
// Error when authentication is loading
|
|
83
|
+
AUTH_LOADING: "Authentication is still loading, please wait...",
|
|
84
|
+
// Error when not signed in
|
|
85
|
+
NOT_SIGNED_IN: "You must be signed in to create or edit a blog post",
|
|
86
|
+
// Warning when business title is missing
|
|
87
|
+
NO_BUSINESS_TITLE: "Business title not found; using username or default author name",
|
|
88
|
+
// Error for incomplete form
|
|
89
|
+
REQUIRED_FIELDS: "Please fill in all required fields",
|
|
90
|
+
// Error when delete fails
|
|
91
|
+
DELETE_FAILED: "Failed to delete blog post",
|
|
92
|
+
// Generic error for delete and submit
|
|
93
|
+
UNKNOWN_ERROR: "An unknown error occurred",
|
|
94
|
+
// Error when submit fails
|
|
95
|
+
SUBMIT_FAILED: "Failed to submit blog post",
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// components/addOns/functional/blogSections/constants/blogList.ts
|
|
2
|
+
// Constants for hardcoded text in BlogList.tsx, organized by purpose
|
|
3
|
+
export var BLOG_LIST = {
|
|
4
|
+
// UI Text for BlogList
|
|
5
|
+
UI: {
|
|
6
|
+
// Card title
|
|
7
|
+
CARD_TITLE: "Latest Blog Posts",
|
|
8
|
+
// Card header description
|
|
9
|
+
CARD_DESCRIPTION: "Discover our latest tips and updates",
|
|
10
|
+
// Text when no blog posts exist
|
|
11
|
+
NO_POSTS_MESSAGE: "No blog posts yet. Check back soon for new updates!",
|
|
12
|
+
},
|
|
13
|
+
// Button Text for BlogList
|
|
14
|
+
BUTTONS: {},
|
|
15
|
+
// Error Messages for BlogList
|
|
16
|
+
ERRORS: {
|
|
17
|
+
// Error when fetch fails
|
|
18
|
+
FETCH_FAILED: "Failed to fetch blog posts",
|
|
19
|
+
// Generic error for fetch
|
|
20
|
+
UNKNOWN_ERROR: "An unknown error occurred",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// components/addOns/functional/blogSections/constants/blogSidebar.ts
|
|
2
|
+
// Constants for hardcoded text in BlogSidebar.tsx, organized by purpose
|
|
3
|
+
export var BLOG_SIDEBAR = {
|
|
4
|
+
// UI Text for BlogSidebar
|
|
5
|
+
UI: {
|
|
6
|
+
// Card title
|
|
7
|
+
CARD_TITLE: "Other Blog Posts",
|
|
8
|
+
// Text when no other posts exist
|
|
9
|
+
NO_POSTS_MESSAGE: "No other posts available.",
|
|
10
|
+
},
|
|
11
|
+
// Button Text for BlogSidebar
|
|
12
|
+
BUTTONS: {},
|
|
13
|
+
// Error Messages for BlogSidebar
|
|
14
|
+
ERRORS: {}, // No errors in JSX
|
|
15
|
+
};
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
import React, { useState, useEffect, useCallback } from "react";
|
|
39
|
+
import { Card } from "@/components/other/card";
|
|
40
|
+
import Spinner from "@/components/addOns/non-functional/spinner";
|
|
41
|
+
import { motion } from "framer-motion";
|
|
42
|
+
import { useAuth as useClerkAuth, useSession } from "@clerk/nextjs";
|
|
43
|
+
import { useStrapiAuth } from "@/lib/auth-context";
|
|
44
|
+
import { Bar } from "react-chartjs-2";
|
|
45
|
+
import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, } from "chart.js";
|
|
46
|
+
import { debounce } from "lodash";
|
|
47
|
+
import { CONTACTS_DASHBOARD } from "./constants/contactsDashboard";
|
|
48
|
+
ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
|
|
49
|
+
var ContactsDashboard = function () {
|
|
50
|
+
var _a = useClerkAuth(), isSignedIn = _a.isSignedIn, userId = _a.userId;
|
|
51
|
+
var session = useSession().session;
|
|
52
|
+
var _b = useStrapiAuth(), user = _b.user, authLoading = _b.authLoading, authError = _b.error, checkSession = _b.checkSession;
|
|
53
|
+
var _c = useState([]), contacts = _c[0], setContacts = _c[1];
|
|
54
|
+
var _d = useState(true), isLoading = _d[0], setIsLoading = _d[1];
|
|
55
|
+
var _e = useState(null), error = _e[0], setError = _e[1];
|
|
56
|
+
var _f = useState(3), visibleRows = _f[0], setVisibleRows = _f[1];
|
|
57
|
+
var _g = useState("all"), selectedYear = _g[0], setSelectedYear = _g[1];
|
|
58
|
+
var _h = useState([]), availableYears = _h[0], setAvailableYears = _h[1];
|
|
59
|
+
var _j = useState(0), retryCount = _j[0], setRetryCount = _j[1];
|
|
60
|
+
var maxRetries = 3;
|
|
61
|
+
var contactsPerRow = 3;
|
|
62
|
+
var totalRows = Math.ceil(contacts.length / contactsPerRow);
|
|
63
|
+
var debouncedCheckSession = useCallback(debounce(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0: return [4 /*yield*/, checkSession()];
|
|
67
|
+
case 1:
|
|
68
|
+
_a.sent();
|
|
69
|
+
return [2 /*return*/];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}); }, 3000), [checkSession]);
|
|
73
|
+
var fetchContacts = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var token, response, errorData, result, fetchedContacts, validContacts, sortedContacts, years, err_1;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
_a.trys.push([0, 6, 7, 8]);
|
|
79
|
+
setIsLoading(true);
|
|
80
|
+
return [4 /*yield*/, (session === null || session === void 0 ? void 0 : session.getToken())];
|
|
81
|
+
case 1:
|
|
82
|
+
token = _a.sent();
|
|
83
|
+
if (!token) {
|
|
84
|
+
throw new Error(CONTACTS_DASHBOARD.ERRORS.NO_TOKEN);
|
|
85
|
+
}
|
|
86
|
+
return [4 /*yield*/, fetch("/api/contacts", {
|
|
87
|
+
headers: {
|
|
88
|
+
"Content-Type": "application/json",
|
|
89
|
+
Authorization: "Bearer ".concat(token),
|
|
90
|
+
},
|
|
91
|
+
})];
|
|
92
|
+
case 2:
|
|
93
|
+
response = _a.sent();
|
|
94
|
+
if (!!response.ok) return [3 /*break*/, 4];
|
|
95
|
+
return [4 /*yield*/, response.json()];
|
|
96
|
+
case 3:
|
|
97
|
+
errorData = _a.sent();
|
|
98
|
+
throw new Error(errorData.error || CONTACTS_DASHBOARD.ERRORS.FETCH_FAILED.replace("${response.status}", response.status.toString()));
|
|
99
|
+
case 4: return [4 /*yield*/, response.json()];
|
|
100
|
+
case 5:
|
|
101
|
+
result = _a.sent();
|
|
102
|
+
fetchedContacts = (result.data || []).map(function (contact) { return ({
|
|
103
|
+
id: contact.id || 0,
|
|
104
|
+
documentId: contact.documentId || "",
|
|
105
|
+
name: contact.name || "Unknown",
|
|
106
|
+
lastName: contact.lastName || "Unknown",
|
|
107
|
+
email: contact.email || "N/A",
|
|
108
|
+
phone: contact.phone || "N/A",
|
|
109
|
+
subject: contact.subject || "No Subject",
|
|
110
|
+
message: contact.message || "No Message",
|
|
111
|
+
submissionDate: contact.submissionDate
|
|
112
|
+
? new Date(contact.submissionDate).toLocaleString("en-US", {
|
|
113
|
+
dateStyle: "medium",
|
|
114
|
+
timeStyle: "short",
|
|
115
|
+
})
|
|
116
|
+
: "N/A",
|
|
117
|
+
rawSubmissionDate: contact.submissionDate || "",
|
|
118
|
+
}); });
|
|
119
|
+
validContacts = fetchedContacts.filter(function (contact) {
|
|
120
|
+
return contact.name !== "Unknown" ||
|
|
121
|
+
contact.lastName !== "Unknown" ||
|
|
122
|
+
contact.email !== "N/A" ||
|
|
123
|
+
contact.phone !== "N/A" ||
|
|
124
|
+
contact.subject !== "No Subject" ||
|
|
125
|
+
contact.message !== "No Message";
|
|
126
|
+
});
|
|
127
|
+
sortedContacts = validContacts.sort(function (a, b) {
|
|
128
|
+
return b.rawSubmissionDate
|
|
129
|
+
? new Date(b.rawSubmissionDate).getTime() - new Date(a.rawSubmissionDate).getTime()
|
|
130
|
+
: 0;
|
|
131
|
+
});
|
|
132
|
+
years = Array.from(new Set(validContacts
|
|
133
|
+
.filter(function (contact) { return contact.rawSubmissionDate; })
|
|
134
|
+
.map(function (contact) { return new Date(contact.rawSubmissionDate).getFullYear(); }))).sort(function (a, b) { return b - a; });
|
|
135
|
+
setAvailableYears(years);
|
|
136
|
+
setContacts(sortedContacts);
|
|
137
|
+
if (validContacts.length === 0 && fetchedContacts.length > 0) {
|
|
138
|
+
setError(CONTACTS_DASHBOARD.ERRORS.NO_VALID_CONTACTS);
|
|
139
|
+
}
|
|
140
|
+
return [3 /*break*/, 8];
|
|
141
|
+
case 6:
|
|
142
|
+
err_1 = _a.sent();
|
|
143
|
+
setError(err_1 instanceof Error ? err_1.message : CONTACTS_DASHBOARD.ERRORS.UNKNOWN_ERROR);
|
|
144
|
+
console.error("ContactsDashboard: Fetch error", err_1);
|
|
145
|
+
return [3 /*break*/, 8];
|
|
146
|
+
case 7:
|
|
147
|
+
setIsLoading(false);
|
|
148
|
+
return [7 /*endfinally*/];
|
|
149
|
+
case 8: return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}); };
|
|
153
|
+
useEffect(function () {
|
|
154
|
+
var attemptFetch = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
if (authLoading) {
|
|
157
|
+
return [2 /*return*/];
|
|
158
|
+
}
|
|
159
|
+
if (!isSignedIn || !user) {
|
|
160
|
+
setError(authError || CONTACTS_DASHBOARD.ERRORS.UNAUTHORIZED);
|
|
161
|
+
setIsLoading(false);
|
|
162
|
+
if (retryCount < maxRetries) {
|
|
163
|
+
setTimeout(function () {
|
|
164
|
+
setRetryCount(function (prev) { return Math.min(prev + 1, maxRetries); });
|
|
165
|
+
debouncedCheckSession();
|
|
166
|
+
}, Math.min(Math.pow(2, retryCount) * 1000, 10000));
|
|
167
|
+
}
|
|
168
|
+
return [2 /*return*/];
|
|
169
|
+
}
|
|
170
|
+
setRetryCount(0);
|
|
171
|
+
fetchContacts();
|
|
172
|
+
return [2 /*return*/];
|
|
173
|
+
});
|
|
174
|
+
}); };
|
|
175
|
+
attemptFetch();
|
|
176
|
+
}, [isSignedIn, user, authLoading, authError, retryCount, debouncedCheckSession]);
|
|
177
|
+
var getChartData = function () {
|
|
178
|
+
var uniqueEmails = new Set();
|
|
179
|
+
var uniqueContacts = contacts.filter(function (contact) {
|
|
180
|
+
if (contact.email === "N/A" || uniqueEmails.has(contact.email)) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
uniqueEmails.add(contact.email);
|
|
184
|
+
return true;
|
|
185
|
+
});
|
|
186
|
+
var filteredContacts = selectedYear === "all"
|
|
187
|
+
? uniqueContacts
|
|
188
|
+
: uniqueContacts.filter(function (contact) {
|
|
189
|
+
return contact.rawSubmissionDate &&
|
|
190
|
+
new Date(contact.rawSubmissionDate).getFullYear() === selectedYear;
|
|
191
|
+
});
|
|
192
|
+
var leadsByMonth = Array(12).fill(0);
|
|
193
|
+
filteredContacts.forEach(function (contact) {
|
|
194
|
+
if (contact.rawSubmissionDate) {
|
|
195
|
+
var month = new Date(contact.rawSubmissionDate).getMonth();
|
|
196
|
+
leadsByMonth[month]++;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
labels: CONTACTS_DASHBOARD.UI.MONTH_LABELS,
|
|
201
|
+
datasets: [
|
|
202
|
+
{
|
|
203
|
+
label: "New Leads",
|
|
204
|
+
data: leadsByMonth,
|
|
205
|
+
backgroundColor: "rgba(59, 130, 246, 0.5)",
|
|
206
|
+
borderColor: "rgba(59, 130, 246, 1)",
|
|
207
|
+
borderWidth: 1,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
var chartOptions = {
|
|
213
|
+
responsive: true,
|
|
214
|
+
plugins: {
|
|
215
|
+
legend: { position: "top" },
|
|
216
|
+
title: { display: true, text: CONTACTS_DASHBOARD.UI.CHART_TITLE },
|
|
217
|
+
},
|
|
218
|
+
scales: {
|
|
219
|
+
y: { beginAtZero: true, title: { display: true, text: CONTACTS_DASHBOARD.UI.Y_AXIS_TITLE } },
|
|
220
|
+
x: { title: { display: true, text: CONTACTS_DASHBOARD.UI.X_AXIS_TITLE } },
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
var handleShowMore = function () {
|
|
224
|
+
setVisibleRows(function (prev) { return prev + 3; });
|
|
225
|
+
};
|
|
226
|
+
var handleCloseAll = function () {
|
|
227
|
+
setVisibleRows(3);
|
|
228
|
+
};
|
|
229
|
+
if (authLoading || isLoading) {
|
|
230
|
+
return <Spinner />;
|
|
231
|
+
}
|
|
232
|
+
if (error || authError) {
|
|
233
|
+
return (<div className="bg-red-900/50 border-l-4 border-red-600 p-4 rounded-lg backdrop-blur-sm text-center">
|
|
234
|
+
<p className="text-red-300">{error || authError}</p>
|
|
235
|
+
<button onClick={function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
236
|
+
return __generator(this, function (_a) {
|
|
237
|
+
switch (_a.label) {
|
|
238
|
+
case 0:
|
|
239
|
+
setIsLoading(true);
|
|
240
|
+
setError(null);
|
|
241
|
+
setRetryCount(0);
|
|
242
|
+
return [4 /*yield*/, debouncedCheckSession()];
|
|
243
|
+
case 1:
|
|
244
|
+
_a.sent();
|
|
245
|
+
return [4 /*yield*/, fetchContacts()];
|
|
246
|
+
case 2:
|
|
247
|
+
_a.sent();
|
|
248
|
+
return [2 /*return*/];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}); }} className="mt-2 bg-blue-600 text-white px-3 py-1 rounded-lg hover:bg-blue-500">
|
|
252
|
+
{CONTACTS_DASHBOARD.BUTTONS.RETRY_BUTTON}
|
|
253
|
+
</button>
|
|
254
|
+
</div>);
|
|
255
|
+
}
|
|
256
|
+
return (<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">
|
|
257
|
+
<motion.h2 initial={{ opacity: 0, y: -20 }} animate={{ opacity: 1, y: 0 }} className="text-2xl font-bold text-blue-200 mb-6">
|
|
258
|
+
{CONTACTS_DASHBOARD.UI.SECTION_HEADING}
|
|
259
|
+
</motion.h2>
|
|
260
|
+
|
|
261
|
+
<div className="mb-8">
|
|
262
|
+
<div className="flex justify-between items-center mb-4">
|
|
263
|
+
<h3 className="text-lg font-semibold text-blue-200">{CONTACTS_DASHBOARD.UI.CHART_SUBHEADING}</h3>
|
|
264
|
+
<div>
|
|
265
|
+
<label htmlFor="yearFilter" className="text-gray-200 mr-2">
|
|
266
|
+
{CONTACTS_DASHBOARD.UI.YEAR_FILTER_LABEL}
|
|
267
|
+
</label>
|
|
268
|
+
<select id="yearFilter" value={selectedYear} onChange={function (e) { return setSelectedYear(e.target.value === "all" ? "all" : Number(e.target.value)); }} className="bg-gray-800 text-gray-200 border border-gray-700 rounded px-2 py-1">
|
|
269
|
+
<option value="all">{CONTACTS_DASHBOARD.UI.ALL_YEARS_OPTION}</option>
|
|
270
|
+
{availableYears.map(function (year) { return (<option key={year} value={year}>
|
|
271
|
+
{year}
|
|
272
|
+
</option>); })}
|
|
273
|
+
</select>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
<div className="bg-gray-800/50 p-4 rounded-lg">
|
|
277
|
+
<Bar data={getChartData()} options={chartOptions}/>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<div>
|
|
282
|
+
{contacts.length === 0 ? (<p className="text-gray-400 text-center py-4">{CONTACTS_DASHBOARD.UI.NO_CONTACTS_MESSAGE}</p>) : (<>
|
|
283
|
+
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
284
|
+
{contacts.slice(0, visibleRows * contactsPerRow).map(function (contact) { return (<Card key={contact.documentId} className="bg-gray-800/50 backdrop-blur-md border border-gray-700/50 rounded-2xl p-6 flex flex-col">
|
|
285
|
+
<h3 className="text-xl font-bold text-blue-200 mb-3">
|
|
286
|
+
{contact.name} {contact.lastName}
|
|
287
|
+
</h3>
|
|
288
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
289
|
+
<strong>{CONTACTS_DASHBOARD.UI.EMAIL_LABEL}</strong>{" "}
|
|
290
|
+
<a href={"mailto:".concat(contact.email)} className="text-blue-300 hover:underline">
|
|
291
|
+
{contact.email}
|
|
292
|
+
</a>
|
|
293
|
+
</p>
|
|
294
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
295
|
+
<strong>{CONTACTS_DASHBOARD.UI.PHONE_LABEL}</strong>{" "}
|
|
296
|
+
<a href={"tel:".concat(contact.phone)} className="text-blue-300 hover:underline">
|
|
297
|
+
{contact.phone}
|
|
298
|
+
</a>
|
|
299
|
+
</p>
|
|
300
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
301
|
+
<strong>{CONTACTS_DASHBOARD.UI.SUBJECT_LABEL}</strong> {contact.subject}
|
|
302
|
+
</p>
|
|
303
|
+
<p className="text-gray-200 font-medium mb-2">
|
|
304
|
+
<strong>{CONTACTS_DASHBOARD.UI.MESSAGE_LABEL}</strong> {contact.message}
|
|
305
|
+
</p>
|
|
306
|
+
<p className="text-gray-200 font-medium">
|
|
307
|
+
<strong>{CONTACTS_DASHBOARD.UI.SUBMITTED_LABEL}</strong> {contact.submissionDate}
|
|
308
|
+
</p>
|
|
309
|
+
</Card>); })}
|
|
310
|
+
</div>
|
|
311
|
+
<div className="flex gap-4 mt-4">
|
|
312
|
+
{visibleRows < totalRows && (<button onClick={handleShowMore} className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition">
|
|
313
|
+
{CONTACTS_DASHBOARD.BUTTONS.SHOW_MORE_BUTTON}
|
|
314
|
+
</button>)}
|
|
315
|
+
{visibleRows > 3 && (<button onClick={handleCloseAll} className="bg-gray-500 text-white px-4 py-2 rounded hover:bg-gray-600 transition">
|
|
316
|
+
{CONTACTS_DASHBOARD.BUTTONS.CLOSE_ALL_BUTTON}
|
|
317
|
+
</button>)}
|
|
318
|
+
</div>
|
|
319
|
+
</>)}
|
|
320
|
+
</div>
|
|
321
|
+
</section>);
|
|
322
|
+
};
|
|
323
|
+
export default ContactsDashboard;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// components/addOns/functional/contactsDashboard/constants/ContactsDashboard.ts
|
|
2
|
+
// Constants for hardcoded text in ContactsDashboard.tsx, organized by purpose
|
|
3
|
+
export var CONTACTS_DASHBOARD = {
|
|
4
|
+
// UI Text for ContactsDashboard
|
|
5
|
+
UI: {
|
|
6
|
+
// Section heading
|
|
7
|
+
SECTION_HEADING: "Contact Submissions",
|
|
8
|
+
// Subheading for chart section
|
|
9
|
+
CHART_SUBHEADING: "Leads Overview",
|
|
10
|
+
// Label for year filter select
|
|
11
|
+
YEAR_FILTER_LABEL: "Filter by Year:",
|
|
12
|
+
// Option in year filter select
|
|
13
|
+
ALL_YEARS_OPTION: "All Years",
|
|
14
|
+
// Chart title
|
|
15
|
+
CHART_TITLE: "New Leads by Month (Unique Emails)",
|
|
16
|
+
// Chart y-axis title
|
|
17
|
+
Y_AXIS_TITLE: "Number of Leads",
|
|
18
|
+
// Chart x-axis title
|
|
19
|
+
X_AXIS_TITLE: "Month",
|
|
20
|
+
// Chart month labels
|
|
21
|
+
MONTH_LABELS: [
|
|
22
|
+
"Jan",
|
|
23
|
+
"Feb",
|
|
24
|
+
"Mar",
|
|
25
|
+
"Apr",
|
|
26
|
+
"May",
|
|
27
|
+
"Jun",
|
|
28
|
+
"Jul",
|
|
29
|
+
"Aug",
|
|
30
|
+
"Sep",
|
|
31
|
+
"Oct",
|
|
32
|
+
"Nov",
|
|
33
|
+
"Dec",
|
|
34
|
+
],
|
|
35
|
+
// Text when no contacts exist
|
|
36
|
+
NO_CONTACTS_MESSAGE: "No valid contact submissions found.",
|
|
37
|
+
// Label for email field
|
|
38
|
+
EMAIL_LABEL: "Email:",
|
|
39
|
+
// Label for phone field
|
|
40
|
+
PHONE_LABEL: "Phone:",
|
|
41
|
+
// Label for subject field
|
|
42
|
+
SUBJECT_LABEL: "Subject:",
|
|
43
|
+
// Label for message field
|
|
44
|
+
MESSAGE_LABEL: "Message:",
|
|
45
|
+
// Label for submission date field
|
|
46
|
+
SUBMITTED_LABEL: "Submitted:",
|
|
47
|
+
},
|
|
48
|
+
// Button Text for ContactsDashboard
|
|
49
|
+
BUTTONS: {
|
|
50
|
+
// Retry button text
|
|
51
|
+
RETRY_BUTTON: "Retry",
|
|
52
|
+
// Show More button text
|
|
53
|
+
SHOW_MORE_BUTTON: "Show More",
|
|
54
|
+
// Close All button text
|
|
55
|
+
CLOSE_ALL_BUTTON: "Close All",
|
|
56
|
+
},
|
|
57
|
+
// Error Messages for ContactsDashboard
|
|
58
|
+
ERRORS: {
|
|
59
|
+
// Error when token is missing
|
|
60
|
+
NO_TOKEN: "No JWT token found from Clerk",
|
|
61
|
+
// Error when fetch fails with status code
|
|
62
|
+
FETCH_FAILED: "Failed to fetch contacts: ${response.status}",
|
|
63
|
+
// Generic error for fetch
|
|
64
|
+
UNKNOWN_ERROR: "An unknown error occurred",
|
|
65
|
+
// Error when not signed in
|
|
66
|
+
UNAUTHORIZED: "Unauthorized: Please log in to view the contacts dashboard",
|
|
67
|
+
// Error when all contacts are invalid
|
|
68
|
+
NO_VALID_CONTACTS: "No valid contact submissions found. All entries have incomplete data.",
|
|
69
|
+
},
|
|
70
|
+
};
|