@messenger-box/tailwind-ui-inbox 10.0.3-alpha.73 → 10.0.3-alpha.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/components/AIAgent/AIAgent.d.ts +7 -0
  3. package/lib/components/AIAgent/AIAgent.d.ts.map +1 -1
  4. package/lib/components/AIAgent/AIAgent.js +362 -615
  5. package/lib/components/AIAgent/AIAgent.js.map +1 -1
  6. package/lib/components/InboxMessage/InputComponent.d.ts.map +1 -1
  7. package/lib/components/InboxMessage/InputComponent.js +143 -140
  8. package/lib/components/InboxMessage/InputComponent.js.map +1 -1
  9. package/lib/components/InboxMessage/RightSidebarAi.d.ts +23 -0
  10. package/lib/components/InboxMessage/RightSidebarAi.d.ts.map +1 -0
  11. package/lib/components/InboxMessage/RightSidebarAi.js +9 -0
  12. package/lib/components/InboxMessage/RightSidebarAi.js.map +1 -0
  13. package/lib/components/InboxMessage/index.d.ts +1 -0
  14. package/lib/components/InboxMessage/index.d.ts.map +1 -1
  15. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts +11 -0
  16. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts.map +1 -0
  17. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js +194 -0
  18. package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js.map +1 -0
  19. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts +5 -1
  20. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -1
  21. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +308 -857
  22. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js.map +1 -1
  23. package/lib/components/ModelConfigPanel.d.ts +12 -0
  24. package/lib/components/ModelConfigPanel.d.ts.map +1 -0
  25. package/lib/components/ModelConfigPanel.js +304 -0
  26. package/lib/components/ModelConfigPanel.js.map +1 -0
  27. package/lib/components/filler-components/RightSiderBar.d.ts +24 -0
  28. package/lib/components/filler-components/RightSiderBar.d.ts.map +1 -0
  29. package/lib/components/filler-components/RightSiderBar.js +335 -0
  30. package/lib/components/filler-components/RightSiderBar.js.map +1 -0
  31. package/lib/components/index.d.ts +4 -2
  32. package/lib/components/index.d.ts.map +1 -1
  33. package/lib/components/live-code-editor/hybrid-live-editor.d.ts +20 -0
  34. package/lib/components/live-code-editor/hybrid-live-editor.d.ts.map +1 -0
  35. package/lib/components/live-code-editor/hybrid-live-editor.js +68 -0
  36. package/lib/components/live-code-editor/hybrid-live-editor.js.map +1 -0
  37. package/lib/components/live-code-editor/index.d.ts +4 -0
  38. package/lib/components/live-code-editor/index.d.ts.map +1 -0
  39. package/lib/components/live-code-editor/live-code-editor.d.ts +14 -0
  40. package/lib/components/live-code-editor/live-code-editor.d.ts.map +1 -0
  41. package/lib/components/live-code-editor/live-code-editor.js +207 -0
  42. package/lib/components/live-code-editor/live-code-editor.js.map +1 -0
  43. package/lib/components/slot-fill/chat-message-filler.js +1 -1
  44. package/lib/components/slot-fill/chat-message-filler.js.map +1 -1
  45. package/lib/components/slot-fill/index.d.ts +1 -0
  46. package/lib/components/slot-fill/index.d.ts.map +1 -1
  47. package/lib/components/slot-fill/right-sidebar-filler.d.ts +4 -0
  48. package/lib/components/slot-fill/right-sidebar-filler.d.ts.map +1 -0
  49. package/lib/components/slot-fill/right-sidebar-filler.js +13 -0
  50. package/lib/components/slot-fill/right-sidebar-filler.js.map +1 -0
  51. package/lib/components/ui/button.d.ts +9 -0
  52. package/lib/components/ui/button.d.ts.map +1 -0
  53. package/lib/compute.js +1 -2
  54. package/lib/container/AiInbox.d.ts.map +1 -1
  55. package/lib/container/AiLandingInput.d.ts.map +1 -1
  56. package/lib/container/AiLandingInput.js +46 -119
  57. package/lib/container/AiLandingInput.js.map +1 -1
  58. package/lib/container/Inbox.js +1 -1
  59. package/lib/container/Inbox.js.map +1 -1
  60. package/lib/container/InboxAiMessagesLoader.d.ts +0 -21
  61. package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -1
  62. package/lib/container/InboxAiMessagesLoader.js +18 -32
  63. package/lib/container/InboxAiMessagesLoader.js.map +1 -1
  64. package/lib/container/ServiceInbox.js +1 -1
  65. package/lib/container/ServiceInbox.js.map +1 -1
  66. package/lib/container/ThreadMessages.js +1 -1
  67. package/lib/container/ThreadMessages.js.map +1 -1
  68. package/lib/container/ThreadMessagesInbox.js +1 -1
  69. package/lib/container/ThreadMessagesInbox.js.map +1 -1
  70. package/lib/container/Threads.js +1 -1
  71. package/lib/container/Threads.js.map +1 -1
  72. package/lib/container/index.d.ts +2 -1
  73. package/lib/container/index.d.ts.map +1 -1
  74. package/lib/enums/messenger-slot-fill-name-enum.d.ts +2 -1
  75. package/lib/enums/messenger-slot-fill-name-enum.d.ts.map +1 -1
  76. package/lib/enums/messenger-slot-fill-name-enum.js +1 -0
  77. package/lib/enums/messenger-slot-fill-name-enum.js.map +1 -1
  78. package/lib/hooks/index.d.ts +3 -0
  79. package/lib/hooks/index.d.ts.map +1 -0
  80. package/lib/hooks/use-file-sync.d.ts +16 -0
  81. package/lib/hooks/use-file-sync.d.ts.map +1 -0
  82. package/lib/hooks/use-file-sync.js +63 -0
  83. package/lib/hooks/use-file-sync.js.map +1 -0
  84. package/lib/hooks/usePersistentModelConfig.d.ts +15 -0
  85. package/lib/hooks/usePersistentModelConfig.d.ts.map +1 -0
  86. package/lib/hooks/usePersistentModelConfig.js +46 -0
  87. package/lib/hooks/usePersistentModelConfig.js.map +1 -0
  88. package/lib/index.d.ts +4 -2
  89. package/lib/index.d.ts.map +1 -1
  90. package/lib/index.js +1 -1
  91. package/lib/machines/aiAgentMachine.d.ts.map +1 -1
  92. package/lib/machines/aiAgentMachine.js +64 -21
  93. package/lib/machines/aiAgentMachine.js.map +1 -1
  94. package/lib/machines/aiAgentMachine.simple.d.ts +3 -0
  95. package/lib/machines/aiAgentMachine.simple.d.ts.map +1 -0
  96. package/lib/machines/aiAgentMachine.simple.js +108 -0
  97. package/lib/machines/aiAgentMachine.simple.js.map +1 -0
  98. package/lib/machines/index.d.ts +3 -0
  99. package/lib/machines/index.d.ts.map +1 -0
  100. package/lib/module.d.ts +2 -1
  101. package/lib/module.d.ts.map +1 -1
  102. package/lib/module.js +11 -3
  103. package/lib/module.js.map +1 -1
  104. package/lib/routes.json +1 -2
  105. package/lib/templates/InboxWithAi.d.ts.map +1 -1
  106. package/lib/templates/InboxWithAi.js +129 -70
  107. package/lib/templates/InboxWithAi.js.map +1 -1
  108. package/lib/templates/InboxWithAi.tsx +151 -90
  109. package/lib/utils/utils.d.ts +2 -0
  110. package/lib/utils/utils.d.ts.map +1 -0
  111. package/lib/utils/utils.js +3 -0
  112. package/lib/utils/utils.js.map +1 -0
  113. package/package.json +8 -5
  114. package/src/components/AIAgent/AIAgent.tsx +469 -731
  115. package/src/components/AIAgent/AIAgent.tsx.bk +1365 -0
  116. package/src/components/InboxMessage/InputComponent.tsx +2 -1
  117. package/src/components/InboxMessage/RightSidebarAi.tsx +37 -0
  118. package/src/components/InboxMessage/index.ts +1 -0
  119. package/src/components/InboxMessage/message-widgets/ErrorFixCard.tsx +240 -0
  120. package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +337 -1116
  121. package/src/components/ModelConfigPanel.tsx +334 -0
  122. package/src/components/filler-components/RightSiderBar.tsx +408 -0
  123. package/src/components/index.ts +4 -1
  124. package/src/components/live-code-editor/hybrid-live-editor.tsx +105 -0
  125. package/src/components/live-code-editor/index.ts +3 -0
  126. package/src/components/live-code-editor/live-code-editor.tsx +257 -0
  127. package/src/components/slot-fill/index.ts +1 -0
  128. package/src/components/slot-fill/right-sidebar-filler.tsx +39 -0
  129. package/src/components/ui/button.tsx +32 -0
  130. package/src/container/AiInbox.tsx +26 -3
  131. package/src/container/AiLandingInput.tsx +48 -22
  132. package/src/container/InboxAiMessagesLoader.tsx +17 -31
  133. package/src/container/index.ts +2 -0
  134. package/src/enums/messenger-slot-fill-name-enum.ts +1 -0
  135. package/src/hooks/index.ts +2 -0
  136. package/src/hooks/use-file-sync.ts +91 -0
  137. package/src/hooks/usePersistentModelConfig.ts +63 -0
  138. package/src/index.ts +7 -0
  139. package/src/machines/aiAgentMachine.simple.ts +89 -0
  140. package/src/machines/aiAgentMachine.ts +67 -19
  141. package/src/machines/aiAgentMachine.ts.bk +1296 -0
  142. package/src/machines/index.ts +2 -0
  143. package/src/module.tsx +10 -1
  144. package/src/templates/InboxWithAi.tsx +151 -90
  145. package/src/utils/utils.ts +3 -0
@@ -0,0 +1,2 @@
1
+ export * from './aiAgentMachine';
2
+ export * from './types';
package/src/module.tsx CHANGED
@@ -3,8 +3,9 @@ import { schema, typePolicies, dataIdFromObject } from '@messenger-box/platform-
3
3
  import { MESSAGE_SLOT_FILL_NAME } from '@messenger-box/core';
4
4
  import { filteredRoutes } from './compute';
5
5
  import { ChatMessageFill, ChatMessageFill2 } from './components/slot-fill/chat-message-filler';
6
+ import { RightSidebarFill } from './components/slot-fill/right-sidebar-filler';
6
7
 
7
- export { ChatMessageFill };
8
+ export { ChatMessageFill, RightSidebarFill };
8
9
  export default new Feature({
9
10
  routeConfig: filteredRoutes,
10
11
  dataIdFromObject,
@@ -19,5 +20,13 @@ export default new Feature({
19
20
  // name: `${MESSAGE_SLOT_FILL_NAME}2`,
20
21
  // render: ChatMessageFill2,
21
22
  // },
23
+ {
24
+ name: 'inbox-with-ai-right-sidebar-1',
25
+ render: RightSidebarFill,
26
+ },
27
+ // {
28
+ // name: 'inbox-with-ai-right-sidebar-2',
29
+ // render: RightSidebarFill2,
30
+ // },
22
31
  ],
23
32
  });
@@ -10,13 +10,17 @@ import React, {
10
10
  useState,
11
11
  } from 'react';
12
12
  import { Outlet, useNavigate, useParams, useLocation } from '@remix-run/react';
13
+ import { RightSidebarAi } from '../components/InboxMessage/RightSidebarAi';
14
+ import { useRecreateSandboxMutation, useRegenerateAiCodeMutation } from 'common/graphql';
15
+ import { usePersistentModelConfig } from '../hooks/usePersistentModelConfig';
16
+ import { useFileSync } from '../hooks/use-file-sync';
13
17
 
14
18
  // Context for sharing tab state between header and sidebar
15
19
  const TabContext = createContext<{
16
20
  activeTab: string;
17
21
  setActiveTab: (tab: string) => void;
18
22
  }>({
19
- activeTab: 'design',
23
+ activeTab: 'preview',
20
24
  setActiveTab: () => {},
21
25
  });
22
26
 
@@ -86,7 +90,7 @@ const EmptyState = React.memo(() => (
86
90
  ));
87
91
 
88
92
  const InboxWithAi = (props: InboxProps) => {
89
- const [activeTab, setActiveTab] = React.useState('design');
93
+ const [activeTab, setActiveTab] = React.useState('preview');
90
94
 
91
95
  return (
92
96
  <TabContext.Provider value={{ activeTab, setActiveTab }}>
@@ -101,14 +105,85 @@ const InboxWithAiInternal = (props: InboxProps) => {
101
105
  const location = useLocation();
102
106
  const urlParams = location?.search ? new URLSearchParams(location.search) : null;
103
107
  const { activeTab, setActiveTab } = useContext(TabContext);
104
-
108
+ const [messages, setMessages] = useState<any[]>([]);
109
+ const [selectedPost, setSelectedPost] = useState<any>(null);
110
+ const [recreateSandbox] = useRecreateSandboxMutation();
111
+ const [regenerateAiCode] = useRegenerateAiCodeMutation();
112
+ const { modelConfig, getValidatedConfig, hasApiKey } = usePersistentModelConfig();
113
+ const [isLoading, setIsLoading] = useState(true);
114
+ const [errorData, setError] = useState<string | null>(null);
105
115
  // Extract channelId from query parameters (priority) or path parameters (fallback)
106
116
  const channelId = urlParams?.get('id') || pathChannelId;
107
117
 
118
+ const regenerateAiCodeForFragment = useCallback(
119
+ async (messageId: string) => {
120
+ try {
121
+ setIsLoading(true);
122
+ setError(null);
123
+
124
+ const response = await regenerateAiCode({
125
+ variables: {
126
+ messageId: messageId,
127
+ modelConfig: modelConfig,
128
+ },
129
+ });
130
+
131
+ if (response.data?.regenerateAiCode?.success) {
132
+ console.log('Sandbox recreation initiated successfully');
133
+ // The subscription will handle updating the UI with the new sandbox URL
134
+ } else {
135
+ const errorMsg = response.data?.regenerateAiCode?.message || 'Failed to regenerate AI code';
136
+ throw new Error(errorMsg);
137
+ }
138
+ } catch (err) {
139
+ console.error('Error recreating sandbox:', err);
140
+ setError(err instanceof Error ? err.message : 'Failed to recreate sandbox');
141
+ setIsLoading(false);
142
+ }
143
+ },
144
+ [regenerateAiCode, modelConfig],
145
+ );
146
+
147
+ const recreateSandboxForFragment = useCallback(
148
+ async (messageId: string) => {
149
+ if (!channelId) {
150
+ console.error('No project ID available for sandbox recreation');
151
+ return;
152
+ }
153
+
154
+ try {
155
+ setIsLoading(true);
156
+ setError(null);
157
+
158
+ const response = await recreateSandbox({
159
+ variables: {
160
+ projectId: channelId,
161
+ messageId,
162
+ },
163
+ });
164
+
165
+ if (response.data?.recreateSandbox?.success) {
166
+ console.log('Sandbox recreation initiated successfully');
167
+ // The subscription will handle updating the UI with the new sandbox URL
168
+ } else {
169
+ const errorMsg = response.data?.recreateSandbox?.message || 'Failed to recreate sandbox';
170
+ throw new Error(errorMsg);
171
+ }
172
+ } catch (err) {
173
+ console.error('Error recreating sandbox:', err);
174
+ setError(err instanceof Error ? err.message : 'Failed to recreate sandbox');
175
+ setIsLoading(false);
176
+ }
177
+ },
178
+ [recreateSandbox, channelId],
179
+ );
180
+
108
181
  // Handle refresh sandbox
109
182
  const handleRefreshSandbox = useCallback(() => {
110
- console.log('Refreshing sandbox...');
111
- }, []);
183
+ if (selectedPost) {
184
+ recreateSandboxForFragment(selectedPost.id);
185
+ }
186
+ }, [activeTab, selectedPost, regenerateAiCodeForFragment]);
112
187
 
113
188
  // Hooks - improved responsive breakpoints with better granularity
114
189
  const { width: windowWidth, height: windowHeight } = useWindowDimensions();
@@ -145,33 +220,9 @@ const InboxWithAiInternal = (props: InboxProps) => {
145
220
  {!isSmallScreen && (
146
221
  <div className="flex bg-gray-100 p-2" style={{ borderRadius: '10px' }}>
147
222
  <button
148
- onClick={() => setActiveTab('design')}
149
- className={`flex items-center space-x-2 px-4 py-2 text-xs font-medium transition-all duration-200 ${
150
- activeTab === 'design'
151
- ? 'bg-blue-500 text-white shadow-sm'
152
- : 'text-gray-600 hover:text-gray-900'
153
- }`}
154
- style={{ borderRadius: '10px' }}
155
- >
156
- <svg
157
- className="w-4 h-4"
158
- fill="none"
159
- stroke="currentColor"
160
- viewBox="0 0 24 24"
161
- >
162
- <path
163
- strokeLinecap="round"
164
- strokeLinejoin="round"
165
- strokeWidth={2}
166
- d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
167
- />
168
- </svg>
169
- <span>Design</span>
170
- </button>
171
- <button
172
- onClick={() => setActiveTab('interact')}
223
+ onClick={() => setActiveTab('preview')}
173
224
  className={`flex items-center space-x-2 px-4 py-2 text-xs font-medium transition-all duration-200 ${
174
- activeTab === 'interact'
225
+ activeTab === 'preview'
175
226
  ? 'bg-blue-500 text-white shadow-sm'
176
227
  : 'text-gray-600 hover:text-gray-900'
177
228
  }`}
@@ -196,7 +247,7 @@ const InboxWithAiInternal = (props: InboxProps) => {
196
247
  d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
197
248
  />
198
249
  </svg>
199
- <span>Interact</span>
250
+ <span>Preview</span>
200
251
  </button>
201
252
  <button
202
253
  onClick={() => setActiveTab('code')}
@@ -229,7 +280,7 @@ const InboxWithAiInternal = (props: InboxProps) => {
229
280
  {/* Refresh icon on the right - hidden on mobile */}
230
281
  {isDesktopView && (
231
282
  <button
232
- onClick={handleRefreshSandbox}
283
+ onClick={() => handleRefreshSandbox()}
233
284
  className="p-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded-lg transition-colors"
234
285
  title="Refresh Sandbox"
235
286
  >
@@ -263,7 +314,20 @@ const InboxWithAiInternal = (props: InboxProps) => {
263
314
  `}
264
315
  style={{ paddingTop: '15px' }}
265
316
  >
266
- {channelId ? <ContentComponent channelId={channelId} /> : <EmptyState />}
317
+ {channelId ? (
318
+ <ContentComponent
319
+ channelId={channelId}
320
+ {...props}
321
+ messages={messages}
322
+ setMessages={setMessages}
323
+ selectedPost={selectedPost}
324
+ setSelectedPost={setSelectedPost}
325
+ setIsLoading={setIsLoading}
326
+ isLoading={isLoading}
327
+ />
328
+ ) : (
329
+ <EmptyState />
330
+ )}
267
331
  </div>
268
332
 
269
333
  {/* Right Sidebar - 65% width on desktop only */}
@@ -276,6 +340,13 @@ const InboxWithAiInternal = (props: InboxProps) => {
276
340
  detailSidebarOptions={detailSidebarOptions}
277
341
  windowWidth={windowWidth}
278
342
  windowHeight={windowHeight}
343
+ activeTab={activeTab}
344
+ channelId={channelId}
345
+ messages={messages}
346
+ selectedPost={selectedPost}
347
+ setIsLoading={setIsLoading}
348
+ isLoading={isLoading}
349
+ {...props}
279
350
  />
280
351
  </div>
281
352
  )}
@@ -286,7 +357,7 @@ const InboxWithAiInternal = (props: InboxProps) => {
286
357
  };
287
358
 
288
359
  const ContentComponent = React.memo((props: any) => {
289
- const { channelId } = props;
360
+ const { channelId, messages, setMessages, selectedPost, setSelectedPost, setIsLoading, isLoading } = props;
290
361
 
291
362
  return (
292
363
  <div className="flex overflow-hidden h-full">
@@ -296,7 +367,16 @@ const ContentComponent = React.memo((props: any) => {
296
367
  <div className="flex-1 flex flex-col min-h-0 overflow-hidden">
297
368
  {channelId && (
298
369
  <>
299
- <MessagesComponent {...props} />
370
+ <MessagesComponent
371
+ {...props}
372
+ channelId={channelId}
373
+ messages={messages}
374
+ setMessages={setMessages}
375
+ selectedPost={selectedPost}
376
+ setSelectedPost={setSelectedPost}
377
+ setIsLoading={setIsLoading}
378
+ isLoading={isLoading}
379
+ />
300
380
  </>
301
381
  )}
302
382
  </div>
@@ -311,42 +391,10 @@ const RightSidebarWrapper = React.memo(({ detailSidebarOptions }: any) => {
311
391
  <div className="h-full flex flex-col overflow-hidden bg-white">
312
392
  {/* Content Area */}
313
393
  <div className="flex-1 overflow-hidden">
314
- {activeTab === 'design' ? (
394
+ {activeTab === 'preview' ? (
315
395
  <div className="h-full flex items-center justify-center bg-gray-50">
316
396
  <div className="text-center">
317
- {/* Next.js Logo */}
318
- <div className="mb-8">
319
- <svg className="w-32 h-16 mx-auto text-black" viewBox="0 0 394 80" fill="currentColor">
320
- <path d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.4zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.7h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z" />
321
- <path d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.2 3.4 1 1.4 1.5 3 1.5 5h-5.8z" />
322
- </svg>
323
- </div>
324
-
325
- <div className="space-y-4 text-gray-600">
326
- <h3 className="text-lg font-semibold text-gray-900">Design View</h3>
327
- <p className="font-mono text-sm bg-gray-100 px-3 py-1 rounded">
328
- Design components and UI
329
- </p>
330
- <p>Customize and preview your design changes.</p>
331
- </div>
332
-
333
- <div className="mt-8 space-y-4">
334
- <button className="bg-black text-white px-6 py-3 rounded-full hover:bg-gray-800 transition-colors flex items-center space-x-2 mx-auto">
335
- <svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
336
- <path d="M12 2L2 7v10c0 5.55 3.84 9.739 9 11 5.16-1.261 9-5.45 9-11V7l-10-5z" />
337
- </svg>
338
- <span>Design now</span>
339
- </button>
340
- <p className="text-sm text-gray-500 underline cursor-pointer hover:text-gray-700">
341
- View design docs
342
- </p>
343
- </div>
344
- </div>
345
- </div>
346
- ) : activeTab === 'interact' ? (
347
- <div className="h-full flex items-center justify-center bg-blue-50">
348
- <div className="text-center">
349
- {/* Interact Icon */}
397
+ {/* Preview Icon */}
350
398
  <div className="mb-8">
351
399
  <svg
352
400
  className="w-32 h-32 mx-auto text-blue-500"
@@ -370,11 +418,11 @@ const RightSidebarWrapper = React.memo(({ detailSidebarOptions }: any) => {
370
418
  </div>
371
419
 
372
420
  <div className="space-y-4 text-gray-600">
373
- <h3 className="text-lg font-semibold text-gray-900">Interactive Mode</h3>
421
+ <h3 className="text-lg font-semibold text-gray-900">Preview Mode</h3>
374
422
  <p className="font-mono text-sm bg-blue-100 px-3 py-1 rounded">
375
- Live interaction and testing
423
+ Live preview and testing
376
424
  </p>
377
- <p>Test and interact with your components in real-time.</p>
425
+ <p>Preview and test your components in real-time.</p>
378
426
  </div>
379
427
 
380
428
  <div className="mt-8 space-y-4">
@@ -382,10 +430,10 @@ const RightSidebarWrapper = React.memo(({ detailSidebarOptions }: any) => {
382
430
  <svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
383
431
  <path d="M8 5v14l11-7z" />
384
432
  </svg>
385
- <span>Start Interacting</span>
433
+ <span>Start Preview</span>
386
434
  </button>
387
435
  <p className="text-sm text-gray-500 underline cursor-pointer hover:text-gray-700">
388
- Learn about interactions
436
+ Learn about preview mode
389
437
  </p>
390
438
  </div>
391
439
  </div>
@@ -472,23 +520,36 @@ const RightSidebarWrapper = React.memo(({ detailSidebarOptions }: any) => {
472
520
  );
473
521
  });
474
522
 
475
- const RightSidebarContent = React.memo(({ detailSidebarOptions, windowWidth, windowHeight }: any) => {
476
- return (
477
- <div
478
- className="border-l border-gray-200 bg-white flex-shrink-0 overflow-hidden"
479
- style={{
480
- // width: `${windowWidth * 0.35}px`, // 35% of window width
481
- height: `${windowHeight}px`,
482
- maxHeight: '100vh',
483
- }}
484
- >
485
- <RightSidebarWrapper detailSidebarOptions={detailSidebarOptions} />
486
- </div>
487
- );
488
- });
523
+ const RightSidebarContent = React.memo(
524
+ ({ detailSidebarOptions, windowWidth, windowHeight, channelId, setIsLoading, isLoading, ...props }: any) => {
525
+ const { activeTab } = useContext(TabContext);
526
+
527
+ return (
528
+ <div
529
+ className="border-l border-gray-200 bg-white flex-shrink-0 overflow-hidden"
530
+ style={{
531
+ // width: `${windowWidth * 0.35}px`, // 35% of window width
532
+ height: `${windowHeight}px`,
533
+ maxHeight: '100vh',
534
+ }}
535
+ >
536
+ <RightSidebarAi
537
+ detailSidebarOptions={detailSidebarOptions}
538
+ windowWidth={windowWidth}
539
+ windowHeight={windowHeight}
540
+ activeTab={activeTab}
541
+ channelId={channelId}
542
+ setIsLoading={setIsLoading}
543
+ isLoading={isLoading}
544
+ {...props}
545
+ />
546
+ </div>
547
+ );
548
+ },
549
+ );
489
550
 
490
551
  const MessagesComponent = React.memo((props: any) => {
491
- return <Outlet context="app" />;
552
+ return <Outlet context={{ ...props, app: 'app' }} />;
492
553
  });
493
554
 
494
555
  // Display names for debugging
@@ -0,0 +1,3 @@
1
+ export function cn(...inputs: (string | undefined | null | false)[]): string {
2
+ return inputs.filter(Boolean).join(' ').trim();
3
+ }