11import { useState } from 'react' ;
22
33import { Badge } from '../components/badge' ;
4+ import { Button } from '../components/button' ;
5+ import { Icon } from '../components/icon' ;
46import { Section } from '../components/section' ;
57import type { UserProfileMenuAction } from './user-profile-action-menu' ;
68import { UserProfileActionMenu } from './user-profile-action-menu' ;
@@ -12,10 +14,12 @@ import { UserProfileRemoveConnectedAccountDialog } from './user-profile-remove-c
1214
1315export function UserProfileConnectedAccountRowView ( {
1416 account,
17+ onConnect,
1518 onReconnect,
1619 onRemove,
1720} : {
1821 account : UserProfileConnectedAccount ;
22+ onConnect ?: ( id : string ) => void ;
1923 onReconnect ?: ( id : string ) => void ;
2024 onRemove ?: ( id : string ) => void ;
2125} ) {
@@ -28,7 +32,7 @@ export function UserProfileConnectedAccountRowView({
2832 actions . push ( { label : m . remove , color : 'negative' , onClick : ( ) => setOpen ( true ) } ) ;
2933 }
3034 return (
31- < Section . Row >
35+ < Section . Row xstyle = { onConnect && styles . connectRow } >
3236 < Section . Item >
3337 < Section . Media size = 'lg' >
3438 < UserProfileConnectedProviderIcon { ...account } />
@@ -47,7 +51,24 @@ export function UserProfileConnectedAccountRowView({
4751 </ Section . Description >
4852 ) : null }
4953 </ Section . Content >
50- { actions . length > 0 ? (
54+ { onConnect ? (
55+ < Section . Actions >
56+ < Button
57+ size = 'sm'
58+ variant = 'outline'
59+ color = 'neutral'
60+ aria-label = { `${ m . connect } ${ account . provider } ` }
61+ onClick = { ( ) => onConnect ( account . id ) }
62+ >
63+ { m . connect }
64+ < Icon
65+ name = 'arrow-right-top'
66+ placement = 'inline-end'
67+ size = 'sm'
68+ />
69+ </ Button >
70+ </ Section . Actions >
71+ ) : actions . length > 0 ? (
5172 < Section . Actions >
5273 < UserProfileActionMenu
5374 label = { `${ m . manage } ${ account . provider } ` }
@@ -67,6 +88,7 @@ export function UserProfileConnectedAccountRowView({
6788 </ Section . Actions >
6889 ) : null }
6990 </ Section . Item >
91+ { account . connectError ? < Section . Error > { account . connectError } </ Section . Error > : null }
7092 { account . reconnectError ? < Section . Error > { account . reconnectError } </ Section . Error > : null }
7193 { account . status === 'error' && account . verificationError ? (
7294 < Section . Error > { account . verificationError } </ Section . Error >
0 commit comments