-
Notifications
You must be signed in to change notification settings - Fork 0
Feature chatbot session #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
badarouzia
wants to merge
17
commits into
staging
Choose a base branch
from
feature-chatbot-session
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d62fc7d
feat(chatbot): add remaining atom components ChatInput, ChatAvatar, aβ¦
badarouzia a599e80
feat: inject ChatWidget globally in root layout
badarouzia 9d3dd34
fix file format
badarouzia bd8a6ad
fix: force prettier format on ChatWidget
badarouzia da14eb3
fix: cleanup timeout, unmount ChatWindow when closed, prevent scroll β¦
badarouzia 2fdcf33
fix: restore auth guard and use semantic tokens in ai-chat route
badarouzia e53e440
fix: file format
badarouzia c11f27c
fix: file format
badarouzia 54ba74c
Potential fix for pull request finding
badarouzia 6fe05dd
fix: file format
badarouzia ad3a0c8
Potential fix for pull request finding
badarouzia e00208b
Potential fix for pull request finding
badarouzia 5474294
fix: file format for prettier validation
badarouzia 1694d11
refactor: apply design tokens, reuse atoms, fix drag leak in chatbot
BhuvanArn ba797f5
fix: clamp FAB drag, fix listener leaks, focus dialog, brand-gradientβ¦
BhuvanArn bdc5e9c
fix: chatbot non-modal popover a11y and stable message ids
BhuvanArn cda4ec5
fix: keep chat input focusable while AI replies, drop nested live region
BhuvanArn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| llm/** filter=lfs diff=lfs merge=lfs -text | ||
| *.md text eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /** | ||
| * ChatAvatar | ||
| * | ||
| * Displays a small circular avatar inside the chatbot interface. | ||
| * The 'ai' variant uses the TalkUp gradient with a "T" initial. | ||
| * The 'user' variant uses a neutral background with a "U" initial. | ||
| * | ||
| * @param props - ChatAvatarProps | ||
| * @returns A circular avatar badge as a React functional component. | ||
| * | ||
| * @example | ||
| * <ChatAvatar variant="ai" /> | ||
| * <ChatAvatar variant="user" size="lg" /> | ||
| */ | ||
|
|
||
| interface ChatAvatarProps { | ||
| /** 'ai' for the TalkUp assistant avatar, 'user' for the current user */ | ||
| variant: 'ai' | 'user'; | ||
| /** Visual size β 'sm' for message rows, 'lg' for the window header */ | ||
| size?: 'sm' | 'lg'; | ||
| } | ||
|
|
||
| const sizeClasses = { | ||
| sm: 'w-7 h-7 text-body-s', | ||
| lg: 'w-9 h-9 text-body-m', | ||
| } as const; | ||
|
|
||
| export const ChatAvatar = ({ variant, size = 'sm' }: ChatAvatarProps) => { | ||
| const isAi = variant === 'ai'; | ||
|
|
||
| return ( | ||
| <div | ||
| className={`${sizeClasses[size]} rounded-full flex-shrink-0 flex items-center justify-center font-bold ${ | ||
| isAi | ||
| ? 'bg-brand-gradient text-white' | ||
| : 'bg-surface-raised text-text-weak' | ||
| }`} | ||
| > | ||
| {isAi ? 'T' : 'U'} | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * ChatBubble | ||
| * | ||
| * Renders a single message bubble inside the chatbot widget. | ||
| * Supports two variants: 'ai' (left-aligned, surface background) and | ||
| * 'user' (right-aligned, TalkUp gradient background). | ||
| * | ||
| * @param props - ChatBubbleProps | ||
| * @returns A styled message bubble as a React functional component. | ||
| * | ||
| * @example | ||
| * <ChatBubble variant="ai" message="Hello! How can I help?" /> | ||
| * <ChatBubble variant="user" message="Tell me about interviews." /> | ||
| */ | ||
|
|
||
| interface ChatBubbleProps { | ||
| /** The text content of the message */ | ||
| message: string; | ||
| /** Visual variant: 'ai' for assistant messages, 'user' for user messages */ | ||
| variant: 'ai' | 'user'; | ||
| } | ||
|
|
||
| export const ChatBubble = ({ message, variant }: ChatBubbleProps) => { | ||
| const isAi = variant === 'ai'; | ||
|
|
||
| return ( | ||
| <div | ||
| className={`max-w-[220px] px-3 py-2 rounded-2xl text-body-s leading-relaxed ${ | ||
| isAi | ||
| ? 'bg-surface border border-border text-text rounded-bl-sm' | ||
| : 'bg-brand-gradient text-white rounded-br-sm' | ||
| }`} | ||
| > | ||
| {message} | ||
| </div> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { BaseInput } from '@/components/atoms/base-input'; | ||
| import React from 'react'; | ||
|
|
||
| /** | ||
| * ChatInput | ||
| * | ||
| * A controlled single-line text input for the chatbot message bar. | ||
| * Thin wrapper around the shared BaseInput atom so focus-ring, disabled and | ||
| * accessibility behaviour stay consistent with the rest of the design system. | ||
| * Triggers onSend when the user presses Enter (without Shift). | ||
| * | ||
| * @param props - ChatInputProps | ||
| * @returns A styled text input as a React functional component. | ||
| * | ||
| * @example | ||
| * <ChatInput | ||
| * value={message} | ||
| * onChange={setMessage} | ||
| * onSend={handleSend} | ||
| * placeholder="Ask a question..." | ||
| * /> | ||
| */ | ||
|
|
||
| interface ChatInputProps { | ||
| /** Current value of the input */ | ||
| value: string; | ||
| /** Callback fired on each keystroke */ | ||
| onChange: (value: string) => void; | ||
| /** Callback fired when the user presses Enter */ | ||
| onSend: () => void; | ||
| /** Placeholder text */ | ||
| placeholder?: string; | ||
| /** Whether the input is disabled */ | ||
| disabled?: boolean; | ||
| } | ||
|
|
||
| export const ChatInput = React.forwardRef<HTMLInputElement, ChatInputProps>( | ||
| ( | ||
| { | ||
| value, | ||
| onChange, | ||
| onSend, | ||
| placeholder = 'Ask a question...', | ||
| disabled = false, | ||
| }, | ||
| ref, | ||
| ) => { | ||
| const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => { | ||
| if (e.key === 'Enter' && !e.shiftKey) { | ||
| e.preventDefault(); | ||
| onSend(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <BaseInput | ||
| ref={ref} | ||
| // `name` drives BaseInput's accessible name (aria-label). | ||
| name="Chat message input" | ||
| value={value} | ||
| onChange={(e) => onChange(e.target.value)} | ||
| onKeyDown={handleKeyDown} | ||
| placeholder={placeholder} | ||
| disabled={disabled} | ||
| className="flex-1 rounded-xl bg-background focus:bg-surface" | ||
| /> | ||
| ); | ||
| }, | ||
| ); | ||
|
|
||
| ChatInput.displayName = 'ChatInput'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * TypingIndicator | ||
| * | ||
| * Displays an animated three-dot indicator to signal that the TalkUp AI | ||
| * is currently generating a response. Uses CSS animations via Tailwind. | ||
| * | ||
| * @returns An animated typing indicator as a React functional component. | ||
| * | ||
| * @example | ||
| * {isTyping && <TypingIndicator />} | ||
| */ | ||
|
|
||
| export const TypingIndicator = () => { | ||
| return ( | ||
| <div | ||
| className="flex items-center gap-1 px-3 py-2" | ||
| // No own live region: this sits inside ChatWindow's role="log" | ||
| // aria-live="polite" list, so a nested status region would | ||
| // double-announce on some screen readers. | ||
| aria-label="TalkUp AI is typing" | ||
| > | ||
| {[0, 1, 2].map((i) => ( | ||
| <span | ||
| key={i} | ||
| className="w-1.5 h-1.5 rounded-full bg-text-weaker animate-bounce" | ||
| style={{ animationDelay: `${i * 0.2}s` }} | ||
| /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.