Skip to content

Add unread notification badge#47

Merged
wsxiaolin merged 1 commit into
mainfrom
codex/show-notification-for-unread-messages
May 14, 2026
Merged

Add unread notification badge#47
wsxiaolin merged 1 commit into
mainfrom
codex/show-notification-for-unread-messages

Conversation

@wsxiaolin

Copy link
Copy Markdown
Member

Motivation

  • Show a red unread indicator on the footer notification icon when the authenticated user has unread messages or letters from Statistic.UnreadMessages / Statistic.UnreadLetters returned by a real login.
  • Use a publish/subscribe approach so multiple UI pieces can react to unread-state changes.
  • Clear the indicator when the notifications page is opened.

Description

  • Add a small notification state helper src/services/notificationUnread.ts that exposes updateNotificationUnread, clearNotificationUnread, and hasUnreadNotifications and emits notificationUnreadChanged via the app Emitter when the unread state changes.
  • Extend src/services/eventEmitter.ts to include a typed notificationUnreadChanged event.
  • Update src/services/api/getData.ts login flow to call updateNotificationUnread for real logins (token/password or password login) using the Authenticate response Data.Statistic, avoiding updates for anonymous login(null, null).
  • Subscribe the footer to the new unread state in src/components/utils/Footer.vue, rendering the red dot SVG circle (matching the requested appearance) when hasUnreadNotification is true.
  • Clear the unread indicator when the notifications view is activated by calling clearNotificationUnread() in src/views/Notifications.vue.

Testing

  • Ran the production build with npm run build (which runs vue-tsc and vite build), and the build completed successfully.

Codex Task

@wsxiaolin

Copy link
Copy Markdown
Member Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wsxiaolin wsxiaolin merged commit a542a5b into main May 14, 2026
1 check passed
@wsxiaolin wsxiaolin deleted the codex/show-notification-for-unread-messages branch May 14, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant