feat: add real-time notification system and fix admin login bug
- Fix login: role field was missing from session (admin page inaccessible)
- Add onlineUsers map in socket/state.ts to track connected users
- Join personal user:${id} socket room on connect for targeted notifications
- Emit friendRequestReceived/friendRequestAccepted socket events from friends controller
- Add sendGameInvite socket event handler on server
- New NotificationContext: global socket provider for registered users
- New NotificationPanel: bell icon with unread badge and dropdown in header
- Friends page: inline game invite input per friend with sendGameInvite
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
12
types/index.d.ts
vendored
12
types/index.d.ts
vendored
@@ -93,6 +93,18 @@ export interface TournamentPlayer {
|
||||
gamesPlayed?: number;
|
||||
}
|
||||
|
||||
export type NotificationType = "friendRequest" | "friendAccepted" | "gameInvite";
|
||||
|
||||
export interface AppNotification {
|
||||
id: string;
|
||||
type: NotificationType;
|
||||
fromId: number;
|
||||
fromName: string;
|
||||
gameCode?: string;
|
||||
createdAt: number;
|
||||
read: boolean;
|
||||
}
|
||||
|
||||
export interface TournamentRound {
|
||||
id?: number;
|
||||
tournamentId?: number;
|
||||
|
||||
Reference in New Issue
Block a user