feat: integrate agent edit profile screen as an embedded tab in profile settings and restrict agent connection actions to non-agent users
This commit is contained in:
@@ -257,6 +257,9 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
|
||||
final agent = state.agent!;
|
||||
final isAvailable = agent.isAvailable;
|
||||
final connState = state.connectionState;
|
||||
// Hide the Connect/Pending/Unlink button when the viewer is an AGENT —
|
||||
// the platform does not support agent-to-agent connections.
|
||||
final viewerIsAgent = ref.watch(authProvider).user?.role == 'AGENT';
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 38),
|
||||
@@ -302,18 +305,20 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
// Connect/Pending/Unlink button
|
||||
_buildConnectButton(
|
||||
connState,
|
||||
isAvailable,
|
||||
() => _handleConnect(state),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
// Connect/Pending/Unlink button — hidden for agent viewers
|
||||
if (!viewerIsAgent) ...[
|
||||
_buildConnectButton(
|
||||
connState,
|
||||
isAvailable,
|
||||
() => _handleConnect(state),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
// Start Message button when connected
|
||||
if (connState == 'accepted') ...[
|
||||
// Start Message button when connected (only for non-agent viewers)
|
||||
if (!viewerIsAgent && connState == 'accepted') ...[
|
||||
const SizedBox(height: 12),
|
||||
_buildStartMessageButton(agent),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user