DEV Community

Ali Hamza
Ali Hamza

Posted on

Day 164 of Learning MERN Stack

Hello Dev Community! 👋

It is officially Day 164 of my full-stack engineering journey! Today, I designed and built the main Chat Dashboard Sidebar (Sidebar.jsx) for my real-time messaging application, QuickChat! 💬⚡

Focusing on scalable user discovery, online presence indicators, and clean state management was today's priority. Here is how I structured the component.


🛠️ Technical Breakdown: QuickChat Sidebar Component

As captured in my dashboard layout and VS Code views (Screenshots 395, 396, & 397):

1. Instant User Filtering Logic

  • Implemented client-side array filtering to allow instantaneous search queries across active users:

javascript
  const filterUsers = input
    ? users.filter((user) =>
        user.fullName.toLowerCase().includes(input.toLowerCase())
      )
    : users; {onlineUsers?.includes(user._id) ? (
  <span className="text-green-600 text-xs">Online</span>
) : (
  <span className="text-neutral-400 text-xs">Offline</span>
)}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)