From 7d55938436d2bb4ce41fcf4ea7f3007bc84cfce3 Mon Sep 17 00:00:00 2001 From: Adam Cohen Hillel Date: Thu, 17 Apr 2025 23:49:07 +0100 Subject: [PATCH] fix build --- frontend/src/app/auth/page.tsx | 16 +++++- frontend/src/app/auth/reset-password/page.tsx | 16 +++++- .../dashboard/(personalAccount)/loading.tsx | 10 ++++ .../app/dashboard/(personalAccount)/page.tsx | 26 ++++++++- .../(teamAccount)/[accountSlug]/page.tsx | 22 ++++---- .../[accountSlug]/settings/billing/page.tsx | 49 +++++++++++++++-- .../[accountSlug]/settings/layout.tsx | 15 +++++- .../[accountSlug]/settings/members/page.tsx | 54 ++++++++++++++++--- .../[accountSlug]/settings/page.tsx | 50 ++++++++++++++--- frontend/src/app/invitation/page.tsx | 18 +++++-- .../file-renderers/markdown-renderer.tsx | 10 ++-- frontend/src/components/theme-provider.tsx | 3 +- frontend/src/lib/home.tsx | 24 ++++----- 13 files changed, 258 insertions(+), 55 deletions(-) create mode 100644 frontend/src/app/dashboard/(personalAccount)/loading.tsx diff --git a/frontend/src/app/auth/page.tsx b/frontend/src/app/auth/page.tsx index 1a829c9a..42277f37 100644 --- a/frontend/src/app/auth/page.tsx +++ b/frontend/src/app/auth/page.tsx @@ -6,7 +6,7 @@ import { Input } from "@/components/ui/input"; import GoogleSignIn from "@/components/GoogleSignIn"; import { FlickeringGrid } from "@/components/home/ui/flickering-grid"; import { useMediaQuery } from "@/hooks/use-media-query"; -import { useState, useEffect, useRef } from "react"; +import { useState, useEffect, useRef, Suspense } from "react"; import { useScroll } from "motion/react"; import { signIn, signUp, forgotPassword } from "./actions"; import { useSearchParams, useRouter } from "next/navigation"; @@ -22,7 +22,7 @@ import { DialogFooter, } from "@/components/ui/dialog"; -export default function Login() { +function LoginContent() { const router = useRouter(); const searchParams = useSearchParams(); const { user, isLoading } = useAuth(); @@ -525,3 +525,15 @@ export default function Login() { ); } + +export default function Login() { + return ( + +
+ + }> + +
+ ); +} diff --git a/frontend/src/app/auth/reset-password/page.tsx b/frontend/src/app/auth/reset-password/page.tsx index 25d82dc6..c2e50874 100644 --- a/frontend/src/app/auth/reset-password/page.tsx +++ b/frontend/src/app/auth/reset-password/page.tsx @@ -3,14 +3,14 @@ import Link from "next/link"; import { useRouter } from "next/navigation"; import { useSearchParams } from "next/navigation"; -import { useState, useEffect } from "react"; +import { useState, useEffect, Suspense } from "react"; import { AlertCircle, ArrowLeft, CheckCircle } from "lucide-react"; import { Input } from "@/components/ui/input"; import { SubmitButton } from "@/components/ui/submit-button"; import { resetPassword } from "../actions"; -export default function ResetPassword() { +function ResetPasswordContent() { const router = useRouter(); const searchParams = useSearchParams(); const code = searchParams.get("code"); @@ -168,4 +168,16 @@ export default function ResetPassword() { ); +} + +export default function ResetPassword() { + return ( + +
+ + }> + +
+ ); } \ No newline at end of file diff --git a/frontend/src/app/dashboard/(personalAccount)/loading.tsx b/frontend/src/app/dashboard/(personalAccount)/loading.tsx new file mode 100644 index 00000000..5f1ee8bd --- /dev/null +++ b/frontend/src/app/dashboard/(personalAccount)/loading.tsx @@ -0,0 +1,10 @@ +'use client'; + +// This component will be shown while the route is loading +export default function Loading() { + return ( +
+
+
+ ); +} \ No newline at end of file diff --git a/frontend/src/app/dashboard/(personalAccount)/page.tsx b/frontend/src/app/dashboard/(personalAccount)/page.tsx index 2628ef71..d43f8f68 100644 --- a/frontend/src/app/dashboard/(personalAccount)/page.tsx +++ b/frontend/src/app/dashboard/(personalAccount)/page.tsx @@ -1,5 +1,27 @@ -import { redirect } from 'next/navigation'; +'use client'; + +import { useEffect } from 'react'; +import { useRouter } from 'next/navigation'; + +// Set all dynamic options to prevent prerendering +export const dynamic = 'force-dynamic'; +export const dynamicParams = true; +export const revalidate = 0; +export const fetchCache = 'force-no-store'; +export const runtime = 'edge'; export default function PersonalAccountPage() { - redirect('/dashboard'); + const router = useRouter(); + + // Use client-side navigation instead of server redirect + useEffect(() => { + router.replace('/dashboard'); + }, [router]); + + // Return a minimal loading state until redirect happens + return ( +
+
+
+ ); } \ No newline at end of file diff --git a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/page.tsx b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/page.tsx index 69e34b0e..d012038f 100644 --- a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/page.tsx +++ b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/page.tsx @@ -1,15 +1,19 @@ +'use client'; + import { redirect } from 'next/navigation'; +import React from 'react'; -interface AccountRedirectProps { - params: { - accountSlug: string; - }; -} +type AccountParams = { + accountSlug: string; +}; -export default function AccountRedirect({ - params, -}: AccountRedirectProps) { - const { accountSlug } = params; +export default function AccountRedirect({ + params +}: { + params: Promise +}) { + const unwrappedParams = React.use(params); + const { accountSlug } = unwrappedParams; // Redirect to the settings page redirect(`/dashboard/${accountSlug}/settings`); diff --git a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/billing/page.tsx b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/billing/page.tsx index 4ed78edc..2d5b64d2 100644 --- a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/billing/page.tsx +++ b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/billing/page.tsx @@ -1,14 +1,53 @@ +'use client'; + +import React from 'react'; import {createClient} from "@/lib/supabase/server"; import AccountBillingStatus from "@/components/basejump/account-billing-status"; import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"; const returnUrl = process.env.NEXT_PUBLIC_URL as string; -export default async function TeamBillingPage({params: {accountSlug}}: {params: {accountSlug: string}}) { - const supabaseClient = await createClient(); - const {data: teamAccount} = await supabaseClient.rpc('get_account_by_slug', { - slug: accountSlug - }); +type AccountParams = { + accountSlug: string; +}; + +export default function TeamBillingPage({ params }: { params: Promise }) { + const unwrappedParams = React.use(params); + const { accountSlug } = unwrappedParams; + + // Use an effect to load team account data + const [teamAccount, setTeamAccount] = React.useState(null); + const [error, setError] = React.useState(null); + + React.useEffect(() => { + async function loadData() { + try { + const supabaseClient = await createClient(); + const {data} = await supabaseClient.rpc('get_account_by_slug', { + slug: accountSlug + }); + setTeamAccount(data); + } catch (err) { + setError("Failed to load account data"); + console.error(err); + } + } + + loadData(); + }, [accountSlug]); + + if (error) { + return ( + + Error + {error} + + ); + } + + if (!teamAccount) { + return
Loading...
; + } if (teamAccount.account_role !== 'owner') { return ( diff --git a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/layout.tsx b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/layout.tsx index 001c4008..a6aa8d2a 100644 --- a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/layout.tsx +++ b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/layout.tsx @@ -1,10 +1,23 @@ 'use client'; +import React from 'react'; import {Separator} from "@/components/ui/separator"; import Link from "next/link"; import { usePathname } from "next/navigation"; -export default function TeamSettingsPage({children, params: {accountSlug}}: {children: React.ReactNode, params: {accountSlug: string}}) { +type LayoutParams = { + accountSlug: string; +}; + +export default function TeamSettingsLayout({ + children, + params +}: { + children: React.ReactNode, + params: Promise +}) { + const unwrappedParams = React.use(params); + const { accountSlug } = unwrappedParams; const pathname = usePathname(); const items = [ { name: "Account", href: `/dashboard/${accountSlug}/settings` }, diff --git a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/members/page.tsx b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/members/page.tsx index 31134e49..2826da5b 100644 --- a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/members/page.tsx +++ b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/members/page.tsx @@ -1,16 +1,58 @@ +'use client'; + +import React from 'react'; import {createClient} from "@/lib/supabase/server"; import ManageTeamMembers from "@/components/basejump/manage-team-members"; import ManageTeamInvitations from "@/components/basejump/manage-team-invitations"; import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -export default async function TeamMembersPage({params: {accountSlug}}: {params: {accountSlug: string}}) { - const supabaseClient = await createClient(); - const {data: teamAccount} = await supabaseClient.rpc('get_account_by_slug', { - slug: accountSlug - }); +type AccountParams = { + accountSlug: string; +}; - if (teamAccount.account_role !== 'owner') { +export default function TeamMembersPage({ params }: { params: Promise }) { + const unwrappedParams = React.use(params); + const { accountSlug } = unwrappedParams; + + // Use an effect to load team account data + const [teamAccount, setTeamAccount] = React.useState(null); + const [loading, setLoading] = React.useState(true); + const [error, setError] = React.useState(null); + + React.useEffect(() => { + async function loadData() { + try { + const supabaseClient = await createClient(); + const {data} = await supabaseClient.rpc('get_account_by_slug', { + slug: accountSlug + }); + setTeamAccount(data); + setLoading(false); + } catch (err) { + setError("Failed to load team data"); + setLoading(false); + console.error(err); + } + } + + loadData(); + }, [accountSlug]); + + if (loading) { + return
Loading...
; + } + + if (error) { + return ( + + Error + {error} + + ); + } + + if (!teamAccount || teamAccount.account_role !== 'owner') { return ( Access Denied diff --git a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/page.tsx b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/page.tsx index ba845c4c..d4d48a02 100644 --- a/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/page.tsx +++ b/frontend/src/app/dashboard/(teamAccount)/[accountSlug]/settings/page.tsx @@ -1,13 +1,51 @@ +'use client'; + +import React from 'react'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import EditTeamName from "@/components/basejump/edit-team-name"; import EditTeamSlug from "@/components/basejump/edit-team-slug"; -import { createClient } from "@/lib/supabase/server"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import {createClient} from "@/lib/supabase/server"; -export default async function TeamSettingsPage({ params: { accountSlug } }: { params: { accountSlug: string } }) { - const supabaseClient = await createClient(); - const { data: teamAccount } = await supabaseClient.rpc('get_account_by_slug', { - slug: accountSlug - }); +type AccountParams = { + accountSlug: string; +}; + +export default function TeamSettingsPage({ params }: { params: Promise }) { + const unwrappedParams = React.use(params); + const { accountSlug } = unwrappedParams; + + // Use an effect to load team account data + const [teamAccount, setTeamAccount] = React.useState(null); + const [loading, setLoading] = React.useState(true); + const [error, setError] = React.useState(null); + + React.useEffect(() => { + async function loadData() { + try { + const supabaseClient = await createClient(); + const {data} = await supabaseClient.rpc('get_account_by_slug', { + slug: accountSlug + }); + setTeamAccount(data); + setLoading(false); + } catch (err) { + setError("Failed to load account data"); + setLoading(false); + console.error(err); + } + } + + loadData(); + }, [accountSlug]); + + if (loading) { + return
Loading...
; + } + + if (!teamAccount) { + return
Account not found
; + } return (
diff --git a/frontend/src/app/invitation/page.tsx b/frontend/src/app/invitation/page.tsx index 58d2bcb4..c84dd025 100644 --- a/frontend/src/app/invitation/page.tsx +++ b/frontend/src/app/invitation/page.tsx @@ -1,15 +1,27 @@ +'use client'; + +import React from 'react'; import AcceptTeamInvitation from "@/components/basejump/accept-team-invitation"; import { redirect } from "next/navigation" -export default async function AcceptInvitationPage({searchParams}: {searchParams: {token?: string}}) { +type InvitationSearchParams = { + token?: string; +}; - if (!searchParams.token) { +export default function AcceptInvitationPage({ + searchParams +}: { + searchParams: Promise +}) { + const unwrappedSearchParams = React.use(searchParams); + + if (!unwrappedSearchParams.token) { redirect("/"); } return (
- +
) } \ No newline at end of file diff --git a/frontend/src/components/file-renderers/markdown-renderer.tsx b/frontend/src/components/file-renderers/markdown-renderer.tsx index bb6f5a44..7dd9462d 100644 --- a/frontend/src/components/file-renderers/markdown-renderer.tsx +++ b/frontend/src/components/file-renderers/markdown-renderer.tsx @@ -20,12 +20,16 @@ export function MarkdownRenderer({ content, className }: MarkdownRendererProps) + {children} ); diff --git a/frontend/src/components/theme-provider.tsx b/frontend/src/components/theme-provider.tsx index 220a1f84..51c643f7 100644 --- a/frontend/src/components/theme-provider.tsx +++ b/frontend/src/components/theme-provider.tsx @@ -1,8 +1,7 @@ "use client" import * as React from "react" -import { ThemeProvider as NextThemesProvider } from "next-themes" -import { type ThemeProviderProps } from "next-themes/dist/types" +import { ThemeProvider as NextThemesProvider, type ThemeProviderProps } from "next-themes" export function ThemeProvider({ children, ...props }: ThemeProviderProps) { return {children} diff --git a/frontend/src/lib/home.tsx b/frontend/src/lib/home.tsx index 16bd6e1f..8783e766 100644 --- a/frontend/src/lib/home.tsx +++ b/frontend/src/lib/home.tsx @@ -41,8 +41,8 @@ export const siteConfig = { ], links: { email: "support@kortix.ai", - twitter: "https://twitter.com/kortixai", - // discord: "https://discord.gg/kortixai", + twitter: "https://x.com/kortixai", + discord: "https://discord.gg/kortixai", github: "https://github.com/Kortix-ai/Suna", instagram: "https://instagram.com/kortixai", }, @@ -52,7 +52,6 @@ export const siteConfig = { { id: 2, name: "Use Cases", href: "#use-cases" }, { id: 3, name: "Open Source", href: "#open-source" }, { id: 4, name: "Pricing", href: "#pricing" }, - // { id: 5, name: "Contact", href: "#cta" }, ], }, hero: { @@ -1012,28 +1011,25 @@ export const siteConfig = { { title: "Kortix", links: [ - { id: 1, title: "About", url: "#" }, - { id: 2, title: "Team", url: "#" }, - { id: 3, title: "Blog", url: "#" }, - { id: 4, title: "Careers", url: "#" }, + { id: 1, title: "About", url: "https://kortix.ai" }, + { id: 3, title: "Contact", url: "contact@kortix.ai" }, + { id: 4, title: "Careers", url: "https://kortix.ai/careers" }, ], }, { title: "Resources", links: [ - { id: 5, title: "Documentation", url: "#" }, - { id: 6, title: "API Reference", url: "#" }, - { id: 7, title: "Community", url: "#" }, + { id: 5, title: "Documentation", url: "https://github.com/Kortix-ai/Suna" }, + { id: 7, title: "Discord", url: "https://discord.gg/Py6pCBUUPw" }, { id: 8, title: "GitHub", url: "https://github.com/Kortix-ai/Suna" }, ], }, { title: "Legal", links: [ - { id: 9, title: "Privacy", url: "#" }, - { id: 10, title: "Terms", url: "#" }, - { id: 11, title: "License", url: "#" }, - { id: 12, title: "Contact", url: "#" }, + { id: 9, title: "Privacy Policy", url: "https://suna.so/legal/privacy" }, + { id: 10, title: "Terms of Service", url: "https://suna.so/legal/terms" }, + { id: 11, title: "License Apache 2.0", url: "https://github.com/Kortix-ai/Suna/blob/main/LICENSE" }, ], }, ],