UX: landscape result screen, chat emojis, unread badges, remove XP text
- PostMatchRewardsModal: short-height (landscape) compaction so the win/forfeit result fits without overflow (smaller emoji/coins/padding, max-h 94dvh, wider). - Chat: emoji/sticker picker (owned reactions) — tap to send; hidden on focus. - Unread messages: online-store now tracks a total `unread` (from listConversations); NavRail Friends icon shows a badge (unread + requests), refreshed every 12s on every screen; Friends «پیامها» tab badged too. (Per-conversation unread badges already existed.) - Remove "XP گران است" / "XP is expensive" from shop.xpHint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -41,9 +41,11 @@ interface OnlineStore {
|
||||
// chat
|
||||
activeChatFriend: Friend | null;
|
||||
chatMessages: ChatMessage[];
|
||||
unread: number; // total unread messages across conversations (for nav badge)
|
||||
openChat: (friend: Friend) => Promise<void>;
|
||||
sendChat: (text: string) => Promise<void>;
|
||||
closeChat: () => void;
|
||||
refreshUnread: () => Promise<void>;
|
||||
}
|
||||
|
||||
let roomUnsub: (() => void) | null = null;
|
||||
@@ -154,11 +156,22 @@ export const useOnlineStore = create<OnlineStore>((set, get) => ({
|
||||
|
||||
activeChatFriend: null,
|
||||
chatMessages: [],
|
||||
unread: 0,
|
||||
|
||||
refreshUnread: async () => {
|
||||
try {
|
||||
const convs = await getService().listConversations();
|
||||
set({ unread: convs.reduce((n, c) => n + (c.unread ?? 0), 0) });
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
},
|
||||
|
||||
openChat: async (friend) => {
|
||||
const svc = getService();
|
||||
set({ activeChatFriend: friend, chatMessages: await svc.getMessages(friend.id) });
|
||||
await svc.markRead(friend.id);
|
||||
get().refreshUnread();
|
||||
if (chatUnsub) chatUnsub();
|
||||
chatUnsub = svc.onChat((friendId, msgs) => {
|
||||
const active = get().activeChatFriend;
|
||||
@@ -182,5 +195,6 @@ export const useOnlineStore = create<OnlineStore>((set, get) => ({
|
||||
chatUnsub = null;
|
||||
}
|
||||
set({ activeChatFriend: null, chatMessages: [] });
|
||||
get().refreshUnread();
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user