diff --git a/bun.lockb b/bun.lockb index 569990d6..1491662a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/web/.env.example b/web/.env.example index 37112a6d..c775b455 100644 --- a/web/.env.example +++ b/web/.env.example @@ -1,4 +1,10 @@ NEXT_PUBLIC_APP_NAME="Learn Anything" NEXT_PUBLIC_APP_URL=http://localhost:3000 -NEXT_PUBLIC_JAZZ_GLOBAL_GROUP="" \ No newline at end of file +NEXT_PUBLIC_JAZZ_GLOBAL_GROUP="" + +NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= +CLERK_SECRET_KEY= + +NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in +NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up \ No newline at end of file diff --git a/web/app/(auth)/layout.tsx b/web/app/(auth)/layout.tsx new file mode 100644 index 00000000..e99c8df2 --- /dev/null +++ b/web/app/(auth)/layout.tsx @@ -0,0 +1,7 @@ +export default function AuthLayout({ + children +}: Readonly<{ + children: React.ReactNode +}>) { + return
{children}
+} diff --git a/web/app/(auth)/sign-in/[[...sign-in]]/page.tsx b/web/app/(auth)/sign-in/[[...sign-in]]/page.tsx new file mode 100644 index 00000000..0b5feeb9 --- /dev/null +++ b/web/app/(auth)/sign-in/[[...sign-in]]/page.tsx @@ -0,0 +1,9 @@ +import { SignInClient } from "@/components/custom/clerk/sign-in-client" + +export default async function Page() { + return ( +
+ +
+ ) +} diff --git a/web/app/(auth)/sign-up/[[...sign-up]]/page.tsx b/web/app/(auth)/sign-up/[[...sign-up]]/page.tsx new file mode 100644 index 00000000..57c4d9e3 --- /dev/null +++ b/web/app/(auth)/sign-up/[[...sign-up]]/page.tsx @@ -0,0 +1,9 @@ +import { SignUpClient } from "@/components/custom/clerk/sign-up-client" + +export default async function Page() { + return ( +
+ +
+ ) +} diff --git a/web/app/(pages)/layout.tsx b/web/app/(pages)/layout.tsx index 5fecb9a3..fb32036d 100644 --- a/web/app/(pages)/layout.tsx +++ b/web/app/(pages)/layout.tsx @@ -1,22 +1,33 @@ +import { SignedInClient } from "@/components/custom/clerk/signed-in-client" import { Sidebar } from "@/components/custom/sidebar/sidebar" -import PublicHomeRoute from "@/components/routes/PublicHomeRoute" +import { PublicHomeRoute } from "@/components/routes/PublicHomeRoute" +import { CommandPalette } from "@/components/ui/CommandPalette" +import { JazzClerkAuth, JazzProvider } from "@/lib/providers/jazz-provider" +import { currentUser } from "@clerk/nextjs/server" -export default async function RootLayout({ children }: { children: React.ReactNode }) { - // TODO: get it from jazz/clerk - const loggedIn = true +export default async function PageLayout({ children }: { children: React.ReactNode }) { + const user = await currentUser() - if (loggedIn) { - return ( -
- - -
-
- {children} -
-
-
- ) + if (!user) { + return } - return + + return ( + + + +
+ + + +
+
+ {children} +
+
+
+
+
+
+ ) } diff --git a/web/app/(pages)/profile/_components/wrapper.tsx b/web/app/(pages)/profile/_components/wrapper.tsx index 829d83bb..a8433c32 100644 --- a/web/app/(pages)/profile/_components/wrapper.tsx +++ b/web/app/(pages)/profile/_components/wrapper.tsx @@ -68,7 +68,7 @@ export const ProfileWrapper = () => {

- Oops! This account doesn't exist. + Oops! This account doesn't exist.

Try searching for another.

@@ -91,7 +91,7 @@ export const ProfileWrapper = () => { onClick={clickEdit} className="shadow-outer ml-auto flex h-[34px] cursor-pointer flex-row space-x-2 rounded-lg bg-white px-3 text-black shadow-[1px_1px_1px_1px_rgba(0,0,0,0.3)] hover:bg-black/10 dark:bg-[#222222] dark:text-white dark:hover:opacity-60" > - + Edit Profile

diff --git a/web/app/globals.css b/web/app/globals.css index 29d3758a..623eca9c 100644 --- a/web/app/globals.css +++ b/web/app/globals.css @@ -21,8 +21,8 @@ --destructive: 0 84.2% 60.2%; --destructive-foreground: 0 0% 98%; --border: 240 5.9% 90%; - --input: 240 5.9% 90%; - --result: 240 5.9% 96%; + --input: 240 5.9% 96%; + --result: 240 5.9% 96%; --ring: 240 5.9% 10%; --radius: 0.5rem; --chart-1: 12 76% 61%; @@ -51,8 +51,8 @@ --destructive: 0 62.8% 30.6%; --destructive-foreground: 0 0% 98%; --border: 240 3.7% 15.9%; - --input: 220 9% 10%; - --result: 0 0% 7%; + --input: 220 9% 10%; + --result: 0 0% 7%; --ring: 240 4.9% 83.9%; --chart-1: 220 70% 50%; --chart-2: 160 60% 45%; diff --git a/web/app/layout.tsx b/web/app/layout.tsx index 065719cf..ddcb409a 100644 --- a/web/app/layout.tsx +++ b/web/app/layout.tsx @@ -3,7 +3,8 @@ import { Inter as FontSans } from "next/font/google" import { cn } from "@/lib/utils" import { ThemeProvider } from "@/lib/providers/theme-provider" import "./globals.css" -import { JazzProvider } from "@/lib/providers/jazz-provider" + +import { ClerkProviderClient } from "@/components/custom/clerk/clerk-provider-client" import { JotaiProvider } from "@/lib/providers/jotai-provider" import { Toaster } from "@/components/ui/sonner" import { ConfirmProvider } from "@/lib/providers/confirm-provider" @@ -25,8 +26,8 @@ export default function RootLayout({ }>) { return ( - - + + @@ -35,8 +36,8 @@ export default function RootLayout({ - - + + ) } diff --git a/web/components/custom/ai-search.tsx b/web/components/custom/ai-search.tsx index d670334b..b7aa9802 100644 --- a/web/components/custom/ai-search.tsx +++ b/web/components/custom/ai-search.tsx @@ -22,7 +22,7 @@ const AiSearch: React.FC = (props: { searchQuery: string }) => { if (root_el.current) { root_el.current.appendChild(md_el) } - }, [root_el.current, md_el]) + }, [md_el]) useEffect(() => { let question = props.searchQuery diff --git a/web/components/custom/auth-ui.tsx b/web/components/custom/auth-ui.tsx deleted file mode 100644 index e2dd2686..00000000 --- a/web/components/custom/auth-ui.tsx +++ /dev/null @@ -1,45 +0,0 @@ -"use client" - -import { useState } from "react" -import { DemoAuth } from "jazz-react" -import { Input } from "../ui/input" -import { Button } from "../ui/button" - -export const AuthUI: DemoAuth.Component = ({ existingUsers, logInAs, signUp, appName, loading }) => { - const [username, setUsername] = useState("") - - if (loading) return
Loading...
- - return ( -
-
-

{appName}

-
{ - e.preventDefault() - signUp(username) - }} - > - setUsername(e.target.value)} - autoComplete="webauthn" - /> - -
- -
- {existingUsers.map(user => ( - - ))} -
-
-
- ) -} - -export default AuthUI diff --git a/web/components/custom/clerk/clerk-provider-client.tsx b/web/components/custom/clerk/clerk-provider-client.tsx new file mode 100644 index 00000000..6edee0ca --- /dev/null +++ b/web/components/custom/clerk/clerk-provider-client.tsx @@ -0,0 +1,7 @@ +"use client" + +import { ClerkProvider } from "@clerk/nextjs" + +export const ClerkProviderClient = ({ children }: { children: React.ReactNode }) => { + return {children} +} diff --git a/web/components/custom/clerk/sign-in-client.tsx b/web/components/custom/clerk/sign-in-client.tsx new file mode 100644 index 00000000..a789546a --- /dev/null +++ b/web/components/custom/clerk/sign-in-client.tsx @@ -0,0 +1,7 @@ +"use client" + +import { SignIn } from "@clerk/nextjs" + +export const SignInClient = () => { + return +} diff --git a/web/components/custom/clerk/sign-up-client.tsx b/web/components/custom/clerk/sign-up-client.tsx new file mode 100644 index 00000000..fdfbd3b5 --- /dev/null +++ b/web/components/custom/clerk/sign-up-client.tsx @@ -0,0 +1,7 @@ +"use client" + +import { SignUp } from "@clerk/nextjs" + +export const SignUpClient = () => { + return +} diff --git a/web/components/custom/clerk/signed-in-client.tsx b/web/components/custom/clerk/signed-in-client.tsx new file mode 100644 index 00000000..b2d70510 --- /dev/null +++ b/web/components/custom/clerk/signed-in-client.tsx @@ -0,0 +1,7 @@ +"use client" + +import { SignedIn } from "@clerk/nextjs" + +export const SignedInClient = ({ children }: { children: React.ReactNode }) => { + return {children} +} diff --git a/web/components/custom/delete-modal.tsx b/web/components/custom/delete-modal.tsx index be8e0551..207a9184 100644 --- a/web/components/custom/delete-modal.tsx +++ b/web/components/custom/delete-modal.tsx @@ -20,7 +20,7 @@ export default function DeletePageModal({ isOpen, onClose, onConfirm, title }: D - Delete "{title}"? + Delete "{title}"? This action cannot be undone. diff --git a/web/components/custom/sidebar/partial/page-section.tsx b/web/components/custom/sidebar/partial/page-section.tsx index 97dd1185..b5064c0f 100644 --- a/web/components/custom/sidebar/partial/page-section.tsx +++ b/web/components/custom/sidebar/partial/page-section.tsx @@ -72,7 +72,7 @@ const PageSectionHeader: React.FC = ({ pageCount }) => ( >

Pages - {pageCount && {pageCount}} + {pageCount > 0 && {pageCount}}

@@ -86,6 +86,8 @@ const NewPageButton: React.FC = () => { const { me } = useAccount() const router = useRouter() + if (!me) return null + const handleClick = () => { try { const newPersonalPage = PersonalPage.create( @@ -248,6 +250,4 @@ const ShowAllForm: React.FC = () => { ) -} - -export default PageSection +} \ No newline at end of file diff --git a/web/components/custom/sidebar/partial/profile-section.tsx b/web/components/custom/sidebar/partial/profile-section.tsx index c150ae75..53b965c1 100644 --- a/web/components/custom/sidebar/partial/profile-section.tsx +++ b/web/components/custom/sidebar/partial/profile-section.tsx @@ -11,6 +11,7 @@ import { } from "@/components/ui/dropdown-menu" import { useAccount } from "@/lib/providers/jazz-provider" import Link from "next/link" +import { useAuth } from "@clerk/nextjs" const MenuItem = ({ icon, @@ -48,9 +49,10 @@ const MenuItem = ({ ) } export const ProfileSection: React.FC = () => { - const { me, logOut } = useAccount({ + const { me } = useAccount({ profile: true }) + const { signOut } = useAuth() const [menuOpen, setMenuOpen] = useState(false) const closeMenu = () => setMenuOpen(false) @@ -86,7 +88,7 @@ export const ProfileSection: React.FC = () => { - + diff --git a/web/components/custom/sidebar/partial/topic-section.tsx b/web/components/custom/sidebar/partial/topic-section.tsx index b6bd04d1..e1aaeb9b 100644 --- a/web/components/custom/sidebar/partial/topic-section.tsx +++ b/web/components/custom/sidebar/partial/topic-section.tsx @@ -50,7 +50,7 @@ const TopicSectionHeader: React.FC = ({ topicCount }) = >

Topics - {topicCount && {topicCount}} + {topicCount > 0 && {topicCount}}

@@ -131,6 +131,4 @@ const ListItem: React.FC = ({ label, value, href, count, isActive
) -} - -export default TopicSection +} \ No newline at end of file diff --git a/web/components/routes/EditProfileRoute.tsx b/web/components/routes/EditProfileRoute.tsx index 69e232d3..3989a00a 100644 --- a/web/components/routes/EditProfileRoute.tsx +++ b/web/components/routes/EditProfileRoute.tsx @@ -1,40 +1,39 @@ "use client" - import { useAccount } from "@/lib/providers/jazz-provider" export default function EditProfileRoute() { const account = useAccount() return ( -
-

Profile

-
+
+

Edit Profile

+
- -
+

learn-anything.xyz/@