feat: add typing indicator with ChatBubble component

- Add ChatBubble component for reusable chat bubble styling
- Add TypingIndicator component with animated dots (. .. ...)
- Show typing indicator after 500ms delay while waiting for AI response
- Refactor ChatMessage to use ChatBubble component
- Add isWaitingForResponse state to ChatStore
This commit is contained in:
2026-01-12 22:49:21 +01:00
parent 489c0271c9
commit 1dbca79edd
5 changed files with 97 additions and 15 deletions

View File

@@ -13,14 +13,17 @@ export type MessageData = {
interface ChatState {
messages: MessageData[];
isWaitingForResponse: boolean;
addMessages: (messages: MessageData[]) => void;
addMessage: (message: MessageData) => void;
updateMessage: (id: string, updates: Partial<MessageData>) => void;
clearMessages: () => void;
setWaitingForResponse: (waiting: boolean) => void;
}
export const useChatStore = create<ChatState>((set) => ({
messages: [],
isWaitingForResponse: false,
addMessages(messages) {
set((state) => ({ messages: [...state.messages, ...messages] }));
},
@@ -37,6 +40,9 @@ export const useChatStore = create<ChatState>((set) => ({
clearMessages: () => {
set({ messages: [] });
},
setWaitingForResponse: (waiting: boolean) => {
set({ isWaitingForResponse: waiting });
},
}));
// Helper to convert server ChatMessage to client MessageData