Merged
Conversation
This commit significantly refactors the chat screen UI and introduces several new components to improve user experience and code organization.
Key changes include:
- **`EclairApp.kt`**: Wrapped the `ChatScreen` with `Scaffold` for better layout structure.
- **`ChatScreen.kt`**:
- Refactored `ChatScreen` into `ChatScreenContent` for better modularity and previewability.
- Added `WindowInsets` padding for system bars and IME to handle keyboard overlap.
- Set background color using `MaterialTheme.colorScheme.background`.
- Integrated new components: `ChatHeader`, `ChatMessagesList`, and `MessageInputArea`.
- Updated sample data in `ChatScreenPreview` to reflect new message structure and streaming state.
- **New Components:**
- **`ChatHeader.kt`**: Created a `TopAppBar` component to display the chat title.
- **`MessageBubble.kt`**: Introduced a reusable `Card` based component to display individual chat messages with customizable background, text color, and a streaming indicator (linear progress bar).
- **`SenderMessage.kt`**: A component that utilizes `MessageBubble` to display messages sent by the user, aligned to the end.
- **`ReceiverMessage.kt`**: A component that utilizes `MessageBubble` to display messages received from the assistant, aligned to the start, and includes a visual cue for streaming messages.
- **`ChatMessagesList.kt`**: A `LazyColumn` component to display the list of chat messages, with auto-scrolling to the latest message.
- **`MessageInputArea.kt`**: A `Card` based component containing an `OutlinedTextField` for message input and an `IconButton` to send messages. It handles keyboard actions and input validation.
- **Dependencies:** Added `compose.materialIconsExtended` to `build.gradle.kts` for access to more icons.
These changes provide a more polished and functional chat interface, with clear separation of concerns for UI elements.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.