fix: repair invite links, social features, messaging + Discord UI overhaul
Phase 1 - Feature Repair: - Fix member kick/leave: add missing db.delete() call in servers.ts - Stabilize invite codes: return existing code instead of regenerating - Fix user search: use LIKE instead of exact match in social.ts - Wire DM button on FriendsPage to create/navigate to DM channels - Add cancel outgoing friend request (DELETE endpoint + frontend) - Add accept/decline friend request actions with WS real-time events - Fix replyToId persistence in message creation - Hydrate reactions and replyTo in message queries - Add joinByCode to API client and serverStore - Add friend_request_received/accepted WebSocket events Phase 2 - Discord UI Overhaul: - Remove stray borders between layout columns - Replace shadow-sm with shadow-header on content headers - Replace all bg-gray-*/text-gray-* with Discord color tokens - Ensure flat color contrast (#1E1F22, #2B2D31, #313338) Testing: - Set up vitest + @testing-library/react + jsdom - Add 17 tests across InviteModal, JoinServer, FriendsPage (all passing) - Fix vite resolve.extensions to prefer .tsx over stale .js files
This commit is contained in:
@@ -99,6 +99,14 @@ export const api = {
|
||||
},
|
||||
sendMessage: (id, data) => request('POST', `/dm/${id}/messages`, data),
|
||||
},
|
||||
social: {
|
||||
friends: () => request('GET', '/social/friends'),
|
||||
requests: () => request('GET', '/social/requests'),
|
||||
sendRequest: (username) => request('POST', '/social/requests', { username }),
|
||||
updateRequest: (id, status) => request('PATCH', `/social/requests/${id}`, { status }),
|
||||
removeFriend: (id) => request('DELETE', `/social/friends/${id}`),
|
||||
search: (q) => request('GET', `/social/search?q=${encodeURIComponent(q)}`),
|
||||
},
|
||||
livekit: {
|
||||
token: (channelId) => request('POST', '/livekit/token', { channelId }),
|
||||
},
|
||||
|
||||
@@ -23,6 +23,8 @@ import type {
|
||||
LiveKitTokenResponse,
|
||||
CreateDmRequest,
|
||||
CreateDmMessageRequest,
|
||||
Friend,
|
||||
FriendRequest,
|
||||
} from '@opencord/shared';
|
||||
|
||||
const BASE_URL = '/api';
|
||||
@@ -110,6 +112,7 @@ export const api = {
|
||||
delete: (id: string) => request<{ success: boolean }>('DELETE', `/servers/${id}`),
|
||||
invite: (id: string) => request<{ inviteCode: string }>('POST', `/servers/${id}/invite`),
|
||||
join: (id: string, data: JoinServerRequest) => request<Server>('POST', `/servers/${id}/join`, data),
|
||||
joinByCode: (inviteCode: string) => request<Server>('POST', '/servers/join', { inviteCode }),
|
||||
members: (id: string) => request<MemberWithUser[]>('GET', `/servers/${id}/members`),
|
||||
updateMember: (serverId: string, userId: string, data: UpdateMemberRequest) =>
|
||||
request<MemberWithUser>('PATCH', `/servers/${serverId}/members/${userId}`, data),
|
||||
@@ -156,6 +159,17 @@ export const api = {
|
||||
request<DmMessageWithUser>('POST', `/dm/${id}/messages`, data),
|
||||
},
|
||||
|
||||
social: {
|
||||
friends: () => request<Friend[]>('GET', '/social/friends'),
|
||||
requests: () => request<FriendRequest[]>('GET', '/social/requests'),
|
||||
sendRequest: (username: string) => request<{ success: boolean }>('POST', '/social/requests', { username }),
|
||||
updateRequest: (id: string, status: 'accepted' | 'declined') =>
|
||||
request<{ success: boolean }>('PATCH', `/social/requests/${id}`, { status }),
|
||||
removeFriend: (id: string) => request<{ success: boolean }>('DELETE', `/social/friends/${id}`),
|
||||
cancelRequest: (id: string) => request<{ success: boolean }>('DELETE', `/social/requests/${id}`),
|
||||
search: (q: string) => request<User[]>('GET', `/social/search?q=${encodeURIComponent(q)}`),
|
||||
},
|
||||
|
||||
livekit: {
|
||||
token: (channelId: string) =>
|
||||
request<LiveKitTokenResponse>('POST', '/livekit/token', { channelId }),
|
||||
|
||||
Reference in New Issue
Block a user