diff --git a/jam-ui/src/store/features/sessionChatSlice.js b/jam-ui/src/store/features/sessionChatSlice.js index ee7084096..8af8cc757 100644 --- a/jam-ui/src/store/features/sessionChatSlice.js +++ b/jam-ui/src/store/features/sessionChatSlice.js @@ -111,6 +111,33 @@ const sessionChatSlice = createSlice({ */ closeChatWindow: (state) => { state.isWindowOpen = false; + }, + + /** + * Mark channel as read + * Resets unread count and updates lastReadAt timestamp + */ + markAsRead: (state, action) => { + const { channel } = action.payload; + state.unreadCounts[channel] = 0; + state.lastReadAt[channel] = new Date().toISOString(); + }, + + /** + * Increment unread count for a channel + * Initializes count to 1 if channel doesn't exist + */ + incrementUnreadCount: (state, action) => { + const { channel } = action.payload; + state.unreadCounts[channel] = (state.unreadCounts[channel] || 0) + 1; + }, + + /** + * Set window position for persistence + * Used by WindowPortal to save drag position + */ + setWindowPosition: (state, action) => { + state.windowPosition = action.payload; } } }); @@ -119,7 +146,10 @@ export const { addMessageFromWebSocket, setActiveChannel, openChatWindow, - closeChatWindow + closeChatWindow, + markAsRead, + incrementUnreadCount, + setWindowPosition } = sessionChatSlice.actions; export default sessionChatSlice.reducer;