• Will Chen's avatar
    Add scroll to bottom button (#1484) · 83126a7e
    Will Chen 提交于
    Based on #1425 
    
    
    <!-- CURSOR_SUMMARY -->
    ---
    
    > [!NOTE]
    > Adds a floating scroll-to-bottom button and refines scroll/auto-scroll
    behavior with layout tweaks to support an overlay.
    > 
    > - **Chat UI**:
    > - **Scroll-to-bottom button**: Adds floating button in `ChatPanel`
    (uses `Button` and `ArrowDown`) that appears when scrolled away and
    scrolls smoothly to the latest message.
    > - **Scroll logic**: Introduces `getDistanceFromBottom`,
    `isNearBottom`, and a `scrollAwayThreshold`; auto-scroll now triggers
    only when near the bottom; refactors `handleScroll` with `useCallback`
    and longer idle timeout.
    > - **Layout**: Wraps `MessagesList` in a `relative` container and
    renders a centered absolute button overlay; adjusts `MessagesList` root
    to `absolute inset-0` for proper overlay behavior.
    > - **Misc**: Updates effect dependencies and console log message
    related to streaming/scrolling.
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    2e1b844830ae26cfc40840b9e8216fefad112a5e. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    Co-authored-by: 's avatarMd Rakibul Islam Rocky <mdrirocky08@outlook.com>
    83126a7e
MessagesList.tsx 10.2 KB