Skip to content

Conversation

@James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Oct 17, 2025

fix: optimize the remote control style 优化遥控器样式

act

Summary by CodeRabbit

  • New Features

    • Added a reusable tooltip for copy actions on remote links and codes.
    • Menu items now include multi-line descriptions, clearer labels for QR login, AI chat, remote link, and remote code.
    • Menu items can display status flags (e.g., active/known) to convey state.
  • Style

    • Redesigned dropdown: rounded corners, increased padding, fixed width, larger spacing and icon sizing for improved readability.

@coderabbitai
Copy link

coderabbitai bot commented Oct 17, 2025

Walkthrough

Adds a new Tooltip class and integrates tooltip-ready copy hints into the remote controller UI; updates menu item shape and rendering with new SVG icons and multi-line descriptions; and adjusts build and TypeScript settings for Vite and SVG ?url imports.

Changes

Cohort / File(s) Summary
New Tooltip Module
packages/next-sdk/remoter/tooltips.ts
Adds a self-contained Tooltip class with placement & trigger options, show/hide delays, viewport-aware positioning and fallback placements, event binding for hover/focus/click, outside-click handling, lazy DOM + CSS injection, and public methods open(), close(), toggle(), destroy().
Remote controller UI & logic
packages/next-sdk/remoter/createRemoter.ts
Extends MenuItemConfig with active?: boolean, know?: boolean, desc?: string. Imports Tooltip and SVG assets; updates default menu items (texts, descs, actions, icons, flags). Reworks dropdown rendering to a multi-line content layout, adds getImageUrl() and renderItem() for icon wiring after DOM insertion, invokes readyTips() for copy-enabled items, and adjusts related CSS/layout.
Build & TypeScript environment
packages/next-sdk/package.json, packages/next-sdk/tsconfig.json, packages/next-sdk/vite-env.d.ts
package.json: build script changed from tsc to tsc && vite build. tsconfig.json: adds "types": ["vite/client"] to compilerOptions. vite-env.d.ts: adds /// <reference types="vite/client" /> and declares module '*.svg?url' exporting a default string.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User
    participant FloatingBlock
    participant Dropdown
    participant MenuItem
    participant Tooltip
    participant DOM

    Note over FloatingBlock,DOM: Dropdown creation
    FloatingBlock->>DOM: create dropdown DOM
    FloatingBlock->>MenuItem: renderItem() -> load SVG into icon container
    FloatingBlock->>Tooltip: readyTips(itemEl) for copy-enabled items
    Tooltip->>DOM: inject CSS (once) & attach tooltip DOM

    Note over User,Dropdown: User interaction
    User->>Dropdown: hover / click a menu item
    Dropdown->>MenuItem: event handler
    MenuItem->>Tooltip: open() / toggle() (for copy hint)
    Tooltip->>DOM: compute placement & show
    User->>MenuItem: move/ click elsewhere
    Tooltip->>DOM: hide() / close()
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 I stitched new tips that pop and gleam,
Icons hop in rows, each with a theme,
Descriptions nestle, line by line,
Copy hints ready — sparkle, align,
A tiny ribbon for each sign. ✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between c42ce50 and 295b447.

📒 Files selected for processing (3)
  • packages/next-sdk/package.json (1 hunks)
  • packages/next-sdk/tsconfig.json (1 hunks)
  • packages/next-sdk/vite-env.d.ts (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

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.

2 participants