-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet-dasboard): style vesting schedule (#4340)
* feat: add new icon * feat: update carAction component * feat: update feature flags * feat: update icon * polish * minor fix * feat: countdown * feat: improve import and naming * feat: add hook * feat: polishes * fix imports * minor fixes * fix build * fix build * feat: rename function, variables and fix improts * feat: add vesting schedule * cleanup * feat: rename countdown and fix it * feat: improvements * cleanup * feat: remove undefined from button type * fix lint * feat: remove debris * fix build * feat: improve naming * minor fix * fix useffect and filter payouts * feat: use last paoyut and fix condition * feat:use current epoch * feat: update to toLocaleDateString * feat: add current epoch * fix build * fix tests * fix: use dynamic constant --------- Co-authored-by: Marc Espin <[email protected]> Co-authored-by: Bran <[email protected]>
- Loading branch information
1 parent
21f8072
commit 2fd6d93
Showing
8 changed files
with
154 additions
and
28 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
31 changes: 31 additions & 0 deletions
31
apps/wallet-dashboard/components/Dialogs/vesting/VestingScheduleBox.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,31 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { useGetCurrentEpochStartTimestamp } from '@/hooks'; | ||
import { DisplayStats, DisplayStatsType } from '@iota/apps-ui-kit'; | ||
import { useFormatCoin } from '@iota/core'; | ||
import { IOTA_TYPE_ARG } from '@iota/iota-sdk/utils'; | ||
import { LockLocked } from '@iota/ui-icons'; | ||
|
||
interface VestingScheduleBoxProps { | ||
amount: number; | ||
expirationTimestampMs: number; | ||
} | ||
|
||
export function VestingScheduleBox({ | ||
amount, | ||
expirationTimestampMs, | ||
}: VestingScheduleBoxProps): React.JSX.Element { | ||
const [formattedAmountVested, amountVestedSymbol] = useFormatCoin(amount, IOTA_TYPE_ARG); | ||
const { data: currentEpochMs } = useGetCurrentEpochStartTimestamp(); | ||
|
||
const isLocked = expirationTimestampMs > Number(currentEpochMs); | ||
return ( | ||
<DisplayStats | ||
label={new Date(expirationTimestampMs).toLocaleDateString()} | ||
value={`${formattedAmountVested} ${amountVestedSymbol}`} | ||
type={isLocked ? DisplayStatsType.Default : DisplayStatsType.Secondary} | ||
icon={isLocked && <LockLocked className="h-4 w-4" />} | ||
/> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
apps/wallet-dashboard/components/Dialogs/vesting/VestingScheduleDialog.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,42 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { SupplyIncreaseVestingPortfolio } from '@/lib/interfaces'; | ||
import { Dialog, DialogContent, DialogBody, Header } from '@iota/apps-ui-kit'; | ||
import { VestingScheduleBox } from './VestingScheduleBox'; | ||
|
||
interface VestingScheduleDialogProps { | ||
setOpen: (bool: boolean) => void; | ||
open: boolean; | ||
vestingPortfolio: SupplyIncreaseVestingPortfolio; | ||
} | ||
|
||
export function VestingScheduleDialog({ | ||
open, | ||
setOpen, | ||
vestingPortfolio, | ||
}: VestingScheduleDialogProps): React.JSX.Element { | ||
return ( | ||
<Dialog open={open} onOpenChange={setOpen}> | ||
<DialogContent | ||
containerId="overlay-portal-container" | ||
customWidth="max-w-md sm:max-w-xl md:max-w-5xl w-full" | ||
> | ||
<Header title="Rewards Schedule" onClose={() => setOpen(false)} titleCentered /> | ||
<DialogBody> | ||
<div className="h-[440px] overflow-y-auto"> | ||
<div className="grid grid-cols-1 gap-sm sm:grid-cols-2 md:grid-cols-4"> | ||
{vestingPortfolio?.map((vestingObject, index) => ( | ||
<VestingScheduleBox | ||
key={index} | ||
amount={vestingObject.amount} | ||
expirationTimestampMs={vestingObject.expirationTimestampMs} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
</DialogBody> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
} |
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,5 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './VestingScheduleDialog'; | ||
export * from './VestingScheduleBox'; |
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