Skip to content

Commit

Permalink
Remove ts-pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonmanRolls committed Oct 25, 2024
1 parent e9e66e7 commit dcb5a06
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions src/pages/legacyfavourites.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Effect, pipe } from 'effect'
import { ReactElement, useEffect, useState } from 'react'
import styled, { css } from 'styled-components'
import { match, P } from 'ts-pattern'
import { useChainId } from 'wagmi'

import { truncateFormat } from '@ensdomains/ensjs/utils'
Expand Down Expand Up @@ -112,28 +111,24 @@ export default function Page() {
</Typography>
</Helper>
<Spacer $height="3" />
{match(favorites)
.with(P.array({ name: P.string, expiry: P._ }), (_favorites) => {
return (
<Container>
{_favorites.map(({ name, expiry }: SimpleFavorite) => (
<TaggedNameItem
key={name}
truncatedName={truncateFormat(name)}
{...{
name,
network: chainId,
hasOtherItems: false,
expiryDate: { date: expiry, value: expiry?.getTime() },
}}
/>
))}
</Container>
)
})
.otherwise(() => (
<Helper type="info">No Favorites found</Helper>
))}
{favorites?.length ? (
<Container>
{favorites.map(({ name, expiry }: SimpleFavorite) => (
<TaggedNameItem
key={name}
truncatedName={truncateFormat(name)}
{...{
name,
network: chainId,
hasOtherItems: false,
expiryDate: { date: expiry, value: expiry?.getTime() },
}}
/>
))}
</Container>
) : (
<Helper type="info">No Favorites found</Helper>
)}
</>
),
}}
Expand Down

0 comments on commit dcb5a06

Please sign in to comment.