diff --git a/frontend/app/components/Kai/KaiChat.tsx b/frontend/app/components/Kai/KaiChat.tsx index dfc504ef7..e38de472c 100644 --- a/frontend/app/components/Kai/KaiChat.tsx +++ b/frontend/app/components/Kai/KaiChat.tsx @@ -19,6 +19,7 @@ function KaiChat() { const setTitle = kaiStore.setTitle; const userId = userStore.account.id; const userName = userStore.account.name; + const limited = kaiStore.usage.percent >= 100; const { activeSiteId } = projectsStore; const [section, setSection] = React.useState<'intro' | 'chat'>('intro'); const [threadId, setThreadId] = React.useState(null); @@ -148,6 +149,7 @@ function KaiChat() { onAsk={onCreate} projectId={activeSiteId} userName={userName} + limited={limited} />
void; projectId: string; threadId?: string | null; inChat?: boolean; + limited?: boolean; }) { const { t } = useTranslation(); const { data: suggestedPromptIdeas = [], isPending } = useQuery({ @@ -46,7 +48,12 @@ function Ideas({ ) : (
{ideas.map((title) => ( - + ))}
)} @@ -57,16 +64,19 @@ function Ideas({ function IdeaItem({ title, onClick, + limited, }: { title: string; onClick: (query: string) => void; + limited?: boolean; }) { return (
onClick(title)} - className={ - 'cursor-pointer text-gray-dark hover:text-black rounded-full px-4 py-2 shadow border' - } + onClick={() => (limited ? null : onClick(title))} + className={cn( + 'cursor-pointer text-gray-dark hover:text-black rounded-full px-4 py-2 shadow border', + limited ? 'bg-gray-lightest cursor-not-allowed' : 'bg-white', + )} > {title}
diff --git a/frontend/app/components/Kai/components/IntroSection.tsx b/frontend/app/components/Kai/components/IntroSection.tsx index dd28f667a..4afc7ed75 100644 --- a/frontend/app/components/Kai/components/IntroSection.tsx +++ b/frontend/app/components/Kai/components/IntroSection.tsx @@ -7,11 +7,13 @@ function IntroSection({ onCancel, userName, projectId, + limited, }: { onAsk: (query: string) => void; projectId: string; onCancel: () => void; userName: string; + limited?: boolean; }) { const isLoading = false; return ( @@ -27,7 +29,7 @@ function IntroSection({ isArea />
- onAsk(query)} projectId={projectId} /> + onAsk(query)} projectId={projectId} />