mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Show OnboardingDialog in ProjectView
This commit is contained in:
2 files changed
+38
-38
No files matched your search
@@ -7,6 +7,7 @@ import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { CircularProgress } from '@/components/ui/circular-progress';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { FileAttachment } from '@/components/ui/file-attachment';
|
||||
import { OnboardingDialog } from '@/components/OnboardingDialog';
|
||||
import { Square, Loader2, ChevronDown, ArrowUp } from 'lucide-react';
|
||||
import { useAISettings } from '@/hooks/useAISettings';
|
||||
import { useFS } from '@/hooks/useFS';
|
||||
@@ -70,6 +71,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
const [attachedFiles, setAttachedFiles] = useState<File[]>([]);
|
||||
const [isDragOver, setIsDragOver] = useState(false);
|
||||
const [scrolledProjects] = useState(() => new Set<string>());
|
||||
const [showOnboarding, setShowOnboarding] = useState(false);
|
||||
|
||||
// Use external state if provided, otherwise default to false
|
||||
const isBuildLoading = externalIsBuildLoading || false;
|
||||
@@ -344,7 +346,16 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
};
|
||||
|
||||
const handleSend = async () => {
|
||||
if ((!input.trim() && attachedFiles.length === 0) || isLoading || !providerModel.trim()) return;
|
||||
if ((!input.trim() && attachedFiles.length === 0) || isLoading) return;
|
||||
|
||||
// If AI is not configured, show onboarding dialog
|
||||
if (!isConfigured) {
|
||||
setShowOnboarding(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// If configured but no model selected, don't proceed
|
||||
if (!providerModel.trim()) return;
|
||||
|
||||
const modelToUse = providerModel.trim();
|
||||
|
||||
@@ -434,6 +445,16 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
}
|
||||
};
|
||||
|
||||
// Handle textarea focus - show onboarding if not configured
|
||||
const handleTextareaFocus = () => {
|
||||
if (!isConfigured) {
|
||||
setShowOnboarding(true);
|
||||
}
|
||||
if (onFirstInteraction) {
|
||||
onFirstInteraction();
|
||||
}
|
||||
};
|
||||
|
||||
// Handle first user interaction to enable audio context
|
||||
const handleFirstInteraction = () => {
|
||||
// This will be handled automatically by the useKeepAlive hook
|
||||
@@ -450,27 +471,6 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
}
|
||||
}), [internalStartNewSession]);
|
||||
|
||||
if (!isConfigured) {
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
<div className="flex-1 flex items-center justify-center bg-gradient-to-br from-primary/5 to-accent/5">
|
||||
<div className="text-center space-y-4 max-w-md mx-auto p-6">
|
||||
<div className="text-4xl mb-4">🤖</div>
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold mb-2 bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">{t('aiNotConfigured')}</h3>
|
||||
<p className="text-sm text-muted-foreground mb-4">
|
||||
{t('configureAI')}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('useMenuForAI')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
@@ -585,10 +585,16 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
onKeyDown={handleKeyDown}
|
||||
onPaste={handlePaste}
|
||||
onFocus={handleFirstInteraction}
|
||||
placeholder={providerModel.trim() ? t('askToAddFeatures') : t('selectModelFirst')}
|
||||
onFocus={handleTextareaFocus}
|
||||
placeholder={
|
||||
!isConfigured
|
||||
? t('askToAddFeatures')
|
||||
: providerModel.trim()
|
||||
? t('askToAddFeatures')
|
||||
: t('selectModelFirst')
|
||||
}
|
||||
className="flex-1 resize-none border-0 bg-transparent px-4 py-3 text-sm focus-visible:ring-0 focus-visible:ring-offset-0 placeholder:text-muted-foreground"
|
||||
disabled={isLoading || !providerModel.trim()}
|
||||
disabled={isLoading || (isConfigured && !providerModel.trim())}
|
||||
rows={1}
|
||||
aria-label="Chat message input"
|
||||
style={{
|
||||
@@ -679,7 +685,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
<Button
|
||||
onClick={handleSend}
|
||||
onMouseDown={handleFirstInteraction}
|
||||
disabled={(!input.trim() && attachedFiles.length === 0) || !providerModel.trim()}
|
||||
disabled={(!input.trim() && attachedFiles.length === 0) || (isConfigured && !providerModel.trim())}
|
||||
size="sm"
|
||||
className="size-8 [&_svg]:size-5 rounded-full p-0"
|
||||
>
|
||||
@@ -690,6 +696,12 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Onboarding Dialog */}
|
||||
<OnboardingDialog
|
||||
open={showOnboarding}
|
||||
onOpenChange={setShowOnboarding}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -98,8 +98,6 @@ const resources = {
|
||||
getHelp: '🔧 Get help with debugging and optimization',
|
||||
buildDeploy: '🚀 Build and deploy your project',
|
||||
aiNotConfigured: 'AI Assistant Not Configured',
|
||||
configureAI: 'Please configure your AI settings to start building with AI assistance.',
|
||||
useMenuForAI: 'Use the menu in the top bar to access AI Settings.',
|
||||
askToAddFeatures: 'Ask me to add features, edit files, or build your project...',
|
||||
selectModelFirst: 'Please select a model to start chatting...',
|
||||
sendMessage: 'Send message',
|
||||
@@ -394,8 +392,6 @@ const resources = {
|
||||
getHelp: '🔧 Obtenha ajuda com depuração e otimização',
|
||||
buildDeploy: '🚀 Construa e implante seu projeto',
|
||||
aiNotConfigured: 'Assistente de IA Não Configurado',
|
||||
configureAI: 'Configure suas configurações de IA para começar a construir com assistência de IA.',
|
||||
useMenuForAI: 'Use o menu na barra superior para acessar as Configurações de IA.',
|
||||
askToAddFeatures: 'Peça para adicionar recursos, editar arquivos ou construir seu projeto...',
|
||||
selectModelFirst: 'Selecione um modelo para começar a conversar...',
|
||||
sendMessage: 'Enviar mensagem',
|
||||
@@ -690,8 +686,6 @@ const resources = {
|
||||
getHelp: '🔧 获得调试和优化帮助',
|
||||
buildDeploy: '🚀 构建和部署您的项目',
|
||||
aiNotConfigured: 'AI助手未配置',
|
||||
configureAI: '请配置您的AI设置以开始使用AI助手构建。',
|
||||
useMenuForAI: '使用顶部栏中的菜单访问AI设置。',
|
||||
askToAddFeatures: '请我添加功能、编辑文件或构建您的项目...',
|
||||
selectModelFirst: '请先选择一个模型开始聊天...',
|
||||
sendMessage: '发送消息',
|
||||
@@ -986,8 +980,6 @@ const resources = {
|
||||
getHelp: '🔧 Sami taimako da gyara kuskure da haɓakawa',
|
||||
buildDeploy: '🚀 Gina da tura aikinku',
|
||||
aiNotConfigured: 'Mataimakin AI Ba a Saita ba',
|
||||
configureAI: 'Da fatan za a saita saitunan AI don farawa ginawa da taimakon AI.',
|
||||
useMenuForAI: 'Yi amfani da menu a saman mashigi don shiga Saitunan AI.',
|
||||
askToAddFeatures: 'Roƙe ni in ƙara fasaloli, gyara fayiloli, ko gina aikinku...',
|
||||
selectModelFirst: 'Da fatan za a zaɓi samfuri don farawa hira...',
|
||||
sendMessage: 'Aika saƙo',
|
||||
@@ -1282,8 +1274,6 @@ const resources = {
|
||||
getHelp: '🔧 Gba iranlọwọ pẹlu atunṣe ati imudara',
|
||||
buildDeploy: '🚀 Kọ ati gbe iṣẹ akanṣe rẹ lọ',
|
||||
aiNotConfigured: 'Oluranlọwọ AI Ko Tunto',
|
||||
configureAI: 'Jọwọ tunto awọn eto AI rẹ lati bẹrẹ kikọ pẹlu iranlọwọ AI.',
|
||||
useMenuForAI: 'Lo akojọ aṣayan ni oke ọpa lati wọle si Awọn eto AI.',
|
||||
askToAddFeatures: 'Beere mi lati fi awọn ẹya kun, ṣatunkọ awọn faili, tabi kọ iṣẹ akanṣe rẹ...',
|
||||
selectModelFirst: 'Jọwọ yan awoṣe lati bẹrẹ ibaraẹnisọrọ...',
|
||||
sendMessage: 'Fi ifiranṣẹ ranṣẹ',
|
||||
@@ -1578,8 +1568,6 @@ const resources = {
|
||||
getHelp: '🔧 Nweta enyemaka na debugging na optimization',
|
||||
buildDeploy: '🚀 Wuo ma bufee ọrụ gị',
|
||||
aiNotConfigured: 'Onye Enyemaka AI Ahazighị',
|
||||
configureAI: 'Biko hazie ntọala AI gị iji malite iwu na enyemaka AI.',
|
||||
useMenuForAI: 'Jiri menu dị n\'elu okporo iji nweta Ntọala AI.',
|
||||
askToAddFeatures: 'Rịọ m ka m tinye atụmatụ, dezie faịlụ, ma ọ bụ wuo ọrụ gị...',
|
||||
selectModelFirst: 'Biko họrọ ụdịdị iji malite ikwu okwu...',
|
||||
sendMessage: 'Ziga ozi',
|
||||
|
||||
Reference in new issue
Block a user