diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 000000000..a964c370b Binary files /dev/null and b/dump.rdb differ diff --git a/package.json b/package.json index 6f5c62145..bced78963 100644 --- a/package.json +++ b/package.json @@ -103,6 +103,7 @@ "eslint": "^8.56.0", "jsdom": "^24.0.0", "prettier": "^3.2.4", + "prettier-plugin-tailwindcss": "^0.6.14", "prisma": "^5.18.0", "tailwindcss": "^3.3.0", "ts-node": "^10.9.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d6bb3dc4..f691d6534 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -240,6 +240,9 @@ importers: prettier: specifier: ^3.2.4 version: 3.3.3 + prettier-plugin-tailwindcss: + specifier: ^0.6.14 + version: 0.6.14(prettier@3.3.3) prisma: specifier: ^5.18.0 version: 5.18.0 @@ -3415,6 +3418,67 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-plugin-tailwindcss@0.6.14: + resolution: {integrity: sha512-pi2e/+ZygeIqntN+vC573BcW5Cve8zUB0SSAGxqpB4f96boZF4M3phPVoOFCeypwkpRYdi7+jQ5YJJUwrkGUAg==} + engines: {node: '>=14.21.3'} + peerDependencies: + '@ianvs/prettier-plugin-sort-imports': '*' + '@prettier/plugin-hermes': '*' + '@prettier/plugin-oxc': '*' + '@prettier/plugin-pug': '*' + '@shopify/prettier-plugin-liquid': '*' + '@trivago/prettier-plugin-sort-imports': '*' + '@zackad/prettier-plugin-twig': '*' + prettier: ^3.0 + prettier-plugin-astro: '*' + prettier-plugin-css-order: '*' + prettier-plugin-import-sort: '*' + prettier-plugin-jsdoc: '*' + prettier-plugin-marko: '*' + prettier-plugin-multiline-arrays: '*' + prettier-plugin-organize-attributes: '*' + prettier-plugin-organize-imports: '*' + prettier-plugin-sort-imports: '*' + prettier-plugin-style-order: '*' + prettier-plugin-svelte: '*' + peerDependenciesMeta: + '@ianvs/prettier-plugin-sort-imports': + optional: true + '@prettier/plugin-hermes': + optional: true + '@prettier/plugin-oxc': + optional: true + '@prettier/plugin-pug': + optional: true + '@shopify/prettier-plugin-liquid': + optional: true + '@trivago/prettier-plugin-sort-imports': + optional: true + '@zackad/prettier-plugin-twig': + optional: true + prettier-plugin-astro: + optional: true + prettier-plugin-css-order: + optional: true + prettier-plugin-import-sort: + optional: true + prettier-plugin-jsdoc: + optional: true + prettier-plugin-marko: + optional: true + prettier-plugin-multiline-arrays: + optional: true + prettier-plugin-organize-attributes: + optional: true + prettier-plugin-organize-imports: + optional: true + prettier-plugin-sort-imports: + optional: true + prettier-plugin-style-order: + optional: true + prettier-plugin-svelte: + optional: true + prettier@3.3.3: resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} engines: {node: '>=14'} @@ -7892,6 +7956,10 @@ snapshots: prelude-ls@1.2.1: {} + prettier-plugin-tailwindcss@0.6.14(prettier@3.3.3): + dependencies: + prettier: 3.3.3 + prettier@3.3.3: {} pretty-format@27.5.1: diff --git a/prisma/seed.ts b/prisma/seed.ts index 0a40fbea3..7e63c8754 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -211,11 +211,11 @@ async function seedVideoMetadata() { video_360p_4: 'https://www.w3schools.com/html/mov_bbb.mp4', slides: 'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf', - segments: [ - { title: "Introduction", start: 0, end: 3 }, - { title: "Chapter 1", start: 3, end: 7 }, - { title: "Conclusion", start: 7, end: 10 } - ] + segments: [ + { title: 'Introduction', start: 0, end: 3 }, + { title: 'Chapter 1', start: 3, end: 7 }, + { title: 'Conclusion', start: 7, end: 10 }, + ], }, }); } catch (error) { diff --git a/public/footer-logos/logos-svg/insta-logo.tsx b/public/footer-logos/logos-svg/insta-logo.tsx index 477c2f3bd..258a961a4 100644 --- a/public/footer-logos/logos-svg/insta-logo.tsx +++ b/public/footer-logos/logos-svg/insta-logo.tsx @@ -1,7 +1,7 @@ import React from 'react'; const InstaLogo = () => ( - (/^[0-9A-Za-z._-]{2,256}@[A-Za-z]{2,64}$/).test(value), { + .refine((value) => /^[0-9A-Za-z._-]{2,256}@[A-Za-z]{2,64}$/.test(value), { message: 'Enter a valid UPI address', }) .optional(), solanaAddress: z .string() - .refine((value) => (/^[A-Za-z0-9]{44}$/).test(value), { + .refine((value) => /^[A-Za-z0-9]{44}$/.test(value), { message: 'Enter a valid Solana address', }) .optional(), @@ -18,13 +18,13 @@ export const payoutMethodSchema = z.object({ export const upiIdInsertSchema = z.object({ upiId: z .string() - .refine((value) => (/^[0-9A_Za-z._-]{2,256}@[A_Za-z]{2,64}$/).test(value), { + .refine((value) => /^[0-9A_Za-z._-]{2,256}@[A_Za-z]{2,64}$/.test(value), { message: 'Invalid UPI address', }), }); export const solanaAddressInsertSchema = z.object({ - solanaAddress: z.string().refine((value) => (/^[A-Za-z0-9]{44}$/).test(value), { + solanaAddress: z.string().refine((value) => /^[A-Za-z0-9]{44}$/.test(value), { message: 'Invalid Solana address', }), }); diff --git a/src/actions/user/index.ts b/src/actions/user/index.ts index 316e29f4c..da52ba808 100644 --- a/src/actions/user/index.ts +++ b/src/actions/user/index.ts @@ -34,11 +34,11 @@ type GetAppxAuthTokenResponse = { email: string | null; appxAuthToken: string | null; appxUserId: string | null; -} +}; export const GetAppxAuthToken = async (): Promise => { const session = await getServerSession(authOptions); - if (!session || !session.user) throw new Error("User is not logged in"); + if (!session || !session.user) throw new Error('User is not logged in'); const user = await db.user.findFirst({ where: { @@ -48,15 +48,18 @@ export const GetAppxAuthToken = async (): Promise => { name: true, email: true, appxAuthToken: true, - appxUserId: true - } + appxUserId: true, + }, }); - if (!user || !user.appxAuthToken) throw new Error("User not found"); + if (!user || !user.appxAuthToken) throw new Error('User not found'); return user; }; -export const GetAppxVideoPlayerUrl = async (courseId: string, videoId: string): Promise => { +export const GetAppxVideoPlayerUrl = async ( + courseId: string, + videoId: string, +): Promise => { const { name, email, appxAuthToken, appxUserId } = await GetAppxAuthToken(); const url = `${process.env.APPX_BASE_API}/get/fetchVideoDetailsById?course_id=${courseId}&video_id=${videoId}&ytflag=${1}&folder_wise_course=${1}`; diff --git a/src/app/api/admin/content/route.ts b/src/app/api/admin/content/route.ts index dbc4e39c8..e134ac472 100644 --- a/src/app/api/admin/content/route.ts +++ b/src/app/api/admin/content/route.ts @@ -150,7 +150,10 @@ export const POST = async (req: NextRequest) => { }); } } - if (discordChecked && (type === 'notion' || type === 'video' || type === 'appx')) { + if ( + discordChecked && + (type === 'notion' || type === 'video' || type === 'appx') + ) { if (!process.env.NEXT_PUBLIC_DISCORD_WEBHOOK_URL) { return NextResponse.json( { message: 'Environment variable for discord webhook is not set' }, @@ -174,7 +177,8 @@ export const POST = async (req: NextRequest) => { return NextResponse.json( { message: - discordChecked && (type === 'notion' || type === 'video' || type === 'appx') + discordChecked && + (type === 'notion' || type === 'video' || type === 'appx') ? 'Content Added and Discord notification has been sent' : 'Content has been added', }, diff --git a/src/app/bounty/page.tsx b/src/app/bounty/page.tsx index c8a2b1218..e687cfd0f 100644 --- a/src/app/bounty/page.tsx +++ b/src/app/bounty/page.tsx @@ -67,8 +67,8 @@ export default function Page() { return ( <> -
-
+
+

Your Bounties diff --git a/src/app/certificate/page.tsx b/src/app/certificate/page.tsx index 8aa1738ee..816cdd22c 100644 --- a/src/app/certificate/page.tsx +++ b/src/app/certificate/page.tsx @@ -5,7 +5,7 @@ const CertificatePage = async () => { const certificates = await getCertificates(); return ( -
+
{certificates?.map(({ cert, course, user }) => ( -
+
diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f5198fcba..057a4dc42 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -34,9 +34,7 @@ export default function RootLayout({ children }: { children: ReactNode }) { )} > - + diff --git a/src/components/Appbar.tsx b/src/components/Appbar.tsx index 56a3cc30e..ff1d20688 100644 --- a/src/components/Appbar.tsx +++ b/src/components/Appbar.tsx @@ -18,7 +18,7 @@ export const menuOptions = [ { id: 5, name: 'Watch History', Component: History, href: '/watch-history' }, ]; -//Added Eventlistener +//Added Eventlistener const useMediaQuery = (query: string): boolean => { const [matches, setMatches] = useState(false); @@ -27,14 +27,14 @@ const useMediaQuery = (query: string): boolean => { const listener = (e: MediaQueryListEvent) => setMatches(e.matches); // Use addEventListener instead of addListener - media.addEventListener("change", listener); - + media.addEventListener('change', listener); + // Set the initial match state setMatches(media.matches); // Cleanup function to remove the event listener return () => { - media.removeEventListener("change", listener); + media.removeEventListener('change', listener); }; }, [query]); @@ -54,14 +54,17 @@ export const Appbar = () => { useEffect(() => { setIsMounted(true); const handleClickOutside = (event: MouseEvent) => { - if (sidebarRef.current && !sidebarRef.current.contains(event.target as Node)) { + if ( + sidebarRef.current && + !sidebarRef.current.contains(event.target as Node) + ) { setIsCollapsed(true); } }; document.addEventListener('mousedown', handleClickOutside); return () => { document.removeEventListener('mousedown', handleClickOutside); - }; + }; }, []); const toggleCollapse = () => setIsCollapsed(!isCollapsed); @@ -85,10 +88,10 @@ export const Appbar = () => { stiffness: 200, damping: 20, }} - className="fixed left-0 top-0 z-[999] hidden h-full flex-col border-r border-primary/10 bg-background dark:bg-background lg:flex min-w-16" + className="fixed left-0 top-0 z-[999] hidden h-full min-w-16 flex-col border-r border-primary/10 bg-background dark:bg-background lg:flex" >
-
+
{
- +
@@ -119,7 +126,11 @@ export const Appbar = () => { className="fixed bottom-0 left-0 right-0 z-[999] lg:hidden" >
- +
diff --git a/src/components/AppxVideoPlayer.tsx b/src/components/AppxVideoPlayer.tsx index 5e24f0686..4990d38b1 100644 --- a/src/components/AppxVideoPlayer.tsx +++ b/src/components/AppxVideoPlayer.tsx @@ -36,9 +36,11 @@ export const AppxVideoPlayer = ({ if (!url.length) { return

Loading...

; } - return ; + return ( + + ); }; diff --git a/src/components/CourseCard.tsx b/src/components/CourseCard.tsx index ecf8cc6ae..0e61b651a 100644 --- a/src/components/CourseCard.tsx +++ b/src/components/CourseCard.tsx @@ -3,9 +3,9 @@ import { Course } from '@/store/atoms'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import { Button } from './ui/button'; -import { Card, CardContent } from "@/components/ui/card"; -import { motion } from "framer-motion"; -import { MessageCircle, PlayCircle } from "lucide-react"; +import { Card, CardContent } from '@/components/ui/card'; +import { motion } from 'framer-motion'; +import { MessageCircle, PlayCircle } from 'lucide-react'; export const CourseCard = ({ course, @@ -16,30 +16,48 @@ export const CourseCard = ({ }) => { const router = useRouter(); const imageUrl = course.imageUrl ? course.imageUrl : 'banner_placeholder.png'; - const percentage = course.totalVideos !== undefined ? Math.ceil(((course.totalVideosWatched ?? 0) / course?.totalVideos) * 100) : 0; + const percentage = + course.totalVideos !== undefined + ? Math.ceil( + ((course.totalVideosWatched ?? 0) / course?.totalVideos) * 100, + ) + : 0; return ( - +
{course.title}
-
-
-
- - +
+
+
+ + -
- {percentage}% +
+ + {percentage}% +
-
-

+

{course.title}

{course.certIssued ? ( @@ -83,11 +102,11 @@ export const CourseCard = ({ ) : ( - + Join Discord )} diff --git a/src/components/CourseView.tsx b/src/components/CourseView.tsx index 0646bc81f..810ea83dc 100644 --- a/src/components/CourseView.tsx +++ b/src/components/CourseView.tsx @@ -56,7 +56,8 @@ export const CourseView = ({ courseId={courseContent.value.id} /> ) : null} - {!courseContent?.folder && (contentType === 'video' || contentType === 'appx') ? ( + {!courseContent?.folder && + (contentType === 'video' || contentType === 'appx') ? ( -
- {filterMessages[currentfilter] || "No content found."} +
+ {filterMessages[currentfilter] || 'No content found.'}
); } - + return (
{filteredCourseContent.map((content) => { const videoProgressPercent = content.type === 'video' && - content.videoFullDuration && - content.duration + content.videoFullDuration && + content.duration ? (content.duration / content.videoFullDuration) * 100 : content.percentComplete || 0; diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 14e7375b5..8a63e0275 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -158,9 +158,9 @@ export const Navbar = () => { exit={{ opacity: 0, y: -20 }} > -
diff --git a/src/components/admin/ContentRendererClient.tsx b/src/components/admin/ContentRendererClient.tsx index f73c0422e..453520acd 100644 --- a/src/components/admin/ContentRendererClient.tsx +++ b/src/components/admin/ContentRendererClient.tsx @@ -102,7 +102,7 @@ export const ContentRendererClient = ({ responsive: true, sources: [source], }} - onVideoEnd={() => { }} + onVideoEnd={() => {}} />
diff --git a/src/components/comment/CommentInputForm.tsx b/src/components/comment/CommentInputForm.tsx index 753ce7525..5a823563b 100644 --- a/src/components/comment/CommentInputForm.tsx +++ b/src/components/comment/CommentInputForm.tsx @@ -41,8 +41,8 @@ const CommentInputForm = ({ }); setCommentText(''); }; - - const isAllSpaces = (str: string): boolean => (/^\s*$/).test(str); + + const isAllSpaces = (str: string): boolean => /^\s*$/.test(str); const isCommentValid = () => { return !isAllSpaces(commentText); @@ -103,7 +103,7 @@ const CommentInputForm = ({