feat: try app page

This commit is contained in:
Joel 2025-09-18 14:54:15 +08:00
parent d4bd19f6d8
commit e54efda36f
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import React from 'react'
import Main from '@/app/components/try/app/index'
export type IInstalledAppProps = {
params: {
appId: string
}
}
async function InstalledApp({ params }: IInstalledAppProps) {
const appId = (await params).appId
return (
<Main appId={appId} />
)
}
export default InstalledApp

View File

@ -0,0 +1,40 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper'
import { useThemeContext } from '../../base/chat/embedded-chatbot/theme/theme-context'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import {
EmbeddedChatbotContext,
} from '@/app/components/base/chat/embedded-chatbot/context'
import {
useEmbeddedChatbot,
} from '@/app/components/base/chat/embedded-chatbot/hooks'
import cn from '@/utils/classnames'
type Props = {
appId: string
className: string
}
const TryApp: FC<Props> = ({
appId,
className,
}) => {
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
const themeBuilder = useThemeContext()
const chatData = useEmbeddedChatbot()
return (
<EmbeddedChatbotContext.Provider value={{
...chatData,
isMobile,
themeBuilder,
}}>
<div className={cn('bg-background-section-burn', className)}>
<ChatWrapper />
</div>
</EmbeddedChatbotContext.Provider>
)
}
export default React.memo(TryApp)

View File

@ -0,0 +1,29 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import Chat from './chat'
type Props = {
appId: string
}
const TryApp: FC<Props> = ({
appId,
}) => {
const isChat = true
const isCompletion = !isChat
return (
<div className='flex h-full'>
{isChat && (
<Chat appId={appId} className='h-full grow' />
)}
{isCompletion && (
<div>Completion</div>
)}
<div className='w-[360px]'>
Right panel
</div>
</div>
)
}
export default React.memo(TryApp)