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" 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..0b888624 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,8 @@ export default function HomePage() { + + {/* Full-width oval carousel section */} {showSearchTiles && hasSearched && (
+
+

Your recent projects

+

+ Sign in to view and continue your projects. +

+ + + +
+
+ ); + } + + return ; +} + +function ChatHistoryList() { + 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 + + )} +
+
+
+ ))} +
+ )} +
+ ); +} 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() {
-