From e7881f9e6fc2a4c1c2053cb87d75f8b30d823267 Mon Sep 17 00:00:00 2001 From: otdoges Date: Thu, 11 Sep 2025 20:43:57 +0000 Subject: [PATCH 1/4] Capy jam: Add sign-in UX and chat history on home; fix auth gating for generation. Adds Clerk modal on home/Toast, guards generation redirect behind keys, and surfaces Convex user chats as project history. --- app/generation/page.tsx | 4 +- app/page.tsx | 33 +++++- .../sections/chat-history/ChatHistory.tsx | 107 ++++++++++++++++++ 3 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 components/app/(home)/sections/chat-history/ChatHistory.tsx diff --git a/app/generation/page.tsx b/app/generation/page.tsx index 49f91451..be98f9bc 100644 --- a/app/generation/page.tsx +++ b/app/generation/page.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useRef, Suspense } from 'react'; import { useSearchParams, useRouter } from 'next/navigation'; -import { useSafeUser } from '@/lib/safe-clerk-hooks'; +import { useSafeUser, hasClerkKeys } from '@/lib/safe-clerk-hooks'; import { appConfig } from '@/config/app.config'; import { getBestAvailableModelClient } from '@/lib/model-detector'; import HeroInput from '@/components/HeroInput'; @@ -152,7 +152,7 @@ function AISandboxPage() { // All useEffect hooks // Redirect to sign-in if not authenticated useEffect(() => { - if (isLoaded && !isSignedIn) { + if (isLoaded && !isSignedIn && hasClerkKeys()) { router.push('/sign-in'); } }, [isLoaded, isSignedIn, router]); diff --git a/app/page.tsx b/app/page.tsx index 09831c31..b6d098f7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -34,6 +34,8 @@ import GithubIcon from "@/components/shared/header/Github/_svg/GithubIcon"; import ButtonUI from "@/components/ui/shadcn/button"; import ZapDevIcon from "@/components/ZapdevIcon"; import ZapDevLogo from "@/components/ZapdevLogo"; +import { SignInButton } from '@clerk/nextjs'; +import ChatHistory from "@/components/app/(home)/sections/chat-history/ChatHistory"; interface SearchResult { url: string; @@ -278,10 +280,16 @@ export default function HomePage() { toast.error(
Please sign in to continue - {hasClerkKeys() && ( - + + ) : ( + Sign In - + )}
); @@ -568,6 +576,25 @@ export default function HomePage() { + {/* Sign in CTA */} + {!isSignedIn && ( +
+ {hasClerkKeys() ? ( + + + + ) : ( + + Sign in to save and generate + + )} +
+ )} + + + {/* Full-width oval carousel section */} {showSearchTiles && hasSearched && (
+
+

Your recent projects

+

+ Sign in to view and continue your projects. +

+ + + +
+
+ ); + } + + const data = useQuery(api.chats.getUserChats, { limit: 10 }); + + return ( +
+
+

Your recent projects

+ + New project + +
+ + {!data && ( +
+ Loading your projects... +
+ )} + + {data && data.chats && data.chats.length === 0 && ( +
+

No projects yet

+ + Start your first project + +
+ )} + + {data && data.chats && data.chats.length > 0 && ( +
+ {data.chats.map((chat: any) => ( +
+ {chat.screenshot ? ( + // eslint-disable-next-line @next/next/no-img-element + {chat.title} + ) : ( +
+ No preview +
+ )} +
+
+ {chat.title} +
+
+ Updated {new Date(chat.updatedAt).toLocaleString()} +
+
+ + Continue + + {chat.sandboxUrl && ( + + Open preview + + )} +
+
+
+ ))} +
+ )} +
+ ); +} From 321bca9079169d53073a70014d41dbde5beb5d8a Mon Sep 17 00:00:00 2001 From: otdoges Date: Thu, 11 Sep 2025 20:49:05 +0000 Subject: [PATCH 2/4] Capy jam: Fix Vercel build by ensuring hooks are not conditional in ChatHistory; isolate Convex useQuery in mounted child component. --- components/app/(home)/sections/chat-history/ChatHistory.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/app/(home)/sections/chat-history/ChatHistory.tsx b/components/app/(home)/sections/chat-history/ChatHistory.tsx index e0d1c5e1..ffc8e91e 100644 --- a/components/app/(home)/sections/chat-history/ChatHistory.tsx +++ b/components/app/(home)/sections/chat-history/ChatHistory.tsx @@ -9,6 +9,8 @@ import { hasClerkKeys, useSafeUser } from "@/lib/safe-clerk-hooks"; export default function ChatHistory() { const { isSignedIn } = useSafeUser(); + const enabled = hasClerkKeys() && isSignedIn; + if (!hasClerkKeys()) { return null; } @@ -31,6 +33,10 @@ export default function ChatHistory() { ); } + return ; +} + +function ChatHistoryList() { const data = useQuery(api.chats.getUserChats, { limit: 10 }); return ( From 4e92e1fa580a922616bd455d5101bf086cdacd58 Mon Sep 17 00:00:00 2001 From: otdoges Date: Thu, 11 Sep 2025 20:49:58 +0000 Subject: [PATCH 3/4] Capy jam: Add CI workflow for lint+typecheck and PR size labeling to improve code reviews. --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/pr-size.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/pr-size.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..eeae2827 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + +jobs: + lint-and-typecheck: + name: Lint and Typecheck + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: 1.2.21 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: ESLint + run: bun run lint + + - name: TypeScript typecheck + run: bunx tsc --noEmit diff --git a/.github/workflows/pr-size.yml b/.github/workflows/pr-size.yml new file mode 100644 index 00000000..b2f15b50 --- /dev/null +++ b/.github/workflows/pr-size.yml @@ -0,0 +1,28 @@ +name: PR Size Labels + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: codelytv/pr-size-labeler@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + xs_label: "size/xs" + s_label: "size/s" + m_label: "size/m" + l_label: "size/l" + xl_label: "size/xl" + xxl_label: "size/xxl" + xs_max_size: "10" + s_max_size: "50" + m_max_size: "200" + l_max_size: "500" + xl_max_size: "1000" From 92cff998d86e3f2b6a9e19c747b18f858b1e92af Mon Sep 17 00:00:00 2001 From: otdoges Date: Thu, 11 Sep 2025 20:57:09 +0000 Subject: [PATCH 4/4] Capy jam: Restyle Sign In buttons to match theme (orange) and remove below-hero CTA so primary Sign In lives in header corner; update toast and ChatHistory sign-in styles. --- app/page.tsx | 21 ++----------------- .../sections/chat-history/ChatHistory.tsx | 2 +- .../shared/header/UserAuth/UserAuth.tsx | 4 ++-- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index b6d098f7..0b888624 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -282,12 +282,12 @@ export default function HomePage() { Please sign in to continue {hasClerkKeys() ? ( - ) : ( - + Sign In )} @@ -576,23 +576,6 @@ export default function HomePage() { - {/* Sign in CTA */} - {!isSignedIn && ( -
- {hasClerkKeys() ? ( - - - - ) : ( - - Sign in to save and generate - - )} -
- )} - {/* Full-width oval carousel section */} diff --git a/components/app/(home)/sections/chat-history/ChatHistory.tsx b/components/app/(home)/sections/chat-history/ChatHistory.tsx index ffc8e91e..a014a56b 100644 --- a/components/app/(home)/sections/chat-history/ChatHistory.tsx +++ b/components/app/(home)/sections/chat-history/ChatHistory.tsx @@ -24,7 +24,7 @@ export default function ChatHistory() { Sign in to view and continue your projects.

- diff --git a/components/shared/header/UserAuth/UserAuth.tsx b/components/shared/header/UserAuth/UserAuth.tsx index ae66893d..b157e3e6 100644 --- a/components/shared/header/UserAuth/UserAuth.tsx +++ b/components/shared/header/UserAuth/UserAuth.tsx @@ -8,7 +8,7 @@ export default function UserAuth() { if (!hasClerkKeys()) { return (
- @@ -20,7 +20,7 @@ export default function UserAuth() {
-