-
Notifications
You must be signed in to change notification settings - Fork 22
fix/dm replies and history #156
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6bba19c
Fix Replies in dms
matheusfillipe 83d6c31
redesign of reply buble
matheusfillipe 4f44d00
fix /me and multiline replies in DMs
matheusfillipe f24578b
fix reactions in DMS
matheusfillipe aedb5e7
Improve reaction picker
matheusfillipe 6276b2e
review feedback
matheusfillipe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import type { EmojiClickData } from "emoji-picker-react"; | ||
| import { useEffect, useRef } from "react"; | ||
| import { createPortal } from "react-dom"; | ||
| import { AppEmojiPicker } from "./AppEmojiPicker"; | ||
|
|
||
| interface Props { | ||
| isOpen: boolean; | ||
| anchorRect: DOMRect | null; | ||
| onClose: () => void; | ||
| onSelectEmoji: (emoji: string) => void; | ||
| } | ||
|
|
||
| const PICKER_W = 352; | ||
| const PICKER_H = 450; | ||
| const GAP = 8; | ||
| const MARGIN = 12; | ||
|
|
||
| function computeStyle(anchorRect: DOMRect): React.CSSProperties { | ||
| const vw = window.innerWidth; | ||
| const vh = window.innerHeight; | ||
|
|
||
| const top = | ||
| anchorRect.bottom + GAP + PICKER_H <= vh - MARGIN | ||
| ? anchorRect.bottom + GAP | ||
| : Math.max(MARGIN, anchorRect.top - GAP - PICKER_H); | ||
|
|
||
| const left = Math.min( | ||
| Math.max(MARGIN, anchorRect.left), | ||
| vw - PICKER_W - MARGIN, | ||
| ); | ||
|
|
||
| return { position: "fixed", top, left, zIndex: 50, width: PICKER_W }; | ||
| } | ||
|
|
||
| export function ReactionPopover({ | ||
| isOpen, | ||
| anchorRect, | ||
| onClose, | ||
| onSelectEmoji, | ||
| }: Props) { | ||
| const popoverRef = useRef<HTMLDivElement>(null); | ||
|
|
||
| useEffect(() => { | ||
| if (!isOpen) return; | ||
|
|
||
| const handleMouseDown = (e: MouseEvent) => { | ||
| if ( | ||
| popoverRef.current && | ||
| !popoverRef.current.contains(e.target as Node) | ||
| ) { | ||
| onClose(); | ||
| } | ||
| }; | ||
|
|
||
| const handleKeyDown = (e: KeyboardEvent) => { | ||
| if (e.key === "Escape") { | ||
| onClose(); | ||
| } | ||
| }; | ||
|
|
||
| document.addEventListener("mousedown", handleMouseDown); | ||
| document.addEventListener("keydown", handleKeyDown); | ||
| return () => { | ||
| document.removeEventListener("mousedown", handleMouseDown); | ||
| document.removeEventListener("keydown", handleKeyDown); | ||
| }; | ||
| }, [isOpen, onClose]); | ||
|
|
||
| if (!isOpen || !anchorRect) return null; | ||
|
|
||
| return createPortal( | ||
| <div ref={popoverRef} style={computeStyle(anchorRect)}> | ||
| <div className="bg-discord-dark-400 rounded-lg shadow-lg border border-discord-dark-300 overflow-hidden"> | ||
| <AppEmojiPicker | ||
| onEmojiClick={(d: EmojiClickData) => onSelectEmoji(d.emoji)} | ||
| /> | ||
| </div> | ||
| </div>, | ||
| document.body, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Dynamic Tailwind class won't be purged correctly.
The template literal
text-${theme}-text-mutedgenerates dynamic class names at runtime (e.g.,text-discord-text-muted). Tailwind's purge/content scanner cannot detect these classes during the build, so they may not be included in the production CSS unless explicitly safelisted.🔧 Suggested fix: Use conditional classes or a lookup
If multiple themes are needed, consider using a class map:
📝 Committable suggestion
🤖 Prompt for AI Agents