From 4811e173e6ca24a0d781b16502f41f034c602a35 Mon Sep 17 00:00:00 2001 From: Gabo Esquivel Date: Sat, 6 Apr 2024 02:37:34 -0600 Subject: [PATCH] feat: thread landing (#80) * devops: debug lhci results comment * feat: thread landing * devops: debug lhci results comment --- .github/workflows/lighthouse.yml | 3 --- .test-lighthouse | 0 .../app/(browse)/[category]/[threadId]/page.tsx | 16 ++++------------ .../masterbots.ai/app/b/[id]/[threadId]/page.tsx | 12 ------------ .../app/c/[chatbot]/[threadId]/page.tsx | 3 +-- apps/masterbots.ai/components/c/chat.tsx | 3 +-- .../services/hasura/hasura.service.ts | 3 +-- .../services/hasura/hasura.service.type.ts | 2 +- 8 files changed, 8 insertions(+), 34 deletions(-) create mode 100644 .test-lighthouse delete mode 100644 apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 38956aae..5da85ca7 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -35,9 +35,6 @@ jobs: with: urls: | "https://${{ steps.vercel_preview_url.outputs.preview_url }}" - # "https://${{ steps.vercel_preview_url.outputs.preview_url }}/b/moneybot" - # "https://${{ steps.vercel_preview_url.outputs.preview_url }}/u/slug-1" - # "https://${{ steps.vercel_preview_url.outputs.preview_url }}/p" # budgetPath: '.github/lighthouse/budget.json' uploadArtifacts: true temporaryPublicStorage: true diff --git a/.test-lighthouse b/.test-lighthouse new file mode 100644 index 00000000..e69de29b diff --git a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx index 883af356..1b37d954 100644 --- a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx +++ b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx @@ -1,18 +1,10 @@ import { getThread } from '@/services/hasura' +import { BrowseThread } from '@/components/home/browse-thread' +import { ChatPageProps } from '@/app/c/[chatbot]/[threadId]/page' -export default async function ChatPage({ params }: ChatPageProps) { +export default async function ThreadLandingPage({ params }: ChatPageProps) { const thread = await getThread({ threadId: params.threadId }) - - //TODO: handle threadId not found - - return
{}
-} - -export interface ChatPageProps { - params: { - threadId: string - chatbot: string - } + return } diff --git a/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx b/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx deleted file mode 100644 index aa0bb6b9..00000000 --- a/apps/masterbots.ai/app/b/[id]/[threadId]/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { getThread } from '@/services/hasura' -import { BrowseThread } from '@/components/home/browse-thread' -import { ChatPageProps } from '@/app/c/[chatbot]/[threadId]/page' -import PageProps from 'next/types' - -export default async function ChatPage({ params }: ChatPageProps) { - const thread = await getThread({ - threadId: params.threadId, - jwt: '' - }) - return -} diff --git a/apps/masterbots.ai/app/c/[chatbot]/[threadId]/page.tsx b/apps/masterbots.ai/app/c/[chatbot]/[threadId]/page.tsx index fb985402..71a9ce6e 100644 --- a/apps/masterbots.ai/app/c/[chatbot]/[threadId]/page.tsx +++ b/apps/masterbots.ai/app/c/[chatbot]/[threadId]/page.tsx @@ -16,8 +16,7 @@ export default async function ChatPage({ params }: ChatPageProps) { if (!jwt || isTokenExpired(jwt) || !user) redirect(`/sign-in?next=/${params.threadId}/${params.threadId}`) const thread = await getThread({ - threadId: params.threadId, - jwt + threadId: params.threadId }) //TODO: handle threadId not found diff --git a/apps/masterbots.ai/components/c/chat.tsx b/apps/masterbots.ai/components/c/chat.tsx index 979c5735..a852774a 100644 --- a/apps/masterbots.ai/components/c/chat.tsx +++ b/apps/masterbots.ai/components/c/chat.tsx @@ -154,8 +154,7 @@ export function Chat({ isPublic: activeChatbot?.name !== 'BlankBot' }) const thread = await getThread({ - threadId, - jwt: hasuraJwt + threadId }) setActiveThread(thread) setIsOpenPopup(true) diff --git a/apps/masterbots.ai/services/hasura/hasura.service.ts b/apps/masterbots.ai/services/hasura/hasura.service.ts index c4662ffa..e79e4402 100644 --- a/apps/masterbots.ai/services/hasura/hasura.service.ts +++ b/apps/masterbots.ai/services/hasura/hasura.service.ts @@ -171,9 +171,8 @@ export async function getThreads({ return thread as Thread[] } -export async function getThread({ threadId, jwt }: GetThreadParams) { +export async function getThread({ threadId }: GetThreadParams) { let client = getHasuraClient({}) - if (jwt) client = getHasuraClient({ jwt }) const { thread } = await client.query({ thread: { chatbot: { diff --git a/apps/masterbots.ai/services/hasura/hasura.service.type.ts b/apps/masterbots.ai/services/hasura/hasura.service.type.ts index bd8e663e..c6333fe5 100644 --- a/apps/masterbots.ai/services/hasura/hasura.service.type.ts +++ b/apps/masterbots.ai/services/hasura/hasura.service.type.ts @@ -18,7 +18,7 @@ export interface GetThreadsParams extends HasuraServiceParams { offset?: number } -export interface GetThreadParams extends HasuraServiceParams { +export interface GetThreadParams { threadId: string }