forked from osmosis-labs/osmosis-frontend
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Bump Cosmos-Kit and Use Wallet Client As Preferred Signer (osmosis-labs#2107) * Update Pool Creation Fee to 1000 OSMO (osmosis-labs#2126) * mattupham/staking mobile (osmosis-labs#2120) * Clean up whitespace * Cleanup on mobile * validator next step modal * Clean up table * Clean up 2 * Remove comment * Asset Integrations: Add USDC.wh and WETH.wh (osmosis-labs#2116) * add USDC.wh and WETH.wh * Update source-chain-infos.ts * Asset Integrations: Add DGL token (osmosis-labs#2114) * add DGL token * Update source-chain-infos.ts * Update ibc-assets.ts * yarn * [Notifi] notification popover integration V2 + V3 (osmosis-labs#2035) * Notifi integration: feat: target verify/ discard modal/ major refactor/ other fixes * Notification integration: feat: unread count badge --------- Co-authored-by: Eric Lee <[email protected]> * fix: Swap Memory Leak (osmosis-labs#2129) * add YieldETH (osmosis-labs#2026) * Notification integration: fix: unread count badge prevents hovering the bell button (osmosis-labs#2131) Co-authored-by: Eric Lee <[email protected]> * Notifi integration: fix: email regex mismatch (osmosis-labs#2132) Co-authored-by: Eric Lee <[email protected]> * mattupham/table performance + sorting (osmosis-labs#2125) * remove virtualizer * Clean up comments * Clean up rows * Uncomment confirmed non-perf issue * Uncomment confirmed non-perf issue 2 * Add useCallback for formatted voting power * Clean up myStake * Optimize comissions * Clean up performance issues * Remove accessor key * Memoize table * Remove cells * Clean up types * Rename files * Justify all left * Add validator names * Move handle button click * Remove logs * Clean up commissions sort * Clean up types * Clean up * add todo * update recommended assets (osmosis-labs#2135) * Asset Integrations: Re-order Assets Page (osmosis-labs#2128) * reorder assets * Update ibc-assets.ts * Update ibc-assets.ts * Asset Integrations: Add noble.USDC (osmosis-labs#2133) * Add noble.USDC * fix noble USDC changes * update noble rest * prettier --------- Co-authored-by: Jose Felix <[email protected]> Co-authored-by: JeremyParish69 <[email protected]> Co-authored-by: Matt Upham <[email protected]> Co-authored-by: eric-notifi <[email protected]> Co-authored-by: Eric Lee <[email protected]>
- Loading branch information
1 parent
ae89fe2
commit 20f335f
Showing
49 changed files
with
2,460 additions
and
1,414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
packages/web/components/stake/validator-squad-table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { Dec } from "@keplr-wallet/unit"; | ||
import { flexRender } from "@tanstack/react-table"; | ||
import { Table } from "@tanstack/react-table"; | ||
import { memo } from "react"; | ||
import { useTranslation } from "react-multi-lang"; | ||
|
||
import { Icon } from "~/components/assets"; | ||
|
||
export type Validator = { | ||
validatorName: string | undefined; | ||
myStake: Dec; | ||
votingPower: Dec; | ||
commissions: Dec; | ||
website: string | undefined; | ||
imageUrl: string; | ||
operatorAddress: string; | ||
isAPRTooHigh: boolean; | ||
isVotingPowerTooHigh: boolean; | ||
}; | ||
|
||
export type FormattedValidator = { | ||
validatorName: string; | ||
formattedMyStake: string; | ||
formattedVotingPower: string; | ||
formattedCommissions: string; | ||
formattedWebsite: string; | ||
website: string; | ||
imageUrl: string; | ||
isAPRTooHigh: boolean; | ||
isVotingPowerTooHigh: boolean; | ||
}; | ||
|
||
interface ValidatorSquadTableProps { | ||
table: Table<FormattedValidator>; | ||
} | ||
|
||
export const ValidatorSquadTable = memo( | ||
({ table }: ValidatorSquadTableProps) => { | ||
const t = useTranslation(); | ||
const { rows } = table.getRowModel(); | ||
|
||
return ( | ||
<table className="w-full"> | ||
<thead className="sticky top-0 z-50 m-0"> | ||
{table | ||
.getHeaderGroups() | ||
.slice(1) | ||
.map((headerGroup) => ( | ||
<tr key={headerGroup.id} className="!bg-osmoverse-700"> | ||
{headerGroup.headers.map((header) => { | ||
return ( | ||
<th key={header.id} colSpan={header.colSpan}> | ||
{header.isPlaceholder ? null : ( | ||
<div | ||
{...{ | ||
className: header.column.getCanSort() | ||
? "cursor-pointer select-none flex items-center gap-2" | ||
: "", | ||
onClick: header.column.getToggleSortingHandler(), | ||
}} | ||
> | ||
{flexRender( | ||
header.column.columnDef.header, | ||
header.getContext() | ||
)} | ||
{{ | ||
asc: ( | ||
<Icon | ||
id="sort-up" | ||
className="h-[16px] w-[7px] text-osmoverse-300" | ||
/> | ||
), | ||
desc: ( | ||
<Icon | ||
id="sort-down" | ||
className="h-[16px] w-[7px] text-osmoverse-300" | ||
/> | ||
), | ||
}[header.column.getIsSorted() as string] ?? null} | ||
</div> | ||
)} | ||
</th> | ||
); | ||
})} | ||
</tr> | ||
))} | ||
</thead> | ||
<tbody> | ||
{rows.length === 0 ? ( | ||
<tr> | ||
<td colSpan={4} className="h-32 text-center"> | ||
{t("stake.validatorSquad.noResults")} | ||
</td> | ||
</tr> | ||
) : ( | ||
rows.map((row) => { | ||
const cells = row?.getVisibleCells(); | ||
return ( | ||
<tr key={row?.id}> | ||
{cells?.map((cell) => { | ||
return ( | ||
<td key={cell.id} className="text-left"> | ||
{flexRender( | ||
cell.column.columnDef.cell, | ||
cell.getContext() | ||
)} | ||
</td> | ||
); | ||
})} | ||
</tr> | ||
); | ||
}) | ||
)} | ||
</tbody> | ||
</table> | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.