← Build logs
FrontendJuly 4, 2026

Improving User Experience by Default Collapsing the Insights Panel in the Admin Page Analytics Tab

Improving User Experience: Insights Panel in Admin Analytics Tab Defaults to Collapsed

When users navigated to the analytics tab in the admin page, the insights panel was always expanded by default. This made the screen feel overly cluttered. The unnecessary information showing up first was actually hindering users from focusing on the truly important data. So, I've changed it so that this insights panel is collapsed by default.

Attempts and Pitfalls

At first, I thought I could just tweak the CSS. I tried applying properties like display: none; or visibility: hidden;.

<!-- Pseudo code I tried initially (doesn't actually work) -->
<div class="insight-panel" style="display: none;">
  <!-- Insight content -->
</div>

However, this either prevented the element from rendering at all, or caused issues with styling not applying correctly when it was later expanded. Hiding something without touching the DOM itself turned out to be trickier than I anticipated.

The Cause

It turns out this insights panel was being managed as a React component. Its visibility during the initial render was determined by state values like isExpanded. Simply hiding it with CSS wasn't a fundamental solution.

The Solution

Ultimately, I resolved it by changing the initial state of the component to false (collapsed).

// Snippet of the actual applied React code (not virtualized)
import React, { useState } from 'react';

function InsightPanel() {
  const [isExpanded, setIsExpanded] = useState(false); // Changed initial value to false

  const toggleExpand = () => {
    setIsExpanded(!isExpanded);
  };

  return (
    <div className={`insight-panel ${isExpanded ? 'expanded' : 'collapsed'}`}>
      <button onClick={toggleExpand}>
        {isExpanded ? 'Collapse Insights' : 'Expand Insights'}
      </button>
      {isExpanded && (
        <div className="insight-content">
          {/* Actual insight data loading and rendering */}
          <p>Actual analytics insights will be displayed here.</p>
        </div>
      )}
    </div>
  );
}

export default InsightPanel;

With this change, the insights panel remains collapsed by default when the page loads. Content only appears when the user explicitly clicks the expand button.

Results

  • Screen clutter upon entering the admin page's analytics tab has been significantly reduced.
  • Users can focus better on the information they need, leading to an overall improved user experience.
  • Existing data and functionality are preserved without any changes.

Takeaways — To Avoid the Same Pitfall

  • [ ] To change the initial state of a UI element, you must first understand the component's logic.
  • [ ] If a simple CSS styling doesn't work, check the component's state management logic.
  • [ ] When using frameworks like React, it's crucial to inspect the initial values of state management hooks like useState or useReducer.