From 088e0bac7e800ee576b997df882385491d9924ba Mon Sep 17 00:00:00 2001 From: Abdullah-dev0 Date: Tue, 2 Sep 2025 17:37:41 +0500 Subject: [PATCH 1/6] posthog --- src/components/PostHogProvider.tsx | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/components/PostHogProvider.tsx b/src/components/PostHogProvider.tsx index 47728ce..89b92d0 100644 --- a/src/components/PostHogProvider.tsx +++ b/src/components/PostHogProvider.tsx @@ -1,29 +1,17 @@ +// app/providers.tsx 'use client'; -import posthogClient from 'posthog-js'; +import { posthog as posthogjs } from 'posthog-js'; import { PostHogProvider as PHProvider } from 'posthog-js/react'; import { useEffect } from 'react'; export function PostHogProvider({ children }: { children: React.ReactNode }) { - const isProd = process.env.NODE_ENV === 'production'; useEffect(() => { - const key = process.env.NEXT_PUBLIC_POSTHOG_KEY; - - if (!isProd) { - posthogClient.opt_out_capturing?.(); - return; - } - - if (!key) return; - - posthogClient.init(key, { - api_host: '/ingest', - ui_host: 'https://us.posthog.com', - capture_exceptions: true, // Enable PostHog error tracking - debug: false, + posthogjs.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { + api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST, + defaults: '2025-05-24', }); - }, [isProd]); + }, []); - if (!isProd) return <>{children}; - return {children}; + return {children}; } From 4289020f04f31128fe9df2ce2db033b911399a16 Mon Sep 17 00:00:00 2001 From: Abdullah-dev0 Date: Tue, 2 Sep 2025 18:12:26 +0500 Subject: [PATCH 2/6] refactor: update VSCode settings, enhance layout styling, and simplify Navbar component --- .vscode/settings.json | 55 +++++++++++++++------------ src/app/(root)/layout.tsx | 2 +- src/components/Navbar.tsx | 50 ++++-------------------- src/components/chat/ChatComponent.tsx | 4 +- 4 files changed, 40 insertions(+), 71 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index de9e817..0a66f19 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,26 +1,31 @@ { - "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], - "sort-imports.default-sort-style": "module-scoped", - "js/ts.implicitProjectConfig.checkJs": true, - "typescript.tsdk": "node_modules\\typescript\\lib", - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true - }, - "[javascriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true - }, - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true - }, - "[typescriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true - }, - "dart.debugExternalPackageLibraries": true, - "dart.debugSdkLibraries": true, - "git.autoRepositoryDetection": "subFolders", - "postman.settings.dotenv-detection-notification-visibility": false -} \ No newline at end of file + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact" + ], + "sort-imports.default-sort-style": "module-scoped", + "js/ts.implicitProjectConfig.checkJs": true, + "typescript.tsdk": "node_modules\\typescript\\lib", + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true + }, + "[javascriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true + }, + "dart.debugExternalPackageLibraries": true, + "dart.debugSdkLibraries": true, + "git.autoRepositoryDetection": "subFolders", + "postman.settings.dotenv-detection-notification-visibility": false +} diff --git a/src/app/(root)/layout.tsx b/src/app/(root)/layout.tsx index ce96d44..f8a8269 100644 --- a/src/app/(root)/layout.tsx +++ b/src/app/(root)/layout.tsx @@ -7,7 +7,7 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( -
+
{children}
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 587243a..fee90e8 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -2,21 +2,16 @@ import { SignedIn, - SignedOut, - SignInButton, - UserButton, - useUser, + useAuth, + UserButton } from '@clerk/nextjs'; -import { ArrowRight } from 'lucide-react'; import Link from 'next/link'; import MaxWidthWrapper from './MaxWidthWrapper'; import MobileNav from './MobileNav'; -import { Button, buttonVariants } from './ui/button'; -import { Skeleton } from './ui/skeleton'; const Navbar = () => { - const { user, isLoaded } = useUser(); + const { sessionId } = useAuth(); return ( diff --git a/src/components/chat/ChatComponent.tsx b/src/components/chat/ChatComponent.tsx index f395035..11bb517 100644 --- a/src/components/chat/ChatComponent.tsx +++ b/src/components/chat/ChatComponent.tsx @@ -60,8 +60,8 @@ const ChatComponent = ({ file }: { file: File }) => { }), { getNextPageParam: (lastPage) => lastPage.cursor, - staleTime: 60 * 1000, - cacheTime: 5 * 60 * 1000, + staleTime: Infinity, + cacheTime: Infinity, } ); From 0f4e0e60b543de49ac1f7ccf02ff686c9845ddf1 Mon Sep 17 00:00:00 2001 From: Abdullah-dev0 Date: Wed, 3 Sep 2025 07:39:27 +0500 Subject: [PATCH 3/6] refactor: streamline import statements in Navbar component --- src/components/Navbar.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index fee90e8..316fbaf 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,10 +1,6 @@ 'use client'; -import { - SignedIn, - useAuth, - UserButton -} from '@clerk/nextjs'; +import { SignedIn, useAuth, UserButton } from '@clerk/nextjs'; import Link from 'next/link'; import MaxWidthWrapper from './MaxWidthWrapper'; From 513cad34aa4b8781148c7e99c8902426c82a47cb Mon Sep 17 00:00:00 2001 From: Abdullah-dev0 Date: Wed, 3 Sep 2025 07:48:20 +0500 Subject: [PATCH 4/6] refactor: update module resolution to node16 and fix typo in relatedpdf.ts path --- tsconfig.json | 66 ++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 679e935..2aa2b7d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,32 +1,38 @@ { - "compilerOptions": { - "lib": ["ESNext", "DOM"], - "module": "commonjs", - "target": "ES6", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "strictNullChecks": true, - "allowSyntheticDefaultImports": true, - "noImplicitReturns": true, - "noImplicitAny": true, - "resolveJsonModule": true, - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "@/*": ["./src/*"] - }, - "allowJs": true, - "noEmit": true, - "incremental": true, - "moduleResolution": "node", - "isolatedModules": true, - "jsx": "preserve" - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/actions/relatedpdf.tss"], - "exclude": ["node_modules"] + "compilerOptions": { + "lib": ["ESNext", "DOM"], + "module": "commonjs", + "target": "ES6", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "strictNullChecks": true, + "allowSyntheticDefaultImports": true, + "noImplicitReturns": true, + "noImplicitAny": true, + "resolveJsonModule": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./src/*"] + }, + "allowJs": true, + "noEmit": true, + "incremental": true, + "moduleResolution": "node16", + "isolatedModules": true, + "jsx": "preserve" + }, + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + "src/actions/relatedpdf.ts" + ], + "exclude": ["node_modules"] } From f1e65ec26e821edeba0bfb26c138ee1e05ab6612 Mon Sep 17 00:00:00 2001 From: Abdullah-dev0 Date: Wed, 3 Sep 2025 07:53:50 +0500 Subject: [PATCH 5/6] refactor: update TypeScript configuration for improved compatibility and module resolution --- tsconfig.json | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 2aa2b7d..eb0b41d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,19 @@ { "compilerOptions": { - "lib": ["ESNext", "DOM"], - "module": "commonjs", - "target": "ES6", - "strict": true, - "esModuleInterop": true, + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, "skipLibCheck": true, + "strict": true, "forceConsistentCasingInFileNames": true, - "strictNullChecks": true, - "allowSyntheticDefaultImports": true, - "noImplicitReturns": true, - "noImplicitAny": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, "plugins": [ { "name": "next" @@ -19,20 +21,8 @@ ], "paths": { "@/*": ["./src/*"] - }, - "allowJs": true, - "noEmit": true, - "incremental": true, - "moduleResolution": "node16", - "isolatedModules": true, - "jsx": "preserve" + } }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - "src/actions/relatedpdf.ts" - ], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"] } From 144ef74d20971337d0e75364a519e54e2dc933bf Mon Sep 17 00:00:00 2001 From: Abdullah-dev0 Date: Sat, 6 Sep 2025 09:21:36 +0500 Subject: [PATCH 6/6] refactor: simplify layout components and remove unused MaxWidthWrapper --- src/app/(root)/dashboard/[fileid]/page.tsx | 6 +- src/app/(root)/dashboard/page.tsx | 4 +- src/app/(root)/layout.tsx | 2 +- src/components/MaxWidthWrapper.tsx | 24 ------ src/components/MobileNav.tsx | 97 ---------------------- src/components/Navbar.tsx | 33 ++++---- src/components/chat/ChatComponent.tsx | 8 +- src/components/landing/CTASection.tsx | 49 +++++------ src/components/landing/FeatureSteps.tsx | 19 +---- src/components/landing/Footer.tsx | 6 +- src/components/landing/Hero.tsx | 5 +- src/components/landing/ProductShowcase.tsx | 96 ++++++++++----------- src/components/ui/button.tsx | 54 ++++++------ 13 files changed, 132 insertions(+), 271 deletions(-) delete mode 100644 src/components/MaxWidthWrapper.tsx delete mode 100644 src/components/MobileNav.tsx diff --git a/src/app/(root)/dashboard/[fileid]/page.tsx b/src/app/(root)/dashboard/[fileid]/page.tsx index cf2c399..949ccdb 100644 --- a/src/app/(root)/dashboard/[fileid]/page.tsx +++ b/src/app/(root)/dashboard/[fileid]/page.tsx @@ -47,11 +47,11 @@ const Page = async ({ params }: PageProps) => { ); return ( -
-
+
+
{/* PDF Column */}
-
+
diff --git a/src/app/(root)/dashboard/page.tsx b/src/app/(root)/dashboard/page.tsx index f2bef28..fb36150 100644 --- a/src/app/(root)/dashboard/page.tsx +++ b/src/app/(root)/dashboard/page.tsx @@ -3,8 +3,8 @@ import UploadButton from '@/components/UploadButton'; const Dashboard = () => { return ( -
-
+
+

My Files

diff --git a/src/app/(root)/layout.tsx b/src/app/(root)/layout.tsx index f8a8269..a4d8ae3 100644 --- a/src/app/(root)/layout.tsx +++ b/src/app/(root)/layout.tsx @@ -7,7 +7,7 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( -
+
{children}
diff --git a/src/components/MaxWidthWrapper.tsx b/src/components/MaxWidthWrapper.tsx deleted file mode 100644 index 390d137..0000000 --- a/src/components/MaxWidthWrapper.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { ReactNode } from 'react'; - -import { cn } from '@/lib/utils'; - -const MaxWidthWrapper = ({ - className, - children, -}: { - className?: string; - children: ReactNode; -}) => { - return ( -
- {children} -
- ); -}; - -export default MaxWidthWrapper; diff --git a/src/components/MobileNav.tsx b/src/components/MobileNav.tsx deleted file mode 100644 index d41442f..0000000 --- a/src/components/MobileNav.tsx +++ /dev/null @@ -1,97 +0,0 @@ -'use client'; - -import { ArrowRight, Menu } from 'lucide-react'; -import Link from 'next/link'; -import { usePathname } from 'next/navigation'; -import { useEffect, useState } from 'react'; - -const MobileNav = ({ isAuth }: { isAuth: boolean }) => { - const [isOpen, setOpen] = useState(false); - - const toggleOpen = () => setOpen((prev) => !prev); - - const pathname = usePathname(); - - useEffect(() => { - if (isOpen) toggleOpen(); - }, [pathname, isOpen]); - - const closeOnCurrent = (href: string) => { - if (pathname === href) { - toggleOpen(); - } - }; - - return ( -
- - - {isOpen ? ( -
-
    - {!isAuth ? ( - <> -
  • - closeOnCurrent('/sign-up')} - className="flex items-center w-full font-semibold text-green-600" - href="/sign-up" - > - Get started - - -
  • -
  • -
  • - closeOnCurrent('/sign-in')} - className="flex items-center w-full font-semibold" - href="/sign-in" - > - Sign in - -
  • -
  • -
  • - closeOnCurrent('/pricing')} - className="flex items-center w-full font-semibold" - href="/pricing" - > - Pricing - -
  • - - ) : ( - <> -
  • - closeOnCurrent('/dashboard')} - className="flex items-center w-full font-semibold" - href="/dashboard" - > - Dashboard - -
  • -
  • -
  • - - Sign out - -
  • - - )} -
-
- ) : null} -
- ); -}; - -export default MobileNav; diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 316fbaf..2a4b038 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,29 +1,28 @@ 'use client'; -import { SignedIn, useAuth, UserButton } from '@clerk/nextjs'; +import { SignedIn, UserButton, SignedOut } from '@clerk/nextjs'; import Link from 'next/link'; -import MaxWidthWrapper from './MaxWidthWrapper'; -import MobileNav from './MobileNav'; +import { Button } from './ui/button'; const Navbar = () => { - const { sessionId } = useAuth(); - return ( - ); }; diff --git a/src/components/chat/ChatComponent.tsx b/src/components/chat/ChatComponent.tsx index 11bb517..9955eda 100644 --- a/src/components/chat/ChatComponent.tsx +++ b/src/components/chat/ChatComponent.tsx @@ -20,7 +20,7 @@ import { Button, buttonVariants } from '../ui/button'; import { Textarea } from '../ui/textarea'; import SelectLanguage from './SelectLanguage'; -import MessageItem from './messages/MessageItem'; +import { MessageItem } from './messages'; const ChatComponent = ({ file }: { file: File }) => { const [input, setInput] = useState(''); @@ -232,6 +232,12 @@ const ChatComponent = ({ file }: { file: File }) => {