Skip to content

Fix utility of AT button#68

Merged
ValwareIRC merged 3 commits into
mainfrom
fix/at-button-user-list
Sep 29, 2025
Merged

Fix utility of AT button#68
ValwareIRC merged 3 commits into
mainfrom
fix/at-button-user-list

Conversation

@matheusfillipe
Copy link
Copy Markdown
Contributor

@matheusfillipe matheusfillipe commented Sep 29, 2025

Summary by CodeRabbit

  • New Features

    • Added an @ button that opens a members autocomplete for quick mentions, with immediate insertion from the input area.
    • Members list aggregates relevant users for channels and private chats and supports direct selection.
  • Bug Fixes

    • Opening one dropdown now closes others (autocomplete, emoji, color picker) to prevent overlap.
    • Click-outside-to-close added for members autocomplete and color picker.
    • Improved dropdown positioning and visibility for consistent on-screen placement.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 29, 2025

Warning

Rate limit exceeded

@matheusfillipe has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f19ecc0 and d1e1a5e.

📒 Files selected for processing (1)
  • src/components/layout/ChatArea.tsx (5 hunks)

Walkthrough

Adds a members AutocompleteDropdown triggered by an @ button in ChatArea, coordinates visibility with existing emoji/color pickers and autocompletes, introduces button-triggered mode to AutocompleteDropdown with different behavior/positioning, and implements outside-click-to-close for both the new dropdown mode and the ColorPicker.

Changes

Cohort / File(s) Summary
Chat input UI integration
src/components/layout/ChatArea.tsx
Adds showMembersDropdown state and handleAtButtonClick; toggles members dropdown and closes emoji/color/autocomplete UIs when opening; injects two Members AutocompleteDropdown instances (one with isAtButtonTriggered); builds member list from channel/private context; handles selection to append username and hide dropdown.
Autocomplete dropdown enhancements
src/components/ui/AutocompleteDropdown.tsx
Adds isAtButtonTriggered?: boolean prop (default false); when true, returns all users sorted (limit 20), enables click-outside-to-close, and changes positioning/styling to absolute bottom-right vs. prior fixed positioning; conditional rendering/styles applied.
Color picker outside-click
src/components/ui/ColorPicker.tsx
Adds pickerRef and a mousedown listener in useEffect to detect outside clicks and call onClose; wraps rendered container with ref.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant CA as ChatArea
  participant AD as AutocompleteDropdown\n(members)
  participant EP as EmojiPicker
  participant CP as ColorPicker

  U->>CA: Click "@"
  activate CA
  CA->>CA: set showMembersDropdown = true\nclose EP/CP/other autocompletes
  CA-->>AD: Render with isAtButtonTriggered = true
  deactivate CA

  U->>AD: Select member
  AD-->>CA: onSelect(username)
  CA->>CA: Insert "@username" into input\nset showMembersDropdown = false

  U->>EP: Open emoji picker
  CA->>CA: Close members dropdown

  U->>CP: Open color picker
  CA->>CA: Close members dropdown

  note over AD,CP: Outside click closes when open (button-triggered AD and ColorPicker)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • ValwareIRC

Poem

I tap my paws and type “@” with glee,
A list of friends hops out for me.
Emojis bloom and colors glow,
The members list will come and go.
Click outside — it bows and fades away. 🐇✨

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 “Fix utility of AT button” clearly and concisely reflects the main change, which is restoring and improving the @ button’s member-autocomplete functionality, without introducing extraneous details or ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

@github-actions
Copy link
Copy Markdown

Pages Preview
Preview URL: https://fix-at-button-user-list.obsidianirc.pages.dev

Automated deployment preview for the PR in the Cloudflare Pages.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1047b45 and 62f81ac.

📒 Files selected for processing (3)
  • src/components/layout/ChatArea.tsx (5 hunks)
  • src/components/ui/AutocompleteDropdown.tsx (5 hunks)
  • src/components/ui/ColorPicker.tsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/layout/ChatArea.tsx (1)
src/components/ui/AutocompleteDropdown.tsx (1)
  • AutocompleteDropdown (19-215)
🪛 GitHub Actions: Deploy to Cloudflare Pages
src/components/layout/ChatArea.tsx

[error] 1245-1245: Type 'User[]' is not assignable to type 'string[]'. (TS2322) in ChatArea.tsx:1245 during TypeScript compilation (npm run build).

🔇 Additional comments (12)
src/components/ui/ColorPicker.tsx (3)

2-2: LGTM!

The added imports are correctly used for implementing outside-click-to-close behavior.


20-31: LGTM!

The outside-click-to-close implementation is correct and follows React best practices. Using mousedown ensures the handler fires before any click handlers, and the cleanup function properly removes the event listener.


34-36: LGTM!

The ref is correctly attached to the container div, enabling proper outside-click detection.

src/components/ui/AutocompleteDropdown.tsx (4)

16-16: LGTM!

The new prop is well-named and properly typed with a sensible default value.

Also applies to: 30-30


42-47: LGTM!

The button-triggered mode correctly displays all users sorted alphabetically with a reasonable 20-user limit for better UX.


136-150: LGTM!

The outside-click-to-close behavior is correctly gated by isAtButtonTriggered and follows the same pattern as ColorPicker. The implementation is clean and the dependencies are correct.


175-185: LGTM!

The conditional positioning logic is correct. Button-triggered mode uses absolute positioning (relative to parent container), while input-based autocomplete uses fixed positioning (relative to viewport).

src/components/layout/ChatArea.tsx (5)

88-88: LGTM!

The state variable follows the existing naming convention and is properly initialized.


885-899: LGTM!

The handler correctly implements mutual exclusion by closing other dropdowns when opening the members dropdown. This ensures a clean UI state.


1112-1126: LGTM!

The mutual exclusion is now complete - emoji and color picker buttons correctly close the members dropdown when opened.


1138-1143: LGTM!

The @ button is well-integrated and follows the existing button styling pattern.


1228-1244: Good integration of the members dropdown.

The implementation correctly handles the button-triggered mode with different behavior from the regular autocomplete:

  • Appends username instead of replacing text
  • Navigation is disabled (appropriate for this mode)
  • Outside-click-to-close is enabled via isAtButtonTriggered

Once the type error at line 1245 is fixed, this will work correctly.

Also applies to: 1258-1267

Comment thread src/components/layout/ChatArea.tsx Outdated
@ValwareIRC ValwareIRC merged commit 505e571 into main Sep 29, 2025
4 checks passed
zocram4cc pushed a commit to zocram4cc/ObsidianIRC that referenced this pull request Feb 17, 2026
* Fix utility of AT button

* fix build

* Fix beginning of input with nick
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