@@ -14,8 +14,10 @@ import { useEffect } from "react";
1414import { useAuthStore } from "@/lib/providers/auth-store-provider" ;
1515import { useCoachingRelationshipStateStore } from "@/lib/providers/coaching-relationship-state-store-provider" ;
1616import { useCoachingSessionStateStore } from "@/lib/providers/coaching-session-state-store-provider" ;
17+ import { cn } from "../lib/utils" ;
1718
1819interface CoachingRelationshipsSelectorProps extends PopoverProps {
20+ className ?: string ;
1921 /// The Organization's Id for which to get a list of associated CoachingRelationships
2022 organizationId : Id ;
2123 /// Disable the component from interaction with the user
@@ -38,18 +40,13 @@ function CoachingRelationshipsSelectItems({
3840 // Be sure to cache the list of current coaching relationships in the CoachingRelationshipStateStore
3941 useEffect ( ( ) => {
4042 if ( ! relationships . length ) return ;
41- console . debug (
42- `relationships (useEffect): ${ JSON . stringify ( relationships ) } `
43- ) ;
4443 setCurrentCoachingRelationships ( relationships ) ;
4544 } , [ relationships , setCurrentCoachingRelationships ] ) ;
4645
4746 if ( isLoading ) return < div > Loading...</ div > ;
4847 if ( isError ) return < div > Error loading coaching relationships</ div > ;
4948 if ( ! relationships ?. length ) return < div > No coaching relationships found</ div > ;
5049
51- console . debug ( `relationships: ${ JSON . stringify ( relationships ) } ` ) ;
52-
5350 return (
5451 < >
5552 { relationships . map ( ( rel ) => (
@@ -63,6 +60,7 @@ function CoachingRelationshipsSelectItems({
6360}
6461
6562export default function CoachingRelationshipSelector ( {
63+ className,
6664 organizationId,
6765 disabled,
6866 onSelect,
@@ -101,29 +99,32 @@ export default function CoachingRelationshipSelector({
10199 ? getCurrentCoachingRelationship ( currentCoachingRelationshipId )
102100 : null ;
103101
104- const displayValue = currentRelationship ? (
105- < >
106- { currentRelationship . coach_first_name } { " " }
107- { currentRelationship . coach_last_name } ->{ " " }
108- { currentRelationship . coachee_first_name } { " " }
109- { currentRelationship . coachee_last_name }
110- </ >
111- ) : undefined ;
102+ const displayValue =
103+ currentRelationship && currentRelationship . id ? (
104+ < >
105+ { currentRelationship . coach_first_name } { " " }
106+ { currentRelationship . coach_last_name } ->{ " " }
107+ { currentRelationship . coachee_first_name } { " " }
108+ { currentRelationship . coachee_last_name }
109+ </ >
110+ ) : undefined ;
112111
113112 return (
114- < Select
115- disabled = { disabled }
116- value = { currentCoachingRelationshipId ?? undefined }
117- onValueChange = { handleSetCoachingRelationship }
118- >
119- < SelectTrigger id = "coaching-relationship-selector" >
120- < SelectValue placeholder = "Select coaching relationship" >
121- { displayValue }
122- </ SelectValue >
123- </ SelectTrigger >
124- < SelectContent >
125- < CoachingRelationshipsSelectItems organizationId = { organizationId } />
126- </ SelectContent >
127- </ Select >
113+ < div className = { cn ( "font-normal" , className ) } >
114+ < Select
115+ disabled = { disabled }
116+ value = { currentCoachingRelationshipId ?? undefined }
117+ onValueChange = { handleSetCoachingRelationship }
118+ >
119+ < SelectTrigger id = "coaching-relationship-selector" >
120+ < SelectValue placeholder = "Select coaching relationship" >
121+ { displayValue }
122+ </ SelectValue >
123+ </ SelectTrigger >
124+ < SelectContent >
125+ < CoachingRelationshipsSelectItems organizationId = { organizationId } />
126+ </ SelectContent >
127+ </ Select >
128+ </ div >
128129 ) ;
129130}
0 commit comments