Skip to content

Commit

Permalink
chore: rem rewards weight from stake table (#468)
Browse files Browse the repository at this point in the history
* chore: rem rewards weight from stake table

* fix: rem rewards rate from 2 other places

* chore: added more spacing on the Quick Stake table

---------

Co-authored-by: Joshua <joshua.brigati@gmail.com>
  • Loading branch information
ericHgorski and JoshuaBrigati authored Jul 14, 2023
1 parent db138e5 commit 354f5c1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 79 deletions.
8 changes: 8 additions & 0 deletions src/components/layout/Table.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,11 @@
border-top: 0px solid var(--card-border);
}
}

.actions {
padding-left: 100px !important;

@media (max-width: 1550px) and (min-width: 1420px) {
padding-left: 50px !important;
}
}
2 changes: 1 addition & 1 deletion src/components/layout/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Table<T>({ dataSource, filter, rowKey, ...props }: Props<T>) {
const columns = props.columns.filter(({ hidden }) => !hidden)

/* helpers */
const getClassName = ({ align }: Column<T>) => cx(align)
const getClassName = ({ align, dataIndex }: Column<T>) => cx(align, dataIndex)

/* pagination */
const [page, setPage] = useState(1)
Expand Down
29 changes: 1 addition & 28 deletions src/pages/stake/QuickStake.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { readPercent } from "@terra-money/terra-utils"
import { Button } from "components/general"
import { Flex, Grid, InlineFlex, Page, Table, Tabs } from "components/layout"
import { useBalances } from "data/queries/bank"
Expand Down Expand Up @@ -265,35 +264,9 @@ const QuickStake = () => {
render: (value = 0) => t("{{value}} days", { value }),
align: "right",
},
{
title: (
<span>
{t("Rewards weight")}{" "}
<TooltipIcon
content={
<article>
<p>
The amount of rewards an Alliance asset accrues is
determined by the asset's Reward Weight.
</p>
<p>
This parameter is set by governance and represents the
maximum proportion of rewards an asset will earn.
</p>
</article>
}
/>
</span>
),
dataIndex: "rewards",
defaultSortOrder: "desc",
sorter: ({ rewards: a = 0 }, { rewards: b = 0 }) => a - b,
render: (rewards = 0) => readPercent(rewards),
align: "right",
},
{
title: t("Actions"),
dataIndex: ["asset", "chainID"],
dataIndex: "actions",
render: (
_,
{
Expand Down
7 changes: 0 additions & 7 deletions src/pages/stake/StakingDetailsCompact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import styles from "./StakingDetailsCompact.module.scss"
import { useNativeDenoms } from "data/token"
import { useNetworkWithFeature } from "data/wallet"
import { useTranslation } from "react-i18next"
import { readPercent } from "@terra-money/terra-utils"
import { useDelegations, useStakingParams } from "data/queries/staking"
import { useAlliance, useAllianceDelegations } from "data/queries/alliance"
import { combineState } from "data/query"
Expand Down Expand Up @@ -92,12 +91,6 @@ const StakingDetailsCompact = ({
<dt>{t("Unbonding period")}:</dt>
<dd>{t("{{value}} days", { value: daysToUnbond })}</dd>
</dl>
<dl>
<dt>{t("Rewards rate")}:</dt>
<dd>
{readPercent(isAlliance ? alliance?.reward_weight ?? 0 : 1)}
</dd>
</dl>
</div>
{!!delegated && (
<div className={styles.staking__details__container}>
Expand Down
28 changes: 0 additions & 28 deletions src/pages/stake/Validators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
} from "data/queries/staking"
import { combineState } from "data/query"
import { useNativeDenoms } from "data/token"
import { readPercent } from "@terra-money/terra-utils"
import { Tooltip, TooltipIcon } from "components/display"
import { ChainFeature } from "types/chains"

Expand Down Expand Up @@ -243,33 +242,6 @@ const Validators = () => {
render: (value = 0) => t("{{value}} days", { value }),
align: "right",
},
{
title: (
<span>
{t("Rewards weight")}{" "}
<TooltipIcon
content={
<article>
<p>
The amount of rewards an Alliance asset accrues is
determined by the asset's Reward Weight.
</p>
<p>
This parameter is set by governance and represents
the maximum proportion of rewards an asset will
earn.
</p>
</article>
}
/>
</span>
),
dataIndex: "rewards",
defaultSortOrder: "desc",
sorter: ({ rewards: a = 0 }, { rewards: b = 0 }) => a - b,
render: (rewards = 0) => readPercent(rewards),
align: "right",
},
]}
/>
</main>
Expand Down
17 changes: 2 additions & 15 deletions src/txs/stake/QuickStakeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useMemo } from "react"
import { useTranslation } from "react-i18next"
import { useForm } from "react-hook-form"
import { Coin } from "@terra-money/feather.js"
import { readPercent, toAmount } from "@terra-money/terra-utils"
import { toAmount } from "@terra-money/terra-utils"
import { getAmount } from "utils/coin"
import { combineState, queryKey } from "data/query"
import { useNetwork } from "data/wallet"
Expand Down Expand Up @@ -38,21 +38,12 @@ interface Props {
balances: { denom: string; amount: string }[]
chainID: string
denom: string
rewardRate: number
unbondingTime: number
isAlliance: boolean
}

const QuickStakeForm = (props: Props) => {
const {
action,
balances,
chainID,
denom,
rewardRate,
unbondingTime,
isAlliance,
} = props
const { action, balances, chainID, denom, unbondingTime, isAlliance } = props

const { t } = useTranslation()
const addresses = useInterchainAddresses()
Expand Down Expand Up @@ -197,10 +188,6 @@ const QuickStakeForm = (props: Props) => {
<dt>{t("Unbonding period")}:</dt>
<dd>{t("{{value}} days", { value: unbondingTime })}</dd>
</dl>
<dl>
<dt>{t("Rewards rate")}:</dt>
<dd>{readPercent(rewardRate)}</dd>
</dl>
</FlexColumn>
<Form onSubmit={handleSubmit(submit.fn)}>
<FormItem
Expand Down

0 comments on commit 354f5c1

Please sign in to comment.