|
|
|
|
|
|
|
|
import { memo } from 'react' |
|
|
import { memo } from 'react' |
|
|
import type { ChatItem } from '../../types' |
|
|
import type { ChatItem } from '../../types' |
|
|
import { useChatContext } from '../context' |
|
|
import { useChatContext } from '../context' |
|
|
import Button from '@/app/components/base/button' |
|
|
|
|
|
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' |
|
|
|
|
|
|
|
|
|
|
|
type SuggestedQuestionsProps = { |
|
|
type SuggestedQuestionsProps = { |
|
|
item: ChatItem |
|
|
item: ChatItem |
|
|
|
|
|
|
|
|
item, |
|
|
item, |
|
|
}) => { |
|
|
}) => { |
|
|
const { onSend } = useChatContext() |
|
|
const { onSend } = useChatContext() |
|
|
const media = useBreakpoints() |
|
|
|
|
|
const isMobile = media === MediaType.mobile |
|
|
|
|
|
const klassName = `mr-1 mt-1 ${isMobile ? 'block overflow-hidden text-ellipsis' : ''} max-w-full shrink-0 last:mr-0` |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
const { |
|
|
isOpeningStatement, |
|
|
isOpeningStatement, |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div className='flex flex-wrap'> |
|
|
<div className='flex flex-wrap'> |
|
|
{suggestedQuestions.filter(q => !!q && q.trim()).map((question, index) => ( |
|
|
{suggestedQuestions.filter(q => !!q && q.trim()).map((question, index) => ( |
|
|
<Button |
|
|
|
|
|
|
|
|
<div |
|
|
key={index} |
|
|
key={index} |
|
|
variant='secondary-accent' |
|
|
|
|
|
className={klassName} |
|
|
|
|
|
|
|
|
className='system-sm-medium mr-1 mt-1 inline-flex max-w-full shrink-0 cursor-pointer flex-wrap rounded-lg border-[0.5px] border-components-button-secondary-border bg-components-button-secondary-bg px-3.5 py-2 text-components-button-secondary-accent-text shadow-xs last:mr-0 hover:border-components-button-secondary-border-hover hover:bg-components-button-secondary-bg-hover' |
|
|
onClick={() => onSend?.(question)} |
|
|
onClick={() => onSend?.(question)} |
|
|
> |
|
|
> |
|
|
{question} |
|
|
{question} |
|
|
</Button>), |
|
|
|
|
|
|
|
|
</div>), |
|
|
)} |
|
|
)} |
|
|
</div> |
|
|
</div> |
|
|
) |
|
|
) |