Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unused component #61

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions components/admins/components/__tests__/adminOptions.test.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions components/admins/components/__tests__/stakingParams.test.tsx

This file was deleted.

71 changes: 0 additions & 71 deletions components/admins/components/adminOptions.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions components/admins/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from './adminOptions';
export * from './stakingParams';
export * from './validatorList';
101 changes: 0 additions & 101 deletions components/admins/components/stakingParams.tsx

This file was deleted.

34 changes: 16 additions & 18 deletions components/admins/components/validatorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div className="flex justify-between items-center mb-4 min-h-[52px]">
<div className="flex items-center space-x-4">
<h2
className="text-black dark:text-white"
className="text-secondary-content"
style={{ fontSize: '20px', fontWeight: 700, lineHeight: '24px' }}
>
Validators
Expand All @@ -89,31 +89,27 @@
<input
type="text"
placeholder="Search for a validator..."
className="input input-bordered w-[224px] h-[40px] rounded-[12px] border-none bg:[#0000000A] dark:bg-[#FFFFFF1F] pl-10"
className="input input-bordered w-[224px] h-[40px] rounded-[12px] border-none bg-secondary text-secondary-content pl-10"
value={searchTerm}
onChange={e => setSearchTerm(e.target.value)}
/>
<SearchIcon className="h-6 w-6 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 " />
</div>
</div>
</div>
<div className="flex mb-6 w-full h-[3.5rem] rounded-xl p-1 bg-[#0000000A] dark:bg-[#FFFFFF0F]">
<div className="flex mb-6 w-full h-[3.5rem] rounded-xl p-1 bg-secondary">
<button
onClick={() => setActive(true)}
className={`flex-1 py-2 px-4 text-sm font-medium rounded-xl ${
active
? 'dark:bg-[#FFFFFF1F] bg-[#FFFFFF] text-[#161616] dark:text-white'
: 'text-[#808080]'
active ? 'bg-base-300 text-secondary-content' : 'text-gray-500'
}`}
>
Active
</button>
<button
onClick={() => setActive(false)}
className={`flex-1 py-2 px-4 text-sm font-medium rounded-xl ${
!active
? 'dark:bg-[#FFFFFF1F] bg-[#FFFFFF] text-[#161616] dark:text-white'
: 'text-[#808080]'
!active ? 'bg-base-300 text-secondary-content' : 'text-gray-500'
}`}
>
Pending
Expand Down Expand Up @@ -148,32 +144,32 @@
.fill(0)
.map((_, index) => (
<tr key={index}>
<td className="dark:bg-[#FFFFFF0F] bg-[#FFFFFF] rounded-l-[12px] w-1/6">
<td className="bg-secondary rounded-l-[12px] w-1/6">

Check warning on line 147 in components/admins/components/validatorList.tsx

View check run for this annotation

Codecov / codecov/patch

components/admins/components/validatorList.tsx#L147

Added line #L147 was not covered by tests
<div className="flex items-center space-x-3">
<div className="skeleton w-10 h-8 rounded-full shrink-0"></div>
<div className="skeleton h-3 w-24"></div>
</div>
</td>
<td className="dark:bg-[#FFFFFF0F] bg-[#FFFFFF] w-1/6">
<td className="bg-secondary w-1/6">

Check warning on line 153 in components/admins/components/validatorList.tsx

View check run for this annotation

Codecov / codecov/patch

components/admins/components/validatorList.tsx#L153

Added line #L153 was not covered by tests
<div className="skeleton h-2 w-24"></div>
</td>
<td className="dark:bg-[#FFFFFF0F] bg-[#FFFFFF] w-1/6">
<td className="bg-secondary w-1/6">

Check warning on line 156 in components/admins/components/validatorList.tsx

View check run for this annotation

Codecov / codecov/patch

components/admins/components/validatorList.tsx#L156

Added line #L156 was not covered by tests
<div className="skeleton h-2 w-8"></div>
</td>
<td className="dark:bg-[#FFFFFF0F] bg-[#FFFFFF] w-1/6 rounded-r-[12px] text-right">
<td className="bg-secondary w-1/6 rounded-r-[12px] text-right">

Check warning on line 159 in components/admins/components/validatorList.tsx

View check run for this annotation

Codecov / codecov/patch

components/admins/components/validatorList.tsx#L159

Added line #L159 was not covered by tests
<div className="skeleton h-2 w-8 ml-auto"></div>
</td>
</tr>
))
: filteredValidators.map(validator => (
<tr
key={validator.operator_address}
className="bg-[#FFFFFFCC] dark:bg-[#FFFFFF0F] hover:bg-[#FFFFFF66] dark:hover:bg-[#FFFFFF1A] text-black dark:text-white rounded-lg cursor-pointer"
className="group text-black dark:text-white rounded-lg cursor-pointer transition-colors"
onClick={() => handleRowClick(validator)}
role="row"
aria-label={`Validator ${validator.description.moniker}`}
>
<td className="rounded-l-[12px] py-4">
<td className="bg-secondary group-hover:bg-base-300 rounded-l-[12px] py-4">
<div className="flex items-center space-x-3">
{validator.logo_url ? (
<Image
Expand All @@ -193,14 +189,16 @@
</div>
</td>

<td className="py-4">
<td className="bg-secondary group-hover:bg-base-300 py-4">
<TruncatedAddressWithCopy
slice={10}
address={validator.operator_address}
/>
</td>
<td className="py-4">{validator.consensus_power?.toString() ?? 'N/A'}</td>
<td className="rounded-r-[12px] py-4 text-right">
<td className="bg-secondary group-hover:bg-base-300 py-4">
{validator.consensus_power?.toString() ?? 'N/A'}
</td>
<td className="bg-secondary group-hover:bg-base-300 rounded-r-[12px] py-4 text-right">
Comment on lines +198 to +201
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance data display and user safety

  1. The consensus power value should be formatted for better readability
  2. The remove button should have a tooltip warning about the action
 <td className="bg-secondary group-hover:bg-base-300 py-4">
-  {validator.consensus_power?.toString() ?? 'N/A'}
+  {validator.consensus_power 
+    ? new Intl.NumberFormat().format(Number(validator.consensus_power))
+    : 'N/A'
+  }
 </td>
 <td className="bg-secondary group-hover:bg-base-300 rounded-r-[12px] py-4 text-right">
   <button
     onClick={e => {
       e.stopPropagation();
       handleRemove(validator);
     }}
-    className="btn btn-error btn-sm text-white "
+    className="btn btn-error btn-sm text-white tooltip tooltip-left"
+    data-tip="Remove validator"
+    aria-label={`Remove validator ${validator.description.moniker}`}
   >
     <TrashIcon className="w-5 h-5" />
   </button>
 </td>

Committable suggestion skipped: line range outside the PR's diff.

<button
onClick={e => {
e.stopPropagation();
Expand Down
Loading
Loading