@ -31,7 +31,7 @@ import type { Group } from '../types/group';
const GroupJoinPage = ( ) = > {
const GroupJoinPage = ( ) = > {
const [ group , setGroup ] = useState < Group | null > ( null ) ;
const [ group , setGroup ] = useState < Group | null > ( null ) ;
const [ selectedRCard , setSelectedR Card ] = useState < string > ( '' ) ;
const [ selectedProfileCard , setSelectedProfile Card ] = useState < string > ( '' ) ;
const [ inviterName , setInviterName ] = useState < string > ( '' ) ;
const [ inviterName , setInviterName ] = useState < string > ( '' ) ;
const [ isLoading , setIsLoading ] = useState ( true ) ;
const [ isLoading , setIsLoading ] = useState ( true ) ;
const navigate = useNavigate ( ) ;
const navigate = useNavigate ( ) ;
@ -67,7 +67,7 @@ const GroupJoinPage = () => {
loadGroupData ( ) ;
loadGroupData ( ) ;
} , [ searchParams ] ) ;
} , [ searchParams ] ) ;
const getR CardIcon = ( iconName : string ) = > {
const getProfile CardIcon = ( iconName : string ) = > {
const iconMap : Record < string , React.ReactElement > = {
const iconMap : Record < string , React.ReactElement > = {
Business : < Business / > ,
Business : < Business / > ,
PersonOutline : < PersonOutline / > ,
PersonOutline : < PersonOutline / > ,
@ -81,22 +81,24 @@ const GroupJoinPage = () => {
return iconMap [ iconName ] || < PersonOutline / > ;
return iconMap [ iconName ] || < PersonOutline / > ;
} ;
} ;
const handleR CardSelect = ( rCardName : string ) = > {
const handleProfile CardSelect = ( p rofile CardName : string ) = > {
setSelectedR Card ( rCardName ) ;
setSelectedProfile Card ( p rofile CardName) ;
} ;
} ;
const handleJoinGroup = ( ) = > {
const handleJoinGroup = ( ) = > {
if ( ! selectedR Card || ! group ) return ;
if ( ! selectedProfile Card || ! group ) return ;
// Store the selected rCard for this group membership
// Store the selected profile card for this group membership
sessionStorage . setItem ( ` groupRCard_ ${ group . id } ` , selectedRCard ) ;
sessionStorage . setItem ( ` groupProfileCard_ ${ group . id } ` , selectedProfileCard ) ;
sessionStorage . setItem ( ` groupRCard_ ${ group . id } ` , selectedProfileCard ) ; // Legacy alias
// Navigate to group with member parameters
// Navigate to group with member parameters
const params = new URLSearchParams ( {
const params = new URLSearchParams ( {
newMember : 'true' ,
newMember : 'true' ,
fromInvite : 'true' ,
fromInvite : 'true' ,
existingMember : 'true' ,
existingMember : 'true' ,
rCard : selectedRCard
profileCard : selectedProfileCard ,
rCard : selectedProfileCard // Legacy alias
} ) ;
} ) ;
navigate ( ` /groups/ ${ group . id } ? ${ params . toString ( ) } ` ) ;
navigate ( ` /groups/ ${ group . id } ? ${ params . toString ( ) } ` ) ;
} ;
} ;
@ -175,7 +177,7 @@ const GroupJoinPage = () => {
< / Box >
< / Box >
< Typography variant = "h6" color = "primary" gutterBottom >
< Typography variant = "h6" color = "primary" gutterBottom >
Choose your relationship type
Choose your profile card
< / Typography >
< / Typography >
< Typography variant = "body1" color = "text.secondary" sx = { { maxWidth : '600px' , mx : 'auto' } } >
< Typography variant = "body1" color = "text.secondary" sx = { { maxWidth : '600px' , mx : 'auto' } } >
@ -184,11 +186,11 @@ const GroupJoinPage = () => {
< / Typography >
< / Typography >
< / Box >
< / Box >
{ /* rCard Selection */ }
{ /* P rofile Card Selection */ }
< Box sx = { { mb : 4 } } >
< Box sx = { { mb : 4 } } >
< Typography variant = "h6" gutterBottom sx = { { display : 'flex' , alignItems : 'center' , justifyContent : 'center' , gap : 1 } } >
< Typography variant = "h6" gutterBottom sx = { { display : 'flex' , alignItems : 'center' , justifyContent : 'center' , gap : 1 } } >
< CheckCircle color = "primary" / >
< CheckCircle color = "primary" / >
Select Your Relationship Type
Select Your Profile Card
< / Typography >
< / Typography >
< Box sx = { {
< Box sx = { {
@ -199,20 +201,20 @@ const GroupJoinPage = () => {
maxWidth : '1000px' ,
maxWidth : '1000px' ,
mx : 'auto'
mx : 'auto'
} } >
} } >
{ DEFAULT_RCARDS . map ( ( rCard ) = > (
{ DEFAULT_RCARDS . map ( ( p rofile Card) = > (
< Card
< Card
key = { rCard . name }
key = { p rofile Card. name }
onClick = { ( ) = > handleR CardSelect ( rCard . name ) }
onClick = { ( ) = > handleProfile CardSelect ( p rofile Card. name ) }
sx = { {
sx = { {
cursor : 'pointer' ,
cursor : 'pointer' ,
transition : 'all 0.2s ease-in-out' ,
transition : 'all 0.2s ease-in-out' ,
border : 2 ,
border : 2 ,
borderColor : selectedR Card === rCard . name ? rCard . color : 'divider' ,
borderColor : selectedProfile Card === p rofile Card. name ? p rofile Card. color : 'divider' ,
backgroundColor : selectedR Card === rCard . name
backgroundColor : selectedProfile Card === p rofile Card. name
? alpha ( rCard . color || theme . palette . primary . main , 0.08 )
? alpha ( p rofile Card. color || theme . palette . primary . main , 0.08 )
: 'background.paper' ,
: 'background.paper' ,
'&:hover' : {
'&:hover' : {
borderColor : rCard.color ,
borderColor : p rofile Card.color,
transform : 'translateY(-2px)' ,
transform : 'translateY(-2px)' ,
boxShadow : theme.shadows [ 4 ] ,
boxShadow : theme.shadows [ 4 ] ,
} ,
} ,
@ -221,7 +223,7 @@ const GroupJoinPage = () => {
< CardContent sx = { { p : 3 , textAlign : 'center' } } >
< CardContent sx = { { p : 3 , textAlign : 'center' } } >
< Avatar
< Avatar
sx = { {
sx = { {
bgcolor : rCard.color || theme . palette . primary . main ,
bgcolor : p rofile Card.color || theme . palette . primary . main ,
width : 48 ,
width : 48 ,
height : 48 ,
height : 48 ,
mx : 'auto' ,
mx : 'auto' ,
@ -229,21 +231,21 @@ const GroupJoinPage = () => {
'& .MuiSvgIcon-root' : { fontSize : 28 }
'& .MuiSvgIcon-root' : { fontSize : 28 }
} }
} }
>
>
{ getR CardIcon ( rCard . icon || 'PersonOutline' ) }
{ getProfile CardIcon ( p rofile Card. icon || 'PersonOutline' ) }
< / Avatar >
< / Avatar >
< Typography variant = "h6" sx = { { fontWeight : 600 , mb : 1 } } >
< Typography variant = "h6" sx = { { fontWeight : 600 , mb : 1 } } >
{ rCard . name }
{ p rofile Card. name }
< / Typography >
< / Typography >
< Typography variant = "body2" color = "text.secondary" sx = { { fontSize : '0.875rem' } } >
< Typography variant = "body2" color = "text.secondary" sx = { { fontSize : '0.875rem' } } >
{ rCard . description }
{ p rofile Card. description }
< / Typography >
< / Typography >
{ selectedR Card === rCard . name && (
{ selectedProfile Card === p rofile Card. name && (
< CheckCircle
< CheckCircle
sx = { {
sx = { {
color : rCard.color ,
color : p rofile Card.color,
mt : 1 ,
mt : 1 ,
fontSize : 20
fontSize : 20
} }
} }
@ -261,7 +263,7 @@ const GroupJoinPage = () => {
variant = "contained"
variant = "contained"
size = "large"
size = "large"
onClick = { handleJoinGroup }
onClick = { handleJoinGroup }
disabled = { ! selectedR Card }
disabled = { ! selectedProfile Card }
sx = { {
sx = { {
px : 4 ,
px : 4 ,
py : 1.5 ,
py : 1.5 ,