diff --git a/.eslintrc.json b/.eslintrc.json index 70c310a..c244846 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,19 +3,19 @@ "root": true, "extends": [ "next/core-web-vitals", - "prettier", "plugin:tailwindcss/recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "prettier" ], - "plugins": ["tailwindcss"], + "plugins": ["tailwindcss", "prettier"], "rules": { "@next/next/no-html-link-for-pages": "off", "react/jsx-key": "off", "tailwindcss/no-custom-classname": "off", - "indent": ["error", 2], "@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-empty-function": "off" + "@typescript-eslint/no-empty-function": "off", + "prettier/prettier": "error" }, "settings": { "tailwindcss": { diff --git a/README.md b/README.md index 4a78263..7a4a223 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@

Tech stacks · - Installation · + Installation · Run Locally · Authors

diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsx index aaa9311..26d6243 100644 --- a/app/(auth)/layout.tsx +++ b/app/(auth)/layout.tsx @@ -1,9 +1,9 @@ -import { AppLogo } from "@/components/ui/common/AppLogo" +import { AppLogo } from "@/components/ui/common/AppLogo"; type AuthLayoutProps = { - children: React.ReactNode - } - + children: React.ReactNode; +}; + export default function AuthLayout({ children }: AuthLayoutProps) { return (
@@ -13,11 +13,11 @@ export default function AuthLayout({ children }: AuthLayoutProps) { className="absolute inset-0 bg-ring bg-right-bottom brightness-50 lg:bg-center lg:brightness-100" style={{ backgroundImage: - "url(https://images.unsplash.com/photo-1627645835237-0743e52b991f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1587&q=80)", + "url(https://images.unsplash.com/photo-1627645835237-0743e52b991f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1587&q=80)", }} />
- +
@@ -27,5 +27,5 @@ export default function AuthLayout({ children }: AuthLayoutProps) {
- ) -} \ No newline at end of file + ); +} diff --git a/app/(auth)/signin/page.tsx b/app/(auth)/signin/page.tsx index fb65111..6984c12 100644 --- a/app/(auth)/signin/page.tsx +++ b/app/(auth)/signin/page.tsx @@ -1,27 +1,28 @@ -import { Metadata } from "next" -import { redirect } from "next/navigation" -import { UserAuthForm } from "@/components/modules/auth/UserAuthForm" -import { getCurrentSession } from "@/lib/session" -import { createClient } from "@/lib/supabase/server" -import { cookies } from "next/headers" -import { Heading3 } from "@/components/ui/typography" -import { siteConfig } from "@/config/site" +import { Metadata } from "next"; +import { cookies } from "next/headers"; +import { redirect } from "next/navigation"; + +import { siteConfig } from "@/config/site"; +import { getCurrentSession } from "@/lib/session"; +import { createClient } from "@/lib/supabase/server"; +import { Heading3 } from "@/components/ui/typography"; +import { UserAuthForm } from "@/components/modules/auth/UserAuthForm"; export const metadata: Metadata = { title: "Sigin", description: "Sigin to your account", -} +}; -export const runtime = "edge" -export const dynamic = 'force-dynamic' +export const runtime = "edge"; +export const dynamic = "force-dynamic"; export default async function LoginPage() { - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const session = await getCurrentSession(supabase) + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const session = await getCurrentSession(supabase); if (session) { - redirect(`/apps/chat`) + redirect(`/apps/chat`); } return ( @@ -34,5 +35,5 @@ export default async function LoginPage() { - ) -} \ No newline at end of file + ); +} diff --git a/app/(auth)/signup/page.tsx b/app/(auth)/signup/page.tsx index 0428aa5..71bb574 100644 --- a/app/(auth)/signup/page.tsx +++ b/app/(auth)/signup/page.tsx @@ -1,27 +1,28 @@ -import { Metadata } from "next" -import { redirect } from "next/navigation" -import { UserSignupForm } from "@/components/modules/auth/UserSignupForm" -import { createClient } from "@/lib/supabase/server" -import { getCurrentSession } from "@/lib/session" -import { cookies } from "next/headers" -import { Heading3 } from "@/components/ui/typography" -import { siteConfig } from "@/config/site" +import { Metadata } from "next"; +import { cookies } from "next/headers"; +import { redirect } from "next/navigation"; -export const runtime = "edge" +import { siteConfig } from "@/config/site"; +import { getCurrentSession } from "@/lib/session"; +import { createClient } from "@/lib/supabase/server"; +import { Heading3 } from "@/components/ui/typography"; +import { UserSignupForm } from "@/components/modules/auth/UserSignupForm"; + +export const runtime = "edge"; export const metadata: Metadata = { title: "Signup", description: "Signup a new account", -} +}; -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; export default async function LoginPage() { - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const session = await getCurrentSession(supabase) + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const session = await getCurrentSession(supabase); if (session) { - redirect(`/apps/chat`) + redirect(`/apps/chat`); } return ( @@ -34,5 +35,5 @@ export default async function LoginPage() { - ) -} \ No newline at end of file + ); +} diff --git a/app/api/auth/callback/route.ts b/app/api/auth/callback/route.ts index 9927c7a..ece6938 100644 --- a/app/api/auth/callback/route.ts +++ b/app/api/auth/callback/route.ts @@ -1,20 +1,21 @@ -import { NextResponse } from 'next/server' -import { cookies } from 'next/headers' -import { createClient } from '@/lib/supabase/server' +import { cookies } from "next/headers"; +import { NextResponse } from "next/server"; + +import { createClient } from "@/lib/supabase/server"; export async function GET(request: Request) { // The `/auth/callback` route is required for the server-side auth flow implemented // by the Auth Helpers package. It exchanges an auth code for the user's session. // https://supabase.com/docs/guides/auth/auth-helpers/nextjs#managing-sign-in-with-code-exchange - const requestUrl = new URL(request.url) - const code = requestUrl.searchParams.get('code') + const requestUrl = new URL(request.url); + const code = requestUrl.searchParams.get("code"); if (code) { - const cookieStore = cookies() - const supabase = createClient(cookieStore) - await supabase.auth.exchangeCodeForSession(code) + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + await supabase.auth.exchangeCodeForSession(code); } // URL to redirect to after sign in process completes - return NextResponse.redirect(requestUrl.origin) + return NextResponse.redirect(requestUrl.origin); } diff --git a/app/api/auth/logout/route.ts b/app/api/auth/logout/route.ts index d7347dc..4624d7a 100644 --- a/app/api/auth/logout/route.ts +++ b/app/api/auth/logout/route.ts @@ -1,23 +1,24 @@ -import { createClient } from '@/lib/supabase/server' -import { cookies } from 'next/headers' -import { type NextRequest, NextResponse } from 'next/server' +import { cookies } from "next/headers"; +import { NextResponse, type NextRequest } from "next/server"; -export const dynamic = 'force-dynamic' +import { createClient } from "@/lib/supabase/server"; + +export const dynamic = "force-dynamic"; export async function POST(req: NextRequest) { - const cookieStore = cookies() - const supabase = createClient(cookieStore) + const cookieStore = cookies(); + const supabase = createClient(cookieStore); // Check if we have a session const { data: { session }, - } = await supabase.auth.getSession() + } = await supabase.auth.getSession(); if (session) { - await supabase.auth.signOut() + await supabase.auth.signOut(); } - return NextResponse.redirect(new URL('/signin', req.url), { + return NextResponse.redirect(new URL("/signin", req.url), { status: 302, - }) -} \ No newline at end of file + }); +} diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index abb25ae..8725c5a 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -1,33 +1,36 @@ -import OpenAI from 'openai' -import { OpenAIStream, StreamingTextResponse } from 'ai' -import { pick } from 'lodash'; -import { AxiomRequest, withAxiom } from 'next-axiom'; -import { getCurrentSession } from '@/lib/session'; -import { createNewMessage, deleteMessagesFrom, getMessageById } from '@/lib/db/message'; -import { createNewChat } from '@/lib/db/chats'; -import { getAppBySlug } from '@/lib/db/apps'; -import { createClient } from "@/lib/supabase/server"; import { cookies } from "next/headers"; +import { env } from "@/env.mjs"; +import { OpenAIStream, StreamingTextResponse } from "ai"; +import { pick } from "lodash"; +import { AxiomRequest, withAxiom } from "next-axiom"; +import OpenAI from "openai"; + +import { getAppBySlug } from "@/lib/db/apps"; +import { createNewChat } from "@/lib/db/chats"; import { - env -} from '@/env.mjs'; + createNewMessage, + deleteMessagesFrom, + getMessageById, +} from "@/lib/db/message"; +import { getCurrentSession } from "@/lib/session"; +import { createClient } from "@/lib/supabase/server"; export const dynamic = "force-dynamic"; -export const runtime = "edge" -export const preferredRegion = "home" +export const runtime = "edge"; +export const preferredRegion = "home"; const openai = new OpenAI({ - apiKey: env.OPENAI_API_KEY -}) + apiKey: env.OPENAI_API_KEY, +}); export const POST = withAxiom(async (req: AxiomRequest) => { const log = req.log.with({ - route: 'api/chat', + route: "api/chat", }); - - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const params = await req.json() + + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const params = await req.json(); const { messages, temperature, @@ -39,18 +42,18 @@ export const POST = withAxiom(async (req: AxiomRequest) => { chatId, isRegenerate, regenerateMessageId, - isNewChat + isNewChat, } = params; - const session = await getCurrentSession(supabase) - const currentApp = await getAppBySlug(supabase, '/apps/chat') + const session = await getCurrentSession(supabase); + const currentApp = await getAppBySlug(supabase, "/apps/chat"); if (!session) { - return new Response('Unauthorized', { status: 401 }) + return new Response("Unauthorized", { status: 401 }); } - const lastMessage = messages[messages.length - 1] - const profileId = session.user.id + const lastMessage = messages[messages.length - 1]; + const profileId = session.user.id; if (!isRegenerate) { if (isNewChat && currentApp) { @@ -59,19 +62,24 @@ export const POST = withAxiom(async (req: AxiomRequest) => { appId: currentApp.id, profileId, name: lastMessage.content, - }) + }); } await createNewMessage(supabase, { chatId, content: lastMessage.content, profileId, - role: 'user', - id: lastMessage.id - }) - }else if (regenerateMessageId) { - const fromMessage = await getMessageById(supabase, regenerateMessageId) + role: "user", + id: lastMessage.id, + }); + } else if (regenerateMessageId) { + const fromMessage = await getMessageById(supabase, regenerateMessageId); if (fromMessage?.createdAt) { - await deleteMessagesFrom(supabase, chatId, profileId, fromMessage.createdAt) + await deleteMessagesFrom( + supabase, + chatId, + profileId, + fromMessage.createdAt + ); } } @@ -79,25 +87,25 @@ export const POST = withAxiom(async (req: AxiomRequest) => { model, temperature, // eslint-disable-next-line @typescript-eslint/no-explicit-any - messages: messages.map((message: any) => pick(message, 'content', 'role')), + messages: messages.map((message: any) => pick(message, "content", "role")), max_tokens: maxTokens, top_p: topP, frequency_penalty: frequencyPenalty, presence_penalty: presencePenalty, - stream: true - }) - log.debug('Create stream'); - + stream: true, + }); + log.debug("Create stream"); + const stream = OpenAIStream(response, { onCompletion: async (completion: string) => { await createNewMessage(supabase, { chatId, content: completion, profileId, - role: 'assistant', - }) - } - }) - - return new StreamingTextResponse(stream) -}) + role: "assistant", + }); + }, + }); + + return new StreamingTextResponse(stream); +}); diff --git a/app/apps/chat/[id]/page.tsx b/app/apps/chat/[id]/page.tsx index 07d904a..6c1e17b 100644 --- a/app/apps/chat/[id]/page.tsx +++ b/app/apps/chat/[id]/page.tsx @@ -1,68 +1,75 @@ -import React from "react" -import { cookies } from "next/headers" -import { Metadata } from "next" -import { ChatPanel } from "@/components/modules/apps/chat/ChatPanel" -import { createClient } from "@/lib/supabase/server" -import { getChatById, getChats } from "@/lib/db/chats" -import { getAppBySlug } from "@/lib/db/apps" -import { getCurrentSession } from "@/lib/session" -import { Message } from "ai" -import { getMessages } from "@/lib/db/message" -import { ChatParams } from "@/components/modules/apps/chat/types" +import React from "react"; +import { Metadata } from "next"; +import { cookies } from "next/headers"; +import { Message } from "ai"; -export const runtime = "edge" -export const preferredRegion = "home" +import { getAppBySlug } from "@/lib/db/apps"; +import { getChatById, getChats } from "@/lib/db/chats"; +import { getMessages } from "@/lib/db/message"; +import { getCurrentSession } from "@/lib/session"; +import { createClient } from "@/lib/supabase/server"; +import { ChatPanel } from "@/components/modules/apps/chat/ChatPanel"; +import { ChatParams } from "@/components/modules/apps/chat/types"; + +export const runtime = "edge"; +export const preferredRegion = "home"; export const metadata: Metadata = { title: "Chat", - description: "Chat with your AI assistant to generate new ideas and get inspired.", -} + description: + "Chat with your AI assistant to generate new ideas and get inspired.", +}; export default async function ChatPage({ params }: { params: { id: string } }) { - const chatId = params.id + const chatId = params.id; - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const session = await getCurrentSession(supabase) - const currentApp = await getAppBySlug(supabase, '/apps/chat') + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const session = await getCurrentSession(supabase); + const currentApp = await getAppBySlug(supabase, "/apps/chat"); if (!currentApp || !session) { - return ( -
No app found
- ) + return
No app found
; } - const currentProfileId = session.user.id + const currentProfileId = session.user.id; const chats = await getChats(supabase, { appId: currentApp.id, profileId: currentProfileId, - }) + }); const dbMessages = await getMessages(supabase, { chatId, profileId: currentProfileId, - }) + }); - const chatDetails = await getChatById(supabase, chatId) - const chatParams = chatDetails?.settings as ChatParams | undefined + const chatDetails = await getChatById(supabase, chatId); + const chatParams = chatDetails?.settings as ChatParams | undefined; - const initialChatMessages: Message[] = dbMessages?.length ? dbMessages.map((message) => { - return { - id: message.id, - role: message.role || 'system', - content: message.content || '', - } - }) : [] + const initialChatMessages: Message[] = dbMessages?.length + ? dbMessages.map((message) => { + return { + id: message.id, + role: message.role || "system", + content: message.content || "", + }; + }) + : []; if (chatParams?.description) { initialChatMessages.unshift({ - id: 'description', - role: 'system', + id: "description", + role: "system", content: chatParams.description, - }) + }); } - + return ( - - ) + + ); } diff --git a/app/apps/chat/loading.tsx b/app/apps/chat/loading.tsx index 865ae82..637a5b6 100644 --- a/app/apps/chat/loading.tsx +++ b/app/apps/chat/loading.tsx @@ -1,20 +1,21 @@ +import { Loader } from "lucide-react"; + import { Separator } from "@/components/ui/Separator"; import { Skeleton } from "@/components/ui/Skeleton"; -import { Loader } from "lucide-react"; import { Heading2 } from "@/components/ui/typography"; export default function Page() { return ( -
-
-
+
+
+
- GPT AI Assistant + GPT AI Assistant
- -
+ +
- +
@@ -27,7 +28,7 @@ export default function Page() {
- +
@@ -49,7 +50,6 @@ export default function Page() {
-
- ) -} \ No newline at end of file + ); +} diff --git a/app/apps/chat/page.tsx b/app/apps/chat/page.tsx index ea3afab..736561b 100644 --- a/app/apps/chat/page.tsx +++ b/app/apps/chat/page.tsx @@ -1,38 +1,37 @@ -import React from "react" -import { Metadata } from "next" -import { ChatPanel } from "@/components/modules/apps/chat/ChatPanel" -import { createClient } from "@/lib/supabase/server" -import { cookies } from "next/headers" -import { getAppBySlug } from "@/lib/db/apps" -import { getCurrentSession } from "@/lib/session" -import { v4 as uuidv4 } from 'uuid'; -import { getChats } from "@/lib/db/chats" +import React from "react"; +import { Metadata } from "next"; +import { cookies } from "next/headers"; +import { v4 as uuidv4 } from "uuid"; + +import { getAppBySlug } from "@/lib/db/apps"; +import { getChats } from "@/lib/db/chats"; +import { getCurrentSession } from "@/lib/session"; +import { createClient } from "@/lib/supabase/server"; +import { ChatPanel } from "@/components/modules/apps/chat/ChatPanel"; export const metadata: Metadata = { title: "Create a New Chat", -} +}; export default async function NewChatPage() { - const chatId = uuidv4() + const chatId = uuidv4(); - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const session = await getCurrentSession(supabase) - const currentApp = await getAppBySlug(supabase, '/apps/chat') + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const session = await getCurrentSession(supabase); + const currentApp = await getAppBySlug(supabase, "/apps/chat"); if (!currentApp || !session) { - return ( -
No app found
- ) + return
No app found
; } - const currentProfileId = session.user.id + const currentProfileId = session.user.id; const chats = await getChats(supabase, { appId: currentApp.id, profileId: currentProfileId, - }) + }); return ( - - ) + + ); } diff --git a/app/apps/layout.tsx b/app/apps/layout.tsx index 5480044..becddcb 100644 --- a/app/apps/layout.tsx +++ b/app/apps/layout.tsx @@ -1,33 +1,32 @@ -import { ChatHistory } from "@/components/modules/apps/chat/ChatHistory" -import { getAppBySlug } from "@/lib/db/apps" -import { getChats } from "@/lib/db/chats" -import { getCurrentSession } from "@/lib/session" -import { createClient } from "@/lib/supabase/server" -import { cookies } from "next/headers" -import { MainLayout } from '@/components/ui/common/MainLayout' +import { cookies } from "next/headers"; + +import { getAppBySlug } from "@/lib/db/apps"; +import { getChats } from "@/lib/db/chats"; +import { getCurrentSession } from "@/lib/session"; +import { createClient } from "@/lib/supabase/server"; +import { MainLayout } from "@/components/ui/common/MainLayout"; +import { ChatHistory } from "@/components/modules/apps/chat/ChatHistory"; interface AppLayoutProps { - children: React.ReactNode + children: React.ReactNode; } export default async function AppLayout({ children }: AppLayoutProps) { - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const session = await getCurrentSession(supabase) - const currentApp = await getAppBySlug(supabase, '/apps/chat') - + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const session = await getCurrentSession(supabase); + const currentApp = await getAppBySlug(supabase, "/apps/chat"); + if (!currentApp || !session) { - return ( -
No app found
- ) + return
No app found
; } - const currentProfileId = session.user.id - + const currentProfileId = session.user.id; + const chats = await getChats(supabase, { appId: currentApp.id, profileId: currentProfileId, - }) + }); return ( @@ -44,5 +43,5 @@ export default async function AppLayout({ children }: AppLayoutProps) {
- ) + ); } diff --git a/app/apps/page.tsx b/app/apps/page.tsx index c3ccb58..6a0d6ea 100644 --- a/app/apps/page.tsx +++ b/app/apps/page.tsx @@ -1,9 +1,7 @@ -import { Heading1 } from "@/components/ui/typography" +import { Heading1 } from "@/components/ui/typography"; -export const runtime = "edge" +export const runtime = "edge"; export default function Apps() { - return ( - Apps - ) + return Apps; } diff --git a/app/docs/page.tsx b/app/docs/page.tsx index a35f459..05967a6 100644 --- a/app/docs/page.tsx +++ b/app/docs/page.tsx @@ -1,7 +1,3 @@ export default async function Docs() { - return ( -
- docs -
- ) + return
docs
; } diff --git a/app/layout.tsx b/app/layout.tsx index f8720dc..6665151 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,11 +1,13 @@ -import { AxiomWebVitals } from 'next-axiom'; -import "./globals.css" -import { Metadata, Viewport } from "next" -import { GeistMono, GeistSans } from 'geist/font' -import { Analytics } from '@vercel/analytics/react'; -import { siteConfig } from "@/config/site" -import { ThemeProvider } from "@/components/theme/ThemeProvider" +import { AxiomWebVitals } from "next-axiom"; + +import "./globals.css"; +import { Metadata, Viewport } from "next"; +import { Analytics } from "@vercel/analytics/react"; +import { GeistMono, GeistSans } from "geist/font"; + +import { siteConfig } from "@/config/site"; import { Toaster } from "@/components/ui/Toaster"; +import { ThemeProvider } from "@/components/theme/ThemeProvider"; export const metadata: Metadata = { title: { @@ -18,24 +20,31 @@ export const metadata: Metadata = { shortcut: "/favicon-16x16.png", apple: "/apple-touch-icon.png", }, -} +}; export const viewport: Viewport = { themeColor: [ { media: "(prefers-color-scheme: light)", color: "white" }, { media: "(prefers-color-scheme: dark)", color: "black" }, ], -} +}; interface RootLayoutProps { - children: React.ReactNode + children: React.ReactNode; } export default function RootLayout({ children }: RootLayoutProps) { return ( <> - - + + @@ -47,5 +56,5 @@ export default function RootLayout({ children }: RootLayoutProps) { - ) + ); } diff --git a/app/page.tsx b/app/page.tsx index 3542cbe..01e9b17 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,20 +1,21 @@ +import { Metadata } from "next"; +import Link from "next/link"; +import { Play } from "lucide-react"; + +import { siteConfig } from "@/config/site"; +import { cn } from "@/lib/utils"; +import { buttonVariants } from "@/components/ui/Button"; +import { MainLayout } from "@/components/ui/common/MainLayout"; import { DescriptionHeadingText } from "@/components/modules/home/DescriptionHeadingText"; import { FeatureItems } from "@/components/modules/home/FeatureItems"; import { HeroBannerImage } from "@/components/modules/home/HeroBannerImage"; -import { buttonVariants } from "@/components/ui/Button"; -import { MainLayout } from "@/components/ui/common/MainLayout"; -import { siteConfig } from "@/config/site"; -import { cn } from "@/lib/utils"; -import { Play } from "lucide-react"; -import { Metadata } from "next"; -import Link from "next/link"; export const metadata: Metadata = { title: siteConfig.name, description: siteConfig.description, -} +}; -export const runtime = "edge" +export const runtime = "edge"; export default async function Home() { return ( @@ -25,26 +26,28 @@ export default async function Home() {

{siteConfig.name}

- +
- Demo + Demo - Get Started + Get Started
- - + + - ) + ); } diff --git a/app/profile/layout.tsx b/app/profile/layout.tsx index ecec0a7..03066d3 100644 --- a/app/profile/layout.tsx +++ b/app/profile/layout.tsx @@ -1,15 +1,13 @@ -import { MainLayout } from "@/components/ui/common/MainLayout" +import { MainLayout } from "@/components/ui/common/MainLayout"; interface AppLayoutProps { - children: React.ReactNode + children: React.ReactNode; } export default function AppLayout({ children }: AppLayoutProps) { return ( -
- {children} -
+
{children}
- ) + ); } diff --git a/app/profile/page.tsx b/app/profile/page.tsx index c182c2c..7302fa1 100644 --- a/app/profile/page.tsx +++ b/app/profile/page.tsx @@ -1,36 +1,43 @@ -import { Header } from "@/components/modules/profile/Header"; -import { ProfileForm } from "@/components/modules/profile/ProfileForm"; -import { ProfileFormValues } from "@/components/modules/profile/type"; +import { cookies } from "next/headers"; + import { getCurrentProfile } from "@/lib/db/profile"; import { getCurrentSession } from "@/lib/session"; import { createClient } from "@/lib/supabase/server"; -import { cookies } from "next/headers"; +import { Header } from "@/components/modules/profile/Header"; +import { ProfileForm } from "@/components/modules/profile/ProfileForm"; +import { ProfileFormValues } from "@/components/modules/profile/type"; -export const dynamic = 'force-dynamic' +export const dynamic = "force-dynamic"; -export const runtime = "edge" +export const runtime = "edge"; export default async function Profile() { - const cookieStore = cookies() - const supabase = createClient(cookieStore) - const profile = await getCurrentProfile(supabase) - const session = await getCurrentSession(supabase) + const cookieStore = cookies(); + const supabase = createClient(cookieStore); + const profile = await getCurrentProfile(supabase); + const session = await getCurrentSession(supabase); if (!profile) { - return null + return null; } - const { avatar_url, full_name, username, website } = profile - const profileFormValues: ProfileFormValues = { + const { avatar_url, full_name, username, website } = profile; + const profileFormValues: ProfileFormValues = { fullName: full_name || undefined, username: username || undefined, - website: website || undefined - } + website: website || undefined, + }; return (
-
- +
+
- ) + ); } diff --git a/components/modules/apps/app-side-bar/AppSideBar.tsx b/components/modules/apps/app-side-bar/AppSideBar.tsx index 00c4f3c..285ba01 100644 --- a/components/modules/apps/app-side-bar/AppSideBar.tsx +++ b/components/modules/apps/app-side-bar/AppSideBar.tsx @@ -1,16 +1,21 @@ -import React from 'react' -import { cookies } from 'next/headers'; -import { createClient } from '@/lib/supabase/server'; -import { getApps } from '@/lib/db/apps'; -import { AppSideBarList } from './AppSideBarList'; +import React from "react"; +import { cookies } from "next/headers"; + +import { getApps } from "@/lib/db/apps"; +import { createClient } from "@/lib/supabase/server"; + +import { AppSideBarList } from "./AppSideBarList"; export const AppSideBar = async () => { - const cookieStore = cookies() - const supabase = await createClient(cookieStore) - const apps = await getApps(supabase) + const cookieStore = cookies(); + const supabase = await createClient(cookieStore); + const apps = await getApps(supabase); return ( -