-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
β¨feat(lld): UI of inscriptions table for ordis #7745
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You maybe should put this outside of TableRow as it's specific to Stats ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I've changed that in feat/LIVE-12479_b. There will be a dedicated component