Skip to content

Commit d71f1a8

Browse files
waleedlatif1claude
andcommitted
chore(tour): extract shared Joyride config, fix popover arrow overflow
- Extract duplicated Joyride floaterProps/styles into getSharedJoyrideProps() in tour-shared.tsx, parameterized by spotlightBorderRadius - Fix showArrow disabling content scrolling in PopoverContent by wrapping children in a scrollable div when arrow is visible Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 752d043 commit d71f1a8

File tree

4 files changed

+55
-71
lines changed

4 files changed

+55
-71
lines changed

apps/sim/app/workspace/[workspaceId]/components/product-tour/product-tour.tsx

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { TourState } from '@/app/workspace/[workspaceId]/components/product
88
import {
99
TourStateContext,
1010
TourTooltipAdapter,
11+
getSharedJoyrideProps,
1112
} from '@/app/workspace/[workspaceId]/components/product-tour/tour-shared'
1213
import { useTour } from '@/app/workspace/[workspaceId]/components/product-tour/use-tour'
1314

@@ -55,41 +56,7 @@ export function NavTour() {
5556
disableOverlayClose
5657
spotlightPadding={4}
5758
tooltipComponent={TourTooltipAdapter}
58-
floaterProps={{
59-
disableAnimation: true,
60-
hideArrow: true,
61-
styles: {
62-
floater: {
63-
filter: 'none',
64-
opacity: 0,
65-
pointerEvents: 'none' as React.CSSProperties['pointerEvents'],
66-
width: 0,
67-
height: 0,
68-
},
69-
},
70-
}}
71-
styles={{
72-
options: {
73-
zIndex: 10000,
74-
},
75-
spotlight: {
76-
backgroundColor: 'transparent',
77-
border: '1px solid rgba(255, 255, 255, 0.1)',
78-
borderRadius: 8,
79-
boxShadow: '0 0 0 9999px rgba(0, 0, 0, 0.55)',
80-
position: 'fixed' as React.CSSProperties['position'],
81-
transition:
82-
'top 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), left 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), width 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), height 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94)',
83-
},
84-
overlay: {
85-
backgroundColor: 'transparent',
86-
mixBlendMode: 'unset' as React.CSSProperties['mixBlendMode'],
87-
position: 'fixed' as React.CSSProperties['position'],
88-
height: '100%',
89-
overflow: 'visible',
90-
pointerEvents: 'none' as React.CSSProperties['pointerEvents'],
91-
},
92-
}}
59+
{...getSharedJoyrideProps({ spotlightBorderRadius: 8 })}
9360
/>
9461
</TourStateContext.Provider>
9562
)

apps/sim/app/workspace/[workspaceId]/components/product-tour/tour-shared.tsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,49 @@ export function TourTooltipAdapter({
109109
</>
110110
)
111111
}
112+
113+
const SPOTLIGHT_TRANSITION =
114+
'top 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), left 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), width 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), height 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94)'
115+
116+
/**
117+
* Returns the shared Joyride floaterProps and styles config used by both tours.
118+
* Only `spotlightPadding` and spotlight `borderRadius` differ between tours.
119+
*/
120+
export function getSharedJoyrideProps(overrides: { spotlightBorderRadius: number }) {
121+
return {
122+
floaterProps: {
123+
disableAnimation: true,
124+
hideArrow: true,
125+
styles: {
126+
floater: {
127+
filter: 'none',
128+
opacity: 0,
129+
pointerEvents: 'none' as React.CSSProperties['pointerEvents'],
130+
width: 0,
131+
height: 0,
132+
},
133+
},
134+
},
135+
styles: {
136+
options: {
137+
zIndex: 10000,
138+
},
139+
spotlight: {
140+
backgroundColor: 'transparent',
141+
border: '1px solid rgba(255, 255, 255, 0.1)',
142+
borderRadius: overrides.spotlightBorderRadius,
143+
boxShadow: '0 0 0 9999px rgba(0, 0, 0, 0.55)',
144+
position: 'fixed' as React.CSSProperties['position'],
145+
transition: SPOTLIGHT_TRANSITION,
146+
},
147+
overlay: {
148+
backgroundColor: 'transparent',
149+
mixBlendMode: 'unset' as React.CSSProperties['mixBlendMode'],
150+
position: 'fixed' as React.CSSProperties['position'],
151+
height: '100%',
152+
overflow: 'visible',
153+
pointerEvents: 'none' as React.CSSProperties['pointerEvents'],
154+
},
155+
},
156+
} as const
157+
}

apps/sim/app/workspace/[workspaceId]/components/product-tour/workflow-tour.tsx

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { TourState } from '@/app/workspace/[workspaceId]/components/product
66
import {
77
TourStateContext,
88
TourTooltipAdapter,
9+
getSharedJoyrideProps,
910
} from '@/app/workspace/[workspaceId]/components/product-tour/tour-shared'
1011
import { useTour } from '@/app/workspace/[workspaceId]/components/product-tour/use-tour'
1112
import { workflowTourSteps } from '@/app/workspace/[workspaceId]/components/product-tour/workflow-tour-steps'
@@ -54,41 +55,7 @@ export function WorkflowTour() {
5455
disableOverlayClose
5556
spotlightPadding={1}
5657
tooltipComponent={TourTooltipAdapter}
57-
floaterProps={{
58-
disableAnimation: true,
59-
hideArrow: true,
60-
styles: {
61-
floater: {
62-
filter: 'none',
63-
opacity: 0,
64-
pointerEvents: 'none' as React.CSSProperties['pointerEvents'],
65-
width: 0,
66-
height: 0,
67-
},
68-
},
69-
}}
70-
styles={{
71-
options: {
72-
zIndex: 10000,
73-
},
74-
spotlight: {
75-
backgroundColor: 'transparent',
76-
border: '1px solid rgba(255, 255, 255, 0.1)',
77-
borderRadius: 6,
78-
boxShadow: '0 0 0 9999px rgba(0, 0, 0, 0.55)',
79-
position: 'fixed' as React.CSSProperties['position'],
80-
transition:
81-
'top 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), left 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), width 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), height 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94)',
82-
},
83-
overlay: {
84-
backgroundColor: 'transparent',
85-
mixBlendMode: 'unset' as React.CSSProperties['mixBlendMode'],
86-
position: 'fixed' as React.CSSProperties['position'],
87-
height: '100%',
88-
overflow: 'visible',
89-
pointerEvents: 'none' as React.CSSProperties['pointerEvents'],
90-
},
91-
}}
58+
{...getSharedJoyrideProps({ spotlightBorderRadius: 6 })}
9259
/>
9360
</TourStateContext.Provider>
9461
)

apps/sim/components/emcn/components/popover/popover.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,11 @@ const PopoverContent = React.forwardRef<
628628
...style,
629629
}}
630630
>
631-
{children}
631+
{showArrow ? (
632+
<div className='flex-1 overflow-auto'>{children}</div>
633+
) : (
634+
children
635+
)}
632636
{showArrow && (
633637
<PopoverPrimitive.Arrow width={14} height={7} asChild>
634638
<svg

0 commit comments

Comments
 (0)