Skip to content

Commit 3f3b295

Browse files
committed
perf: empty base ui dark color adjustment etc
1 parent 14caa72 commit 3f3b295

File tree

4 files changed

+72
-12
lines changed

4 files changed

+72
-12
lines changed

‎apps/nextjs-app/src/features/app/base/ChatPage/PromptBox.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,10 @@ export const PromptBox: React.FC<IPromptBoxProps> = ({ onEnter }) => {
439439
},
440440
],
441441
},
442-
];
442+
] as const;
443443
return (
444444
<div className="mx-auto flex w-full justify-center px-4 sm:px-6 lg:px-8">
445-
<div className="shadow-black/6 w-full max-w-3xl rounded-2xl border border-gray-200 bg-card p-4 text-left shadow-sm">
445+
<div className="shadow-black/6 w-full max-w-3xl rounded-2xl border bg-card p-4 text-left shadow-sm">
446446
<div className="relative space-y-2 rounded-2xl bg-muted px-6 py-3">
447447
<textarea
448448
id="prompt-box"
@@ -493,7 +493,7 @@ export const PromptBox: React.FC<IPromptBoxProps> = ({ onEnter }) => {
493493
<Button
494494
variant={'ghost'}
495495
size={'xs'}
496-
className="flex items-center gap-1 rounded-md bg-muted/30 p-1 py-1.5 text-xs transition-colors "
496+
className="bg-sc flex items-center gap-1 rounded-md bg-secondary/50 p-1 py-1.5 text-xs transition-colors"
497497
>
498498
<ChevronRight className="size-3" />
499499
<span className="text-xs">{suggestion.title}</span>

‎apps/nextjs-app/src/features/app/base/ChatPage/Template.tsx‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ export const Template: React.FC<TemplateProps> = ({ initialTemplates: templates,
111111
<div className="relative mx-auto flex w-full max-w-[1158px] flex-col items-center justify-start gap-2 p-4 sm:px-6 lg:px-8">
112112
{/* Title */}
113113
<div className="flex items-start justify-start self-stretch">
114-
<h1 className="text-2xl font-bold text-[#121827]">
115-
{t('common:template.templateTitle')}
116-
</h1>
114+
<h1 className="text-2xl font-bold">{t('common:template.templateTitle')}</h1>
117115
</div>
118116

119117
{/* Filter and Sort Header */}
@@ -127,10 +125,10 @@ export const Template: React.FC<TemplateProps> = ({ initialTemplates: templates,
127125
size="xs"
128126
onClick={() => setActiveCategory(category.id)}
129127
className={cn(
130-
'flex justify-center items-center relative gap-1 px-3 py-2 rounded-lg border border-gray-200 transition-all duration-200 hover:bg-gray-50',
131-
activeCategory === category.id
132-
? 'bg-gray-50 border-gray-200'
133-
: 'bg-white hover:bg-gray-25'
128+
'flex justify-center items-center relative gap-1 px-3 py-2 rounded-lg border transition-all duration-200 text-card-foreground bg-card',
129+
{
130+
'text-card-foreground bg-secondary': activeCategory === category.id,
131+
}
134132
)}
135133
>
136134
<p className="text-left text-xs">{category.name}</p>

‎apps/nextjs-app/src/features/app/components/ai-chat/components/message-part/preview/ViewListDiffPreview.tsx‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ const ViewItem = (props: {
2626
options?: IViewOptions;
2727
style?: React.CSSProperties;
2828
changeViewIdId?: string;
29-
views: IViewVo[];
29+
views: {
30+
id: string;
31+
name: string;
32+
type: ViewType;
33+
isLocked?: boolean;
34+
options?: IViewOptions;
35+
style?: React.CSSProperties;
36+
}[];
3037
}) => {
3138
const { id, name, type, isLocked, style, options, changeViewIdId, views } = props;
3239
const ref = useRef<HTMLButtonElement>(null);
@@ -46,6 +53,8 @@ const ViewItem = (props: {
4653

4754
const isExpired = !views.find((view) => view.id === id);
4855

56+
console.log('ViewItemViewItemViewItem', views, currentViewId);
57+
4958
return (
5059
<Button
5160
style={style}
@@ -218,7 +227,7 @@ export const ViewListDiffPreview = (props: IViewListPreviewProps) => {
218227
return (
219228
<div className="flex gap-2 overflow-x-auto p-2">
220229
{viewList.map((view) => (
221-
<ViewItem key={view.id} {...view} changeViewIdId={changeViewIdId} views={views} />
230+
<ViewItem key={view.id} {...view} changeViewIdId={changeViewIdId} views={viewList} />
222231
))}
223232
</div>
224233
);

‎apps/nextjs-app/src/features/app/components/ai-chat/panel/ChatContainer.tsx‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const ChatContainer = forwardRef<
3535
const chatIdRef = useRef(generateChatId());
3636
const { modelKey, setModelKey } = useChatStore();
3737
const tableIdRef = useRef<string | undefined>();
38+
const viewIdRef = useRef<string | undefined>();
3839
const activeChat = useActiveChat(baseId);
3940
const queryClient = useQueryClient();
4041
const chatContext = useChatContext();
@@ -48,6 +49,10 @@ export const ChatContainer = forwardRef<
4849
tableIdRef.current = tableId;
4950
}, [tableId]);
5051

52+
useEffect(() => {
53+
viewIdRef.current = router.query.viewId as string | undefined;
54+
}, [router.query.viewId]);
55+
5156
const { data: baseAiConfig, isLoading: isBaseAiConfigLoading } = useQuery({
5257
queryKey: ['ai-config', baseId],
5358
queryFn: () => getAIConfig(baseId).then(({ data }) => data),
@@ -157,6 +162,52 @@ export const ChatContainer = forwardRef<
157162
}
158163
break;
159164
}
165+
case McpToolInvocationName.CreateView: {
166+
setTimeout(() => {
167+
const { toolCallId } = toolCall;
168+
const { tableId } = toolCall.args as { tableId: string };
169+
const partItem = messagesRef?.current
170+
?.map(({ parts }) => parts)
171+
.flat()
172+
?.find(
173+
(part) =>
174+
(part as unknown as IToolInvocationUIPart)?.toolInvocation?.toolCallId ===
175+
toolCallId
176+
);
177+
const toolInvocation = (partItem as IToolInvocationUIPart)?.toolInvocation;
178+
if (!toolInvocation) {
179+
return;
180+
}
181+
let createdViewId: string | undefined;
182+
try {
183+
const { result } = toolInvocation;
184+
const createdView = JSON.parse(result?.content?.[0]?.text);
185+
createdViewId = createdView?.view.id;
186+
} catch (error) {
187+
console.error('parse created table error', error);
188+
}
189+
if (!createdViewId) {
190+
return;
191+
}
192+
if (createdViewId !== currentTableId) {
193+
router.push(
194+
{
195+
pathname: `/base/[baseId]/[tableId]/[viewId]`,
196+
query: {
197+
baseId,
198+
tableId,
199+
viewId: createdViewId,
200+
},
201+
},
202+
undefined,
203+
{
204+
shallow: Boolean(currentTableId),
205+
}
206+
);
207+
}
208+
}, 3000);
209+
break;
210+
}
160211
case McpToolInvocationName.CreateTable: {
161212
setTimeout(() => {
162213
const { toolCallId } = toolCall;
@@ -177,7 +228,9 @@ export const ChatContainer = forwardRef<
177228
const { result } = toolInvocation;
178229
const createdTable = JSON.parse(result?.content?.[0]?.text);
179230
createdTableId = createdTable?.table.id;
231+
console.log('createdTablecreatedTablecreatedTable', createdTable);
180232
} catch (error) {
233+
console.error('createdTablecreatedTablecreatedTable', error);
181234
console.error('parse created table error', error);
182235
}
183236
if (!createdTableId) {

0 commit comments

Comments
 (0)