1+ // Copyright © 2024–2026 Jasper Ford
2+ // SPDX-License-Identifier: AGPL-3.0-or-later
3+ // Author: Jasper Ford
4+ // See NOTICE file for attribution and acknowledgements.
5+
16"use client" ;
27
38import { useEffect , useState } from "react" ;
@@ -55,8 +60,8 @@ function DashboardContent() {
5560 const [ balance , setBalance ] = useState < WalletBalance | null > ( null ) ;
5661 const [ transactions , setTransactions ] = useState < Transaction [ ] > ( [ ] ) ;
5762 const [ listings , setListings ] = useState < Listing [ ] > ( [ ] ) ;
58- const [ unreadCount , setUnreadCount ] = useState ( 0 ) ;
5963 const [ gamification , setGamification ] = useState < GamificationProfile | null > ( null ) ;
64+ const [ messageCount , setMessageCount ] = useState ( 0 ) ;
6065 const [ isLoading , setIsLoading ] = useState ( true ) ;
6166
6267 useEffect ( ( ) => {
@@ -66,14 +71,14 @@ function DashboardContent() {
6671 api . getBalance ( ) ,
6772 api . getTransactions ( { limit : 5 } ) ,
6873 api . getListings ( { status : "active" , limit : 4 } ) ,
69- api . getUnreadMessageCount ( ) ,
74+ api . getUnreadMessageCount ( ) . catch ( ( ) => ( { count : 0 } ) ) ,
7075 api . getGamificationProfile ( ) . catch ( ( ) => null ) ,
7176 ] ) ;
7277
7378 setBalance ( balanceRes ) ;
7479 setTransactions ( txRes ?. data || [ ] ) ;
7580 setListings ( listingsRes ?. data || [ ] ) ;
76- setUnreadCount ( msgRes ?. count || 0 ) ;
81+ setMessageCount ( msgRes ?. count || 0 ) ;
7782 if ( gamRes ?. profile ) {
7883 setGamification ( gamRes . profile ) ;
7984 }
@@ -89,7 +94,7 @@ function DashboardContent() {
8994
9095 return (
9196 < div className = "min-h-screen" >
92- < Navbar user = { user } unreadCount = { unreadCount } onLogout = { logout } />
97+ < Navbar user = { user } onLogout = { logout } />
9398
9499 < div className = "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8" >
95100 { /* Welcome Header */ }
@@ -225,7 +230,7 @@ function DashboardContent() {
225230 < div className = "w-10 h-10 rounded-xl bg-cyan-500/20 flex items-center justify-center mb-4" >
226231 < MessageSquare className = "w-5 h-5 text-cyan-400" />
227232 </ div >
228- < p className = "text-2xl font-bold text-white" > { unreadCount } </ p >
233+ < p className = "text-2xl font-bold text-white" > { messageCount } </ p >
229234 < p className = "text-sm text-white/50 mb-4" > Unread Messages</ p >
230235 < Link href = "/messages" className = "mt-auto" >
231236 < Button
0 commit comments