Skip to content
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

[ENG-3351] feat: exotics v1 #689

Merged
merged 37 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9958758
chore: merge from upstream develop (#26)
teebszet Oct 3, 2023
783d854
chore: allow ci build version to pass env vars to build (#27)
teebszet Oct 3, 2023
f48e78c
feat/eng 2904 implement frontend on web extension (#5)
teebszet Oct 3, 2023
1ce9f04
release v0.20.0 (#29)
yknl Oct 6, 2023
a110adb
chore: tidy up zips of each build run and the release uploads (#31)
teebszet Oct 10, 2023
0595589
feat: collectibles ui frontend (#30)
dhriaznov Oct 10, 2023
c5f6a89
Release/0.21.0 (#49)
teebszet Nov 16, 2023
2efe5fc
chore: merge upstream develop (#53)
teebszet Nov 16, 2023
ec8d560
feat: add new sattributes to rarity scale screen (#54)
fedeerbes Nov 17, 2023
2fd63a5
chore: add mock data and local storage values for testing and mapRare…
fedeerbes Nov 21, 2023
d42dbdb
feat: tweak rare sats bundle screen to support new satributes (#58)
fedeerbes Nov 22, 2023
45faa8b
Merge remote-tracking branch 'origin/develop' into chore-merge-ours-t…
teebszet Nov 23, 2023
836914c
Chore merge ours to downstream develop (#62)
teebszet Nov 23, 2023
7d4ef02
chore: merge develop into feat/exotics-sats-v1
fedeerbes Nov 23, 2023
aa7b7d3
feat: send flow (#63)
abdulhaseeb4239 Nov 24, 2023
0030399
feat: add v2 of useGetUtxoOrdinalBundle and use it in ordinal detail …
fedeerbes Nov 24, 2023
568430a
feat: send inscriptions that belong to a rare sat (#64)
abdulhaseeb4239 Nov 24, 2023
5499535
feat: add sat bundle layout to sign psbt screen (#65)
fedeerbes Nov 27, 2023
fdbc08a
feat: show callout if ordinal holds a rare sat (#66)
abdulhaseeb4239 Nov 27, 2023
af58f15
chore: move methods and utils to core, remove v2 suffix and clean up …
fedeerbes Nov 28, 2023
e35723a
feat: confirm ordinal screen gallery view (#68)
abdulhaseeb4239 Nov 28, 2023
28d8223
fix: testing issues (#69)
abdulhaseeb4239 Nov 29, 2023
de03029
Merge branch 'develop' into chore-merge-ours-to-downstream-develop
teebszet Nov 29, 2023
3a588b3
Merge pull request #70 from secretkeylabs/chore-merge-ours-to-downstr…
teebszet Nov 29, 2023
bbb321e
Merge remote-tracking branch 'origin/develop' into feat/exotics-sats-v1
teebszet Nov 29, 2023
13092a2
Merge remote-tracking branch 'upstream/develop' into feat/exotics-sat…
teebszet Nov 29, 2023
e574270
fix: logic and ui in RareSatsTabGridItem component (#692)
fedeerbes Nov 29, 2023
606095a
chore: merge develop into feat/ENG-3351
fedeerbes Nov 29, 2023
49c351d
fix: typo
teebszet Nov 30, 2023
743fa72
chore: use colors from theme
abdulhaseeb4239 Nov 30, 2023
6c8abe8
Merge branch 'feat/ENG-3351' of https://github.com/secretkeylabs/xver…
abdulhaseeb4239 Nov 30, 2023
d5409a4
fix: padding
abdulhaseeb4239 Nov 30, 2023
c6af900
chore: remove mock data and code
teebszet Nov 30, 2023
240464e
Merge branch 'feat/ENG-3351' of github.com:secretkeylabs/xverse-web-e…
teebszet Nov 30, 2023
c57c861
fix: restore cache key
fedeerbes Nov 30, 2023
93d0c6f
fix: UI
abdulhaseeb4239 Nov 30, 2023
0cc3293
fix: import sort
fedeerbes Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@ledgerhq/hw-transport-webusb": "^6.27.13",
"@phosphor-icons/react": "^2.0.10",
"@react-spring/web": "^9.6.1",
"@secretkeylabs/xverse-core": "3.1.1",
"@secretkeylabs/xverse-core": "3.1.1-e148aa5",
"@stacks/connect": "^6.10.2",
"@stacks/encryption": "4.3.5",
"@stacks/stacks-blockchain-api-types": "6.1.1",
Expand Down
88 changes: 88 additions & 0 deletions src/app/components/assetModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import Cross from '@assets/img/dashboard/X.svg';
import { animated, useSpring } from '@react-spring/web';
import OrdinalImage from '@screens/ordinals/ordinalImage';
import { CondensedInscription, SatRangeInscription } from '@secretkeylabs/xverse-core';
import styled from 'styled-components';

const TransparentButton = styled.button({
background: 'transparent',
display: 'flex',
alignItems: 'center',
marginLeft: 10,
});

const CrossContainer = styled.div({
display: 'flex',
marginTop: 10,
justifyContent: 'flex-end',
alignItems: 'flex-end',
});

const OrdinalOuterImageContainer = styled.div({
justifyContent: 'center',
alignItems: 'center',
borderRadius: 2,
display: 'flex',
flexDirection: 'column',
flex: 1,
});

const OrdinalImageContainer = styled.div({
width: '50%',
});

const OrdinalBackgroundContainer = styled(animated.div)({
width: '100%',
height: '100%',
top: 0,
left: 0,
bottom: 0,
right: 0,
position: 'fixed',
zIndex: 10,
background: 'rgba(18, 21, 30, 0.8)',
backdropFilter: 'blur(16px)',
padding: 16,
display: 'flex',
flexDirection: 'column',
});

interface Props {
inscription: SatRangeInscription;
onClose: () => void;
}

function AssetModal({ inscription, onClose }: Props) {
const consdensedInscription: CondensedInscription = {
...inscription,
number: inscription.inscription_number,
};
const styles = useSpring({
from: {
opacity: 0,
y: 24,
},
to: {
y: 0,
opacity: 1,
},
delay: 100,
});

return (
<OrdinalBackgroundContainer style={styles}>
<CrossContainer onClick={onClose}>
<TransparentButton>
<img src={Cross} alt="cross" />
</TransparentButton>
</CrossContainer>
<OrdinalOuterImageContainer>
<OrdinalImageContainer>
<OrdinalImage ordinal={consdensedInscription} />
</OrdinalImageContainer>
</OrdinalOuterImageContainer>
</OrdinalBackgroundContainer>
);
}

export default AssetModal;
42 changes: 0 additions & 42 deletions src/app/components/bundleAsset/bundleAsset.tsx

This file was deleted.

16 changes: 8 additions & 8 deletions src/app/components/collectibleCollage/collectibleCollage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import RareSatAsset from '@components/rareSatAsset/rareSatAsset';
import Nft from '@screens/nftDashboard/nft';
import { NonFungibleToken } from '@secretkeylabs/xverse-core';
import { BundleItem } from '@utils/rareSats';
import OrdinalImage from '@screens/ordinals/ordinalImage';
import { CondensedInscription, NonFungibleToken } from '@secretkeylabs/xverse-core';
import styled from 'styled-components';

const CollageContainer = styled.div`
Expand Down Expand Up @@ -39,10 +38,11 @@ const RemainingAmountOfAssets = styled.div((props) => ({
},
}));

function CollectibleCollage({ items }: { items: Array<BundleItem | NonFungibleToken> }) {
function CollectibleCollage({ items }: { items: Array<CondensedInscription | NonFungibleToken> }) {
const moreThanFourItems = items.length > 4;

const isBundleItem = (item: any): boolean => (item as BundleItem).rarity_ranking !== undefined;
const isStacksNft = (item: CondensedInscription | NonFungibleToken): boolean =>
'asset_identifier' in item;
return (
<CollageContainer>
{items.slice(0, 4).map((item, index) => (
Expand All @@ -53,10 +53,10 @@ function CollectibleCollage({ items }: { items: Array<BundleItem | NonFungibleTo
<p>+{items.length - 4}</p>
</RemainingAmountOfAssets>
) : // Conditionally render RareSatAsset if item is a BundleItem otherwise render Nft
isBundleItem(item) ? (
<RareSatAsset item={item as BundleItem} isCollage />
) : (
isStacksNft(item) ? (
<Nft asset={item as NonFungibleToken} isGalleryOpen={false} />
) : (
<OrdinalImage ordinal={item as CondensedInscription} />
)}
</CollageItem>
))}
Expand Down
109 changes: 109 additions & 0 deletions src/app/components/confirmBtcTransactionComponent/bundle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import BundleIcon from '@assets/img/rareSats/satBundle.svg';
import AssetModal from '@components/assetModal';
import { CaretDown } from '@phosphor-icons/react';
import { Bundle, BundleSatRange, SatRangeInscription } from '@secretkeylabs/xverse-core';
import { StyledP } from '@ui-library/common.styled';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';
import Theme from 'theme';
import BundleItem from './bundleItem';

interface BundleItemContainerProps {
addMargin: boolean;
}

const BundleItemsContainer = styled.div<BundleItemContainerProps>`
margin-top: ${(props) => (props.addMargin ? props.theme.space.m : 0)};
`;

const SatsBundleContainer = styled.div`
display: flex;
flex-direction: column;
margin-bottom: ${(props) => props.theme.space.s};
border-radius: ${(props) => props.theme.space.s};
padding: ${(props) => props.theme.space.m};
background-color: ${(props) => props.theme.colors.elevation1};
`;

const SatsBundleButton = styled.button`
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background-color: ${(props) => props.theme.colors.elevation1};
`;

const Row = styled.div`
display: flex;
flex-direction: row;
align-items: center;
`;

const BundleTitle = styled(StyledP)`
margin-left: ${(props) => props.theme.space.s};
`;

const BundleValue = styled(StyledP)`
margin-right: ${(props) => props.theme.space.xs};
`;

const Title = styled(StyledP)((props) => ({
marginBottom: props.theme.space.xs,
}));

function SatsBundle({ bundle, title }: { bundle: Bundle; title?: string }) {
const [showBundleDetail, setShowBundleDetail] = useState(false);
const [inscriptionToShow, setInscriptionToShow] = useState<SatRangeInscription | undefined>(
undefined,
);

const { t } = useTranslation('translation');

return (
<>
{inscriptionToShow && (
<AssetModal
onClose={() => setInscriptionToShow(undefined)}
inscription={inscriptionToShow}
/>
)}
<SatsBundleContainer>
{title && <Title typography="body_medium_m">{title}</Title>}
<SatsBundleButton
type="button"
onClick={() => setShowBundleDetail((prevState) => !prevState)}
>
<Row>
<img src={BundleIcon} alt="bundle" />
<BundleTitle typography="body_medium_m" color="white_200">
{t('RARE_SATS.SATS_BUNDLE')}
</BundleTitle>
</Row>
<Row>
<BundleValue typography="body_medium_m" color="white_0">{`${bundle.totalExoticSats} ${t(
'NFT_DASHBOARD_SCREEN.RARE_SATS',
)}`}</BundleValue>
<CaretDown color={Theme.colors.white_0} size={16} />
</Row>
</SatsBundleButton>

{showBundleDetail &&
bundle.satRanges.map((item: BundleSatRange, index: number) => (
<BundleItemsContainer key={`${item.block}-${item.offset}`} addMargin={index === 0}>
<BundleItem
item={item}
ordinalEyePressed={(inscription: SatRangeInscription) => {
// show ordinal modal to show asset
setInscriptionToShow(inscription);
}}
showDivider={index !== bundle.satRanges.length - 1}
/>
</BundleItemsContainer>
))}
</SatsBundleContainer>
</>
);
}

export default SatsBundle;
Loading
Loading