@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,465 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
import React, { useEffect, useRef, useCallback, useState } from 'react';
|
|
50
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
51
|
+
import { CloseButton, ToggleButton, UpdateButton, CancelButton, ChatToggleButton, ChatSubmitButton, DeleteButton } from '@/components/other/button'; // Updated import
|
|
52
|
+
import { Input } from '@/components/other/input';
|
|
53
|
+
import { Label } from '@/components/other/label';
|
|
54
|
+
import { X, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
55
|
+
import { useAuth, useUser } from '@clerk/nextjs';
|
|
56
|
+
import { useStrapiAuth } from '@/lib/auth-context';
|
|
57
|
+
import { useChat } from 'ai/react';
|
|
58
|
+
var BlogFormPopUp = function (_a) {
|
|
59
|
+
var isModalOpen = _a.isModalOpen, setIsModalOpen = _a.setIsModalOpen, isConfirmDeleteOpen = _a.isConfirmDeleteOpen, setIsConfirmDeleteOpen = _a.setIsConfirmDeleteOpen, postToDelete = _a.postToDelete, setPostToDelete = _a.setPostToDelete, isLoading = _a.isLoading, setIsLoading = _a.setIsLoading, formData = _a.formData, setFormData = _a.setFormData, setError = _a.setError, setShowSuccess = _a.setShowSuccess, fetchData = _a.fetchData;
|
|
60
|
+
var _b = useState(null), formError = _b[0], setFormError = _b[1];
|
|
61
|
+
var _c = useState(false), isChatbotOpen = _c[0], setIsChatbotOpen = _c[1];
|
|
62
|
+
var _d = useState(false), showKeywords = _d[0], setShowKeywords = _d[1];
|
|
63
|
+
var _e = useState(formData.title.length), titleCharCount = _e[0], setTitleCharCount = _e[1];
|
|
64
|
+
var _f = useState(formData.title.trim().split(/\s+/).filter(Boolean).length), titleWordCount = _f[0], setTitleWordCount = _f[1];
|
|
65
|
+
var _g = useState(formData.description.length), descriptionCharCount = _g[0], setDescriptionCharCount = _g[1];
|
|
66
|
+
var _h = useState(formData.description.trim().split(/\s+/).filter(Boolean).length), descriptionWordCount = _h[0], setDescriptionWordCount = _h[1];
|
|
67
|
+
var modalRef = useRef(null);
|
|
68
|
+
var descriptionRef = useRef(null);
|
|
69
|
+
var _j = useStrapiAuth(), user = _j.user, authLoading = _j.authLoading;
|
|
70
|
+
var _k = useAuth(), getToken = _k.getToken, isSignedIn = _k.isSignedIn;
|
|
71
|
+
var clerkUser = useUser().user;
|
|
72
|
+
var _l = useState(0), scrollPosition = _l[0], setScrollPosition = _l[1];
|
|
73
|
+
var seoKeywords = [
|
|
74
|
+
'fitness training',
|
|
75
|
+
'gym workout plans',
|
|
76
|
+
'strength exercises',
|
|
77
|
+
'cardio routines',
|
|
78
|
+
'weight loss tips',
|
|
79
|
+
'muscle building',
|
|
80
|
+
'home workouts',
|
|
81
|
+
'personal trainer',
|
|
82
|
+
'fitness motivation',
|
|
83
|
+
'healthy lifestyle',
|
|
84
|
+
'gym equipment',
|
|
85
|
+
'bodybuilding tips',
|
|
86
|
+
'HIIT workouts',
|
|
87
|
+
'nutrition for fitness',
|
|
88
|
+
'exercise routines',
|
|
89
|
+
];
|
|
90
|
+
var _m = useChat({
|
|
91
|
+
api: '/api/chat',
|
|
92
|
+
initialMessages: [
|
|
93
|
+
{
|
|
94
|
+
id: 'system-prompt',
|
|
95
|
+
role: 'system',
|
|
96
|
+
content: "You are an AI assistant helping with blog writing and SEO optimization. You are aware of the current blog post's title: \"".concat(formData.title, "\", description: \"").concat(formData.description, "\", and the following SEO keywords: ").concat(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."),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
}), messages = _m.messages, input = _m.input, handleInputChange = _m.handleInputChange, handleChatSubmit = _m.handleSubmit, isChatLoading = _m.isLoading, error = _m.error;
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
}, [user, clerkUser]);
|
|
102
|
+
var handleClose = useCallback(function () {
|
|
103
|
+
setIsModalOpen(false);
|
|
104
|
+
setFormData({
|
|
105
|
+
id: 0,
|
|
106
|
+
documentId: '',
|
|
107
|
+
title: '',
|
|
108
|
+
description: '',
|
|
109
|
+
author: (user === null || user === void 0 ? void 0 : user.businessTitle) || (clerkUser === null || clerkUser === void 0 ? void 0 : clerkUser.username) || (user === null || user === void 0 ? void 0 : user.username) || 'Anonymous',
|
|
110
|
+
publishedAt: '',
|
|
111
|
+
});
|
|
112
|
+
setFormError(null);
|
|
113
|
+
setIsChatbotOpen(false);
|
|
114
|
+
setShowKeywords(false);
|
|
115
|
+
setTitleCharCount(0);
|
|
116
|
+
setTitleWordCount(0);
|
|
117
|
+
setDescriptionCharCount(0);
|
|
118
|
+
setDescriptionWordCount(0);
|
|
119
|
+
window.scrollTo({ top: scrollPosition, behavior: 'smooth' });
|
|
120
|
+
}, [setIsModalOpen, setFormData, user, clerkUser, scrollPosition]);
|
|
121
|
+
var handleKeywordClick = useCallback(function (keyword) {
|
|
122
|
+
var textarea = descriptionRef.current;
|
|
123
|
+
if (!textarea) {
|
|
124
|
+
setFormError('Text area not initialized');
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
var start = textarea.selectionStart;
|
|
128
|
+
var end = textarea.selectionEnd;
|
|
129
|
+
var text = formData.description;
|
|
130
|
+
var newText = text.substring(0, start) + "".concat(keyword, " ") + text.substring(end);
|
|
131
|
+
var truncatedText = newText.slice(0, 1500);
|
|
132
|
+
setFormData(__assign(__assign({}, formData), { description: truncatedText }));
|
|
133
|
+
setDescriptionCharCount(truncatedText.length);
|
|
134
|
+
setDescriptionWordCount(truncatedText.trim().split(/\s+/).filter(Boolean).length);
|
|
135
|
+
setTimeout(function () {
|
|
136
|
+
textarea.focus();
|
|
137
|
+
textarea.selectionStart = textarea.selectionEnd = start + keyword.length + 1;
|
|
138
|
+
}, 0);
|
|
139
|
+
}, [formData, setFormData]);
|
|
140
|
+
var handleConfirmDelete = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
+
var token, response, errorData, err_1;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
if (!postToDelete)
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
setIsLoading(true);
|
|
148
|
+
setError(null);
|
|
149
|
+
_a.label = 1;
|
|
150
|
+
case 1:
|
|
151
|
+
_a.trys.push([1, 7, 8, 9]);
|
|
152
|
+
return [4 /*yield*/, getToken()];
|
|
153
|
+
case 2:
|
|
154
|
+
token = _a.sent();
|
|
155
|
+
return [4 /*yield*/, fetch('/api/blog', {
|
|
156
|
+
method: 'DELETE',
|
|
157
|
+
headers: {
|
|
158
|
+
'Content-Type': 'application/json',
|
|
159
|
+
Authorization: "Bearer ".concat(token),
|
|
160
|
+
},
|
|
161
|
+
body: JSON.stringify({ documentId: postToDelete.documentId }),
|
|
162
|
+
})];
|
|
163
|
+
case 3:
|
|
164
|
+
response = _a.sent();
|
|
165
|
+
if (!!response.ok) return [3 /*break*/, 5];
|
|
166
|
+
return [4 /*yield*/, response.json()];
|
|
167
|
+
case 4:
|
|
168
|
+
errorData = _a.sent();
|
|
169
|
+
throw new Error(errorData.error || 'Failed to delete blog post');
|
|
170
|
+
case 5: return [4 /*yield*/, fetchData()];
|
|
171
|
+
case 6:
|
|
172
|
+
_a.sent();
|
|
173
|
+
setIsConfirmDeleteOpen(false);
|
|
174
|
+
setPostToDelete(null);
|
|
175
|
+
return [3 /*break*/, 9];
|
|
176
|
+
case 7:
|
|
177
|
+
err_1 = _a.sent();
|
|
178
|
+
setError(err_1 instanceof Error ? err_1.message : 'An unknown error occurred');
|
|
179
|
+
return [3 /*break*/, 9];
|
|
180
|
+
case 8:
|
|
181
|
+
setIsLoading(false);
|
|
182
|
+
return [7 /*endfinally*/];
|
|
183
|
+
case 9: return [2 /*return*/];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}); };
|
|
187
|
+
var handleCancelDelete = function () {
|
|
188
|
+
setIsConfirmDeleteOpen(false);
|
|
189
|
+
setPostToDelete(null);
|
|
190
|
+
window.scrollTo({ top: scrollPosition, behavior: 'smooth' });
|
|
191
|
+
};
|
|
192
|
+
useEffect(function () {
|
|
193
|
+
if (isModalOpen) {
|
|
194
|
+
if (authLoading) {
|
|
195
|
+
setFormError('Authentication is still loading, please wait...');
|
|
196
|
+
}
|
|
197
|
+
else if (!isSignedIn || !user || !(clerkUser === null || clerkUser === void 0 ? void 0 : clerkUser.id)) {
|
|
198
|
+
setFormError('You must be signed in to create or edit a blog post');
|
|
199
|
+
setFormData(__assign(__assign({}, formData), { author: 'Anonymous' }));
|
|
200
|
+
}
|
|
201
|
+
else if (user === null || user === void 0 ? void 0 : user.businessTitle) {
|
|
202
|
+
setFormData(__assign(__assign({}, formData), { author: user.businessTitle }));
|
|
203
|
+
setFormError(null);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
setFormData(__assign(__assign({}, formData), { author: (clerkUser === null || clerkUser === void 0 ? void 0 : clerkUser.username) || (user === null || user === void 0 ? void 0 : user.username) || 'Anonymous' }));
|
|
207
|
+
setFormError('Business title not found; using username or default author name');
|
|
208
|
+
}
|
|
209
|
+
setTitleCharCount(formData.title.length);
|
|
210
|
+
setTitleWordCount(formData.title.trim().split(/\s+/).filter(Boolean).length);
|
|
211
|
+
setDescriptionCharCount(formData.description.length);
|
|
212
|
+
setDescriptionWordCount(formData.description.trim().split(/\s+/).filter(Boolean).length);
|
|
213
|
+
}
|
|
214
|
+
}, [isModalOpen, user, isSignedIn, clerkUser, authLoading, setFormData, formData.title, formData.description]);
|
|
215
|
+
useEffect(function () {
|
|
216
|
+
if (isModalOpen && modalRef.current) {
|
|
217
|
+
setScrollPosition(window.scrollY);
|
|
218
|
+
var modal_1 = modalRef.current;
|
|
219
|
+
var focusableElements_1 = modal_1.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
220
|
+
var firstElement_1 = focusableElements_1[0];
|
|
221
|
+
if (firstElement_1) {
|
|
222
|
+
firstElement_1.focus({ preventScroll: true });
|
|
223
|
+
}
|
|
224
|
+
var handleKeyDown_1 = function (e) {
|
|
225
|
+
if (e.key === 'Tab') {
|
|
226
|
+
var lastElement = focusableElements_1[focusableElements_1.length - 1];
|
|
227
|
+
if (document.activeElement === lastElement && !e.shiftKey) {
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
firstElement_1.focus({ preventScroll: true });
|
|
230
|
+
}
|
|
231
|
+
if (document.activeElement === firstElement_1 && e.shiftKey) {
|
|
232
|
+
e.preventDefault();
|
|
233
|
+
lastElement.focus({ preventScroll: true });
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (e.key === 'Escape') {
|
|
237
|
+
handleClose();
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
modal_1.addEventListener('keydown', handleKeyDown_1);
|
|
241
|
+
return function () { return modal_1.removeEventListener('keydown', handleKeyDown_1); };
|
|
242
|
+
}
|
|
243
|
+
}, [isModalOpen, handleClose]);
|
|
244
|
+
useEffect(function () {
|
|
245
|
+
if (isModalOpen || isConfirmDeleteOpen) {
|
|
246
|
+
var scrollY_1 = window.scrollY;
|
|
247
|
+
document.body.style.position = 'fixed';
|
|
248
|
+
document.body.style.top = "-".concat(scrollY_1, "px");
|
|
249
|
+
document.body.style.width = '100%';
|
|
250
|
+
document.body.classList.add('overflow-hidden');
|
|
251
|
+
setScrollPosition(scrollY_1);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
var scrollY_2 = scrollPosition;
|
|
255
|
+
document.body.style.position = '';
|
|
256
|
+
document.body.style.top = '';
|
|
257
|
+
document.body.style.width = '';
|
|
258
|
+
document.body.classList.remove('overflow-hidden');
|
|
259
|
+
window.scrollTo({ top: scrollY_2, behavior: 'instant' });
|
|
260
|
+
}
|
|
261
|
+
return function () {
|
|
262
|
+
document.body.style.position = '';
|
|
263
|
+
document.body.style.top = '';
|
|
264
|
+
document.body.style.width = '';
|
|
265
|
+
document.body.classList.remove('overflow-hidden');
|
|
266
|
+
};
|
|
267
|
+
}, [isModalOpen, isConfirmDeleteOpen, scrollPosition]);
|
|
268
|
+
useEffect(function () {
|
|
269
|
+
var event = new CustomEvent('modalStateChange', {
|
|
270
|
+
detail: { isOpen: isModalOpen || isConfirmDeleteOpen },
|
|
271
|
+
});
|
|
272
|
+
window.dispatchEvent(event);
|
|
273
|
+
}, [isModalOpen, isConfirmDeleteOpen]);
|
|
274
|
+
var handleTitleChange = function (e) {
|
|
275
|
+
var value = e.target.value.slice(0, 50);
|
|
276
|
+
setFormData(__assign(__assign({}, formData), { title: value }));
|
|
277
|
+
setTitleCharCount(value.length);
|
|
278
|
+
setTitleWordCount(value.trim().split(/\s+/).filter(Boolean).length);
|
|
279
|
+
};
|
|
280
|
+
var handleDescriptionChange = function (e) {
|
|
281
|
+
var value = e.target.value.slice(0, 1500);
|
|
282
|
+
setFormData(__assign(__assign({}, formData), { description: value }));
|
|
283
|
+
setDescriptionCharCount(value.length);
|
|
284
|
+
setDescriptionWordCount(value.trim().split(/\s+/).filter(Boolean).length);
|
|
285
|
+
};
|
|
286
|
+
var onSubmit = function (e) { return __awaiter(void 0, void 0, void 0, function () {
|
|
287
|
+
var token, response, errorData, err_2;
|
|
288
|
+
return __generator(this, function (_a) {
|
|
289
|
+
switch (_a.label) {
|
|
290
|
+
case 0:
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
if (!isSignedIn || !user || !(clerkUser === null || clerkUser === void 0 ? void 0 : clerkUser.id)) {
|
|
293
|
+
setError('You must be signed in to submit a blog post');
|
|
294
|
+
return [2 /*return*/];
|
|
295
|
+
}
|
|
296
|
+
if (!formData.title || !formData.description || !formData.author) {
|
|
297
|
+
setFormError('Please fill in all required fields');
|
|
298
|
+
return [2 /*return*/];
|
|
299
|
+
}
|
|
300
|
+
setIsLoading(true);
|
|
301
|
+
setFormError(null);
|
|
302
|
+
_a.label = 1;
|
|
303
|
+
case 1:
|
|
304
|
+
_a.trys.push([1, 7, 8, 9]);
|
|
305
|
+
return [4 /*yield*/, getToken()];
|
|
306
|
+
case 2:
|
|
307
|
+
token = _a.sent();
|
|
308
|
+
return [4 /*yield*/, fetch('/api/blog', {
|
|
309
|
+
method: formData.id ? 'PUT' : 'POST',
|
|
310
|
+
headers: {
|
|
311
|
+
'Content-Type': 'application/json',
|
|
312
|
+
Authorization: "Bearer ".concat(token),
|
|
313
|
+
},
|
|
314
|
+
body: JSON.stringify({
|
|
315
|
+
documentId: formData.documentId,
|
|
316
|
+
data: {
|
|
317
|
+
title: formData.title,
|
|
318
|
+
description: formData.description,
|
|
319
|
+
author: formData.author,
|
|
320
|
+
publishedAt: formData.publishedAt || new Date().toISOString(),
|
|
321
|
+
},
|
|
322
|
+
}),
|
|
323
|
+
})];
|
|
324
|
+
case 3:
|
|
325
|
+
response = _a.sent();
|
|
326
|
+
if (!!response.ok) return [3 /*break*/, 5];
|
|
327
|
+
return [4 /*yield*/, response.json()];
|
|
328
|
+
case 4:
|
|
329
|
+
errorData = _a.sent();
|
|
330
|
+
throw new Error(errorData.error || 'Failed to submit blog post');
|
|
331
|
+
case 5: return [4 /*yield*/, fetchData()];
|
|
332
|
+
case 6:
|
|
333
|
+
_a.sent();
|
|
334
|
+
setShowSuccess(true);
|
|
335
|
+
setTimeout(function () { return setShowSuccess(false); }, 3000);
|
|
336
|
+
handleClose();
|
|
337
|
+
return [3 /*break*/, 9];
|
|
338
|
+
case 7:
|
|
339
|
+
err_2 = _a.sent();
|
|
340
|
+
setFormError(err_2 instanceof Error ? err_2.message : 'An unknown error occurred');
|
|
341
|
+
return [3 /*break*/, 9];
|
|
342
|
+
case 8:
|
|
343
|
+
setIsLoading(false);
|
|
344
|
+
return [7 /*endfinally*/];
|
|
345
|
+
case 9: return [2 /*return*/];
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}); };
|
|
349
|
+
var modalVariants = {
|
|
350
|
+
hidden: { opacity: 0, y: '100vh' },
|
|
351
|
+
visible: { opacity: 1, y: 0, transition: { duration: 0.5, ease: [0.16, 1, 0.3, 1] } },
|
|
352
|
+
exit: { opacity: 0, y: '100vh', transition: { duration: 0.3, ease: 'easeIn' } },
|
|
353
|
+
};
|
|
354
|
+
return (<div>
|
|
355
|
+
{isModalOpen && (<motion.div variants={modalVariants} initial="hidden" animate="visible" exit="exit" className="fixed inset-0 flex items-center justify-center z-[10000] p-4" onClick={handleClose}>
|
|
356
|
+
<motion.div ref={modalRef} className="relative w-full max-w-5xl mx-4 bg-gray-800/90 backdrop-blur-lg rounded-2xl p-4 sm:p-6 max-h-[90vh] overflow-y-auto overflow-x-hidden flex flex-col sm:flex-row gap-4" onClick={function (e) { return e.stopPropagation(); }} role="dialog" aria-modal="true" aria-labelledby="modal-title">
|
|
357
|
+
<div className="flex-1">
|
|
358
|
+
<div className="relative mb-6 pr-12">
|
|
359
|
+
<h3 id="modal-title" className="text-xl sm:text-2xl font-bold text-white">
|
|
360
|
+
{formData.id ? 'Edit Blog Post' : 'Add New Blog Post'}
|
|
361
|
+
</h3>
|
|
362
|
+
<CloseButton variant="close-form" onClick={handleClose}>
|
|
363
|
+
<X className="h-6 w-6 sm:h-8 sm:w-8"/>
|
|
364
|
+
</CloseButton>
|
|
365
|
+
</div>
|
|
366
|
+
<form onSubmit={onSubmit} className="space-y-4">
|
|
367
|
+
<div>
|
|
368
|
+
<Label htmlFor="title" className="block text-sm font-semibold text-gray-200 mb-2">
|
|
369
|
+
Title
|
|
370
|
+
</Label>
|
|
371
|
+
<Input id="title" type="text" placeholder="Enter post title" value={formData.title} onChange={handleTitleChange} maxLength={50} className="w-full bg-transparent text-white border-gray-400 rounded-md p-3 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required/>
|
|
372
|
+
<p className="text-sm text-gray-500 mt-1">
|
|
373
|
+
{titleCharCount}/50 characters, {titleWordCount} words
|
|
374
|
+
</p>
|
|
375
|
+
</div>
|
|
376
|
+
<div>
|
|
377
|
+
<Label htmlFor="author" className="block text-sm font-semibold text-gray-200 mb-2">
|
|
378
|
+
Author
|
|
379
|
+
</Label>
|
|
380
|
+
<Input id="author" type="text" value={formData.author} onChange={function (e) { return setFormData(__assign(__assign({}, formData), { author: e.target.value })); }} className="w-full bg-transparent text-white border-gray-400 rounded-md p-3 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required/>
|
|
381
|
+
</div>
|
|
382
|
+
<div>
|
|
383
|
+
<Label htmlFor="description" className="block text-sm font-semibold text-gray-200 mb-2">
|
|
384
|
+
Description
|
|
385
|
+
</Label>
|
|
386
|
+
<textarea ref={descriptionRef} id="description" placeholder="Enter post description" value={formData.description} onChange={handleDescriptionChange} maxLength={1500} className="w-full bg-transparent text-white border border-gray-400 rounded-md p-3 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 min-h-[150px]" required/>
|
|
387
|
+
<p className="text-sm text-gray-500 mt-1">
|
|
388
|
+
{descriptionCharCount}/1500 characters, {descriptionWordCount} words
|
|
389
|
+
</p>
|
|
390
|
+
</div>
|
|
391
|
+
<div>
|
|
392
|
+
<ToggleButton variant="toggle-keywords" onClick={function () { return setShowKeywords(!showKeywords); }} aria-expanded={showKeywords} aria-controls="seo-keywords">
|
|
393
|
+
{showKeywords ? 'Hide Keywords' : 'Show SEO Keywords'}
|
|
394
|
+
</ToggleButton>
|
|
395
|
+
{showKeywords && (<ul id="seo-keywords" className="mt-2 bg-gray-700 border border-gray-600 rounded-md p-4 max-h-40 overflow-y-auto text-white text-sm">
|
|
396
|
+
{seoKeywords.map(function (keyword, index) { return (<li key={index} onClick={function () { return handleKeywordClick(keyword); }} onKeyDown={function (e) {
|
|
397
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
398
|
+
e.preventDefault();
|
|
399
|
+
handleKeywordClick(keyword);
|
|
400
|
+
}
|
|
401
|
+
}} tabIndex={0} role="button" aria-label={"Insert keyword: ".concat(keyword)} className="cursor-pointer py-1 px-2 hover:bg-blue-500 hover:text-white rounded transition-colors break-words">
|
|
402
|
+
{keyword}
|
|
403
|
+
</li>); })}
|
|
404
|
+
</ul>)}
|
|
405
|
+
</div>
|
|
406
|
+
<div className="flex flex-col sm:flex-row gap-3 justify-end">
|
|
407
|
+
<UpdateButton type="submit" disabled={isLoading || !isSignedIn || !user || !(clerkUser === null || clerkUser === void 0 ? void 0 : clerkUser.id) || authLoading}>
|
|
408
|
+
{isLoading ? 'Saving...' : formData.id ? 'Update' : 'Submit'}
|
|
409
|
+
</UpdateButton>
|
|
410
|
+
<CancelButton type="button" onClick={handleClose}>
|
|
411
|
+
Cancel
|
|
412
|
+
</CancelButton>
|
|
413
|
+
</div>
|
|
414
|
+
{formError && <p className="text-red-500 text-sm font-semibold break-words">{formError}</p>}
|
|
415
|
+
</form>
|
|
416
|
+
</div>
|
|
417
|
+
<ChatToggleButton onClick={function () { return setIsChatbotOpen(!isChatbotOpen); }} aria-label={isChatbotOpen ? 'Close AI chatbot' : 'Open AI chatbot'}>
|
|
418
|
+
{isChatbotOpen ? (<ChevronLeft className="h-5 w-5 text-white"/>) : (<ChevronRight className="h-5 w-5 text-white"/>)}
|
|
419
|
+
</ChatToggleButton>
|
|
420
|
+
<AnimatePresence>
|
|
421
|
+
{isChatbotOpen && (<motion.div initial={{ opacity: 0, x: 50 }} animate={{ opacity: 1, x: 0 }} exit={{ opacity: 0, x: 50 }} transition={{ duration: 0.3, ease: 'easeInOut' }} className="hidden sm:flex flex-col w-72 bg-gray-700 border-l border-gray-600 p-4 max-h-[90vh] overflow-y-auto">
|
|
422
|
+
<h4 className="text-lg font-bold text-white mb-3">AI Chatbot is coming soon!</h4>
|
|
423
|
+
{error && <p className="text-red-500 text-sm bg-gray-800 p-2 rounded-md break-words">Error: {error.message}</p>}
|
|
424
|
+
<div className="flex-1 overflow-y-auto bg-gray-800 p-3 rounded-md border border-gray-600 break-words">
|
|
425
|
+
{messages
|
|
426
|
+
.filter(function (msg) { return msg.role !== 'system'; })
|
|
427
|
+
.map(function (msg, index) { return (<p key={index} className={"text-sm p-2 rounded-md mb-2 ".concat(msg.role === 'user' ? 'bg-blue-500 text-white text-right' : 'bg-gray-700 text-white text-left')}>
|
|
428
|
+
{msg.content}
|
|
429
|
+
</p>); })}
|
|
430
|
+
</div>
|
|
431
|
+
<form onSubmit={handleChatSubmit} className="flex gap-2 mt-3">
|
|
432
|
+
<Input value={input} onChange={handleInputChange} placeholder="Ask for suggestions..." disabled={isChatLoading} className="flex-1 bg-gray-800 text-white border-gray-600 rounded-md p-2 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500"/>
|
|
433
|
+
<ChatSubmitButton type="submit" disabled={isChatLoading}>
|
|
434
|
+
{isChatLoading ? '⟳' : '➤'}
|
|
435
|
+
</ChatSubmitButton>
|
|
436
|
+
</form>
|
|
437
|
+
</motion.div>)}
|
|
438
|
+
</AnimatePresence>
|
|
439
|
+
</motion.div>
|
|
440
|
+
</motion.div>)}
|
|
441
|
+
|
|
442
|
+
{isConfirmDeleteOpen && postToDelete && (<motion.div variants={modalVariants} initial="hidden" animate="visible" exit="exit" className="fixed inset-0 bg-black/90 flex items-center justify-center z-[10000] p-4" onClick={handleCancelDelete} data-testid="confirm-modal-overlay">
|
|
443
|
+
<div className="relative w-full max-w-md mx-auto bg-gray-800/90 backdrop-blur-lg rounded-2xl p-4 sm:p-6 h-fit max-h-[90vh] overflow-y-auto" onClick={function (e) { return e.stopPropagation(); }}>
|
|
444
|
+
<CloseButton onClick={handleCancelDelete}>
|
|
445
|
+
<X className="h-6 w-6 sm:h-8 sm:w-8"/>
|
|
446
|
+
</CloseButton>
|
|
447
|
+
<h3 id="modal-title" className="text-xl font-bold text-white mb-4">
|
|
448
|
+
Confirm Deletion
|
|
449
|
+
</h3>
|
|
450
|
+
<p className="text-white text-sm mb-4">
|
|
451
|
+
Are you sure you want to delete the post "{postToDelete.title}"? This action cannot be undone.
|
|
452
|
+
</p>
|
|
453
|
+
<div className="flex flex-col sm:flex-row gap-3 justify-end">
|
|
454
|
+
<DeleteButton onClick={handleConfirmDelete} disabled={isLoading}>
|
|
455
|
+
{isLoading ? 'Deleting...' : 'Delete'}
|
|
456
|
+
</DeleteButton>
|
|
457
|
+
<CancelButton onClick={handleCancelDelete}>
|
|
458
|
+
Cancel
|
|
459
|
+
</CancelButton>
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
</motion.div>)}
|
|
463
|
+
</div>);
|
|
464
|
+
};
|
|
465
|
+
export default BlogFormPopUp;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import React, { useState, useEffect, useRef } from "react";
|
|
49
|
+
import { useRouter } from "next/navigation";
|
|
50
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/other/card";
|
|
51
|
+
import { Calendar } from "lucide-react";
|
|
52
|
+
import Spinner from "@/components/addOns/non-functional/spinner";
|
|
53
|
+
import { BLOG_LIST } from "./constants/blogList";
|
|
54
|
+
export default function BlogList() {
|
|
55
|
+
var _this = this;
|
|
56
|
+
var router = useRouter();
|
|
57
|
+
var _a = useState([]), posts = _a[0], setPosts = _a[1];
|
|
58
|
+
var _b = useState(true), isLoading = _b[0], setIsLoading = _b[1];
|
|
59
|
+
var _c = useState(null), error = _c[0], setError = _c[1];
|
|
60
|
+
var _d = useState(false), isMobile = _d[0], setIsMobile = _d[1];
|
|
61
|
+
var hasFetched = useRef(false);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
var handleResize = function () {
|
|
64
|
+
setIsMobile(window.innerWidth < 640);
|
|
65
|
+
};
|
|
66
|
+
handleResize();
|
|
67
|
+
window.addEventListener("resize", handleResize);
|
|
68
|
+
return function () { return window.removeEventListener("resize", handleResize); };
|
|
69
|
+
}, []);
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
if (hasFetched.current)
|
|
72
|
+
return;
|
|
73
|
+
hasFetched.current = true;
|
|
74
|
+
var fetchPosts = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
75
|
+
var response, errorData, data, blogPosts, err_1;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
setIsLoading(true);
|
|
80
|
+
_a.label = 1;
|
|
81
|
+
case 1:
|
|
82
|
+
_a.trys.push([1, 6, 7, 8]);
|
|
83
|
+
return [4 /*yield*/, fetch("/api/blog", {
|
|
84
|
+
headers: { "Content-Type": "application/json" },
|
|
85
|
+
cache: "no-store",
|
|
86
|
+
})];
|
|
87
|
+
case 2:
|
|
88
|
+
response = _a.sent();
|
|
89
|
+
if (!!response.ok) return [3 /*break*/, 4];
|
|
90
|
+
return [4 /*yield*/, response.json()];
|
|
91
|
+
case 3:
|
|
92
|
+
errorData = _a.sent();
|
|
93
|
+
throw new Error(errorData.error || BLOG_LIST.ERRORS.FETCH_FAILED);
|
|
94
|
+
case 4: return [4 /*yield*/, response.json()];
|
|
95
|
+
case 5:
|
|
96
|
+
data = (_a.sent()).data;
|
|
97
|
+
blogPosts = data.blogPosts.map(function (p) { return (__assign(__assign({}, p), { publishedAt: new Date(p.publishedAt).toISOString() })); });
|
|
98
|
+
setPosts(blogPosts);
|
|
99
|
+
return [3 /*break*/, 8];
|
|
100
|
+
case 6:
|
|
101
|
+
err_1 = _a.sent();
|
|
102
|
+
setError(err_1 instanceof Error ? err_1.message : BLOG_LIST.ERRORS.UNKNOWN_ERROR);
|
|
103
|
+
return [3 /*break*/, 8];
|
|
104
|
+
case 7:
|
|
105
|
+
setIsLoading(false);
|
|
106
|
+
return [7 /*endfinally*/];
|
|
107
|
+
case 8: return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); };
|
|
111
|
+
fetchPosts();
|
|
112
|
+
}, []);
|
|
113
|
+
var truncateText = function (text, field) {
|
|
114
|
+
var maxLength = isMobile ? (field === "authorDate" ? 30 : 20) : 50;
|
|
115
|
+
if (text.length <= maxLength)
|
|
116
|
+
return text;
|
|
117
|
+
return text.slice(0, maxLength - 3) + "...";
|
|
118
|
+
};
|
|
119
|
+
if (isLoading) {
|
|
120
|
+
return (<div className="py-8 text-center">
|
|
121
|
+
<Spinner />
|
|
122
|
+
</div>);
|
|
123
|
+
}
|
|
124
|
+
return (<div className="w-full bg-[#1E2A44] border-none outline-none z-0 px-0 py-8 sm:px-6 sm:py-16 md:p-8">
|
|
125
|
+
<style jsx>{"\n .file-item {\n z-index: 30;\n pointer-events: auto;\n cursor: pointer;\n }\n "}</style>
|
|
126
|
+
<section className="relative z-10">
|
|
127
|
+
<div className="w-full max-w-7xl mx-auto">
|
|
128
|
+
<Card className="w-full max-w-7xl mx-auto p-4 sm:p-8 text-white flex flex-col items-center space-y-6 bg-[#1E2A44] border-none rounded-none">
|
|
129
|
+
<CardHeader className="pb-4 text-center">
|
|
130
|
+
<CardTitle className="text-2xl sm:text-3xl md:text-4xl font-bold tracking-tight text-white">
|
|
131
|
+
{BLOG_LIST.UI.CARD_TITLE}
|
|
132
|
+
</CardTitle>
|
|
133
|
+
<p className="text-gray-300 text-base sm:text-lg md:text-xl">
|
|
134
|
+
{BLOG_LIST.UI.CARD_DESCRIPTION}
|
|
135
|
+
</p>
|
|
136
|
+
</CardHeader>
|
|
137
|
+
<CardContent className="w-full space-y-4">
|
|
138
|
+
{error && (<p className="text-red-400 text-base sm:text-lg md:text-xl text-center">
|
|
139
|
+
{error}
|
|
140
|
+
</p>)}
|
|
141
|
+
{posts.length > 0 ? (<div className="space-y-4 max-h-[400px] overflow-y-auto">
|
|
142
|
+
{posts.map(function (post) { return (<div key={post.id} className="file-item w-full flex flex-col sm:flex-row items-start sm:items-center justify-between p-3 sm:p-4 rounded-lg bg-[#2A3A66]/50 hover:bg-[#2A3A66]/70 hover:shadow-lg hover:border-[#FF69B4]/50 transition-all cursor-pointer" onClick={function () { return router.push("/blog/".concat(post.id)); }} role="link" aria-label={"View post: ".concat(post.title)}>
|
|
143
|
+
<div className="flex flex-col w-full">
|
|
144
|
+
<h4 className="font-bold text-base sm:text-lg md:text-xl text-white mb-1 truncate">
|
|
145
|
+
{truncateText(post.title, "title")}
|
|
146
|
+
</h4>
|
|
147
|
+
<div className="flex items-center gap-2 text-sm text-gray-300">
|
|
148
|
+
<Calendar className="h-4 w-4 sm:h-5 sm:w-5 text-[#FF69B4] flex-shrink-0"/>
|
|
149
|
+
<span>
|
|
150
|
+
{truncateText("By ".concat(post.author, " | ").concat(new Date(post.publishedAt).toLocaleDateString("en-US", {
|
|
151
|
+
year: "numeric",
|
|
152
|
+
month: "short",
|
|
153
|
+
day: "numeric",
|
|
154
|
+
})), "authorDate")}
|
|
155
|
+
</span>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
{/* <p className="text-sm text-gray-300 mt-2 sm:mt-0 sm:ml-4 w-full sm:w-auto flex-1 truncate">
|
|
159
|
+
{truncateText(post.description, "description")}
|
|
160
|
+
</p> */}
|
|
161
|
+
</div>); })}
|
|
162
|
+
</div>) : (<p className="text-gray-300 font-bold text-base sm:text-lg md:text-xl text-center">
|
|
163
|
+
{BLOG_LIST.UI.NO_POSTS_MESSAGE}
|
|
164
|
+
</p>)}
|
|
165
|
+
</CardContent>
|
|
166
|
+
</Card>
|
|
167
|
+
</div>
|
|
168
|
+
</section>
|
|
169
|
+
</div>);
|
|
170
|
+
}
|