-
Notifications
You must be signed in to change notification settings - Fork 614
feat: add loading animation to scroll-to-bottom button during generation #784
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
Conversation
WalkthroughUI logic in MessageList.vue was revised to use a persistent bottom action container that shows either Cancel (while generating) or New Chat (when idle). The scroll-to-bottom button now appears when aboveThreshold or generating, gains a loading style during generation, and includes new CSS with spin animation for a visual loading ring. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant MessageList
participant ScrollObserver as Scroll State
participant Generation as Generation State
rect rgb(245,248,255)
note over MessageList: Idle state
ScrollObserver->>MessageList: aboveThreshold = true/false
alt aboveThreshold == true
MessageList->>User: Show "Scroll to bottom" button
else aboveThreshold == false
MessageList->>User: Hide button
end
User->>MessageList: Click "New Chat"
MessageList->>Generation: startNewChat()
end
rect rgb(255,248,240)
note over MessageList: Generating state
Generation-->>MessageList: showCancelButton = true
MessageList->>User: Show Cancel + loading-ring on bottom button
User->>MessageList: Click "Cancel"
MessageList->>Generation: cancelGeneration()
Generation-->>MessageList: showCancelButton = false
MessageList->>User: Switch to "New Chat", remove loading-ring
end
User->>MessageList: Click bottom button
MessageList->>MessageList: scrollToBottom()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/renderer/src/components/message/MessageList.vue (4)
34-41: Use English comments and add type="button" to avoid implicit form submits
- Per repo guidelines, comments/logs should be in English. Please translate the inline comment.
- Add type="button" on the Button to prevent accidental form submissions if this component is ever nested inside a form.
- <!-- 取消按钮 --> + <!-- Cancel button --> <Button v-if="showCancelButton" variant="outline" size="sm" - class="rounded-lg" + class="rounded-lg" + type="button" @click="handleCancel" >
50-57: Translate comment to English and add type="button"
- Keep comments in English to meet the codebase guideline.
- Explicitly set type="button" on the Button.
- <!-- 新聊天按钮 (仅在非生成状态显示) --> + <!-- New chat button (only when not generating) --> <Button v-if="!showCancelButton" variant="outline" size="sm" class="rounded-lg shrink-0" + type="button" @click="createNewThread" >
420-474: Loading ring CSS: support reduced motion and remove duplicate positioning
- Respect users with reduced motion preferences by disabling the spin animation.
- position: relative is already applied via the template class; remove duplication here.
- Optionally keep the ring behind content with an explicit z-index on ::after.
.scroll-to-bottom-loading { - position: relative; overflow: visible; } @@ .scroll-to-bottom-loading::after { content: ''; position: absolute; @@ animation: spin 1.2s linear infinite; pointer-events: none; will-change: transform; + z-index: 0; } @keyframes spin { to { transform: rotate(360deg); } } + +@media (prefers-reduced-motion: reduce) { + .scroll-to-bottom-loading::after { + animation: none; + } +}
368-371: Optional: Enhance clarity of theshowCancelButtoncomputedI verified that
generatingThreadIdsis initialized as a reactiveSet<string>and is consistently mutated via.add()/.delete()insrc/renderer/src/stores/chat.ts, so Vue will correctly trackSet.hascalls. The existing code works as intended; the suggested change is purely a readability nit.• Location:
src/renderer/src/components/message/MessageList.vuelines 368–371
• Current implementation reacts togeneratingThreadIds.has(activeThreadId || ''), which safely handlesundefinedbut embeds the default here.
• Proposed tweak pulls out the ID and uses an explicit truthiness check, making the intent more obvious.-const showCancelButton = computed(() => { - return chatStore.generatingThreadIds.has(chatStore.getActiveThreadId() ?? '') -}) +const showCancelButton = computed(() => { + const id = chatStore.getActiveThreadId() + return !!id && chatStore.generatingThreadIds.has(id) +})
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/renderer/src/components/message/MessageList.vue(3 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for logs and comments
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/src/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI componentsUse scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/src/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/src/**/*.{ts,tsx,vue}: Use Pinia for frontend state management
Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/src/**/*
📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/**/*.{vue,ts}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
Implement lazy loading for routes and components.
Files:
src/renderer/src/components/message/MessageList.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.
Files:
src/renderer/src/components/message/MessageList.vue
⏰ 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-check (x64)
🔇 Additional comments (1)
src/renderer/src/components/message/MessageList.vue (1)
71-78: Add missing i18n key and improve the icon-only button for accessibilityIt looks like the translation key
common.scrollToBottomis not defined in any of your locale files undersrc/renderer/src/i18n/**/common.json. Please add entries in each locale before usingt('common.scrollToBottom').• In each
/src/renderer/src/i18n/<locale>/common.json, add:{ // …existing keys… "scrollToBottom": "Scroll to Bottom" }(and the appropriate translations in non-en files)
• Update the
<Button>insrc/renderer/src/components/message/MessageList.vueas follows:- <Button - v-if="aboveThreshold || showCancelButton" - variant="outline" - size="icon" - :class="[ - 'w-8 h-8 shrink-0 rounded-lg relative', - showCancelButton ? 'scroll-to-bottom-loading' : '' - ]" - @click="scrollToBottom" - > + <Button + v-if="aboveThreshold || showCancelButton" + variant="outline" + size="icon" + :class="[ + 'w-8 h-8 shrink-0 rounded-lg relative', + { 'scroll-to-bottom-loading': showCancelButton } + ]" + :aria-label="t('common.scrollToBottom')" + :title="t('common.scrollToBottom')" + :aria-busy="showCancelButton" + type="button" + @click="scrollToBottom" + > <!-- icon-only content --> </Button>• These changes:
- Simplify the conditional class binding (object syntax)
- Add
aria-label/titlevia i18n- Expose loading state with
aria-busy- Explicitly set
type="button"
add loading animation to scroll-to-bottom button during generation
Summary by CodeRabbit
New Features
Style