Skip to content

Avatar alignment, markdown render and other UX fixes in chat#267

Open
dhirenmathur wants to merge 1 commit into
mainfrom
chat_ux
Open

Avatar alignment, markdown render and other UX fixes in chat#267
dhirenmathur wants to merge 1 commit into
mainfrom
chat_ux

Conversation

@dhirenmathur

@dhirenmathur dhirenmathur commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

@nndn

  1. Avatar alignment is fixed in this commit
  2. Markdown rendering on sent message is fixed as well

Copy button works for me locally, verified in prod as well
Attachment button work for me locally, probably needs env change in prod/

MCP support for conversations will be added in a later PR WIP
Staging logging is restored

Agent selection - will be fixed with new UX

Summary by CodeRabbit

  • New Features

    • Added Markdown rendering support for user messages in chat threads
  • Bug Fixes

    • Improved vertical alignment of messages and avatars for better visual consistency

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Thread.tsx UI layer receives vertical alignment adjustments for UserMessage and AssistantMessage containers and their avatars. UserMessage now supports Markdown rendering by injecting MarkdownText into MessagePrimitive.Parts. Package.json adds react-virtuoso dependency and reorders zustand/zod entries.

Changes

Cohort / File(s) Summary
Message UI Alignment
app/(main)/chat/[chatId]/components/Thread.tsx
UserMessage container changed from align-items: center to align-items: start; Avatar updated to self-start. AssistantMessage wrapper now uses grid with items-start alignment; Avatar also set to self-start. Adjusts vertical positioning of message content and avatars.
Markdown Rendering Enhancement
app/(main)/chat/[chatId]/components/Thread.tsx
MarkdownText injected into MessagePrimitive.Parts for UserMessage component, enabling Markdown formatting in user messages alongside existing Image handling.
Dependencies Update
package.json
Added react-virtuoso (^4.18.1) to dependencies. Reordered zustand (^5.0.8) and zod (^3.25.76) in dependencies block without version changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • nndn
  • Zingzy

Poem

🐰 Hop, hop—alignment springs to start,
Markdown blooms in messages' heart,
Virtuoso joins the dependencies' dance,
Threading through with graceful stance!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: avatar alignment fixes, markdown rendering for user messages, and layout adjustments in the chat thread component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chat_ux

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

sonarqubecloud Bot commented Jan 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66d9cbd and 7e42d17.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • app/(main)/chat/[chatId]/components/Thread.tsx
  • package.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Use PascalCase for component names and camelCase for utility names
Order imports: React/Next imports first, then components, then utilities
Use Next.js error boundaries, optional chaining, and nullish coalescing for error handling

Files:

  • app/(main)/chat/[chatId]/components/Thread.tsx
**/*.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.tsx: Use Tailwind CSS for styling and the cn utility for conditional classes
Use functional components with TypeScript FC types
Prefer destructuring props at the component level
Use the "use client" directive for client components

Files:

  • app/(main)/chat/[chatId]/components/Thread.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-22T09:20:21.427Z
Learnt from: CR
Repo: potpie-ai/potpie-ui PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-07-22T09:20:21.427Z
Learning: Use Redux Toolkit with Redux Persist for global state management, and React hooks for local state

Applied to files:

  • package.json
🧬 Code graph analysis (1)
app/(main)/chat/[chatId]/components/Thread.tsx (2)
components/assistant-ui/markdown-text.tsx (1)
  • MarkdownText (131-131)
components/ui/avatar.tsx (1)
  • Avatar (50-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build, Deploy, and Comment
🔇 Additional comments (3)
app/(main)/chat/[chatId]/components/Thread.tsx (3)

248-248: LGTM! Avatar alignment improvements.

The changes to use items-start on the container and self-start on the avatar improve the vertical alignment, especially for multi-line messages where the avatar should align with the first line of text rather than center vertically.

Also applies to: 263-263


640-641: LGTM! Consistent avatar alignment for assistant messages.

The alignment changes mirror the UserMessage improvements, ensuring consistent visual behavior across both user and assistant messages. The items-start grid alignment and self-start avatar positioning work together to properly align the avatar with the first line of message content.


257-257: MarkdownText component is secure by default and does not require additional sanitization.

The MarkdownText component uses react-markdown with only the remark-gfm plugin, which builds a virtual DOM and does not parse HTML. This is inherently safe against XSS. No raw HTML parsing (via rehype-raw) is enabled, and no dangerouslySetInnerHTML is used for user content. DOMPurify is not a production dependency, and rehype-sanitize is not needed because user input cannot be rendered as raw HTML in this configuration.

Likely an incorrect or invalid review comment.

Comment thread package.json
"react-markdown": "^9.1.0",
"react-redux": "^9.2.0",
"react-syntax-highlighter": "^15.6.1",
"react-virtuoso": "^4.18.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for react-virtuoso imports and usage

echo "=== Searching for react-virtuoso imports ==="
rg -n --type=ts --type=tsx "from ['\"]react-virtuoso['\"]" || echo "No direct imports found"

echo ""
echo "=== Searching for Virtuoso component usage ==="
rg -n --type=ts --type=tsx "<Virtuoso|VirtuosoGrid|useVirtual" || echo "No Virtuoso components found"

echo ""
echo "=== Broader search for 'virtuoso' references ==="
rg -i -n --type=ts --type=tsx "virtuoso" || echo "No virtuoso references found"

Repository: potpie-ai/potpie-ui

Length of output: 388


🏁 Script executed:

#!/bin/bash
# Broader search without file type restrictions

echo "=== Searching for any 'virtuoso' references (case-insensitive) ==="
rg -i "virtuoso" . --max-count=20 || echo "No virtuoso references found anywhere"

echo ""
echo "=== Checking if react-virtuoso is listed in package.json ==="
cat package.json | grep -A2 -B2 "react-virtuoso" || echo "Not found in package.json"

Repository: potpie-ai/potpie-ui

Length of output: 565


Remove unused react-virtuoso dependency.

The react-virtuoso package (^4.18.1) is listed in package.json but is not imported or used anywhere in the codebase. Remove it from dependencies to avoid unnecessary package bloat.

🤖 Prompt for AI Agents
In package.json around line 77, remove the unused "react-virtuoso": "^4.18.1"
dependency entry from the dependencies list; after removing the line, run
package manager cleanup (npm/yarn/pnpm) to update lockfile and node_modules
(e.g., npm install or yarn install), and run project tests/build to ensure
nothing breaks.

@github-actions

github-actions Bot commented Jan 3, 2026

Copy link
Copy Markdown

Cloud Run service deployed: https://pr-chat-ux-cj6r7x3fpa-uc.a.run.app

@dhirenmathur dhirenmathur requested a review from nndn January 3, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant