-
Notifications
You must be signed in to change notification settings - Fork 0
chore: prepare release v0.3.0 #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const Layout = ({ children }: { children: React.ReactNode }) => { | ||
| return ( | ||
| <div className="flex h-full min-h-screen min-w-screen flex-col items-center justify-center"> | ||
| {children} | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default Layout |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { SignIn } from "@clerk/nextjs" | ||
|
|
||
| const Page = () => { | ||
| return <SignIn /> | ||
| } | ||
|
|
||
| export default Page |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { SignUp } from "@clerk/nextjs" | ||
|
|
||
| const Page = () => { | ||
| return <SignUp /> | ||
| } | ||
|
|
||
| export default Page |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,34 @@ | ||
| "use client" | ||
|
|
||
| import { useMutation, useQuery } from "convex/react" | ||
| import { | ||
| useMutation, | ||
| useQuery, | ||
| Authenticated, | ||
| Unauthenticated, | ||
| } from "convex/react" | ||
| import { api } from "@workspace/backend/_generated/api" | ||
| import { Button } from "@workspace/ui/components/button" | ||
| import { SignInButton, UserButton } from "@clerk/nextjs" | ||
|
|
||
| export default function Page() { | ||
| const users = useQuery(api.users.getMany) | ||
| const addUser = useMutation(api.users.add) | ||
| return ( | ||
| <div className="flex min-h-svh flex-col items-center justify-center"> | ||
| <p> apps/web</p> | ||
| <Button onClick={() => addUser()}>Add</Button> | ||
| <div className="mx-auto w-full max-w-sm"> | ||
| {JSON.stringify(users, null, 2)} | ||
| </div> | ||
| </div> | ||
| <> | ||
| <Authenticated> | ||
| <div className="flex min-h-svh flex-col items-center justify-center"> | ||
| <p> apps/web</p> | ||
| <UserButton /> | ||
| <Button onClick={() => addUser()}>Add</Button> | ||
| <div className="mx-auto w-full max-w-sm"> | ||
| {JSON.stringify(users, null, 2)} | ||
| </div> | ||
| </div> | ||
| </Authenticated> | ||
| <Unauthenticated> | ||
| <p>Must be signed In</p> | ||
| <SignInButton>Sign In!</SignInButton> | ||
| </Unauthenticated> | ||
| </> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,22 @@ | ||
| "use client" | ||
|
|
||
| import * as React from "react" | ||
| import { ConvexProvider, ConvexReactClient } from "convex/react" | ||
| import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes" | ||
| import { ConvexReactClient } from "convex/react" | ||
| import { ConvexProviderWithClerk } from "convex/react-clerk" | ||
|
|
||
| const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL || "") | ||
| import { useAuth } from "@clerk/nextjs" | ||
|
|
||
| function ThemeProvider({ | ||
| children, | ||
| ...props | ||
| }: React.ComponentProps<typeof NextThemesProvider>) { | ||
| return <ConvexProvider client={convex}>{children}</ConvexProvider> | ||
| if (!process.env.NEXT_PUBLIC_CONVEX_URL) { | ||
| throw new Error("Missing NEXT_PUBLIC_CONVEX_URL in your .env file") | ||
| } | ||
|
|
||
| function isTypingTarget(target: EventTarget | null) { | ||
| if (!(target instanceof HTMLElement)) { | ||
| return false | ||
| } | ||
| const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL) | ||
|
|
||
| function ThemeProvider({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| target.isContentEditable || | ||
| target.tagName === "INPUT" || | ||
| target.tagName === "TEXTAREA" || | ||
| target.tagName === "SELECT" | ||
| <ConvexProviderWithClerk client={convex} useAuth={useAuth}> | ||
| {children} | ||
| </ConvexProviderWithClerk> | ||
| ) | ||
| } | ||
|
|
||
| function ThemeHotkey() { | ||
| const { resolvedTheme, setTheme } = useTheme() | ||
|
|
||
| React.useEffect(() => { | ||
| function onKeyDown(event: KeyboardEvent) { | ||
| if (event.defaultPrevented || event.repeat) { | ||
| return | ||
| } | ||
|
|
||
| if (event.metaKey || event.ctrlKey || event.altKey) { | ||
| return | ||
| } | ||
|
|
||
| if (event.key.toLowerCase() !== "d") { | ||
| return | ||
| } | ||
|
|
||
| if (isTypingTarget(event.target)) { | ||
| return | ||
| } | ||
|
|
||
| setTheme(resolvedTheme === "dark" ? "light" : "dark") | ||
| } | ||
|
|
||
| window.addEventListener("keydown", onKeyDown) | ||
|
|
||
| return () => { | ||
| window.removeEventListener("keydown", onKeyDown) | ||
| } | ||
| }, [resolvedTheme, setTheme]) | ||
|
|
||
| return null | ||
| } | ||
|
|
||
| export { ThemeProvider } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||
| import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const isPublicRoute = createRouteMatcher(["/sign-in(.*)", "/sign-up(.*)"]) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export default clerkMiddleware(async (auth, req) => { | ||||||||||||||||||||||||||||||||||
| if (!isPublicRoute(req)) { | ||||||||||||||||||||||||||||||||||
| await auth.protect() | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Make
Suggested fix-const isPublicRoute = createRouteMatcher(["/sign-in(.*)", "/sign-up(.*)"])
+const isPublicRoute = createRouteMatcher([
+ "/",
+ "/sign-in(.*)",
+ "/sign-up(.*)",
+])📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export const config = { | ||||||||||||||||||||||||||||||||||
| matcher: [ | ||||||||||||||||||||||||||||||||||
| // Skip Next.js internals and all static files, unless found in search params | ||||||||||||||||||||||||||||||||||
| "/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)", | ||||||||||||||||||||||||||||||||||
| // Always run for API routes | ||||||||||||||||||||||||||||||||||
| "/(api|trpc)(.*)", | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Clarify the
CLERK_JWT_ISSUER_DOMAINsetup note.The table states that
packages/backend/.env.localis "auto-generated byconvex dev", butCLERK_JWT_ISSUER_DOMAINis not auto-generated — it must be manually configured from the Clerk Dashboard. OnlyCONVEX_DEPLOYMENTis automatically created byconvex dev. This could mislead developers setting up the backend.📝 Suggested clarification
📝 Committable suggestion
🤖 Prompt for AI Agents