-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨feat(lld): UI of inscriptions table for ordis
- Loading branch information
1 parent
255f035
commit f8c6953
Showing
11 changed files
with
283 additions
and
16 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,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
LLD ORDINALS add dummy table to display inscriptions inside BTC account screen. |
80 changes: 80 additions & 0 deletions
80
...live-desktop/src/newArch/features/Collectibles/Ordinals/components/Inscriptions/index.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,80 @@ | ||
import React from "react"; | ||
import { Account } from "@ledgerhq/types-live"; | ||
import { Box, Flex } from "@ledgerhq/react-ui"; | ||
import { useInscriptionsModel } from "./useInscriptionsModel"; | ||
import TableContainer from "~/renderer/components/TableContainer"; | ||
import TableHeader from "LLD/features/Collectibles/components/Collection/TableHeader"; | ||
import { OrdinalsRowProps, TableHeaderTitleKey } from "LLD/features/Collectibles/types/Collection"; | ||
import TableRow from "LLD/features/Collectibles/components/Collection/TableRow"; | ||
import ShowMore from "LLD/features/Collectibles/components/Collection/ShowMore"; | ||
import { MediaProps } from "LLD/features/Collectibles/types/Media"; | ||
|
||
type ViewProps = ReturnType<typeof useInscriptionsModel>; | ||
|
||
type Props = { | ||
account: Account; | ||
}; | ||
|
||
export type InscriptionsItemProps = { | ||
isLoading: boolean; | ||
tokenName: string; | ||
collectionName: string; | ||
tokenIcons: OrdinalsRowProps["tokenIcons"]; | ||
media: MediaProps; | ||
onClick: () => void; | ||
}; | ||
|
||
const Item: React.FC<InscriptionsItemProps> = ({ | ||
isLoading, | ||
tokenName, | ||
collectionName, | ||
tokenIcons, | ||
media, | ||
onClick, | ||
}) => { | ||
return ( | ||
<TableRow | ||
isLoading={isLoading} | ||
tokenName={tokenName} | ||
collectionName={collectionName} | ||
tokenIcons={tokenIcons} | ||
media={media} | ||
onClick={onClick} | ||
/> | ||
); | ||
}; | ||
|
||
function View({ displayedObjects, displayShowMore, onShowMore }: ViewProps) { | ||
return ( | ||
<Box> | ||
<TableContainer id="oridinals-inscriptions"> | ||
<TableHeader titleKey={TableHeaderTitleKey.Inscriptions} /> | ||
{/** titlekey doesn't need to be translated so we keep it hard coded */} | ||
{displayedObjects ? ( | ||
displayedObjects.map((item, index) => ( | ||
<Item | ||
key={index} | ||
isLoading={item.isLoading} | ||
tokenName={item.tokenName} | ||
collectionName={item.collectionName} | ||
tokenIcons={item.tokenIcons} | ||
media={item.media} | ||
onClick={item.onClick} | ||
/> | ||
)) | ||
) : ( | ||
<Flex justifyContent={"center"} my={12}> | ||
{"NOTHING TO SHOW"} | ||
</Flex> | ||
)} | ||
{displayShowMore && <ShowMore onShowMore={onShowMore} />} | ||
</TableContainer> | ||
</Box> | ||
); | ||
} | ||
|
||
const Inscriptions: React.FC<Props> = ({ account }: Props) => { | ||
return <View {...useInscriptionsModel({ account })} />; | ||
}; | ||
|
||
export default Inscriptions; |
32 changes: 32 additions & 0 deletions
32
...c/newArch/features/Collectibles/Ordinals/components/Inscriptions/useInscriptionsModel.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,32 @@ | ||
import { useEffect, useMemo, useState } from "react"; | ||
import { Account } from "@ledgerhq/types-live"; | ||
import { InscriptionsItemProps } from "./index"; | ||
import { mockedItems as InscriptionsMocked } from "LLD/features/Collectibles/__integration__/mockedInscriptions"; | ||
type Props = { | ||
account: Account; | ||
}; | ||
|
||
export const useInscriptionsModel = ({ account }: Props) => { | ||
const [displayShowMore, setDisplayShowMore] = useState(false); | ||
const [displayedObjects, setDisplayedObjects] = useState<InscriptionsItemProps[]>([]); | ||
|
||
const mockedItems: InscriptionsItemProps[] = useMemo(() => [...InscriptionsMocked], []); | ||
|
||
useEffect(() => { | ||
if (mockedItems.length > 3) setDisplayShowMore(true); | ||
setDisplayedObjects(mockedItems.slice(0, 3)); | ||
}, [mockedItems]); | ||
|
||
const onShowMore = () => { | ||
setDisplayedObjects(prevDisplayedObjects => { | ||
const newDisplayedObjects = [ | ||
...prevDisplayedObjects, | ||
...mockedItems.slice(prevDisplayedObjects.length, prevDisplayedObjects.length + 3), | ||
]; | ||
if (newDisplayedObjects.length === mockedItems.length) setDisplayShowMore(false); | ||
return newDisplayedObjects; | ||
}); | ||
}; | ||
|
||
return { account, displayedObjects, displayShowMore, onShowMore }; | ||
}; |
Empty file.
14 changes: 14 additions & 0 deletions
14
.../ledger-live-desktop/src/newArch/features/Collectibles/Ordinals/screens/Account/index.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,14 @@ | ||
import React from "react"; | ||
import { Account } from "@ledgerhq/types-live"; | ||
import Inscriptions from "../../components/Inscriptions"; | ||
|
||
type Props = { | ||
account: Account; | ||
}; | ||
|
||
const OrdinalsAccount: React.FC<Props> = ({ account }) => { | ||
return <Inscriptions account={account} />; | ||
// here we will add the rare sats table | ||
}; | ||
|
||
export default OrdinalsAccount; |
90 changes: 90 additions & 0 deletions
90
...dger-live-desktop/src/newArch/features/Collectibles/__integration__/mockedInscriptions.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,90 @@ | ||
import { Icons } from "@ledgerhq/react-ui"; | ||
import { InscriptionsItemProps } from "../Ordinals/components/Inscriptions"; | ||
|
||
export const mockedItems: InscriptionsItemProps[] = [ | ||
{ | ||
isLoading: false, | ||
tokenName: "NodeMonke#5673", | ||
collectionName: "NodeMonkes", | ||
tokenIcons: [Icons.OrdinalsAlpha, Icons.OrdinalsPaliblockPalindrome], | ||
media: { | ||
uri: "https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2Ff976d219206858d782cccd90d25882cc77cafd3d6c159728f0d3407e25961ab0i0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252Ff976d219206858d782cccd90d25882cc77cafd3d6c159728f0d3407e25961ab0i0.png&w=1920&q=75", | ||
previewUri: | ||
"https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2Ff976d219206858d782cccd90d25882cc77cafd3d6c159728f0d3407e25961ab0i0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252Ff976d219206858d782cccd90d25882cc77cafd3d6c159728f0d3407e25961ab0i0.png&w=1920&q=75", | ||
mediaType: "image", | ||
isLoading: false, | ||
useFallback: true, | ||
contentType: "image", | ||
}, | ||
onClick: () => console.log("clicked"), | ||
}, | ||
{ | ||
isLoading: false, | ||
tokenName: "NodeMonke#5673#22", | ||
collectionName: "NodeMonkes#2", | ||
tokenIcons: [Icons.OrdinalsAlpha, Icons.OrdinalsPaliblockPalindrome], | ||
media: { | ||
uri: "https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
previewUri: | ||
"https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
mediaType: "image", | ||
isLoading: false, | ||
useFallback: true, | ||
contentType: "image", | ||
}, | ||
onClick: () => console.log("clicked"), | ||
}, | ||
{ | ||
isLoading: false, | ||
tokenName: "NodeMonke#5673#33", | ||
collectionName: "NodeMonkes#2", | ||
tokenIcons: [], | ||
media: { | ||
uri: "https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
previewUri: | ||
"https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
mediaType: "image", | ||
isLoading: false, | ||
useFallback: true, | ||
contentType: "image", | ||
}, | ||
onClick: () => console.log("clicked"), | ||
}, | ||
{ | ||
isLoading: false, | ||
tokenName: "NodeMonke#5673#44", | ||
collectionName: "NodeMonkes#2", | ||
tokenIcons: [Icons.OrdinalsBlackLegendary], | ||
media: { | ||
uri: "https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
previewUri: | ||
"https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
mediaType: "image", | ||
isLoading: false, | ||
useFallback: true, | ||
contentType: "image", | ||
}, | ||
onClick: () => console.log("clicked"), | ||
}, | ||
{ | ||
isLoading: false, | ||
tokenName: "NodeMonke#5673#55", | ||
collectionName: "NodeMonkes#2", | ||
tokenIcons: [ | ||
Icons.OrdinalsBlock9450X, | ||
Icons.OrdinalsPaliblockPalindrome, | ||
Icons.OrdinalsBlock9, | ||
Icons.OrdinalsHitman, | ||
], | ||
media: { | ||
uri: "https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
previewUri: | ||
"https://www.cryptoslam.io/_next/image?url=https%3A%2F%2Fd6rvidx1ucs57.cloudfront.net%2Fcryptoslam-token-images.s3.amazonaws.com%2FBitcoin%2Fnodemonkes%2Fimage%2F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png%3Fd%3D354%26u%3Dhttps%253A%252F%252Fcryptoslam-token-images.s3.amazonaws.com%252FBitcoin%252Fnodemonkes%252Fimage%252F33199e5e35a90b516d274e8c076ca205436db00a36bc5a99d2f0e26110ca7abai0.png&w=1920&q=75", | ||
mediaType: "image", | ||
isLoading: false, | ||
useFallback: true, | ||
contentType: "image", | ||
}, | ||
onClick: () => console.log("clicked"), | ||
}, | ||
]; |
16 changes: 11 additions & 5 deletions
16
...e-desktop/src/newArch/features/Collectibles/components/Collection/TableRow/TokenTitle.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
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
Oops, something went wrong.