fix(modals): center modals in visible content area and remove open/close animation#3937
fix(modals): center modals in visible content area and remove open/close animation#3937waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Non-workspace pages now default Removes the modal content slide-in/out animation classes so open/close transitions no longer include the previous sliding motion. Reviewed by Cursor Bugbot for commit 0f471fb. Configure here. |
Greptile SummaryThis PR fixes modal centering by accounting for the sidebar (and panel on workflow pages) when computing the horizontal Key changes:
Confidence Score: 5/5Safe to merge — the centering logic is correct and all remaining findings are P2 style concerns. All three comments are P2 (style/architecture suggestions). No P0 or P1 defects were found. The core centering math is correct for both page types, the blocking script improvements are sound, and the removal of animations is intentional. Score remains 5 because P2 findings do not block merge. apps/sim/components/emcn/components/modal/modal.tsx — architectural coupling via usePathname worth revisiting if ModalContent is ever used outside the Next.js app context. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Page Load - Blocking Script] --> B{Is /workspace/ path?}
B -- No --> C[Exit early\n--sidebar-width stays 0px]
B -- Yes --> D{localStorage sidebar-state exists?}
D -- No --> E[Set --sidebar-width = 248px default]
D -- Yes --> F{isCollapsed?}
F -- Yes --> G[Set --sidebar-width = 51px]
F -- No --> H{stored width in valid range?}
H -- In range --> I[Set --sidebar-width = stored px]
H -- Too wide --> J[Set --sidebar-width = 30vw max]
H -- Too narrow / missing --> K[Set --sidebar-width = 248px default]
D -- Error --> L[Set --sidebar-width = 248px default]
subgraph Modal Centering
M{ModalContent rendered}
M --> N{usePathname includes /w/?}
N -- Yes workflow page --> O["left = calc(50% + (sidebar-width - panel-width) / 2)"]
N -- No other page --> P["left = calc(sidebar-width / 2 + 50%)"]
end
|
| ref={ref} | ||
| className={cn( | ||
| ANIMATION_CLASSES, | ||
| CONTENT_ANIMATION_CLASSES, | ||
| 'fixed top-[50%] z-[var(--z-modal)] flex max-h-[84vh] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl bg-[var(--bg)] text-small ring-1 ring-foreground/10 duration-200', | ||
| MODAL_SIZES[size], | ||
| className |
There was a problem hiding this comment.
duration-200 is orphaned without animation classes
duration-200 remains in the base class string, but the animate-in/animate-out classes (previously in ANIMATION_CLASSES and CONTENT_ANIMATION_CLASSES) have been removed. duration-200 controls the duration of CSS animations/transitions, so without an active animation or transition to pair with it, this class has no effect on the content element.
If the intent is to keep an animation duration for future use, a comment to that effect would help. Otherwise it can be removed to avoid confusion.
| ref={ref} | |
| className={cn( | |
| ANIMATION_CLASSES, | |
| CONTENT_ANIMATION_CLASSES, | |
| 'fixed top-[50%] z-[var(--z-modal)] flex max-h-[84vh] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl bg-[var(--bg)] text-small ring-1 ring-foreground/10 duration-200', | |
| MODAL_SIZES[size], | |
| className | |
| 'fixed top-[50%] z-[var(--z-modal)] flex max-h-[84vh] translate-x-[-50%] translate-y-[-50%] flex-col overflow-hidden rounded-xl bg-[var(--bg)] text-small ring-1 ring-foreground/10', |
…ose animation (#3937) * fix(modals): center modals in visible content area accounting for sidebar and panel * fix(modals): address pr feedback — comment clarity and document panel assumption * fix(modals): remove open/close animation from modal content
Summary
Type of Change
Testing
Tested manually
Checklist