AOSSIE-Org / Agora-Blockchain

26 stars 46 forks source link

Show 'No Elections Found' when filter is empty #62

Closed akathedeveloper closed 2 weeks ago

akathedeveloper commented 3 months ago

Description:

This PR enhances the ElectionDash component by adding a message that is displayed when there are no elections matching the selected filter (Pending, Active, or Ended). The message is centered and styled to be easily noticeable, improving the user experience by providing clear feedback when no elections are available for the chosen filter.

Changes Made:

  1. "No pending elections found"
  2. "No active elections found"
  3. "No ended elections found"

Screenshots :

Before:

image

After:

image

Testing:

Related Issue:

Issue #61

Ronnieraj37 commented 2 months ago

Hey @akathedeveloper your commits are creating a conflict please fix them.

Additional Changes:

  1. Please don't use those many if else statements. The file already contains an object const counts = { total: 0, pending: 0, active: 0, ended: 0 }; you can use this to get const statusNames = Object.keys(counts); // ['total', 'pending', 'active', 'ended'] which can be later used to show the name No {name} Elections found.
  2. You do not have to again check for empty elections (count.active ==0, etc..) as you're already doing that when calling the renderMessage function checking the filteredElections variable check of 0.
akathedeveloper commented 2 months ago

Sure sir I will make sure to incorporate the changes suggest by you