-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨feat(ui): add simplehash calls for ordis
- Loading branch information
1 parent
9ae8724
commit 1758aac
Showing
32 changed files
with
750 additions
and
250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
"@ledgerhq/live-nft-react": patch | ||
"@ledgerhq/live-nft": patch | ||
--- | ||
|
||
Plug the front with simplehash api for the rare sats table and inscriptions table |
21 changes: 21 additions & 0 deletions
21
apps/ledger-live-desktop/src/newArch/features/Collectibles/Ordinals/components/Error.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,21 @@ | ||
import React from "react"; | ||
import { Flex, Icons, Text } from "@ledgerhq/react-ui"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
type Props = { | ||
hasError: boolean; | ||
}; | ||
|
||
const Error: React.FC<Props> = ({ hasError }) => { | ||
const { t } = useTranslation(); | ||
if (!hasError) return null; | ||
|
||
return ( | ||
<Flex justifyContent="center" my={4} columnGap={2}> | ||
<Icons.Warning size={"S"} color="palette.error.c60" /> | ||
<Text color="palette.error.c60">{t("crash.title")}</Text> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default Error; |
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
43 changes: 43 additions & 0 deletions
43
...ive-desktop/src/newArch/features/Collectibles/Ordinals/components/Inscriptions/helpers.ts
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,43 @@ | ||
import { SimpleHashNft } from "@ledgerhq/live-nft/api/types"; | ||
import { IconProps } from "LLD/features/Collectibles/types/Collection"; | ||
import { mappingKeysWithIconAndName } from "../Icons"; | ||
|
||
function matchCorrespondingIcon( | ||
rareSats: SimpleHashNft[], | ||
): Array<SimpleHashNft & { icons: Array<({ size, color, style }: IconProps) => JSX.Element> }> { | ||
return rareSats.map(rareSat => { | ||
const iconKeys: string[] = []; | ||
const rarity = rareSat.extra_metadata?.ordinal_details?.sat_rarity?.toLowerCase(); | ||
|
||
if (rarity && rarity !== "common") { | ||
iconKeys.push(rarity.replace(" ", "_")); | ||
} | ||
|
||
const icons = iconKeys | ||
.map( | ||
iconKey => | ||
mappingKeysWithIconAndName[iconKey as keyof typeof mappingKeysWithIconAndName]?.icon, | ||
) | ||
.filter(Boolean) as Array<({ size, color, style }: IconProps) => JSX.Element>; | ||
|
||
return { ...rareSat, icons }; | ||
}); | ||
} | ||
|
||
export function getInscriptionsData(inscriptions: SimpleHashNft[]) { | ||
const inscriptionsWithIcons = matchCorrespondingIcon(inscriptions); | ||
return inscriptionsWithIcons.map(item => ({ | ||
tokenName: item.name || item.contract.name || "", | ||
collectionName: item.collection.name, | ||
tokenIcons: item.icons, | ||
rareSatName: item.extra_metadata?.ordinal_details?.sat_name, | ||
media: { | ||
uri: item.image_url || item.previews?.image_small_url, | ||
isLoading: false, | ||
useFallback: true, | ||
contentType: item.extra_metadata?.ordinal_details?.content_type, | ||
mediaType: "image", | ||
}, | ||
onClick: () => {}, | ||
})); | ||
} |
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
Oops, something went wrong.