Trainer-Client Relationships
Connection management between trainers and clients, including sending, accepting, rejecting, and blocking connection requests, viewing connection lists, and managing ongoing relationships.
Overview
Connections form the foundational relationship layer of MTC. Clients connect with trainers to access training services, and trainers manage their client roster through connections. The connections page displays a searchable grid of connected trainers/clients with profile previews, ratings, specialties, and quick action buttons for messaging and viewing profiles.
The connection lifecycle follows a request-based workflow: clients can send connection requests to trainers (discovered through the Explore page or Smart Matching), and trainers can accept, reject, or defer requests. Both parties can remove connections or block users. Connection status influences access to features like messaging, session booking, and program assignment.
The current implementation provides a client-facing connections grid using mock data from trainer profiles. The connection request workflow, trainer-side connection management, blocking functionality, and real-time connection status updates are planned for future implementation.
User Stories
Client
As a client, I want to send a connection request to a trainer so that I can begin working with them.
As a client, I want to view all my connected trainers in a grid so that I can quickly access their profiles and message them.
As a client, I want to search my connections by name so that I can quickly find a specific trainer.
As a client, I want to remove a trainer connection so that I can manage my active training relationships.
As a client, I want to block a trainer so that they cannot contact me or send further requests.
As a client, I want to see trainer ratings, specialties, and client count so that I can assess the quality of my connections at a glance.
Trainer
As a trainer, I want to accept or reject client connection requests so that I can control who joins my client roster.
As a trainer, I want to view my active clients list so that I can manage my coaching relationships and track my roster size.
As a trainer, I want to see connection requests with match percentages so that I can prioritize leads that align with my specialties.
As a trainer, I want to block problematic clients so that they cannot reach me or book sessions.
Data Model
| Table | Column | Type | Description |
|---|---|---|---|
trainer_connections |
id |
uuid |
Primary key |
trainer_id |
uuid (FK) |
References users.id (trainer) | |
client_id |
uuid (FK) |
References users.id (client) | |
status |
enum |
active | blocked | |
connected_at |
timestamptz |
When the connection was established | |
connection_requests |
id |
uuid |
Primary key |
from_user_id |
uuid (FK) |
User who sent the request | |
to_user_id |
uuid (FK) |
User who receives the request | |
status |
enum |
pending | accepted | rejected | |
match_percentage |
integer |
Smart match score (0-100) | |
message |
text |
Optional intro message with request |
Connection Lifecycle
Screens & Routes
/_authed/_onboarded/_client/connections
Client connections grid — search, cards with message/profile actions
/_authed/_onboarded/_trainer/clients
Trainer clients management page
/_authed/_onboarded/_trainer/leads
Trainer leads dashboard — incoming connection requests with match %
/_authed/_onboarded/_client/explore
Discovery page — origin point for sending connection requests
Connection Card Anatomy
Acceptance Criteria
- Client can view all connected trainers in a responsive grid (1/2/3 columns)
- Connection count is displayed in the page header
- Search input filters connections by name
- Each card shows avatar, name, rating, client count, specialties, and bio
- Message and View Profile action buttons are available on each card
- Connection request workflow (send, accept, reject) is not yet implemented
- Remove and block connection actions are not yet implemented
- Backend connection tables and RLS policies are not yet created
API Surface
Server Functions (Planned)
getConnections
Fetch all active connections for current user
sendConnectionRequest
Client sends a request to a trainer
respondToRequest
Trainer accepts or rejects a connection request
removeConnection
Either party removes an active connection
blockUser
Block a user from sending requests or messages
React Query Hooks (Planned)
useConnections()
src/api/connections/hooks.ts
usePendingRequests()
src/api/connections/hooks.ts
useSendConnectionRequest()
src/api/connections/hooks.ts
Current Status
Connections Grid UI
Responsive grid layout with connection cards, avatar, stats, specialties, bio, and action buttons.
Search Input
Search field at the top of the connections page for filtering by name.
Trainer Leads Page
Trainer-facing leads dashboard showing incoming connection requests with match percentages.
Request Workflow
Send/accept/reject connection request flow with optimistic updates.
Block / Remove
Connection removal and user blocking functionality with confirmation dialogs.
Database & RLS
trainer_connections and connection_requests tables with Row Level Security policies.