Repository navigation
feat(dashboard): Polish event details header and stack nested drawers #2418
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
4e90305
feat(dashboard): Make the event details header easier to read
sentry-junior[bot] be20024
feat(dashboard): Stack nested drawers and show the subagent event log…
sentry-junior[bot] b5b5e84
feat(dashboard): Group the event step buttons
sentry-junior[bot] 3768e5a
fix(dashboard): Keep side drawers full width on small screens
sentry-junior[bot] 10fb22c
Merge remote-tracking branch 'origin/main' into feat/dashboard-event-…
sentry-junior[bot] 6641398
fix(dashboard): Fit event detail timestamps and group fields in cards
sentry-junior[bot] 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
59 changes: 59 additions & 0 deletions
59
packages/junior-dashboard/src/client/components/ui/button-group.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,59 @@ | ||
| import { cva, type VariantProps } from "class-variance-authority"; | ||
| import { cn } from "@dashboard/lib/utils"; | ||
|
|
||
| import { Separator } from "@dashboard/components/ui/separator"; | ||
|
|
||
| const buttonGroupVariants = cva( | ||
| "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2", | ||
| { | ||
| variants: { | ||
| orientation: { | ||
| horizontal: | ||
| "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0", | ||
| vertical: | ||
| "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0", | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| orientation: "horizontal", | ||
| }, | ||
| }, | ||
| ); | ||
|
|
||
| /** Join related buttons into one control and name it for assistive technology. */ | ||
| function ButtonGroup({ | ||
| className, | ||
| orientation, | ||
| ...props | ||
| }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) { | ||
| return ( | ||
| <div | ||
| role="group" | ||
| data-slot="button-group" | ||
| data-orientation={orientation} | ||
| className={cn(buttonGroupVariants({ orientation }), className)} | ||
| {...props} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| /** Draw a divider between buttons in a group. */ | ||
| function ButtonGroupSeparator({ | ||
| className, | ||
| orientation = "vertical", | ||
| ...props | ||
| }: React.ComponentProps<typeof Separator>) { | ||
| return ( | ||
| <Separator | ||
| data-slot="button-group-separator" | ||
| orientation={orientation} | ||
| className={cn( | ||
| "relative self-stretch bg-dashboard-border data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto", | ||
| className, | ||
| )} | ||
| {...props} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export { ButtonGroup, ButtonGroupSeparator }; |
140 changes: 140 additions & 0 deletions
140
packages/junior-dashboard/src/client/components/ui/drawer.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,140 @@ | ||
| import * as React from "react"; | ||
| import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer"; | ||
| import { cn } from "@dashboard/lib/utils"; | ||
|
|
||
| type DrawerContextProps = { | ||
| modal: DrawerPrimitive.Root.Props["modal"]; | ||
| swipeDirection: NonNullable<DrawerPrimitive.Root.Props["swipeDirection"]>; | ||
| }; | ||
|
|
||
| const DrawerContext = React.createContext<DrawerContextProps | null>(null); | ||
|
|
||
| function useDrawer() { | ||
| const context = React.useContext(DrawerContext); | ||
|
|
||
| if (!context) { | ||
| throw new Error("useDrawer must be used within a Drawer."); | ||
| } | ||
|
|
||
| return context; | ||
| } | ||
|
|
||
| /** | ||
| * Own the open state, swipe dismissal, and nesting for a shadcn drawer. | ||
| * A drawer rendered inside another drawer stacks in front of it. | ||
| */ | ||
| function Drawer({ | ||
| modal = true, | ||
| swipeDirection = "down", | ||
| ...props | ||
| }: DrawerPrimitive.Root.Props) { | ||
| const contextValue = React.useMemo( | ||
| () => ({ modal, swipeDirection }), | ||
| [modal, swipeDirection], | ||
| ); | ||
|
|
||
| return ( | ||
| <DrawerContext.Provider value={contextValue}> | ||
| <DrawerPrimitive.Root | ||
| data-slot="drawer" | ||
| modal={modal} | ||
| swipeDirection={swipeDirection} | ||
| {...props} | ||
| /> | ||
| </DrawerContext.Provider> | ||
| ); | ||
| } | ||
|
|
||
| function DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) { | ||
| return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />; | ||
| } | ||
|
|
||
| /** Close the drawer through Base UI dismissal and focus handling. */ | ||
| function DrawerClose({ ...props }: DrawerPrimitive.Close.Props) { | ||
| return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />; | ||
| } | ||
|
|
||
| function DrawerOverlay({ | ||
| className, | ||
| ...props | ||
| }: DrawerPrimitive.Backdrop.Props) { | ||
| return ( | ||
| <DrawerPrimitive.Backdrop | ||
| data-slot="drawer-overlay" | ||
| className={cn( | ||
| "fixed inset-0 z-50 min-h-dvh bg-dashboard-overlay opacity-[calc(1-var(--drawer-swipe-progress))] transition-opacity duration-450 ease-[cubic-bezier(0.32,0.72,0,1)] select-none motion-reduce:transition-none data-ending-style:pointer-events-none data-ending-style:opacity-0 data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:opacity-0 data-swiping:duration-0 supports-[-webkit-touch-callout:none]:absolute", | ||
| className, | ||
| )} | ||
| {...props} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Place the drawer on its swipe edge. While a nested drawer is open, this | ||
| * drawer scales back, peeks out behind it, and hides its content. | ||
| */ | ||
| function DrawerContent({ | ||
| className, | ||
| children, | ||
| ...props | ||
| }: DrawerPrimitive.Popup.Props) { | ||
| const { modal, swipeDirection } = useDrawer(); | ||
| const swipeAxis = | ||
| swipeDirection === "down" || swipeDirection === "up" ? "y" : "x"; | ||
|
|
||
| return ( | ||
| <DrawerPortal> | ||
| {/* App drawers trap focus without a modal root, so keep the overlay. | ||
| Base UI skips it for a nested drawer. */} | ||
| <DrawerOverlay /> | ||
| <DrawerPrimitive.Viewport | ||
| data-slot="drawer-viewport" | ||
| data-modal={modal} | ||
| className="pointer-events-none fixed inset-0 z-50 select-none data-[modal=true]:pointer-events-auto" | ||
|
sentry-junior[bot] marked this conversation as resolved.
Resolved
|
||
| > | ||
| <DrawerPrimitive.Popup | ||
| data-slot="drawer-popup" | ||
| data-swipe-axis={swipeAxis} | ||
| className={cn( | ||
| // Base. | ||
| "group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col border-dashboard-border-strong bg-popover text-sm text-popover-foreground transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none motion-reduce:transition-none select-none [interpolate-size:allow-keywords] data-[swipe-direction=down]:rounded-t-xl data-[swipe-direction=down]:border-t data-[swipe-direction=left]:rounded-r-xl data-[swipe-direction=left]:border-r data-[swipe-direction=right]:rounded-l-xl data-[swipe-direction=right]:border-l data-[swipe-direction=up]:rounded-b-xl data-[swipe-direction=up]:border-b", | ||
| // Nested. | ||
| "data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95", | ||
| // Bleed. | ||
| "after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full", | ||
| // Sizing. | ||
| "[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:75%] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh] data-[swipe-axis=x]:sm:[--drawer-content-width:24rem]", | ||
| // Stack. | ||
| "[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05]", | ||
| // Transitions. | ||
| "data-ending-style:transform-(--closed-transform) data-ending-style:opacity-[0.9999] data-ending-style:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-nested-drawer-swiping:duration-0 data-ending-style:data-nested-drawer-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)] data-starting-style:transform-(--closed-transform) data-swiping:duration-0 data-ending-style:data-swiping:duration-[calc(var(--drawer-swipe-strength)*400ms)]", | ||
| // Axis: y. | ||
| "data-[swipe-axis=y]:inset-x-0 data-[swipe-axis=y]:data-nested-drawer-open:h-(--stack-height)", | ||
| // Axis: x. | ||
| "data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row", | ||
| // Direction: down. | ||
| "data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+2px),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]", | ||
| // Direction: up. | ||
| "data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-2px),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]", | ||
| // Direction: left. | ||
| "data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-2px),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]", | ||
| // Direction: right. | ||
| "data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+2px),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]", | ||
| className, | ||
| )} | ||
| {...props} | ||
| > | ||
| <DrawerPrimitive.Content | ||
| data-slot="drawer-content" | ||
| className="flex min-h-0 flex-1 flex-col overflow-hidden overscroll-contain rounded-[inherit] transition-opacity duration-300 ease-[cubic-bezier(0.45,1.005,0,1.005)] select-text motion-reduce:transition-none group-data-nested-drawer-open/drawer-popup:opacity-0 group-data-nested-drawer-swiping/drawer-popup:opacity-100 group-data-swiping/drawer-popup:select-none" | ||
| > | ||
| {children} | ||
| </DrawerPrimitive.Content> | ||
| </DrawerPrimitive.Popup> | ||
| </DrawerPrimitive.Viewport> | ||
| </DrawerPortal> | ||
| ); | ||
| } | ||
|
|
||
| export { Drawer, DrawerClose, DrawerContent }; | ||
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.
Uh oh!
There was an error while loading. Please reload this page.