Skip to content

Commit 59cd7b9

Browse files
linkielinkPatricie29StefChatz
authored
v3.0.5 (#1696)
Co-authored-by: Patricie <99055449+Patricie29@users.noreply.github.com> Co-authored-by: Monkmansteve <47855432+StefChatz@users.noreply.github.com> Co-authored-by: Patricie29 <patricie@marsprotocol.foundation>
1 parent 19f81d6 commit 59cd7b9

File tree

38 files changed

+307
-93
lines changed

38 files changed

+307
-93
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mars-v2-frontend",
3-
"version": "3.0.4",
3+
"version": "3.0.5",
44
"homepage": "./",
55
"private": false,
66
"license": "SEE LICENSE IN LICENSE FILE",
@@ -37,6 +37,7 @@
3737
"bignumber.js": "^9.3.1",
3838
"bitcoinjs-lib": "^7.0.0",
3939
"classnames": "^2.5.1",
40+
"dayjs": "^1.11.19",
4041
"debounce-promise": "^3.1.2",
4142
"graphql-request": "^7.3.1",
4243
"ibc-domains-sdk": "^1.1.0",
@@ -45,7 +46,6 @@
4546
"lodash.debounce": "^4.0.8",
4647
"lodash.throttle": "^4.1.1",
4748
"mobx": "^6.15.0",
48-
"moment": "^2.30.1",
4949
"next": "16.0.1",
5050
"next-devtools-mcp": "^0.2.5",
5151
"react": "19.2.0",

src/api/vaults/getDepositedVaults.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import moment from 'moment'
1+
import dayjs from 'utils/dayjs'
22

33
import { getClient, getCreditManagerQueryClient, getVaultQueryClient } from 'api/cosmwasm-client'
44
import getVaults from 'api/vaults/getVaults'
@@ -47,7 +47,7 @@ async function getVaultPositionStatusAndUnlockIdAndUnlockTime(
4747
vaultPosition.vault.address,
4848
)
4949

50-
if (moment(unlocksAtTimestamp).isBefore(new Date())) {
50+
if (dayjs(unlocksAtTimestamp).isBefore(new Date())) {
5151
return [VaultStatus.UNLOCKED, unlockId, unlocksAtTimestamp]
5252
}
5353

src/components/Modals/Vault/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import moment from 'moment'
1+
import dayjs from 'utils/dayjs'
22
import { useCallback, useMemo } from 'react'
33

44
import DoubleLogo from 'components/common/DoubleLogo'
@@ -38,9 +38,10 @@ function VaultModal(props: Props) {
3838
}, [])
3939

4040
const unlockTime = useMemo(() => {
41-
if ('unlocksAt' in vault && vault.unlocksAt) {
42-
return moment(vault.unlocksAt)
41+
if ('unlocksAt' in vault && typeof vault.unlocksAt === 'number') {
42+
return dayjs(vault.unlocksAt)
4343
}
44+
return undefined
4445
}, [vault])
4546

4647
const { addedDebts, removedDeposits, removedLends, simulateVaultDeposit } =
@@ -55,7 +56,7 @@ function VaultModal(props: Props) {
5556
<Text className='pl-3 pr-2'>{vault.name}</Text>
5657
{unlockTime && (
5758
<Tooltip
58-
content={`Account position for this vault unlocks at ${unlockTime}`}
59+
content={`Account position for this vault unlocks at ${unlockTime.format('MMM D, YYYY h:mm A')}`}
5960
type={'info'}
6061
>
6162
<div className='w-4 h-4'>

src/components/Wallet/RecentTransactions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames'
2-
import moment from 'moment'
2+
import dayjs from 'utils/dayjs'
33

44
import Card from 'components/common/Card'
55
import Divider from 'components/common/Divider'
@@ -52,7 +52,7 @@ export default function RecentTransactions() {
5252
<div className='flex flex-wrap items-start justify-between w-full gap-2 pb-2 md:flex-nowrap'>
5353
<Text className='flex font-bold'>{target}</Text>
5454
<Text size='sm' className='text-white/70'>
55-
{moment.unix(timestamp).format('lll')}
55+
{dayjs.unix(timestamp).format('lll')}
5656
</Text>
5757
</div>
5858
{message && (

src/components/Wallet/WalletSelect.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useShuttle } from '@delphi-labs/shuttle-react'
2-
import moment from 'moment'
2+
import dayjs from 'utils/dayjs'
33
import Image from 'next/image'
44
import React, { useEffect, useMemo, useState } from 'react'
55
import { isMobile } from 'react-device-detect'
@@ -145,7 +145,7 @@ export default function WalletSelect(props: Props) {
145145
if (error?.message && error?.title) {
146146
useStore.setState({
147147
toast: {
148-
id: moment.now(),
148+
id: dayjs().valueOf(),
149149
isError: true,
150150
title: error.title,
151151
message: error.message,

src/components/account/RiskChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import moment from 'moment'
1+
import dayjs from 'utils/dayjs'
22
import {
33
Area,
44
AreaChart,
@@ -65,7 +65,7 @@ export const RiskChart = ({ data }: RiskChartProps) => {
6565
stroke='rgba(255, 255, 255, 0.6)'
6666
tickLine={false}
6767
tickFormatter={(value) => {
68-
return moment(value).format('DD')
68+
return dayjs(value).format('DD')
6969
}}
7070
fontSize={10.53}
7171
dataKey='date'
@@ -83,7 +83,7 @@ export const RiskChart = ({ data }: RiskChartProps) => {
8383
const risk = Number(payload[0].value) ?? 0
8484
return (
8585
<div className='max-w-[320px] rounded-lg px-4 py-2 shadow-tooltip bg-surface'>
86-
<Text size='sm'>{moment(label).format('MM-DD-YYYY')}</Text>
86+
<Text size='sm'>{dayjs(label).format('MM-DD-YYYY')}</Text>
8787
<Text size='sm'>
8888
Risk: {formatValue(risk, { minDecimals: 0, maxDecimals: 0, suffix: '%' })}
8989
</Text>

src/components/common/DynamicLineChart/AreaChartLoading.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import classNames from 'classnames'
2-
import moment from 'moment'
2+
import dayjs from 'utils/dayjs'
33
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, XAxis, YAxis } from 'recharts'
44

55
import { getDefaultChainSettings } from 'constants/defaultSettings'
@@ -13,11 +13,11 @@ interface Props {
1313
function createLoadingData() {
1414
const data = []
1515
const dataValues = [10, 20, 80, 30, 60, 50, 60]
16-
const startDate = moment().subtract(7, 'days')
17-
const endDate = moment()
16+
const startDate = dayjs().subtract(7, 'days')
17+
const endDate = dayjs()
1818
const days = endDate.diff(startDate, 'days')
1919
for (let i = 0; i < days; i++) {
20-
const date = moment(startDate).add(i, 'days')
20+
const date = startDate.add(i, 'days')
2121
data.push({
2222
date: date.format('YYYY-MM-DD'),
2323
value: dataValues[i],

src/components/common/DynamicLineChart/ChartTooltip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import classNames from 'classnames'
3-
import moment from 'moment'
3+
import dayjs from 'utils/dayjs'
44
import Text from 'components/common/Text'
55

66
interface Props {
@@ -14,7 +14,7 @@ export default function CustomTooltip(props: Props) {
1414
const { active, payload, label, renderContent } = props
1515

1616
const formatDateLabel = (label: string) => {
17-
const date = moment(label)
17+
const date = dayjs(label)
1818
return date.isValid() ? date.format('DD MMM YYYY') : label
1919
}
2020

src/components/common/DynamicLineChart/DynamicLineChartBody.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
XAxis,
1111
YAxis,
1212
} from 'recharts'
13-
import moment from 'moment'
13+
import dayjs from 'utils/dayjs'
1414
import { formatValue } from 'utils/formatters'
1515
import ChartLegend from 'components/common/Legend/ChartLegend'
1616
import DisplayCurrency from 'components/common/DisplayCurrency'
@@ -215,9 +215,9 @@ export default function DynamicLineChartBody(props: Props) {
215215
stroke={axisColor}
216216
tickFormatter={(value) => {
217217
if (timeframe === '24') {
218-
return moment(value).format('HH:mm')
218+
return dayjs(value).format('HH:mm')
219219
}
220-
return moment(value).format('DD MMM')
220+
return dayjs(value).format('DD MMM')
221221
}}
222222
interval={data.length > 10 ? Math.floor(data.length / 7) : 0}
223223
/>

src/components/common/Timestamp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Loading from 'components/common/Loading'
22
import Text from 'components/common/Text'
33
import TitleAndSubCell from 'components/common/TitleAndSubCell'
4-
import moment from 'moment'
4+
import dayjs from 'utils/dayjs'
55

66
export const TIMESTAMP_META = {
77
id: 'name',
@@ -40,7 +40,7 @@ export default function Timestamp(props: Props) {
4040
break
4141
}
4242

43-
const date = showUtc ? moment.unix(timestampInSeconds).utc() : moment.unix(timestampInSeconds)
43+
const date = showUtc ? dayjs.unix(timestampInSeconds).utc() : dayjs.unix(timestampInSeconds)
4444
const dateFormatted = date.format('MMM D, YYYY')
4545
const timeFormat = use24Hour ? 'HH:mm' : 'hh:mm A'
4646
const timeFormatted = date.format(timeFormat)

0 commit comments

Comments
 (0)