Commit bf608999 authored by Mahmoud Aglan's avatar Mahmoud Aglan

feat(social): full friends system — search, add, pending requests, online filter, remove

Friends scene rebuilt:
- 3 tabs: الأصدقاء (all), الطلبات (pending), متصلين (online)
- Search players by username (🔍 button → input + results)
- Send friend request with + button (success feedback)
- Accept/reject pending requests (✓/✕ buttons)
- Remove friend (with confirm dialog)
- Challenge online friend (️ → navigates to game select)
- View profile button
- Online dot indicator on avatars
- Empty states with helpful CTAs

API updated:
- New action: search — finds players by username (ilike)
- Returns id, username, display_name, avatar_url, level, is_online

UI polish:
- Tab system with active state
- Card-based friend list with actions
- Animations and haptic on interactions
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent e1001508
......@@ -56,6 +56,20 @@ if ($method === 'GET') {
]);
jsonResponse(['pending' => $pending ?: []]);
}
if ($action === 'search') {
$query = $_GET['query'] ?? '';
if (strlen($query) < 2) jsonError('Query too short');
$results = $db->get('profiles', [
'username' => 'ilike.*' . $query . '*',
'id' => 'neq.' . $userId,
'select' => 'id,username,display_name,avatar_url,level,is_online',
'limit' => 10
]);
jsonResponse(['players' => is_array($results) && !isset($results['error']) ? $results : []]);
}
}
if ($method === 'POST') {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment