Skip to content

Commit

Permalink
Merge branch 'develop' into tooling-wallet/fix-empty-infobox-on-short…
Browse files Browse the repository at this point in the history
…er-mnemonic
  • Loading branch information
evavirseda authored Jan 14, 2025
2 parents 07cffc1 + 674b141 commit 9b7566f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
8 changes: 5 additions & 3 deletions apps/wallet-dashboard/app/(protected)/vesting/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ export default function VestingDashboardPage(): JSX.Element {
nextPayout,
supplyIncreaseVestingPortfolio,
supplyIncreaseVestingSchedule,
supplyIncreaseVestingMapped,
supplyIncreaseVestingStakedMapped,
isTimelockedStakedObjectsLoading,
unlockAllSupplyIncreaseVesting,
refreshStakeList,
isSupplyIncreaseVestingScheduleEmpty,
} = useGetSupplyIncreaseVestingObjects(address);

const timelockedStakedObjectsGrouped: TimelockedStakedObjectsGrouped[] =
Expand Down Expand Up @@ -297,18 +297,20 @@ export default function VestingDashboardPage(): JSX.Element {
</div>
</Panel>

{supplyIncreaseVestingMapped.length === 0 ? (
{isSupplyIncreaseVestingScheduleEmpty ? (
<Banner
videoSrc={videoSrc}
title="Stake Vested Tokens"
subtitle="Earn Rewards"
onButtonClick={() => handleNewStake()}
buttonText="Stake"
disabled={supplyIncreaseVestingSchedule.availableStaking === 0n}
/>
) : null}
</div>

{supplyIncreaseVestingMapped.length !== 0 ? (
{!isSupplyIncreaseVestingScheduleEmpty &&
supplyIncreaseVestingSchedule.totalStaked !== 0n ? (
<div className="flex w-full md:w-1/2">
<Panel>
<Title
Expand Down
11 changes: 10 additions & 1 deletion apps/wallet-dashboard/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ interface BannerProps {
subtitle?: string;
onButtonClick: () => void;
buttonText: string;
disabled?: boolean;
}
export function Banner({ videoSrc, title, subtitle, onButtonClick, buttonText }: BannerProps) {
export function Banner({
videoSrc,
title,
subtitle,
onButtonClick,
buttonText,
disabled,
}: BannerProps) {
return (
<Panel bgColor="bg-secondary-90 dark:bg-secondary-10">
<div className="flex h-full w-full justify-between ">
Expand All @@ -29,6 +37,7 @@ export function Banner({ videoSrc, title, subtitle, onButtonClick, buttonText }:
size={ButtonSize.Small}
type={ButtonType.Outlined}
text={buttonText}
disabled={disabled}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function SupplyIncreaseVestingOverview() {
const {
nextPayout,
supplyIncreaseVestingSchedule,
supplyIncreaseVestingMapped,
isSupplyIncreaseVestingScheduleEmpty,
supplyIncreaseVestingStakedMapped,
} = useGetSupplyIncreaseVestingObjects(address);

Expand Down Expand Up @@ -57,9 +57,6 @@ export function SupplyIncreaseVestingOverview() {
IOTA_TYPE_ARG,
);

const showSupplyIncreaseVestingOverview =
supplyIncreaseVestingMapped.length > 0 || supplyIncreaseVestingStakedMapped.length > 0;

function handleOnSuccess(digest: string): void {
iotaClient
.waitForTransaction({
Expand All @@ -81,7 +78,7 @@ export function SupplyIncreaseVestingOverview() {
});
}

return showSupplyIncreaseVestingOverview ? (
return !isSupplyIncreaseVestingScheduleEmpty || supplyIncreaseVestingStakedMapped.length > 0 ? (
<div style={{ gridArea: 'vesting' }} className="with-vesting flex grow overflow-hidden">
<Panel>
<Title title="Vesting" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function ConfirmMigrationView({
basicOutputs: basicOutputObjects,
nftOutputs: nftOutputObjects,
address: account?.address || '',
resolvedObjects: resolvedObjects,
});

const [timelockedIotaTokens, symbol] = useFormatCoin(totalIotaAmount, IOTA_TYPE_ARG);
Expand Down
15 changes: 13 additions & 2 deletions apps/wallet-dashboard/hooks/useGetSupplyIncreaseVestingObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from '@iota/core';
import { Transaction } from '@iota/iota-sdk/transactions';

export function useGetSupplyIncreaseVestingObjects(address: string): {
interface SupplyIncreaseVestingObject {
nextPayout: SupplyIncreaseVestingPayout | undefined;
lastPayout: SupplyIncreaseVestingPayout | undefined;
supplyIncreaseVestingSchedule: VestingOverview;
Expand All @@ -40,7 +40,10 @@ export function useGetSupplyIncreaseVestingObjects(address: string): {
}
| undefined;
refreshStakeList: () => void;
} {
isSupplyIncreaseVestingScheduleEmpty: boolean;
}

export function useGetSupplyIncreaseVestingObjects(address: string): SupplyIncreaseVestingObject {
const { data: currentEpochMs } = useGetCurrentEpochStartTimestamp();

const { data: timelockedObjects, refetch: refetchGetAllOwnedObjects } = useGetAllOwnedObjects(
Expand Down Expand Up @@ -93,6 +96,13 @@ export function useGetSupplyIncreaseVestingObjects(address: string): {
supplyIncreaseVestingUnlockedObjectIds,
);

const isSupplyIncreaseVestingScheduleEmpty =
!supplyIncreaseVestingSchedule.totalVested &&
!supplyIncreaseVestingSchedule.totalLocked &&
!supplyIncreaseVestingSchedule.availableClaiming &&
!supplyIncreaseVestingSchedule.totalStaked &&
!supplyIncreaseVestingSchedule.totalEarned;

function refreshStakeList() {
refetchTimelockedStakedObjects();
refetchGetAllOwnedObjects();
Expand All @@ -108,5 +118,6 @@ export function useGetSupplyIncreaseVestingObjects(address: string): {
isTimelockedStakedObjectsLoading,
unlockAllSupplyIncreaseVesting,
refreshStakeList,
isSupplyIncreaseVestingScheduleEmpty,
};
}
4 changes: 2 additions & 2 deletions crates/iota-indexer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl IndexerMetrics {
).unwrap(),
fullnode_checkpoint_data_download_latency: register_histogram_with_registry!(
"fullnode_checkpoint_data_download_latency",
"Time spent in downloading checkpoint and transation for a new checkpoint from the Full Node",
"Time spent in downloading checkpoint and transaction for a new checkpoint from the Full Node",
DATA_INGESTION_LATENCY_SEC_BUCKETS.to_vec(),
registry,
)
Expand Down Expand Up @@ -458,7 +458,7 @@ impl IndexerMetrics {
)
.unwrap(),
checkpoint_db_commit_latency_transactions_chunks_transformation: register_histogram_with_registry!(
"checkpoint_db_commit_latency_transactions_transaformation",
"checkpoint_db_commit_latency_transactions_transformation",
"Time spent in transactions chunks transformation prior to commit",
DATA_INGESTION_LATENCY_SEC_BUCKETS.to_vec(),
registry,
Expand Down

0 comments on commit 9b7566f

Please sign in to comment.