Skip to content

Admin Dashboard Component

Overview

The AdminDashboard component provides administrators with a comprehensive view of platform metrics, user statistics, engagement data, and financial performance. It enables filtering and displays detailed insights to support operational decisions. Data is retrieved from Firebase Firestore and other APIs.


Key Features

  1. Dynamic Metrics:

    • Displays key statistics such as total users, paid users, free trial users, and free users.
    • Financial metrics including Monthly Recurring Revenue (MRR), conversion rates, and churn rates.
    • Engagement metrics such as tenders scraped, searches, applications, email recommendations, and customer satisfaction.
  2. Interactive Filtering:

    • Administrators can filter and toggle between views for:
      • Latest Suppliers
      • Top Engagers
      • Apply Button Clicks
  3. Data Tracking:

    • Tracks engagement data, including apply button clicks and email recommendations.
  4. Component Modularity:

    • Modular components like AdminStats, LatestSuppliers, and TopEngagers encapsulate functionality for better maintainability.

Dependencies

  • React: Core framework for component rendering.
  • Firebase: Authentication and Firestore database interactions.
  • Axios: For making API requests.
  • Lucide-React: For icons used in metrics cards.
  • Custom UI Components: Card, Input, Button, etc.

Component Structure

AdminDashboard

State VariablesTypeDescription
tokenstringStores the Firebase authentication token.
liststringDetermines the current view ("latest suppliers", "top engagers", etc.).

UseEffect Hooks:

  • Retrieves the authentication token when the component is mounted.

Conditional Rendering:

  • Based on list, renders LatestSuppliers, TopEngagers, or ApplyBtnClicks.
return (
<div className="flex min-h-screen w-full flex-col">
<main className="flex flex-1 flex-col gap-4 p-4 md:gap-8 md:p-8">
<AdminStats token={token} />
<div className="text-right">
<select
onChange={(e) => setList(e.target.value)}
className="form-select rounded px-4 py-2"
id="list-item"
value={list}
>
<option value="latest suppliers">Latest Subscriptions</option>
<option value="top engagers">Top Engagers</option>
<option value="apply btn clicks">Apply Btn Clicks</option>
</select>
</div>
{list === "latest suppliers" && <LatestSuppliers token={token} />}
{list === "top engagers" && <TopEngagers token={token} />}
{list === "apply btn clicks" && <ApplyBtnClicks token={token} />}
</main>
</div>
);

AdminStats Component

Key Features

  • Displays platform metrics in a structured grid layout using cards.
  • Metrics include:
    • Total Users
    • Free Users
    • Free Trial Users
    • Paid Users
    • Monthly Recurring Revenue (MRR)
    • Conversion Rates
    • Churn Rates (Gross and Net)
    • Engagement Scores
    • Searches (Regular and Semantic)
    • Applications
    • Customer Satisfaction Scores
    • Email Recommendations
    • Invites Sent
    • New Sign-ups from Invites

State Variables

State VariableTypeDescription
totalUsersnumberTotal number of users on the platform.
freeUsersnumberCount of users on the free tier.
freeTrialUsersnumberCount of users on a free trial.
paidUsersnumberCount of users on the paid tier.
mrrnumberMonthly Recurring Revenue.
churnRatenumberOverall churn rate of users.
netRevenueChurnRatenumberChurn rate calculated based on net revenue.
grossRevenueChurnRatenumberChurn rate calculated based on gross revenue.
engagementScorenumberOverall engagement score of users.
tendersScrapednumberCount of tenders scraped for platform use.
regularSearchesnumberNumber of regular searches performed by users.
applyButtonClickedCountnumberCount of apply button clicks.
emailRecommendationsnumberCount of email recommendations sent.
invitesSentnumberNumber of invites sent to prospective users.
newSignUpsFromInvitenumberCount of new sign-ups generated via invites.

Cards for Metrics

MetricIconDescription
Total UsersUsersTotal users registered on the platform.
Free UsersUsersUsers on the free plan.
Free Trial UsersUsersUsers currently in the free trial period.
Paid UsersCreditCardUsers subscribed to paid plans.
Tenders ScrapedFileBadgeTotal tenders available on the platform.
MRRDollarSignMonthly Recurring Revenue in USD.
Conversion RateFilterPercentage of free users converted to paid users.
Churn RateUnlinkPercentage of users leaving the platform.
Net Revenue Churn RateUnlinkChurn rate calculated using net revenue.
Gross Revenue Churn RateUnlinkChurn rate calculated using gross revenue.
Engagement ScoreMailPlusAverage engagement score across all users.
Regular SearchesSearchTotal regular searches performed by users.
Semantic SearchesSearchTotal semantic searches performed.
ApplicationsFileBadgeNumber of applications submitted via the platform.
Email RecommendationsMailNumber of recommendations sent via email.
Customer SatisfactionSmileAggregated customer satisfaction score.
Invites SentMailPlusTotal invitations sent by users.
New Sign-ups from InvitesMailPlusUsers who signed up via an invitation.

Functional Highlights

  1. Dynamic Data Retrieval:

    • Metrics are retrieved dynamically from Firebase and API endpoints.
    • Data includes real-time updates for user engagement and platform activity.
  2. Semantic and Regular Search Metrics:

    • Includes counts for both semantic and regular searches.
    • Helps administrators understand search behavior on the platform.
  3. Visual Representation:

    • Metrics are displayed in visually distinct cards for better readability.
    • Iconography helps in quick identification of metrics.
  4. Financial and User Retention Metrics:

    • MRR and churn rates provide insight into platform profitability.
    • Conversion rates track free-to-paid user transitions.

Data Fetching

Fetching from Firebase

  • Admin KPIs such as:
    • Apply button clicks
    • Regular and semantic searches
    • Email recommendations
  • These metrics are retrieved from the adminkpis collection in Firebase Firestore.

Fetching from External API

  • Metrics like:
    • Monthly Recurring Revenue (MRR)
    • Conversion rates
    • Churn rates (Gross and Net)
  • These are fetched via API calls using the getDashboardData function.

CSV Export Functions

  • Admins can export data as CSV files for external analysis.
  • Available exports include:
    1. Supplier List: Contains information about all registered suppliers.
    2. Apply Button Click Information: Details on recent apply button interactions.

Modular Components

ComponentDescription
AdminStatsDisplays overall platform metrics in a grid layout using cards.
LatestSuppliersShows a table of the most recent supplier sign-ups.
TopEngagersDisplays a list of users with the highest engagement scores.
ApplyBtnClicksDisplays detailed information about recent apply button clicks.

Conclusion

The AdminDashboard component provides a robust overview of platform operations, supporting data-driven decisions for improving engagement and user retention. Modular components and interactive filtering enhance maintainability and usability. For further details, refer to the component’s source code in the project repository.