@devvistatech/devvista-kit 0.0.12 → 0.0.13

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.
Files changed (84) hide show
  1. package/README.md +40 -0
  2. package/app/ClientLayout.tsx +66 -0
  3. package/app/about/page.tsx +11 -248
  4. package/app/adRequest/page.tsx +101 -25
  5. package/app/admin-profile/page.tsx +123 -0
  6. package/app/analytics/page.tsx +41 -5
  7. package/app/api/about/route.ts +2 -18
  8. package/app/api/adRequest/route.ts +7 -27
  9. package/app/api/analytics/[reportType]/route.ts +1 -64
  10. package/app/api/bio/route.ts +1 -17
  11. package/app/api/blog/route.ts +1 -19
  12. package/app/api/contacts/route.ts +1 -46
  13. package/app/api/files/route.ts +1 -15
  14. package/app/api/gallery-data/route.ts +53 -61
  15. package/app/api/schedule/route.ts +5 -21
  16. package/app/api/signup/route.ts +129 -0
  17. package/app/api/sync-user/route.ts +268 -94
  18. package/app/api/verify-admin/route.ts +46 -0
  19. package/app/blog/[id]/page.tsx +71 -52
  20. package/app/blog/page.tsx +43 -10
  21. package/app/favicon.ico +0 -0
  22. package/app/gallery/page.tsx +27 -6
  23. package/app/layout.tsx +31 -82
  24. package/app/page.tsx +20 -311
  25. package/app/products/constants/product.ts +27 -0
  26. package/app/products/page.tsx +296 -0
  27. package/app/products/productOne/page.tsx +266 -0
  28. package/app/products/productTwo/page.tsx +272 -0
  29. package/app/schedule/page.tsx +78 -40
  30. package/bin/init.js +0 -12
  31. package/components/addOns/functional/ClassList.tsx +21 -17
  32. package/components/addOns/functional/ProductList.tsx +1027 -0
  33. package/components/addOns/functional/aboutSections/AboutSection.tsx +107 -70
  34. package/components/addOns/functional/aboutSections/constants/aboutSection.ts +9 -4
  35. package/components/addOns/functional/banner/Banner.tsx +150 -0
  36. package/components/addOns/functional/banner/BannerDashboard.tsx +283 -0
  37. package/components/addOns/functional/bioSections/BioEditor.tsx +471 -0
  38. package/components/addOns/functional/bioSections/constants/bioEditor.ts +36 -0
  39. package/components/addOns/functional/blogSections/BlogDashboard.tsx +1 -1
  40. package/components/addOns/functional/blogSections/BlogFormPopUp.tsx +2 -1
  41. package/components/addOns/functional/{ImageDescCarousel.tsx → carousels/ImageDescCarousel.tsx} +166 -57
  42. package/components/addOns/functional/carousels/ProductDescCarousel.tsx +1129 -0
  43. package/components/addOns/functional/{ScheduleCarousel.tsx → carousels/ScheduleCarousel.tsx} +110 -50
  44. package/components/addOns/functional/carousels/constants.ts/productDescCarousel.ts +197 -0
  45. package/components/addOns/functional/carousels/constants.ts/scheduleCarousel.ts +20 -0
  46. package/components/addOns/functional/contactsDashboard/ContactsDashboard.tsx +1 -1
  47. package/components/addOns/functional/fileUploaders/FileUploader.tsx +437 -0
  48. package/components/addOns/functional/fileUploaders/constants/fileUploader.ts +45 -0
  49. package/components/addOns/functional/galleries/GalleryComplex.tsx +468 -267
  50. package/components/addOns/functional/galleries/GallerySimple.tsx +78 -50
  51. package/components/addOns/functional/galleries/ThreeSetGallery.tsx +260 -0
  52. package/components/addOns/functional/schedules/ScheduleGridOne.tsx +22 -8
  53. package/components/addOns/functional/schedules/ScheduleGridTwo.tsx +12 -7
  54. package/components/addOns/functional/schedules/ScheduleGridTwoBasic.tsx +12 -7
  55. package/components/addOns/non-functional/SampleCarousel.tsx +3 -3
  56. package/components/addOns/non-functional/ThreeSetGallery.tsx +3 -3
  57. package/components/addOns/non-functional/featureSections/FeaturesSection.tsx +74 -0
  58. package/components/addOns/non-functional/featureSections/constants/featuresSection.ts +30 -0
  59. package/components/addOns/non-functional/{Heros/HeroSection.tsx → heros/HomeHero.tsx} +17 -15
  60. package/components/addOns/non-functional/heros/ProductHero.tsx +111 -0
  61. package/components/addOns/non-functional/heros/constants/hero.ts +62 -0
  62. package/components/addOns/non-functional/imageCarousels/ProductSlider.tsx +6 -6
  63. package/components/addOns/non-functional/imageCarousels/ProgramCarousel.tsx +10 -10
  64. package/components/footers/footer.tsx +161 -198
  65. package/components/other/admin-menu.tsx +1 -1
  66. package/lib/auth/auth-context.tsx +225 -0
  67. package/lib/auth/auth-utils.tsx +30 -0
  68. package/lib/constants/adRequest.ts +199 -56
  69. package/lib/constants/admin-profile.ts +12 -0
  70. package/lib/constants/page.ts +15 -15
  71. package/lib/google/google-analytics-tracking.tsx +44 -0
  72. package/lib/types.ts +235 -0
  73. package/lib/utils/compressImage.tsx +32 -0
  74. package/middleware.ts +9 -5
  75. package/next.config.js +1 -1
  76. package/package.json +3 -2
  77. package/public/images/test.png +0 -0
  78. package/components/addOns/functional/BioEditor.tsx +0 -447
  79. package/components/addOns/functional/FileUploader.tsx +0 -295
  80. package/components/addOns/non-functional/FeaturesSection.tsx +0 -63
  81. package/components/types.ts +0 -50
  82. package/lib/auth-context.tsx +0 -131
  83. package/lib/verify-user.ts +0 -118
  84. /package/lib/{google-analytics.tsx → google/google-analytics.tsx} +0 -0
@@ -5,11 +5,11 @@ import { Card } from "@/components/other/card";
5
5
  import Spinner from "@/components/addOns/non-functional/spinner";
6
6
  import { motion } from "framer-motion";
7
7
  import Schedule from "@/components/addOns/functional/schedules/SchedulerForm";
8
- import ScheduleGrid from "@/components/addOns/functional/schedules/ScheduleGridTwoBasic";
9
- import { ScheduleClass, WeeklySchedule } from "@/components/types";
8
+ import ScheduleGrid from "@/components/addOns/functional/schedules/ScheduleGridTwo";
9
+ import { ScheduleClass, WeeklySchedule } from "@/lib/types";
10
10
  import { useAuth, useUser } from "@clerk/nextjs";
11
- import { useStrapiAuth } from "@/lib/auth-context";
12
- import { SCHEDULE_PAGE } from "../../lib/constants/schedule";
11
+ import { useStrapiAuth } from "@/lib/auth/auth-context";
12
+ import { SCHEDULE_PAGE } from "../../lib/constants/schedule";
13
13
 
14
14
  export default function SchedulePage() {
15
15
  const [schedule, setSchedule] = useState<WeeklySchedule>({
@@ -44,9 +44,9 @@ export default function SchedulePage() {
44
44
  const { getToken } = useAuth();
45
45
  const { isSignedIn } = useUser();
46
46
 
47
- const isAdmin = isSignedIn && !!user?.businessAdminId || false;
47
+ const isAdmin = (isSignedIn && !!user?.businessAdminId) || false;
48
48
 
49
- const numberToDayKey: { [key: number]: string } = {
49
+ const numberToDayKey: { [key: number]: keyof WeeklySchedule } = {
50
50
  1: "Monday",
51
51
  2: "Tuesday",
52
52
  3: "Wednesday",
@@ -107,7 +107,13 @@ export default function SchedulePage() {
107
107
  });
108
108
  if (!response.ok) {
109
109
  const errorData = await response.json();
110
- throw new Error(errorData.error || SCHEDULE_PAGE.ERRORS.FETCH_EVENTS_FAILED.replace("${response.status}", response.status.toString()));
110
+ throw new Error(
111
+ errorData.error ||
112
+ SCHEDULE_PAGE.ERRORS.FETCH_EVENTS_FAILED.replace(
113
+ "${response.status}",
114
+ response.status.toString()
115
+ )
116
+ );
111
117
  }
112
118
 
113
119
  const result = await response.json();
@@ -117,7 +123,7 @@ export default function SchedulePage() {
117
123
  name: event.title || "Untitled",
118
124
  startTime: roundToNearestFiveMinutes(event.startTime || "00:00"),
119
125
  endTime: roundToNearestFiveMinutes(event.endTime || "00:00"),
120
- daysOfWeek: event.daysOfWeek || [],
126
+ daysOfWeek: event.daysOfWeek ?? [],
121
127
  classDescription: event.classDescription || "",
122
128
  }));
123
129
 
@@ -131,25 +137,29 @@ export default function SchedulePage() {
131
137
  Sunday: [],
132
138
  };
133
139
  fetchedClasses.forEach((cls: ScheduleClass) => {
134
- cls.daysOfWeek.forEach((dayNum: number) => {
135
- const dayKey = numberToDayKey[dayNum];
136
- if (dayKey && updatedSchedule[dayKey]) {
137
- updatedSchedule[dayKey].push({
138
- name: cls.name,
139
- startTime: cls.startTime,
140
- endTime: cls.endTime,
141
- id: cls.id,
142
- documentId: cls.documentId,
143
- daysOfWeek: cls.daysOfWeek,
144
- classDescription: cls.classDescription,
145
- });
146
- }
147
- });
140
+ if (cls.daysOfWeek) {
141
+ cls.daysOfWeek.forEach((dayNum: number) => {
142
+ const dayKey = numberToDayKey[dayNum] as keyof WeeklySchedule;
143
+ if (dayKey && updatedSchedule[dayKey]) {
144
+ updatedSchedule[dayKey].push({
145
+ name: cls.name,
146
+ startTime: cls.startTime,
147
+ endTime: cls.endTime,
148
+ id: cls.id,
149
+ documentId: cls.documentId,
150
+ daysOfWeek: cls.daysOfWeek,
151
+ classDescription: cls.classDescription,
152
+ });
153
+ }
154
+ });
155
+ }
148
156
  });
149
157
 
150
158
  setSchedule(updatedSchedule);
151
159
  } catch (err) {
152
- setError(err instanceof Error ? err.message : SCHEDULE_PAGE.ERRORS.UNKNOWN_ERROR);
160
+ setError(
161
+ err instanceof Error ? err.message : SCHEDULE_PAGE.ERRORS.UNKNOWN_ERROR
162
+ );
153
163
  } finally {
154
164
  setIsLoading(false);
155
165
  }
@@ -165,7 +175,7 @@ export default function SchedulePage() {
165
175
  name: cls?.name || "",
166
176
  startTime: cls?.startTime || "",
167
177
  endTime: cls?.endTime || "",
168
- daysOfWeek: cls ? cls.daysOfWeek : [],
178
+ daysOfWeek: cls?.daysOfWeek ?? [],
169
179
  classDescription: cls?.classDescription || "",
170
180
  id: cls?.id || null,
171
181
  documentId: cls?.documentId || null,
@@ -208,14 +218,30 @@ export default function SchedulePage() {
208
218
 
209
219
  if (!response.ok) {
210
220
  const errorData = await response.json();
211
- throw new Error(errorData.error || SCHEDULE_PAGE.ERRORS.SUBMIT_CLASS_FAILED.replace("${formData.documentId ? 'update' : 'create'}", formData.documentId ? "update" : "create"));
221
+ throw new Error(
222
+ errorData.error ||
223
+ SCHEDULE_PAGE.ERRORS.SUBMIT_CLASS_FAILED.replace(
224
+ "${formData.documentId ? 'update' : 'create'}",
225
+ formData.documentId ? "update" : "create"
226
+ )
227
+ );
212
228
  }
213
229
 
214
230
  await fetchEvents();
215
231
  setIsModalOpen(false);
216
- setFormData({ name: "", startTime: "", endTime: "", daysOfWeek: [], classDescription: "", id: null, documentId: null });
232
+ setFormData({
233
+ name: "",
234
+ startTime: "",
235
+ endTime: "",
236
+ daysOfWeek: [],
237
+ classDescription: "",
238
+ id: null,
239
+ documentId: null,
240
+ });
217
241
  } catch (err) {
218
- setError(err instanceof Error ? err.message : SCHEDULE_PAGE.ERRORS.UNKNOWN_ERROR);
242
+ setError(
243
+ err instanceof Error ? err.message : SCHEDULE_PAGE.ERRORS.UNKNOWN_ERROR
244
+ );
219
245
  } finally {
220
246
  setIsLoading(false);
221
247
  }
@@ -246,12 +272,20 @@ export default function SchedulePage() {
246
272
 
247
273
  if (!response.ok) {
248
274
  const errorData = await response.json();
249
- throw new Error(errorData.error || SCHEDULE_PAGE.ERRORS.DELETE_CLASS_FAILED.replace("${response.status}", response.status.toString()));
275
+ throw new Error(
276
+ errorData.error ||
277
+ SCHEDULE_PAGE.ERRORS.DELETE_CLASS_FAILED.replace(
278
+ "${response.status}",
279
+ response.status.toString()
280
+ )
281
+ );
250
282
  }
251
283
 
252
284
  await fetchEvents();
253
285
  } catch (err) {
254
- setError(err instanceof Error ? err.message : SCHEDULE_PAGE.ERRORS.UNKNOWN_ERROR);
286
+ setError(
287
+ err instanceof Error ? err.message : SCHEDULE_PAGE.ERRORS.UNKNOWN_ERROR
288
+ );
255
289
  } finally {
256
290
  setIsLoading(false);
257
291
  }
@@ -278,7 +312,10 @@ export default function SchedulePage() {
278
312
 
279
313
  const formatTime = (time: string) => {
280
314
  if (!time) return "";
281
- return new Date(`2023-01-01 ${time}`).toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" });
315
+ return new Date(`2023-01-01 ${time}`).toLocaleTimeString("en-US", {
316
+ hour: "numeric",
317
+ minute: "2-digit",
318
+ });
282
319
  };
283
320
 
284
321
  const uniqueClassDescriptions = Array.from(
@@ -312,9 +349,7 @@ export default function SchedulePage() {
312
349
  {
313
350
  name: SCHEDULE_PAGE.UI.MEMBERSHIP_3_NAME,
314
351
  desc: SCHEDULE_PAGE.UI.MEMBERSHIP_3_DESC,
315
- pricing: [
316
- SCHEDULE_PAGE.UI.MEMBERSHIP_3_PRICING_1,
317
- ],
352
+ pricing: [SCHEDULE_PAGE.UI.MEMBERSHIP_3_PRICING_1],
318
353
  },
319
354
  {
320
355
  name: SCHEDULE_PAGE.UI.MEMBERSHIP_4_NAME,
@@ -551,7 +586,8 @@ export default function SchedulePage() {
551
586
  {/* Footer Text */}
552
587
  <div className="mt-6 text-center">
553
588
  <p className="text-md">
554
- <strong>{SCHEDULE_PAGE.UI.FAMILY_RATES_BOLD}</strong> {SCHEDULE_PAGE.UI.FAMILY_RATES_TEXT}
589
+ <strong>{SCHEDULE_PAGE.UI.FAMILY_RATES_BOLD}</strong>{" "}
590
+ {SCHEDULE_PAGE.UI.FAMILY_RATES_TEXT}
555
591
  </p>
556
592
  <p className="mt-2 text-md italic">
557
593
  <strong>{SCHEDULE_PAGE.UI.NOTE_BOLD}</strong> {SCHEDULE_PAGE.UI.NOTE_TEXT}
@@ -609,12 +645,16 @@ export default function SchedulePage() {
609
645
  >
610
646
  {cls.name}
611
647
  </h3>
612
- <p className="text-white font-medium flex-1 overflow-hidden text-ellipsis content-text">{cls.desc}</p>
648
+ <p className="text-white font-medium flex-1 overflow-hidden text-ellipsis content-text">
649
+ {cls.desc}
650
+ </p>
613
651
  </Card>
614
652
  </div>
615
653
  ))
616
654
  ) : (
617
- <p className="text-center text-white text-lg content-text">{SCHEDULE_PAGE.UI.NO_CLASS_DESCRIPTIONS}</p>
655
+ <p className="text-center text-white text-lg content-text">
656
+ {SCHEDULE_PAGE.UI.NO_CLASS_DESCRIPTIONS}
657
+ </p>
618
658
  )}
619
659
  </div>
620
660
  </div>
@@ -628,11 +668,9 @@ export default function SchedulePage() {
628
668
  {SCHEDULE_PAGE.UI.ADMIN_LOGGED_IN_MESSAGE}
629
669
  </p>
630
670
  ) : user ? (
631
- <p className="text-gray-400 text-sm font-medium">
632
- </p>
671
+ <p className="text-gray-400 text-sm font-medium"></p>
633
672
  ) : (
634
- <p className="text-gray-400 text-sm font-medium">
635
- </p>
673
+ <p className="text-gray-400 text-sm font-medium"></p>
636
674
  )}
637
675
  </div>
638
676
 
package/bin/init.js CHANGED
@@ -30,7 +30,6 @@ try {
30
30
  copyFiles(sourceItemPath, destItemPath);
31
31
  } else {
32
32
  fs.copyFileSync(sourceItemPath, destItemPath);
33
- console.log(`Copied ${path.relative(projectDir, destItemPath)}`);
34
33
  }
35
34
  });
36
35
  };
@@ -42,7 +41,6 @@ try {
42
41
  const destPath = path.join(projectDir, file);
43
42
  if (!fs.existsSync(destPath)) {
44
43
  fs.cpSync(sourcePath, destPath, { recursive: true });
45
- console.log(`Copied new directory ${file}`);
46
44
  } else {
47
45
  copyFiles(sourcePath, destPath);
48
46
  }
@@ -66,9 +64,7 @@ try {
66
64
  const destPath = path.join(projectDir, file);
67
65
  if (!fs.existsSync(destPath)) {
68
66
  fs.copyFileSync(sourcePath, destPath);
69
- console.log(`Copied new file ${file}`);
70
67
  } else {
71
- console.log(`Skipping ${file} (already exists)`);
72
68
  }
73
69
  }
74
70
  });
@@ -141,7 +137,6 @@ readline.question('Proceed with update? (y/n): ', answer => {
141
137
  copyFiles(sourceItemPath, destItemPath);
142
138
  } else {
143
139
  fs.copyFileSync(sourceItemPath, destItemPath);
144
- console.log(\`Updated \${path.relative(projectDir, destItemPath)}\`);
145
140
  }
146
141
  });
147
142
  };
@@ -153,7 +148,6 @@ readline.question('Proceed with update? (y/n): ', answer => {
153
148
  const destPath = path.join(projectDir, file);
154
149
  if (!fs.existsSync(destPath)) {
155
150
  fs.cpSync(sourcePath, destPath, { recursive: true });
156
- console.log(\`Copied new directory \${file}\`);
157
151
  } else {
158
152
  copyFiles(sourcePath, destPath);
159
153
  }
@@ -170,14 +164,11 @@ readline.question('Proceed with update? (y/n): ', answer => {
170
164
  const sourceContent = fs.readFileSync(sourcePath, 'utf8');
171
165
  const destContent = fs.readFileSync(destPath, 'utf8');
172
166
  if (sourceContent !== destContent) {
173
- console.log(\`Skipping \${file} (modified locally)\`);
174
167
  } else {
175
168
  fs.copyFileSync(sourcePath, destPath);
176
- console.log(\`Updated \${file}\`);
177
169
  }
178
170
  } else {
179
171
  fs.copyFileSync(sourcePath, destPath);
180
- console.log(\`Copied new file \${file}\`);
181
172
  }
182
173
  }
183
174
  });
@@ -199,8 +190,6 @@ readline.question('Proceed with update? (y/n): ', answer => {
199
190
  autoprefixer: libPkg.dependencies.autoprefixer
200
191
  });
201
192
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
202
-
203
- console.log('Project updated successfully.');
204
193
  } catch (error) {
205
194
  console.error('Error updating project:', error.message);
206
195
  process.exit(1);
@@ -213,7 +202,6 @@ readline.question('Proceed with update? (y/n): ', answer => {
213
202
  // Run npm install to ensure dependencies are installed
214
203
  execSync('npm install', { stdio: 'inherit', cwd: projectDir });
215
204
 
216
- console.log('Project initialized successfully.');
217
205
  } catch (error) {
218
206
  console.error('Error initializing project:', error.message);
219
207
  process.exit(1);
@@ -3,7 +3,7 @@
3
3
  import React, { useState, useEffect } from "react";
4
4
  import { useRouter } from "next/navigation";
5
5
  import { Card, CardHeader, CardTitle, CardContent } from "@/components/other/card";
6
- import { ScheduleClass, WeeklySchedule } from "@/components/types";
6
+ import { ScheduleClass, WeeklySchedule } from "@/lib/types";
7
7
 
8
8
  interface ClassDescription {
9
9
  name: string;
@@ -16,7 +16,9 @@ export default function ClassList() {
16
16
  const [error, setError] = useState<string | null>(null);
17
17
  const router = useRouter();
18
18
 
19
- const numberToDayKey: { [key: number]: string } = {
19
+ type DayKey = keyof WeeklySchedule;
20
+
21
+ const numberToDayKey: { [key: number]: DayKey } = {
20
22
  1: "Monday",
21
23
  2: "Tuesday",
22
24
  3: "Wednesday",
@@ -54,7 +56,7 @@ export default function ClassList() {
54
56
  name: event.title || "Untitled",
55
57
  startTime: roundToNearestFiveMinutes(event.startTime || "00:00"),
56
58
  endTime: roundToNearestFiveMinutes(event.endTime || "00:00"),
57
- daysOfWeek: event.daysOfWeek || [],
59
+ daysOfWeek: event.daysOfWeek ?? [],
58
60
  classDescription: event.classDescription || "",
59
61
  }));
60
62
 
@@ -68,20 +70,22 @@ export default function ClassList() {
68
70
  Sunday: [],
69
71
  };
70
72
  fetchedClasses.forEach((cls: ScheduleClass) => {
71
- cls.daysOfWeek.forEach((dayNum: number) => {
72
- const dayKey = numberToDayKey[dayNum];
73
- if (dayKey && updatedSchedule[dayKey]) {
74
- updatedSchedule[dayKey].push({
75
- name: cls.name,
76
- startTime: cls.startTime,
77
- endTime: cls.endTime,
78
- id: cls.id,
79
- documentId: cls.documentId,
80
- daysOfWeek: cls.daysOfWeek,
81
- classDescription: cls.classDescription,
82
- });
83
- }
84
- });
73
+ if (cls.daysOfWeek) {
74
+ cls.daysOfWeek.forEach((dayNum: number) => {
75
+ const dayKey = numberToDayKey[dayNum];
76
+ if (dayKey && updatedSchedule[dayKey]) {
77
+ updatedSchedule[dayKey].push({
78
+ name: cls.name,
79
+ startTime: cls.startTime,
80
+ endTime: cls.endTime,
81
+ id: cls.id,
82
+ documentId: cls.documentId,
83
+ daysOfWeek: cls.daysOfWeek,
84
+ classDescription: cls.classDescription,
85
+ });
86
+ }
87
+ });
88
+ }
85
89
  });
86
90
 
87
91
  const uniqueClassDescriptions: ClassDescription[] = Array.from(