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

Merge develop into testnet #1777

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 11 additions & 9 deletions src/pages/Address/AddressAssetComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { getDobs } from '../../services/DobsService'
import { sliceNftName } from '../../utils/string'
import styles from './addressAssetComp.module.scss'
import EllipsisMiddle from '../../components/EllipsisMiddle'
import Inscription from './Inscription'

export const AddressAssetComp = ({
href,
Expand Down Expand Up @@ -259,19 +260,20 @@ export const AddressCoTAComp = ({ account, isRGBPP }: { account: CoTA; isRGBPP?:
)
}

export const AddressOmigaInscriptionComp = ({ account, isRGBPP }: { account: OmigaInscription; isRGBPP?: boolean }) => {
const { decimal, expectedSupply, mintStatus, amount, typeHash, udtAmount } = account
export const AddressOmigaInscriptionComp = ({ account }: { account: OmigaInscription }) => {
const { decimal, mintStatus, amount, typeHash, symbol, udtAmount } = account
const { t } = useTranslation()
return (
<AddressAssetComp
isRGBPP={isRGBPP ?? false}
<Inscription
href={`/inscription/${typeHash}`}
name={parseUDTAmount(amount, decimal)}
property={`${t(`udt.mint_status_${mintStatus}`)}(${parseUDTAmount(udtAmount, decimal)}/${parseUDTAmount(
expectedSupply,
decimal,
)})`}
content={{
Symbol: symbol,
Amount: amount,
Decimal: decimal,
Supply: udtAmount,
}}
udtLabel="Omiga"
mintingStatus={t(`udt.mint_status_${mintStatus}`)}
/>
)
}
34 changes: 20 additions & 14 deletions src/pages/Address/AddressComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,26 @@ export const AddressOverviewCard: FC<{ address: Address }> = ({ address }) => {
key={AssetInfo.INSCRIPTION}
>
<div className={styles.assetCardList}>
{inscriptions.map(inscription => {
switch (inscription.udtType) {
case 'omiga_inscription':
return (
<AddressOmigaInscriptionComp
account={inscription}
key={`${inscription.symbol + inscription.udtType + inscription.udtAmount}`}
/>
)

default:
return null
}
})}
<div className={styles.inscriptions}>
<ul>
{inscriptions.map(inscription => {
switch (inscription.udtType) {
case 'omiga_inscription':
return (
<li>
<AddressOmigaInscriptionComp
account={inscription}
key={`${inscription.symbol + inscription.udtType + inscription.udtAmount}`}
/>
</li>
)

default:
return null
}
})}
</ul>
</div>
</div>
</AddressAssetsTabPane>
) : null}
Expand Down
36 changes: 36 additions & 0 deletions src/pages/Address/Inscription.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import classNames from 'classnames'
import styles from './inscription.module.scss'
import { Link } from '../../components/Link'

const Inscription = ({
href,
udtLabel,
mintingStatus,
content,
}: {
content: Record<string, string>
href: string
mintingStatus?: string
udtLabel: string
}) => {
return (
<Link to={href} className={styles.container}>
<h5>
<span className="monospace">{udtLabel}</span>
<span className="monospace">{mintingStatus}</span>
</h5>
<div className={styles.content}>
{'{'}
{Object.entries(content).map(([key, value]) => (
<div className={classNames('monospace', styles.jsonValue)}>
<div className={classNames('monospace', styles.title)}>{key}:</div>
<div className={classNames('monospace', styles.value)}>{value}</div>
</div>
))}
{'}'}
</div>
</Link>
)
}

export default Inscription
2 changes: 1 addition & 1 deletion src/pages/Address/MergedAssetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const MergedAssetList: FC<{
case 'omiga_inscription':
return (
<AddressOmigaInscriptionComp
isRGBPP
// isRGBPP
account={omiga}
key={`${omiga.symbol + omiga.udtType + omiga.udtAmount}`}
/>
Expand Down
50 changes: 50 additions & 0 deletions src/pages/Address/inscription.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// @import '../../../styles//variables.module.scss';

.container {
min-width: 250px;
min-height: 86px;
background: #fff;
overflow: hidden;
max-width: 287px;
border-radius: 4px;
display: block;

h5 {
height: 30px;
background-color: #f8b83c;
display: flex;
justify-content: space-between;
padding: 8px 8px 6px;
margin: 0;
color: #333;
font-size: 12px;
font-style: normal;
font-weight: 500;
line-height: normal;
text-transform: capitalize;
}

.content {
height: 90px;
overflow-y: scroll;
padding: 8px;
background-color: #000;
width: 100%;
color: #fff;
text-wrap: nowrap;

.jsonValue {
.value {
overflow: hidden;
text-overflow: ellipsis;
flex-grow: 1;
}

padding-left: 2em;
width: 100%;
overflow: hidden;
max-width: 100%;
display: flex;
}
}
}
21 changes: 21 additions & 0 deletions src/pages/Address/styles.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
@import '../../styles/variables.module';

.inscriptions {
overflow-x: scroll;
width: 100%;

@media (width >= $extraLargeBreakPoint) {
max-height: 220px;
}

@media (width <= $extraLargeBreakPoint) {
max-height: 310px;
}

ul {
list-style: none;
padding: 0;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
gap: 1rem;
}
}

.addressOverviewCard:not(
[_='This `:not` selector is used to increase the specificity of the selector and serves no other purpose.']
) {
Expand Down