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

feat(wallet-dashboard): style staking overview #4026

Closed
wants to merge 126 commits into from
Closed
Show file tree
Hide file tree
Changes from 124 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
54aa532
feat(wallet-dashboard): add styles for Review & Send screen
VmMad Oct 30, 2024
9ae17c0
Merge branch 'develop' into tooling-dashboard/style-send-screen
VmMad Oct 30, 2024
cc2a855
fix: move CoinIcon to core
VmMad Oct 30, 2024
7bd6cbf
feat(wallet-dashboard): style send entry screen WIP
cpl121 Oct 30, 2024
10c23f8
Merge branches 'tooling-dashboard/style-send-entry-screen' and 'devel…
cpl121 Oct 30, 2024
40d36db
Merge branches 'tooling-dashboard/style-send-entry-screen' and 'devel…
cpl121 Oct 31, 2024
79c283b
feat(wallet-dashboard): style send entry screen WIP
cpl121 Oct 31, 2024
c925a99
feat(tooling-dashboard): style selected stake
panteleymonchuk Oct 31, 2024
1d8887e
feat(tooling-dashboard): add data to stake details page
panteleymonchuk Oct 31, 2024
a852fab
feat(wallet-dashboard): remove extra memo.
panteleymonchuk Nov 1, 2024
993a16a
Merge branches 'tooling-dashboard/style-send-entry-screen' and 'devel…
cpl121 Nov 4, 2024
f820cf3
fix(wallet-dashboard): sort the dependencies
cpl121 Nov 4, 2024
cb75496
feat(wallet-dashboard): includes icon coin in coin selector
cpl121 Nov 4, 2024
9b56596
fix(wallet-dashboard): prettier
cpl121 Nov 4, 2024
758cba8
fix(wallet-dashboard): update schema validation and share gas budget …
cpl121 Nov 4, 2024
439f050
Merge branches 'tooling-dashboard/style-send-entry-screen' and 'devel…
cpl121 Nov 7, 2024
8325b36
Merge remote-tracking branch 'origin/develop' into tooling-dashboard/…
panteleymonchuk Nov 7, 2024
388058c
feat(staking): refactor StakeDialog. Add new Layout component.
panteleymonchuk Nov 7, 2024
d011746
fix(wallet-dashboard): some fixes
cpl121 Nov 7, 2024
d8d03ac
feat(tooling-core): add clsx dependency to package.json and update pn…
panteleymonchuk Nov 7, 2024
1ff40ea
Merge remote-tracking branch 'origin/develop' into tooling-dashboard/…
panteleymonchuk Nov 7, 2024
d20a617
fix(wallet-dashboard): some build errors
cpl121 Nov 7, 2024
f7ae2d7
fix(wallet-dashboard): fix change amount in send token input
cpl121 Nov 7, 2024
b23246f
fix(wallet-dashboard): linter
cpl121 Nov 7, 2024
193cf87
Merge branch 'develop' of github.com:iotaledger/iota into tooling-das…
cpl121 Nov 7, 2024
f4abb91
Merge branches 'tooling-dashboard/style-send-entry-screen' and 'devel…
cpl121 Nov 8, 2024
86bedbf
fix(wallet-dashboard): linter
cpl121 Nov 8, 2024
d0ca55d
fix(wallet-dashboard): core prettier
cpl121 Nov 8, 2024
657329a
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 8, 2024
eefbd09
feat: add review dialog as view
VmMad Nov 8, 2024
1de3906
Merge branches 'tooling-dashboard/style-send-entry-screen' and 'tooli…
cpl121 Nov 11, 2024
625aeef
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 11, 2024
be6d9f2
fix(wallet-dashboard): include interface with props and some fixes
cpl121 Nov 11, 2024
b3960fd
fix: update review comments
VmMad Nov 11, 2024
ea8646d
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 11, 2024
82909d8
fix(wallet-dashboard): fixes
cpl121 Nov 11, 2024
b9a659e
fix(wallet-dashboard): fixes
cpl121 Nov 12, 2024
58415c7
fix(wallet-dashboard): move FormInputs to a standalone component
cpl121 Nov 12, 2024
3b37425
fix(wallet-dashboard): improve AddressInputs props
cpl121 Nov 12, 2024
64d5693
fix(wallet-dashboard): linter
cpl121 Nov 12, 2024
df00b07
fix(wallet-dashboard): format core
cpl121 Nov 12, 2024
ed3b9b5
feat: add staking overview
brancoder Nov 12, 2024
290b7e9
fix: prettier
brancoder Nov 12, 2024
13aaf0e
fix(wallet-dashboard): clean debris
cpl121 Nov 12, 2024
288483f
fix: add ExplorerLink component and add missing dialog styles
VmMad Nov 13, 2024
088b300
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 13, 2024
2c1adc9
Merge remote-tracking branch 'origin/tooling-epic/dashboard-styling' …
panteleymonchuk Nov 13, 2024
f1699c0
fix: use correct values for keyvalue
VmMad Nov 13, 2024
28a9353
fix(wallet-dashboard): bring back the validation field
cpl121 Nov 13, 2024
72bfb38
fix(wallet-dashboard): bad merge removing duplicated image components
cpl121 Nov 13, 2024
86c27ae
fix(wallet-dashboard): remove unnecesary InputForm component
cpl121 Nov 13, 2024
7e6c12d
fix(wallet-dashboard): adjust to full height the dialog body
cpl121 Nov 13, 2024
af32d3a
fix(wallet-dashboard): prettier
cpl121 Nov 13, 2024
9b2c108
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 13, 2024
754d2db
fix: gas approximation
VmMad Nov 13, 2024
4d93394
feat(wallet-dashboard): manage view for dialog outside.
panteleymonchuk Nov 13, 2024
8c17341
feat(wallet-dashboard): join changes from PR 3854
panteleymonchuk Nov 13, 2024
7f66cd0
feat(wallet-dashboard): join enter amount screen from PR 3874
panteleymonchuk Nov 13, 2024
78e5527
fix(wallet-dashboard): max button disabled
cpl121 Nov 14, 2024
1fe1d05
feat(wallet-dashboard): improvements
cpl121 Nov 14, 2024
94bcca1
fix(wallet-dashboard): improve formik props
cpl121 Nov 14, 2024
17058ad
fix(wallet-dashboard): improvements
cpl121 Nov 14, 2024
5932ed5
feat(tooling-core): move validation schema
panteleymonchuk Nov 14, 2024
ddca44c
refactor: Simplify SendTokenFormInput
marc2332 Nov 14, 2024
76d2e89
refactor: prettier:fix
marc2332 Nov 14, 2024
6b388b6
refactor: prettier:fix on apps/core
marc2332 Nov 14, 2024
78af8b4
refactor: Add missing license header to token.ts
marc2332 Nov 14, 2024
3e9fa71
fix: linter
cpl121 Nov 14, 2024
9bdb887
feat(wallet-dashboard): integrate Formik
panteleymonchuk Nov 14, 2024
012b773
fix(wallet-dashboard): linter
cpl121 Nov 14, 2024
e97e879
fix(wallet-dashboard): linter
cpl121 Nov 14, 2024
14a2786
feat(wallet-dashboard): enhance StakeDialog and EnterAmountView with …
panteleymonchuk Nov 14, 2024
c1341dc
feat(wallet-dashboard): update StakeDialog to support selectedValidat…
panteleymonchuk Nov 14, 2024
c4329f4
feat(wallet-dashboard): refactor StakedInfo and Validator components …
panteleymonchuk Nov 14, 2024
19b96fc
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 15, 2024
1a2f009
fix: amount format
VmMad Nov 15, 2024
3a4ebb7
feat(wallet-dashboard): move useStakeTxnInfo hook to the core
panteleymonchuk Nov 15, 2024
54b1b1f
fix(tooling-core): downgrade bignumber.js to 9.1.1 and yup to 1.1.1
panteleymonchuk Nov 15, 2024
ed42962
feat: Improve validation flow of sent screen
marc2332 Nov 15, 2024
69dab33
fmt
marc2332 Nov 15, 2024
8242185
refactor(tooling-dashboard): change export to default and clean up co…
panteleymonchuk Nov 15, 2024
3ee028a
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
VmMad Nov 18, 2024
b394e26
fix: format gas outside of hook
VmMad Nov 18, 2024
bcf0e17
Merge branch 'tooling-epic/dashboard-styling' into tooling-dashboard/…
cpl121 Nov 19, 2024
7eb6be4
fix(wallet-dashboard): fixes
cpl121 Nov 19, 2024
4164afa
fix(wallet-dashboard): linter
cpl121 Nov 19, 2024
eece95d
Merge branch 'tooling-epic/dashboard-styling' into tooling-dashboard/…
brancoder Nov 19, 2024
371b2fd
Merge branch 'tooling-epic/dashboard-styling' into tooling-dashboard/…
brancoder Nov 19, 2024
b889904
fix(wallet-dashboard): error to click max button
cpl121 Nov 19, 2024
be3b938
refactor(wallet-dashboard): simplify validator info retrieval and add…
panteleymonchuk Nov 19, 2024
80049ac
refactor(wallet-dashboard): streamline stake calculations and integra…
panteleymonchuk Nov 19, 2024
6eca201
fix(wallet-dashboard): add setFieldValue in useEffect
cpl121 Nov 20, 2024
218a118
Merge branch 'tooling-dashboard/style-send-screen' into tooling-dashb…
brancoder Nov 20, 2024
bc4e0a8
Merge branch 'tooling-dashboard/style-send-entry-screen' into tooling…
brancoder Nov 20, 2024
f01d18d
Merge branch 'tooling-epic/dashboard-styling' into tooling-dashboard/…
VmMad Nov 20, 2024
1292ff6
fix: gas ticker
VmMad Nov 20, 2024
a5f5f58
fix: lint
VmMad Nov 20, 2024
24144b3
Merge remote-tracking branch 'origin/tooling-epic/dashboard-styling' …
panteleymonchuk Nov 20, 2024
0cfd637
refactor(wallet, core): update import paths for consistency and clarity
panteleymonchuk Nov 20, 2024
3ce05be
fix: improve codebase as reviewed
VmMad Nov 20, 2024
dc99beb
refactor(wallet-dashboard): integrate FormikProvider. Polish interfaces.
panteleymonchuk Nov 20, 2024
4737361
fix: remove log and use isPayAllIota from form values
VmMad Nov 21, 2024
7fded74
Merge branch 'develop' into tooling-dashboard/style-send-screen
brancoder Nov 21, 2024
0a152bb
Merge branch 'develop' into tooling-dashboard/style-send-screen
brancoder Nov 21, 2024
679adf5
Merge branch 'tooling-dashboard/style-send-screen' into tooling-dashb…
brancoder Nov 21, 2024
a6e664b
Merge remote-tracking branch 'origin/develop' into tooling-dashboard/…
panteleymonchuk Nov 21, 2024
2afa4d8
Merge branch 'develop' into tooling-dashboard/style-selected-stake
brancoder Nov 22, 2024
323bcd5
fix: resolve conflicts
brancoder Nov 22, 2024
111e1ad
fix: lint
brancoder Nov 22, 2024
bcbdebd
feat(wallet-dashboard): refactor staking dialog management for home
panteleymonchuk Nov 22, 2024
b964e75
feat(wallet-dashboard): move constants to another folder.
panteleymonchuk Nov 22, 2024
21f13fb
fix: remove leftover comments
brancoder Nov 22, 2024
e0a0a7e
fix: resolve conflicts
brancoder Nov 22, 2024
471761e
fix: resolve conflicts
brancoder Nov 26, 2024
d420f2a
Merge branch 'develop' into tooling-dashboard/style-staking-overview
brancoder Nov 26, 2024
17be2c3
fix: comments and remove stakingStats component for DisplatStats from…
brancoder Nov 26, 2024
072f01c
fix: remove unused files
brancoder Nov 26, 2024
eed1f3a
Merge branch 'develop' into tooling-dashboard/style-staking-overview
brancoder Nov 26, 2024
bb697fa
Merge branch 'develop' into tooling-dashboard/style-staking-overview
brancoder Nov 27, 2024
cc7f965
fix: remove the StatsDetail component
brancoder Nov 27, 2024
c9ca20a
Merge branch 'develop' into tooling-dashboard/style-staking-overview
brancoder Nov 27, 2024
c38a8b3
fix: conditions to display stake dialog
brancoder Nov 27, 2024
e75678c
Merge branch 'tooling-dashboard/style-staking-overview' of github.com…
brancoder Nov 27, 2024
36f178c
Merge branch 'develop' into tooling-dashboard/style-staking-overview
brancoder Nov 29, 2024
54d8dc8
fix: add useIsAsetTransferable hook
brancoder Nov 29, 2024
c3b0243
fix: revert constant changes
brancoder Nov 29, 2024
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
1 change: 1 addition & 0 deletions apps/core/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export * from './coin';
export * from './icon';
export * from './Inputs';
export * from './QR';
export * from './staking';

export * from './providers';
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
// Modifications Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { NUM_OF_EPOCH_BEFORE_STAKING_REWARDS_REDEEMABLE } from '@iota/core';
import { determineCountDownText } from '_src/ui/app/shared/countdown-timer';
import {
type ExtendedDelegatedStake,
TimeUnit,
useFormatCoin,
useGetTimeBeforeEpochNumber,
useTimeAgo,
ImageIcon,
} from '@iota/core';
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils';
import { Card, CardImage, CardType, CardBody, CardAction, CardActionType } from '@iota/apps-ui-kit';
import { useMemo } from 'react';
import { Link } from 'react-router-dom';

import { useIotaClientQuery } from '@iota/dapp-kit';
import { ImageIcon } from '../icon';
import { determineCountDownText, ExtendedDelegatedStake } from '../../utils';
import { TimeUnit, useFormatCoin, useGetTimeBeforeEpochNumber, useTimeAgo } from '../../hooks';
import { NUM_OF_EPOCH_BEFORE_STAKING_REWARDS_REDEEMABLE } from '../../constants';

export enum StakeState {
WarmUp = 'WARM_UP',
Expand All @@ -35,21 +27,22 @@ const STATUS_COPY: { [key in StakeState]: string } = {
[StakeState.InActive]: 'Inactive',
};

interface StakeCardProps {
interface StakingCardProps {
extendedStake: ExtendedDelegatedStake;
currentEpoch: number;
inactiveValidator?: boolean;
onClick: () => void;
}

// For delegationsRequestEpoch n through n + 2, show Start Earning
// Show epoch number or date/time for n + 3 epochs
export function StakeCard({
export function StakingCard({
extendedStake,
currentEpoch,
inactiveValidator = false,
}: StakeCardProps) {
const { stakedIotaId, principal, stakeRequestEpoch, estimatedReward, validatorAddress } =
extendedStake;
onClick,
}: StakingCardProps) {
const { principal, stakeRequestEpoch, estimatedReward, validatorAddress } = extendedStake;

// TODO: Once two step withdraw is available, add cool down and withdraw now logic
// For cool down epoch, show Available to withdraw add rewards to principal
Expand Down Expand Up @@ -115,32 +108,20 @@ export function StakeCard({
};

return (
<Link
data-testid="stake-card"
to={`/stake/delegation-detail?${new URLSearchParams({
validator: validatorAddress,
staked: stakedIotaId,
}).toString()}`}
className="no-underline"
>
<Card type={CardType.Default} isHoverable>
<CardImage>
<ImageIcon
src={validatorMeta?.imageUrl || null}
label={validatorMeta?.name || ''}
fallback={validatorMeta?.name || ''}
/>
</CardImage>
<CardBody
title={validatorMeta?.name || ''}
subtitle={`${principalStaked} ${symbol}`}
/>
<CardAction
title={rewardTime()}
subtitle={STATUS_COPY[delegationState]}
type={CardActionType.SupportingText}
<Card type={CardType.Default} isHoverable onClick={onClick}>
<CardImage>
<ImageIcon
src={validatorMeta?.imageUrl || null}
label={validatorMeta?.name || ''}
fallback={validatorMeta?.name || ''}
/>
</Card>
</Link>
</CardImage>
<CardBody title={validatorMeta?.name || ''} subtitle={`${principalStaked} ${symbol}`} />
<CardAction
title={rewardTime()}
subtitle={STATUS_COPY[delegationState]}
type={CardActionType.SupportingText}
/>
</Card>
);
}
4 changes: 4 additions & 0 deletions apps/core/src/components/staking/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

export * from './StakingCard';
1 change: 1 addition & 0 deletions apps/core/src/constants/staking.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export const DELEGATED_STAKES_QUERY_REFETCH_INTERVAL = 30_000;

export const NUM_OF_EPOCH_BEFORE_STAKING_REWARDS_REDEEMABLE = 2;
export const NUM_OF_EPOCH_BEFORE_STAKING_REWARDS_STARTS = 1;
export const MIN_NUMBER_IOTA_TO_STAKE = 1;
85 changes: 85 additions & 0 deletions apps/core/src/hooks/useNftDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
import { useGetNFTMeta, useOwnedNFT, useNFTBasicData, useGetKioskContents } from './';
import { formatAddress } from '@iota/iota-sdk/utils';
import { isAssetTransferable, truncateString } from '../utils';

type NftFields = {
metadata?: { fields?: { attributes?: { fields?: { keys: string[]; values: string[] } } } };
};

export function useNftDetails(nftId: string, accountAddress: string | null) {
const { data: objectData, isPending: isNftLoading } = useOwnedNFT(nftId || '', accountAddress);
const { data } = useGetKioskContents(accountAddress);

const isContainedInKiosk = data?.lookup.get(nftId!);
const kioskItem = data?.list.find((k) => k.data?.objectId === nftId);

const isTransferable = isAssetTransferable(objectData);
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be fixed (conflict) since this is merged #4159

Copy link
Contributor

Choose a reason for hiding this comment

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

Weird that github doesn't say there are conflict. But isAssetTransferable doesn't exist anymore. Use the useIsAssetTransferable hook.


const { nftFields } = useNFTBasicData(objectData);

const { data: nftMeta, isPending: isPendingMeta } = useGetNFTMeta(nftId);

const nftName = nftMeta?.name || formatAddress(nftId);
const nftImageUrl = nftMeta?.imageUrl || '';

// Extract either the attributes, or use the top-level NFT fields:
const { keys: metaKeys, values: metaValues } =
(nftFields as NftFields)?.metadata?.fields?.attributes?.fields ||
Object.entries(nftFields ?? {})
.filter(([key]) => key !== 'id')
.reduce(
(acc, [key, value]) => {
acc.keys.push(key);
acc.values.push(value as string);
return acc;
},
{ keys: [] as string[], values: [] as string[] },
);

const ownerAddress =
(objectData?.owner &&
typeof objectData?.owner === 'object' &&
'AddressOwner' in objectData.owner &&
objectData.owner.AddressOwner) ||
'';

function formatMetaValue(value: string | object) {
if (typeof value === 'object') {
return {
value: JSON.stringify(value),
valueLink: undefined,
};
} else {
if (value.includes('http')) {
return {
value: value.startsWith('http')
? truncateString(value, 20, 8)
: formatAddress(value),
valueLink: value,
};
}
return {
value: value,
valueLink: undefined,
};
}
}

return {
objectData,
isNftLoading,
nftName,
nftImageUrl,
ownerAddress,
isTransferable,
metaKeys,
metaValues,
formatMetaValue,
isContainedInKiosk,
kioskItem,
nftMeta,
isPendingMeta,
};
}
1 change: 1 addition & 0 deletions apps/core/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export * from './getDelegationDataByStakeId';
export * from './api-env';
export * from './getExplorerPaths';
export * from './getExplorerLink';
export * from './determineCountDownText';

export * from './stake';
export * from './transaction';
Expand Down
Loading
Loading