From 95cbee48ab5d9db48673480b87b6e953e4d2c33c Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 21:49:25 +0330 Subject: [PATCH] fix(dashboard): empty state for comments and messages tabs These tabs have no backend endpoint yet (only per-doctor comments and admin exist; user messages don't), so they read the always-empty user.comments/user.messages. Guard against null and show a clear empty state instead of a blank list. Co-Authored-By: Claude Opus 4.8 --- .../userAccount/sidebars/comments/index.js | 14 ++++++++++++-- .../userAccount/sidebars/messages/index.js | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/components/dashboard/userAccount/sidebars/comments/index.js b/components/dashboard/userAccount/sidebars/comments/index.js index 2c8a2c5..fa6e8bd 100644 --- a/components/dashboard/userAccount/sidebars/comments/index.js +++ b/components/dashboard/userAccount/sidebars/comments/index.js @@ -1,15 +1,25 @@ import Comment from "./Comment"; function Comments({ user, loading }) { + const comments = user?.comments ?? []; + + if (comments.length === 0) { + return ( +

+ نظری ثبت نکرده‌اید. +

+ ); + } + return ( diff --git a/components/dashboard/userAccount/sidebars/messages/index.js b/components/dashboard/userAccount/sidebars/messages/index.js index 20d4419..80a6256 100644 --- a/components/dashboard/userAccount/sidebars/messages/index.js +++ b/components/dashboard/userAccount/sidebars/messages/index.js @@ -1,15 +1,25 @@ import Message from "./Message"; function Messages({ user, loading }) { + const messages = user?.messages ?? []; + + if (messages.length === 0) { + return ( +

+ پیامی ندارید. +

+ ); + } + return (