-
Notifications
You must be signed in to change notification settings - Fork 59
feat(activity): open mention threads in a side panel with scroll-to-message, pulse & slide #3561
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
Open
adamleithp
wants to merge
7
commits into
main
Choose a base branch
from
activity-thread-mention-scroll
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
30e2a9d
feat(activity): open mention thread in side panel, scroll to & pulse …
adamleithp d7f9818
feat(canvas): add jump-to-latest pill to ThreadPanel
adamleithp 037d1e1
feat(activity): close open thread on Escape from anywhere in Activity
adamleithp fac577b
style(canvas): make mention highlight span the full thread row
adamleithp ea9a565
feat(activity): animate the thread panel sliding in/out
adamleithp 407f2ee
feat(channels): animate channel thread panel + close it on Escape
adamleithp 790c5af
refactor(canvas): extract AnimatedThreadDock; fix resize-handle clip …
adamleithp 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
49 changes: 49 additions & 0 deletions
49
packages/ui/src/features/canvas/components/AnimatedThreadDock.tsx
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,49 @@ | ||
| import { AnimatePresence, motion, useReducedMotion } from "framer-motion"; | ||
| import type { ReactNode } from "react"; | ||
| import { useState } from "react"; | ||
|
|
||
| // The right-hand thread dock, shared by Activity and the channel feed. Slides | ||
| // in/out by animating the wrapper width so the list/feed reflows in lockstep — | ||
| // the same 200ms / cubic-bezier(0,0,0.2,1) the docked ResizableSidebar uses. | ||
| // | ||
| // `width: auto` once open so the inner ThreadSidebar keeps owning its resizable | ||
| // width. overflow-hidden is applied ONLY while animating: a permanent clip | ||
| // would swallow the ResizableSidebar's resize handle (it overhangs the panel's | ||
| // inner edge), so it must be gone once the panel is settled open. | ||
| // | ||
| // Caller guards the child with the same condition it passes as `open` (e.g. | ||
| // `{selected && <ThreadSidebar .../>}`) so nothing is evaluated while closed; | ||
| // AnimatePresence retains the previous child through the exit animation. | ||
| export function AnimatedThreadDock({ | ||
| open, | ||
| children, | ||
| }: { | ||
| open: boolean; | ||
| children: ReactNode; | ||
| }) { | ||
| const reduceMotion = useReducedMotion(); | ||
| // Start clipped so the first frame (width: 0, full-width child) can't spill. | ||
| const [animating, setAnimating] = useState(true); | ||
|
|
||
| return ( | ||
| <AnimatePresence> | ||
| {open && ( | ||
| <motion.div | ||
| key="thread" | ||
| className={`h-full shrink-0 ${animating ? "overflow-hidden" : ""}`} | ||
| initial={reduceMotion ? false : { width: 0, opacity: 0 }} | ||
| animate={{ width: "auto", opacity: 1 }} | ||
| exit={reduceMotion ? { opacity: 0 } : { width: 0, opacity: 0 }} | ||
| transition={{ | ||
| duration: reduceMotion ? 0 : 0.2, | ||
| ease: [0, 0, 0.2, 1], | ||
| }} | ||
| onAnimationStart={() => setAnimating(true)} | ||
| onAnimationComplete={() => setAnimating(false)} | ||
| > | ||
| {children} | ||
| </motion.div> | ||
| )} | ||
| </AnimatePresence> | ||
| ); | ||
| } |
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.
When a focused menu or popover handles Escape without calling
preventDefault()on the native event, this window listener also clears the selected thread. One key press then closes both the overlay and the underlying thread instead of only the topmost layer.