@@ -168,7 +168,11 @@ export const loader = async ({ request }: Route.LoaderArgs) => {
168
168
169
169
const mediaLinks = [
170
170
...userPreferences . featuresEnabled . media . specific . map ( ( f ) => {
171
- return { label : f , href : undefined } ;
171
+ return {
172
+ label : f ,
173
+ href : undefined ,
174
+ tourStepId : f === MediaLot . Movie ? "step-2" : undefined ,
175
+ } ;
172
176
} ) ,
173
177
userPreferences . featuresEnabled . media . groups
174
178
? {
@@ -193,6 +197,7 @@ export const loader = async ({ request }: Route.LoaderArgs) => {
193
197
link
194
198
? {
195
199
label : changeCase ( link . label ) ,
200
+ tourStepId : "tourStepId" in link ? link . tourStepId : undefined ,
196
201
link : link . href
197
202
? link . href
198
203
: $path ( "/media/:action/:lot" , {
@@ -809,7 +814,7 @@ interface LinksGroupProps {
809
814
toggle : ( ) => void ;
810
815
tourStepId ?: string ;
811
816
setOpened : ( v : boolean ) => void ;
812
- links ?: Array < { label : string ; link : string } > ;
817
+ links ?: Array < { label : string ; link : string ; tourStepId ?: string } > ;
813
818
}
814
819
815
820
const LinksGroup = ( {
@@ -823,23 +828,32 @@ const LinksGroup = ({
823
828
tourStepId,
824
829
} : LinksGroupProps ) => {
825
830
const { dir } = useDirection ( ) ;
831
+
826
832
const hasLinks = Array . isArray ( links ) ;
827
833
const ChevronIcon = dir === "ltr" ? IconChevronRight : IconChevronLeft ;
828
- const allLinks = ( hasLinks ? links || [ ] : [ ] ) . filter ( ( s ) => s !== undefined ) ;
829
- const items = allLinks . map ( ( link ) => (
830
- < NavLink
831
- to = { link . link }
832
- key = { link . label }
833
- onClick = { toggle }
834
- className = { classes . link }
835
- >
836
- { ( { isActive } ) => (
837
- < span style = { isActive ? { textDecoration : "underline" } : undefined } >
838
- { link . label }
839
- </ span >
840
- ) }
841
- </ NavLink >
842
- ) ) ;
834
+ const linkItems = ( hasLinks ? links || [ ] : [ ] ) . map ( ( link ) => {
835
+ const component = (
836
+ < NavLink
837
+ to = { link . link }
838
+ key = { link . label }
839
+ onClick = { toggle }
840
+ className = { classes . link }
841
+ >
842
+ { ( { isActive } ) => (
843
+ < span style = { isActive ? { textDecoration : "underline" } : undefined } >
844
+ { link . label }
845
+ </ span >
846
+ ) }
847
+ </ NavLink >
848
+ ) ;
849
+ if ( link . tourStepId )
850
+ return (
851
+ < OnboardingTour . Target id = { link . tourStepId } >
852
+ { component }
853
+ </ OnboardingTour . Target >
854
+ ) ;
855
+ return component ;
856
+ } ) ;
843
857
844
858
const component = (
845
859
< Box >
@@ -878,7 +892,7 @@ const LinksGroup = ({
878
892
) : null }
879
893
</ Group >
880
894
</ UnstyledButton >
881
- { hasLinks ? < Collapse in = { opened } > { items } </ Collapse > : null }
895
+ { hasLinks ? < Collapse in = { opened } > { linkItems } </ Collapse > : null }
882
896
</ Box >
883
897
) ;
884
898
0 commit comments