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

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 (143) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/components/AIAgent/AIAgent.d.ts +14 -0
  3. package/lib/components/AIAgent/AIAgent.d.ts.map +1 -0
  4. package/lib/components/AIAgent/AIAgent.js +1148 -0
  5. package/lib/components/AIAgent/AIAgent.js.map +1 -0
  6. package/lib/components/AIAgent/index.d.ts +2 -0
  7. package/lib/components/AIAgent/index.d.ts.map +1 -0
  8. package/lib/components/InboxMessage/InputComponent.d.ts +9 -0
  9. package/lib/components/InboxMessage/InputComponent.d.ts.map +1 -0
  10. package/lib/components/InboxMessage/InputComponent.js +210 -0
  11. package/lib/components/InboxMessage/InputComponent.js.map +1 -0
  12. package/lib/components/InboxMessage/MessageInput.d.ts.map +1 -1
  13. package/lib/components/InboxMessage/MessageInput.js +14 -10
  14. package/lib/components/InboxMessage/MessageInput.js.map +1 -1
  15. package/lib/components/InboxMessage/MessageInputComponent.d.ts +9 -0
  16. package/lib/components/InboxMessage/MessageInputComponent.d.ts.map +1 -0
  17. package/lib/components/InboxMessage/Messages.d.ts.map +1 -1
  18. package/lib/components/InboxMessage/Messages.js +4 -54
  19. package/lib/components/InboxMessage/Messages.js.map +1 -1
  20. package/lib/components/InboxMessage/MessagesBuilderUi.d.ts +17 -0
  21. package/lib/components/InboxMessage/MessagesBuilderUi.d.ts.map +1 -0
  22. package/lib/components/InboxMessage/UploadImageButton.d.ts +1 -0
  23. package/lib/components/InboxMessage/UploadImageButton.d.ts.map +1 -1
  24. package/lib/components/InboxMessage/UploadImageButton.js +3 -3
  25. package/lib/components/InboxMessage/UploadImageButton.js.map +1 -1
  26. package/lib/components/InboxMessage/index.d.ts +3 -0
  27. package/lib/components/InboxMessage/index.d.ts.map +1 -1
  28. package/lib/components/InboxMessage/message-widgets/CommonMessage.d.ts.map +1 -1
  29. package/lib/components/InboxMessage/message-widgets/CommonMessage.js +11 -6
  30. package/lib/components/InboxMessage/message-widgets/CommonMessage.js.map +1 -1
  31. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts +14 -0
  32. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -0
  33. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +1525 -0
  34. package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js.map +1 -0
  35. package/lib/components/InboxMessage/message-widgets/PlainMessage.d.ts.map +1 -1
  36. package/lib/components/InboxMessage/message-widgets/PlainMessage.js +6 -3
  37. package/lib/components/InboxMessage/message-widgets/PlainMessage.js.map +1 -1
  38. package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.d.ts.map +1 -1
  39. package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.js +207 -12
  40. package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.js.map +1 -1
  41. package/lib/components/InboxMessage/message-widgets/index.d.ts +1 -0
  42. package/lib/components/InboxMessage/message-widgets/index.d.ts.map +1 -1
  43. package/lib/components/index.d.ts +2 -1
  44. package/lib/components/index.d.ts.map +1 -1
  45. package/lib/compute.d.ts.map +1 -1
  46. package/lib/compute.js +79 -3
  47. package/lib/compute.js.map +1 -1
  48. package/lib/config/env-config.d.ts +6 -0
  49. package/lib/config/env-config.d.ts.map +1 -1
  50. package/lib/config/env-config.js +19 -1
  51. package/lib/config/env-config.js.map +1 -1
  52. package/lib/container/AiInbox.d.ts +15 -0
  53. package/lib/container/AiInbox.d.ts.map +1 -0
  54. package/lib/container/AiInboxWithLoader.d.ts +36 -0
  55. package/lib/container/AiInboxWithLoader.d.ts.map +1 -0
  56. package/lib/container/AiLandingInput.d.ts +4 -0
  57. package/lib/container/AiLandingInput.d.ts.map +1 -0
  58. package/lib/container/AiLandingInput.js +164 -0
  59. package/lib/container/AiLandingInput.js.map +1 -0
  60. package/lib/container/Inbox.d.ts.map +1 -1
  61. package/lib/container/Inbox.js +6 -4
  62. package/lib/container/Inbox.js.map +1 -1
  63. package/lib/container/InboxAiMessagesLoader.d.ts +36 -0
  64. package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -0
  65. package/lib/container/InboxAiMessagesLoader.js +44 -0
  66. package/lib/container/InboxAiMessagesLoader.js.map +1 -0
  67. package/lib/container/InboxContainer.d.ts +12 -0
  68. package/lib/container/InboxContainer.d.ts.map +1 -0
  69. package/lib/container/InboxContainer.js +31 -0
  70. package/lib/container/InboxContainer.js.map +1 -0
  71. package/lib/container/InboxTemplate1.d.ts +15 -0
  72. package/lib/container/InboxTemplate1.d.ts.map +1 -0
  73. package/lib/container/InboxTemplate1WithLoader.d.ts +36 -0
  74. package/lib/container/InboxTemplate1WithLoader.d.ts.map +1 -0
  75. package/lib/container/InboxTemplate2.d.ts +15 -0
  76. package/lib/container/InboxTemplate2.d.ts.map +1 -0
  77. package/lib/container/InboxWithAiLoader.d.ts +15 -0
  78. package/lib/container/InboxWithAiLoader.d.ts.map +1 -0
  79. package/lib/container/InboxWithAiLoader.js +56 -0
  80. package/lib/container/InboxWithAiLoader.js.map +1 -0
  81. package/lib/container/ServiceInbox.js +1 -1
  82. package/lib/container/ServiceInbox.js.map +1 -1
  83. package/lib/container/ThreadMessages.js +1 -1
  84. package/lib/container/ThreadMessages.js.map +1 -1
  85. package/lib/container/ThreadMessagesInbox.js +1 -1
  86. package/lib/container/ThreadMessagesInbox.js.map +1 -1
  87. package/lib/container/Threads.js +1 -1
  88. package/lib/container/Threads.js.map +1 -1
  89. package/lib/container/index.d.ts +4 -1
  90. package/lib/container/index.d.ts.map +1 -1
  91. package/lib/index.d.ts +3 -2
  92. package/lib/index.d.ts.map +1 -1
  93. package/lib/index.js +1 -1
  94. package/lib/machines/aiAgentMachine.d.ts +3 -0
  95. package/lib/machines/aiAgentMachine.d.ts.map +1 -0
  96. package/lib/machines/aiAgentMachine.js +1040 -0
  97. package/lib/machines/aiAgentMachine.js.map +1 -0
  98. package/lib/machines/types.d.ts +77 -0
  99. package/lib/machines/types.d.ts.map +1 -0
  100. package/lib/routes.json +40 -0
  101. package/lib/templates/InboxWithAi.d.ts +15 -0
  102. package/lib/templates/InboxWithAi.d.ts.map +1 -0
  103. package/lib/templates/InboxWithAi.js +405 -0
  104. package/lib/templates/InboxWithAi.js.map +1 -0
  105. package/lib/templates/InboxWithAi.tsx +502 -0
  106. package/lib/templates/index.d.ts +2 -0
  107. package/lib/templates/index.d.ts.map +1 -0
  108. package/lib/templates/index.ts +1 -0
  109. package/package.json +7 -5
  110. package/src/components/AIAgent/AIAgent.tsx +1351 -0
  111. package/src/components/AIAgent/README.md +82 -0
  112. package/src/components/AIAgent/index.ts +1 -0
  113. package/src/components/InboxMessage/InputComponent.tsx +263 -0
  114. package/src/components/InboxMessage/MessageInput.tsx +73 -66
  115. package/src/components/InboxMessage/MessageInputComponent.tsx +245 -0
  116. package/src/components/InboxMessage/Messages.tsx +2 -56
  117. package/src/components/InboxMessage/MessagesBuilderUi.tsx +205 -0
  118. package/src/components/InboxMessage/UploadImageButton.tsx +3 -2
  119. package/src/components/InboxMessage/index.ts +3 -0
  120. package/src/components/InboxMessage/message-widgets/CommonMessage.tsx +39 -21
  121. package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +1968 -0
  122. package/src/components/InboxMessage/message-widgets/PlainMessage.tsx +6 -2
  123. package/src/components/InboxMessage/message-widgets/SlackLikeMessageGroup.tsx +306 -54
  124. package/src/components/InboxMessage/message-widgets/index.ts +1 -0
  125. package/src/components/index.ts +4 -0
  126. package/src/compute.ts +83 -2
  127. package/src/config/env-config.ts +6 -0
  128. package/src/container/AiInbox.tsx +1796 -0
  129. package/src/container/AiInboxWithLoader.tsx +356 -0
  130. package/src/container/AiLandingInput.tsx +168 -0
  131. package/src/container/Inbox.tsx +8 -5
  132. package/src/container/InboxAiMessagesLoader.tsx +58 -0
  133. package/src/container/InboxContainer.tsx +35 -0
  134. package/src/container/InboxTemplate1.tsx +1542 -0
  135. package/src/container/InboxTemplate1WithLoader.tsx +338 -0
  136. package/src/container/InboxTemplate2.tsx +1606 -0
  137. package/src/container/InboxWithAiLoader.tsx +76 -0
  138. package/src/container/index.ts +21 -1
  139. package/src/index.ts +12 -1
  140. package/src/machines/aiAgentMachine.ts +1248 -0
  141. package/src/machines/types.ts +59 -0
  142. package/src/templates/InboxWithAi.tsx +502 -0
  143. package/src/templates/index.ts +1 -0
@@ -0,0 +1,59 @@
1
+ export interface Message {
2
+ id: string;
3
+ content: string;
4
+ sender: 'user' | 'ai';
5
+ timestamp: Date;
6
+ }
7
+
8
+ export interface MCPData {
9
+ searchResults?: Array<{
10
+ title: string;
11
+ url: string;
12
+ snippet: string;
13
+ source?: string;
14
+ }>;
15
+ newsArticles?: Array<{
16
+ title: string;
17
+ url: string;
18
+ description: string;
19
+ publishedAt: string;
20
+ source: { name: string };
21
+ }>;
22
+ summary: string;
23
+ sources: string[];
24
+ searchTime: number;
25
+ }
26
+
27
+ export interface AIAgentContext {
28
+ messages: Message[];
29
+ currentInput: string;
30
+ error: string | null;
31
+ isTyping: boolean;
32
+ mcpData?: MCPData;
33
+ multiMessageMode?: boolean;
34
+ currentMultiStep?: number;
35
+ totalMultiSteps?: number;
36
+ multiMessagePlan?: string[];
37
+ regularMessages?: any[]; // Add regular messages from query
38
+ messageToRespondTo?: string; // Add field for messages that need AI responses
39
+ }
40
+
41
+ export type UpdateEvent = {
42
+ type: 'UPDATE';
43
+ value?: Partial<AIAgentContext>;
44
+ };
45
+
46
+ export type AIAgentEvent =
47
+ | { type: 'SEND_MESSAGE'; message: string }
48
+ | { type: 'INPUT_CHANGE'; value: string }
49
+ | { type: 'AI_RESPONSE_SUCCESS'; response: string }
50
+ | { type: 'AI_RESPONSE_ERROR'; error: string }
51
+ | { type: 'RETRY' }
52
+ | { type: 'CLEAR_ERROR' }
53
+ | { type: 'CONTINUE_MULTI_MESSAGE' }
54
+ | { type: 'FORCE_MULTI_MESSAGE'; message: string }
55
+ | { type: 'UPDATE_REGULAR_MESSAGES'; messages: any[] } // Add event for updating regular messages
56
+ | { type: 'ANALYZE_EXISTING_CONTEXT' } // Add event for analyzing existing conversation context
57
+ | { type: 'AUTO_RESPOND_TO_MESSAGE'; message: string; isAutoResponse?: boolean } // Add event for automatic responses
58
+ | { type: 'CONTINUE_PROCESSING' } // Add event for continuing message processing
59
+ | UpdateEvent;
@@ -0,0 +1,502 @@
1
+ import React, {
2
+ ReactNode,
3
+ useCallback,
4
+ useEffect,
5
+ useMemo,
6
+ useReducer,
7
+ useRef,
8
+ createContext,
9
+ useContext,
10
+ useState,
11
+ } from 'react';
12
+ import { Outlet, useNavigate, useParams, useLocation } from '@remix-run/react';
13
+
14
+ // Context for sharing tab state between header and sidebar
15
+ const TabContext = createContext<{
16
+ activeTab: string;
17
+ setActiveTab: (tab: string) => void;
18
+ }>({
19
+ activeTab: 'design',
20
+ setActiveTab: () => {},
21
+ });
22
+
23
+ export interface InboxProps {
24
+ channelFilters?: Record<string, unknown>;
25
+ channelRole?: string;
26
+ supportServices?: boolean;
27
+ pathPrefix?: string;
28
+ data?: any;
29
+ orgName?: string;
30
+ }
31
+
32
+ // Static utility hooks and components
33
+ const useMediaQuery = (query: string) => {
34
+ const [matches, setMatches] = React.useState(false);
35
+
36
+ useEffect(() => {
37
+ if (typeof window === 'undefined') return;
38
+
39
+ const mediaQuery = window.matchMedia(query);
40
+ const updateMatches = () => setMatches(mediaQuery.matches);
41
+
42
+ updateMatches();
43
+ mediaQuery.addEventListener('change', updateMatches);
44
+ return () => mediaQuery.removeEventListener('change', updateMatches);
45
+ }, [query]);
46
+
47
+ return matches;
48
+ };
49
+
50
+ // Hook to get window dimensions
51
+ const useWindowDimensions = () => {
52
+ const [windowDimensions, setWindowDimensions] = React.useState({
53
+ width: typeof window !== 'undefined' ? window.innerWidth : 1024,
54
+ height: typeof window !== 'undefined' ? window.innerHeight : 768,
55
+ });
56
+
57
+ useEffect(() => {
58
+ if (typeof window === 'undefined') return;
59
+
60
+ const handleResize = () => {
61
+ setWindowDimensions({
62
+ width: window.innerWidth,
63
+ height: window.innerHeight,
64
+ });
65
+ };
66
+
67
+ window.addEventListener('resize', handleResize);
68
+ handleResize(); // Set initial dimensions
69
+
70
+ return () => window.removeEventListener('resize', handleResize);
71
+ }, []);
72
+
73
+ return windowDimensions;
74
+ };
75
+
76
+ const EmptyState = React.memo(() => (
77
+ <div className="h-full flex items-center justify-center bg-gray-100 p-4 sm:p-6 overflow-hidden">
78
+ <div className="text-center max-w-sm mx-auto">
79
+ <div className="text-3xl sm:text-4xl text-gray-400 mb-4">💬</div>
80
+ <h3 className="text-lg sm:text-xl font-semibold text-gray-600 mb-2">Welcome to Messenger</h3>
81
+ <p className="text-sm sm:text-base text-gray-500 leading-relaxed">
82
+ Select a conversation from the sidebar to start messaging
83
+ </p>
84
+ </div>
85
+ </div>
86
+ ));
87
+
88
+ const InboxWithAi = (props: InboxProps) => {
89
+ const [activeTab, setActiveTab] = React.useState('design');
90
+
91
+ return (
92
+ <TabContext.Provider value={{ activeTab, setActiveTab }}>
93
+ <InboxWithAiInternal {...props} />
94
+ </TabContext.Provider>
95
+ );
96
+ };
97
+
98
+ const InboxWithAiInternal = (props: InboxProps) => {
99
+ // const { channelFilters: channelFilterProp, channelRole, supportServices, data, orgName, pathPrefix = null } = props;
100
+ const { id: pathChannelId, postId: pathPostId } = useParams();
101
+ const location = useLocation();
102
+ const urlParams = location?.search ? new URLSearchParams(location.search) : null;
103
+ const { activeTab, setActiveTab } = useContext(TabContext);
104
+
105
+ // Extract channelId from query parameters (priority) or path parameters (fallback)
106
+ const channelId = urlParams?.get('id') || pathChannelId;
107
+
108
+ // Handle refresh sandbox
109
+ const handleRefreshSandbox = useCallback(() => {
110
+ console.log('Refreshing sandbox...');
111
+ }, []);
112
+
113
+ // Hooks - improved responsive breakpoints with better granularity
114
+ const { width: windowWidth, height: windowHeight } = useWindowDimensions();
115
+ const isMobileView = useMediaQuery('(max-width: 640px)');
116
+ const isSmallTabletView = useMediaQuery('(min-width: 641px) and (max-width: 900px)');
117
+ const isTabletView = useMediaQuery('(min-width: 901px) and (max-width: 1024px)');
118
+ const isDesktopView = useMediaQuery('(min-width: 1025px)');
119
+ const isLargeDesktopView = useMediaQuery('(min-width: 1440px)');
120
+ const isSmallScreen = useMediaQuery('(max-width: 900px)');
121
+ // const auth = useSelector(userSelector);
122
+
123
+ const detailSidebarOptions = useMemo(
124
+ () => ({
125
+ isMobileView,
126
+ isSmallTabletView,
127
+ isTabletView,
128
+ isDesktopView,
129
+ isLargeDesktopView,
130
+ isSmallScreen,
131
+ }),
132
+ [isMobileView, isSmallTabletView, isTabletView, isDesktopView, isLargeDesktopView, isSmallScreen],
133
+ );
134
+
135
+ return (
136
+ <>
137
+ {/* Main Container */}
138
+ <div className="flex flex-col h-screen overflow-hidden">
139
+ {/* Header with Design/Interact/Code tabs - now inside main container */}
140
+ {channelId && (
141
+ <div className="flex-shrink-0 bg-white ">
142
+ <div className="flex items-center justify-between px-4 py-3">
143
+ <div className="flex items-center">
144
+ {/* Show tabs only on larger screens */}
145
+ {!isSmallScreen && (
146
+ <div className="flex bg-gray-100 p-2" style={{ borderRadius: '10px' }}>
147
+ <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')}
173
+ className={`flex items-center space-x-2 px-4 py-2 text-xs font-medium transition-all duration-200 ${
174
+ activeTab === 'interact'
175
+ ? 'bg-blue-500 text-white shadow-sm'
176
+ : 'text-gray-600 hover:text-gray-900'
177
+ }`}
178
+ style={{ borderRadius: '10px' }}
179
+ >
180
+ <svg
181
+ className="w-4 h-4"
182
+ fill="none"
183
+ stroke="currentColor"
184
+ viewBox="0 0 24 24"
185
+ >
186
+ <path
187
+ strokeLinecap="round"
188
+ strokeLinejoin="round"
189
+ strokeWidth={2}
190
+ d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
191
+ />
192
+ <path
193
+ strokeLinecap="round"
194
+ strokeLinejoin="round"
195
+ strokeWidth={2}
196
+ 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
+ />
198
+ </svg>
199
+ <span>Interact</span>
200
+ </button>
201
+ <button
202
+ onClick={() => setActiveTab('code')}
203
+ className={`flex items-center space-x-2 px-4 py-2 text-xs font-medium transition-all duration-200 ${
204
+ activeTab === 'code'
205
+ ? 'bg-blue-500 text-white shadow-sm'
206
+ : 'text-gray-600 hover:text-gray-900'
207
+ }`}
208
+ style={{ borderRadius: '10px' }}
209
+ >
210
+ <svg
211
+ className="w-4 h-4"
212
+ fill="none"
213
+ stroke="currentColor"
214
+ viewBox="0 24 24"
215
+ >
216
+ <path
217
+ strokeLinecap="round"
218
+ strokeLinejoin="round"
219
+ strokeWidth={2}
220
+ d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"
221
+ />
222
+ </svg>
223
+ <span>Code</span>
224
+ </button>
225
+ </div>
226
+ )}
227
+ </div>
228
+
229
+ {/* Refresh icon on the right - hidden on mobile */}
230
+ {isDesktopView && (
231
+ <button
232
+ onClick={handleRefreshSandbox}
233
+ className="p-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 rounded-lg transition-colors"
234
+ title="Refresh Sandbox"
235
+ >
236
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
237
+ <path
238
+ strokeLinecap="round"
239
+ strokeLinejoin="round"
240
+ strokeWidth={2}
241
+ d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
242
+ />
243
+ </svg>
244
+ </button>
245
+ )}
246
+ </div>
247
+ </div>
248
+ )}
249
+
250
+ {/* Content Grid - ContentComponent and RightSidebar */}
251
+ <div
252
+ className="flex-1 grid overflow-hidden"
253
+ style={{
254
+ gridTemplateColumns: isDesktopView ? '35% 65%' : '1fr',
255
+ height: 'calc(100vh - 80px)', // Subtract header height
256
+ }}
257
+ >
258
+ {/* Main Content Area - 35% width on desktop */}
259
+ <div
260
+ className={`
261
+ ${isMobileView && !channelId ? 'hidden' : 'flex'}
262
+ flex flex-col overflow-hidden transition-all duration-300 ease-in-out
263
+ `}
264
+ style={{ paddingTop: '15px' }}
265
+ >
266
+ {channelId ? <ContentComponent channelId={channelId} /> : <EmptyState />}
267
+ </div>
268
+
269
+ {/* Right Sidebar - 65% width on desktop only */}
270
+ {channelId && isDesktopView && (
271
+ <div
272
+ className="overflow-hidden border"
273
+ style={{ marginBottom: 10, marginRight: 10, borderRadius: 10 }}
274
+ >
275
+ <RightSidebarContent
276
+ detailSidebarOptions={detailSidebarOptions}
277
+ windowWidth={windowWidth}
278
+ windowHeight={windowHeight}
279
+ />
280
+ </div>
281
+ )}
282
+ </div>
283
+ </div>
284
+ </>
285
+ );
286
+ };
287
+
288
+ const ContentComponent = React.memo((props: any) => {
289
+ const { channelId } = props;
290
+
291
+ return (
292
+ <div className="flex overflow-hidden h-full">
293
+ {/* Main Chat Content */}
294
+ <div className="flex-1 flex flex-col min-w-0 overflow-hidden border-t border-gray-300">
295
+ {/* Content based on postId */}
296
+ <div className="flex-1 flex flex-col min-h-0 overflow-hidden">
297
+ {channelId && (
298
+ <>
299
+ <MessagesComponent {...props} />
300
+ </>
301
+ )}
302
+ </div>
303
+ </div>
304
+ </div>
305
+ );
306
+ });
307
+
308
+ const RightSidebarWrapper = React.memo(({ detailSidebarOptions }: any) => {
309
+ const { activeTab } = useContext(TabContext);
310
+ return (
311
+ <div className="h-full flex flex-col overflow-hidden bg-white">
312
+ {/* Content Area */}
313
+ <div className="flex-1 overflow-hidden">
314
+ {activeTab === 'design' ? (
315
+ <div className="h-full flex items-center justify-center bg-gray-50">
316
+ <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 */}
350
+ <div className="mb-8">
351
+ <svg
352
+ className="w-32 h-32 mx-auto text-blue-500"
353
+ fill="none"
354
+ stroke="currentColor"
355
+ viewBox="0 0 24 24"
356
+ >
357
+ <path
358
+ strokeLinecap="round"
359
+ strokeLinejoin="round"
360
+ strokeWidth={1}
361
+ d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
362
+ />
363
+ <path
364
+ strokeLinecap="round"
365
+ strokeLinejoin="round"
366
+ strokeWidth={1}
367
+ 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"
368
+ />
369
+ </svg>
370
+ </div>
371
+
372
+ <div className="space-y-4 text-gray-600">
373
+ <h3 className="text-lg font-semibold text-gray-900">Interactive Mode</h3>
374
+ <p className="font-mono text-sm bg-blue-100 px-3 py-1 rounded">
375
+ Live interaction and testing
376
+ </p>
377
+ <p>Test and interact with your components in real-time.</p>
378
+ </div>
379
+
380
+ <div className="mt-8 space-y-4">
381
+ <button className="bg-blue-500 text-white px-6 py-3 rounded-full hover:bg-blue-600 transition-colors flex items-center space-x-2 mx-auto">
382
+ <svg className="w-4 h-4" fill="currentColor" viewBox="0 0 24 24">
383
+ <path d="M8 5v14l11-7z" />
384
+ </svg>
385
+ <span>Start Interacting</span>
386
+ </button>
387
+ <p className="text-sm text-gray-500 underline cursor-pointer hover:text-gray-700">
388
+ Learn about interactions
389
+ </p>
390
+ </div>
391
+ </div>
392
+ </div>
393
+ ) : (
394
+ <div className="h-full bg-gray-900 text-gray-300 p-4 overflow-auto">
395
+ <div className="font-mono text-sm">
396
+ <div className="mb-4">
397
+ <div className="text-green-400">// app/page.tsx</div>
398
+ </div>
399
+ <div className="space-y-2">
400
+ <div>
401
+ <span className="text-purple-400">export</span>{' '}
402
+ <span className="text-purple-400">default</span>{' '}
403
+ <span className="text-blue-400">function</span>{' '}
404
+ <span className="text-yellow-400">Home</span>() {'{'}
405
+ </div>
406
+ <div className="ml-4">
407
+ <span className="text-purple-400">return</span> (
408
+ </div>
409
+ <div className="ml-8">
410
+ {'<'}
411
+ <span className="text-red-400">main</span>{' '}
412
+ <span className="text-green-400">className</span>=
413
+ <span className="text-yellow-400">
414
+ "flex min-h-screen flex-col items-center justify-between p-24"
415
+ </span>
416
+ {'>'}
417
+ </div>
418
+ <div className="ml-12">
419
+ {'<'}
420
+ <span className="text-red-400">div</span>{' '}
421
+ <span className="text-green-400">className</span>=
422
+ <span className="text-yellow-400">
423
+ "z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex"
424
+ </span>
425
+ {'>'}
426
+ </div>
427
+ <div className="ml-16">
428
+ {'<'}
429
+ <span className="text-red-400">p</span>{' '}
430
+ <span className="text-green-400">className</span>=
431
+ <span className="text-yellow-400">
432
+ "fixed left-0 top-0 flex w-full justify-center border-b border-gray-300
433
+ bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl
434
+ dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static
435
+ lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30"
436
+ </span>
437
+ {'>'}
438
+ </div>
439
+ <div className="ml-20 text-gray-400">Get started by editing&nbsp;</div>
440
+ <div className="ml-20">
441
+ {'<'}
442
+ <span className="text-red-400">code</span>{' '}
443
+ <span className="text-green-400">className</span>=
444
+ <span className="text-yellow-400">"font-mono font-bold"</span>
445
+ {'>'}app/page.tsx{'</'}
446
+ <span className="text-red-400">code</span>
447
+ {'>'}
448
+ </div>
449
+ <div className="ml-16">
450
+ {'</'}
451
+ <span className="text-red-400">p</span>
452
+ {'>'}
453
+ </div>
454
+ <div className="ml-12">
455
+ {'</'}
456
+ <span className="text-red-400">div</span>
457
+ {'>'}
458
+ </div>
459
+ <div className="ml-8">
460
+ {'</'}
461
+ <span className="text-red-400">main</span>
462
+ {'>'}
463
+ </div>
464
+ <div className="ml-4">);</div>
465
+ <div>{'}'}</div>
466
+ </div>
467
+ </div>
468
+ </div>
469
+ )}
470
+ </div>
471
+ </div>
472
+ );
473
+ });
474
+
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
+ });
489
+
490
+ const MessagesComponent = React.memo((props: any) => {
491
+ return <Outlet context="app" />;
492
+ });
493
+
494
+ // Display names for debugging
495
+ InboxWithAi.displayName = 'Inbox';
496
+ InboxWithAiInternal.displayName = 'InboxWithAiInternal';
497
+ ContentComponent.displayName = 'ContentComponent';
498
+ MessagesComponent.displayName = 'MessagesComponent';
499
+ RightSidebarWrapper.displayName = 'RightSidebarWrapper';
500
+ RightSidebarContent.displayName = 'RightSidebarContent';
501
+
502
+ export default React.memo(InboxWithAi);
@@ -0,0 +1 @@
1
+ export { default as InboxWithAi } from './InboxWithAi';