11import Modal from 'apps/web/src/components/Modal' ;
22import data from 'apps/web/src/data/usernamePriceDecayTable.json' ;
3- import { useBasenamesLaunchTime } from 'apps/web/src/hooks/useBasenamesLaunchTime ' ;
3+ import { useBasenamesNameExpiresWithGracePeriod } from 'apps/web/src/hooks/useBasenamesNameExpiresWithGracePeriod ' ;
44import { CartesianGrid , Line , LineChart , ResponsiveContainer , Tooltip } from 'recharts' ;
55import { formatEther } from 'viem' ;
66
77type CustomTooltipProps = {
88 active ?: boolean ;
99 baseSingleYearEthCost ?: bigint ;
10- launchTimeSeconds ?: bigint ;
10+ auctionStartTimeSeconds ?: bigint ;
1111 payload : [
1212 {
1313 dataKey : 'premium' ;
1414 name : 'premium' ;
15- payload : { hours : number ; premium : number } ;
15+ payload : { days : number ; premium : number } ;
1616 value : number ;
1717 } ,
1818 ] ;
@@ -22,13 +22,13 @@ function CustomTooltip({
2222 active,
2323 payload,
2424 baseSingleYearEthCost,
25- launchTimeSeconds ,
25+ auctionStartTimeSeconds ,
2626} : CustomTooltipProps ) {
27- if ( active && payload ?. length && launchTimeSeconds && baseSingleYearEthCost ) {
27+ if ( active && payload ?. length && auctionStartTimeSeconds && baseSingleYearEthCost ) {
2828 const premium = payload [ 0 ] . value ;
29- const hours = payload [ 0 ] . payload . hours ;
30- const seconds = hours * 60 * 60 ;
31- const tooltipSeconds = seconds + Number ( launchTimeSeconds ) ;
29+ const days = payload [ 0 ] . payload . days ;
30+ const seconds = days * 24 * 60 * 60 ; // Convert days to seconds
31+ const tooltipSeconds = seconds + Number ( auctionStartTimeSeconds ) ;
3232 const timeOfPremium = new Date ( tooltipSeconds * 1000 ) . toLocaleString ( undefined , {
3333 year : 'numeric' ,
3434 month : '2-digit' ,
@@ -65,15 +65,17 @@ type PremiumExplainerModalProps = {
6565 toggleModal : ( ) => void ;
6666 premiumEthAmount : bigint | undefined ;
6767 baseSingleYearEthCost : bigint ;
68+ name : string ;
6869} ;
6970const chartMarginValues = { top : 2 , right : 2 , left : 2 , bottom : 2 } ;
7071export function PremiumExplainerModal ( {
7172 isOpen,
7273 toggleModal,
7374 premiumEthAmount,
7475 baseSingleYearEthCost,
76+ name,
7577} : PremiumExplainerModalProps ) {
76- const { data : launchTimeSeconds } = useBasenamesLaunchTime ( ) ;
78+ const { data : auctionStartTimeSeconds } = useBasenamesNameExpiresWithGracePeriod ( name ) ;
7779
7880 if ( ! premiumEthAmount || ! baseSingleYearEthCost ) return null ;
7981 const formattedOneYearCost = Number ( formatEther ( baseSingleYearEthCost ) ) . toLocaleString (
@@ -94,8 +96,8 @@ export function PremiumExplainerModal({
9496 < div className = "flex max-w-[491px] flex-1 flex-col gap-3" >
9597 < h1 className = "w-full text-2xl font-bold" > This name has a temporary premium</ h1 >
9698 < p className = "mb-3 text-illoblack" >
97- To ensure fair distribution of Basenames, all names have a temporary premium starting at
98- 100 ETH that then decays exponentially to 0 over 36 hours .
99+ To ensure fair distribution of recently expired Basenames, all names have a price premium
100+ which starts at 100 ETH that then decays exponentially to 0 over 21 days .
99101 </ p >
100102 < div className = "grid grid-cols-2 grid-rows-4" >
101103 < div className = "col-span-2 mb-2 text-sm font-medium uppercase text-gray-60" >
@@ -147,7 +149,7 @@ export function PremiumExplainerModal({
147149 // @ts -expect-error type wants an unnecessary prop
148150 < CustomTooltip
149151 baseSingleYearEthCost = { baseSingleYearEthCost }
150- launchTimeSeconds = { launchTimeSeconds }
152+ auctionStartTimeSeconds = { auctionStartTimeSeconds }
151153 />
152154 }
153155 />
0 commit comments