Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

feat: add chat content and loading skeleton components for AI chat feature

Salman-Ahamed5c442bf542df
diff --git a/packages/app/src/react/features/ai-chat/components/auth/index.ts b/packages/app/src/react/features/ai-chat/components/auth/index.ts
index 3dcc3212..184c4795 100644
--- a/packages/app/src/react/features/ai-chat/components/auth/index.ts
+++ b/packages/app/src/react/features/ai-chat/components/auth/index.ts
@@ -1,3 +1,3 @@
+export * from './api-key-overlay';
export * from './auth-overlay';
export * from './oauth-overlay';
-export * from './api-key-overlay';
diff --git a/packages/app/src/react/features/ai-chat/components/chat-content.tsx b/packages/app/src/react/features/ai-chat/components/chat-content.tsx
new file mode 100644
index 00000000..10349fbf
--- /dev/null
+++ b/packages/app/src/react/features/ai-chat/components/chat-content.tsx
@@ -0,0 +1,102 @@
+import {
+ ArrowLeftIcon,
+ AuthOverlay,
+ Chats,
+ Footer,
+ Header,
+ LoadingSkeleton,
+} from '@react/features/ai-chat/components';
+import { DEFAULT_AVATAR_URL } from '@react/features/ai-chat/constants';
+import { useChatStores } from '@react/features/ai-chat/hooks';
+import { useNavigate } from 'react-router-dom';
+
+/**
+ * Handles conditional rendering based on page state
+ * Renders appropriate UI for loading, auth, disabled, or ready states
+ */
+export const ChatContent = () => {
+ const { pageState, agent } = useChatStores();
+ const navigate = useNavigate();
+
+ // Loading state
+ if (pageState === 'loading') return <LoadingSkeleton />;
+
+ // Auth required
+ if (pageState === 'auth-required') return <AuthOverlay />;
+
+ // Chatbot disabled
+ if (pageState === 'disabled') {
+ const agentName = agent?.data?.name || 'Agent';
+ const agentAvatar = agent?.settings?.avatar || DEFAULT_AVATAR_URL;
+
+ return (
+ <div className="w-full h-full flex flex-col">
+ {/* Minimal header with back button */}
+ <div className="w-full max-w-4xl mx-auto flex items-center py-4 px-4">
+ <button
+ onClick={() => navigate(-1)}
+ className="group flex items-center gap-2 px-3 py-2 rounded-lg text-slate-500 hover:text-slate-900 hover:bg-slate-100 transition-all duration-200"
+ aria-label="Go back"
+ >
+ <ArrowLeftIcon className="size-4 group-hover:-translate-x-0.5 transition-transform" />
+ <span className="text-sm font-medium">Back</span>
+ </button>
+ </div>
+
+ {/* Disabled message - centered card */}
+ <div className="flex-1 flex items-center justify-center p-4">
+ <div className="text-center max-w-md">
+ {/* Agent Avatar */}
+ <div className="mx-auto w-20 h-20 rounded-2xl overflow-hidden mb-6 shadow-lg ring-4 ring-slate-100">
+ <img src={agentAvatar} alt={agentName} className="w-full h-full object-cover" />
+ </div>
+
+ {/* Agent name */}
+ <h2 className="text-xl font-semibold text-slate-800 mb-2">{agentName}</h2>
+
+ {/* Status badge */}
+ <span className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-amber-50 text-amber-700 text-xs font-medium mb-4">
+ <span className="w-1.5 h-1.5 rounded-full bg-amber-500" />
+ Chat Disabled
+ </span>
+
+ {/* Description */}
+ <p className="text-slate-500 text-sm leading-relaxed mb-6">
+ The chat feature is currently disabled for this agent.
+ </p>
+
+ {/* Action hint */}
+ <div className="inline-flex items-center gap-2 px-4 py-3 rounded-xl bg-slate-50 border border-slate-100">
+ <svg
+ className="w-4 h-4 text-slate-400"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ >
+ <path
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
+ />
+ </svg>
+ <p className="text-slate-600 text-xs">
+ Enable in{' '}
+ <span className="font-medium">Agent Settings → Deployments → Chatbot</span>
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+ }
+
+ // Ready - show full chat UI
+ return (
+ <>
+ <Header />
+ <Chats />
+ <Footer />
+ </>
+ );
+};
diff --git a/packages/app/src/react/features/ai-chat/components/common/icons.tsx b/packages/app/src/react/features/ai-chat/components/common/icons.tsx
index 6ea61c9e..c497645e 100644
--- a/packages/app/src/react/features/ai-chat/components/common/icons.tsx
+++ b/packages/app/src/react/features/ai-chat/components/common/icons.tsx
@@ -1,5 +1,18 @@
import { cn } from '@react/shared/utils/general';
+export const ArrowLeftIcon = ({ className }: { className?: string }) => (
+ <svg
+ className={cn('size-5', className)}
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ aria-hidden="true"
+ >
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M15 19l-7-7 7-7" />
+ </svg>
+);
+
export const CloseIcon = ({ className }: { className?: string }) => (
<svg className={cn('size-6', className)} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
diff --git a/packages/app/src/react/features/ai-chat/components/header/index.ts b/packages/app/src/react/features/ai-chat/components/header/index.ts
index d7ff0b56..520bf981 100644
--- a/packages/app/src/react/features/ai-chat/components/header/index.ts
+++ b/packages/app/src/react/features/ai-chat/components/header/index.ts
@@ -3,4 +3,3 @@ export * from './agent-name';
export * from './header-actions';
export * from './main';
export * from './model-dropdown';
-export * from './skeleton';
diff --git a/packages/app/src/react/features/ai-chat/components/index.ts b/packages/app/src/react/features/ai-chat/components/index.ts
index 8deab5ba..04ff40a0 100644
--- a/packages/app/src/react/features/ai-chat/components/index.ts
+++ b/packages/app/src/react/features/ai-chat/components/index.ts
@@ -1,6 +1,9 @@
+export * from './skeleton';
export * from './auth';
export * from './chat';
+export * from './chat-content';
export * from './common';
export * from './container';
export * from './footer';
export * from './header';
+export * from './loading-skeleton';
diff --git a/packages/app/src/react/features/ai-chat/components/loading-skeleton.tsx b/packages/app/src/react/features/ai-chat/components/loading-skeleton.tsx
new file mode 100644
index 00000000..0eade376
--- /dev/null
+++ b/packages/app/src/react/features/ai-chat/components/loading-skeleton.tsx
@@ -0,0 +1,33 @@
+import { Skeleton } from '@react/features/ai-chat/components';
+
+/**
+ * Loading skeleton that mimics the chat UI layout
+ * Displayed while chat data is being fetched
+ */
+export const LoadingSkeleton = () => (
+ <>
+ {/* Header skeleton */}
+ <div className="w-full max-w-4xl flex justify-between items-center pt-2">
+ <div className="w-full flex items-center gap-2.5">
+ <Skeleton className="size-10 rounded-full" />
+ <div className="flex flex-col gap-0.5">
+ <Skeleton className="w-32 h-4 rounded" />
+ <Skeleton className="w-20 h-3 rounded" />
+ </div>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <Skeleton className="size-7 rounded-xl" />
+ <Skeleton className="size-7 rounded-xl" />
+ </div>
+ </div>
+
+ {/* Chat area skeleton */}
+ <div className="w-full h-full flex-1" />
+
+ {/* Footer skeleton */}
+ <div className="w-full max-w-4xl py-4 space-y-4">
+ <Skeleton className="w-full h-[124px] rounded-xl" />
+ <Skeleton className="w-4/6 h-4 rounded-md mx-auto" />
+ </div>
+ </>
+);
diff --git a/packages/app/src/react/features/ai-chat/components/header/skeleton.tsx b/packages/app/src/react/features/ai-chat/components/skeleton.tsx
similarity index 100%
rename from packages/app/src/react/features/ai-chat/components/header/skeleton.tsx
rename to packages/app/src/react/features/ai-chat/components/skeleton.tsx
diff --git a/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx b/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx
index 9315be86..9397666c 100644
--- a/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx
+++ b/packages/app/src/react/features/ai-chat/pages/ai-chat.tsx
@@ -1,84 +1,11 @@
-import { Chats, Container, Footer, Header } from '@react/features/ai-chat/components';
-import { AuthOverlay } from '@react/features/ai-chat/components/auth/auth-overlay';
-import { Skeleton } from '@react/features/ai-chat/components/header/skeleton';
+import { ChatContent, Container } from '@react/features/ai-chat/components';
import { ChatContextProvider } from '@react/features/ai-chat/contexts';
-import { useChatStores } from '@react/features/ai-chat/hooks';
import { memo } from 'react';
/**
- * Loading skeleton that mimics the chat UI layout
+ * Main AI Chat page component
+ * Wraps chat content with context provider and container
*/
-const LoadingSkeleton = () => (
- <>
- {/* Header skeleton */}
- <div className="w-full max-w-4xl flex justify-between items-center pt-2">
- <div className="w-full flex items-center gap-2.5">
- <Skeleton className="size-10 rounded-full" />
- <div className="flex flex-col gap-0.5">
- <Skeleton className="w-32 h-4 rounded" />
- <Skeleton className="w-20 h-3 rounded" />
- </div>
- </div>
- <div className="flex items-center gap-1.5">
- <Skeleton className="size-7 rounded-xl" />
- <Skeleton className="size-7 rounded-xl" />
- </div>
- </div>
-
- {/* Chat area skeleton */}
- <div className="w-full h-full flex-1" />
-
- <div className="w-full max-w-4xl py-4 space-y-4">
- <Skeleton className="w-full h-[124px] rounded-xl" />
- <Skeleton className="w-4/6 h-4 rounded-md mx-auto" />
- </div>
- </>
-);
-
-/**
- * Handles conditional rendering based on page state
- */
-const ChatContent = () => {
- const { pageState } = useChatStores();
-
- // Loading state
- if (pageState === 'loading') {
- return <LoadingSkeleton />;
- }
-
- // Auth required
- if (pageState === 'auth-required') {
- return <AuthOverlay />;
- }
-
- // Chatbot disabled
- if (pageState === 'disabled') {
- return (
- <>
- <Header />
- <div className="w-full h-full flex items-center justify-center">
- <div className="text-center max-w-md p-8">
- <p className="text-gray-600">This feature is disabled for your SmythOS Agent.</p>
- <p className="text-gray-500 mt-2 text-sm">
- To enable it, go to <strong>Agent Settings → Deployments</strong> and turn on{' '}
- <strong>&quot;Chatbot&quot;</strong>
- </p>
- </div>
- </div>
- </>
- );
- }
-
- // Ready - show full chat UI
- return (
- <>
- <Header />
- <Chats />
- <Footer />
- </>
- );
-};
-
const AgentChatPage = () => {
return (
<ChatContextProvider>