diff --git a/.jest/__mocks__/hooksMocks.ts b/.jest/__mocks__/hooksMocks.ts new file mode 100644 index 000000000..bf8d5c09c --- /dev/null +++ b/.jest/__mocks__/hooksMocks.ts @@ -0,0 +1,20 @@ +import marketMetadata from '../__fixtures__/marketMetadata' +import userPreferences from '../__fixtures__/userPreferences' +import web3 from '../__fixtures__/web3' +import { asset } from '../__fixtures__/assetWithAccessDetails' + +jest.mock('../../src/@context/MarketMetadata', () => ({ + useMarketMetadata: () => marketMetadata +})) + +jest.mock('../../src/@context/UserPreferences', () => ({ + useUserPreferences: () => userPreferences +})) + +jest.mock('../../src/@context/Web3', () => ({ + useWeb3: () => web3 +})) + +jest.mock('../../../@context/Asset', () => ({ + useAsset: () => ({ asset }) +})) diff --git a/.jest/jest.setup.js b/.jest/jest.setup.js index 8c121fd5f..3acd4900e 100644 --- a/.jest/jest.setup.js +++ b/.jest/jest.setup.js @@ -1,23 +1,3 @@ import '@testing-library/jest-dom/extend-expect' import './__mocks__/matchMedia' - -import marketMetadata from './__fixtures__/marketMetadata' -import userPreferences from './__fixtures__/userPreferences' -import web3 from './__fixtures__/web3' -import { asset } from './__fixtures__/assetWithAccessDetails' - -jest.mock('../../src/@context/MarketMetadata', () => ({ - useMarketMetadata: () => marketMetadata -})) - -jest.mock('../../src/@context/UserPreferences', () => ({ - useUserPreferences: () => userPreferences -})) - -jest.mock('../../src/@context/Web3', () => ({ - useWeb3: () => web3 -})) - -jest.mock('../../../@context/Asset', () => ({ - useAsset: () => ({ asset }) -})) +import './__mocks__/hooksMocks' diff --git a/package-lock.json b/package-lock.json index 61ab776bd..003dfca3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -97,7 +97,7 @@ "typescript": "^4.8.4" }, "engines": { - "node": ">=14" + "node": "16" } }, "node_modules/@adobe/css-tools": { diff --git a/src/components/@shared/AssetList/index.tsx b/src/components/@shared/AssetList/index.tsx index fd016e85e..f58a43c34 100644 --- a/src/components/@shared/AssetList/index.tsx +++ b/src/components/@shared/AssetList/index.tsx @@ -24,6 +24,8 @@ export declare type AssetListProps = { onPageChange?: React.Dispatch> className?: string noPublisher?: boolean + noDescription?: boolean + noPrice?: boolean } export default function AssetList({ @@ -34,7 +36,9 @@ export default function AssetList({ isLoading, onPageChange, className, - noPublisher + noPublisher, + noDescription, + noPrice }: AssetListProps): ReactElement { const { accountId } = useWeb3() const [assetsWithPrices, setAssetsWithPrices] = @@ -74,6 +78,8 @@ export default function AssetList({ asset={assetWithPrice} key={assetWithPrice.id} noPublisher={noPublisher} + noDescription={noDescription} + noPrice={noPrice} /> )) ) : ( diff --git a/src/components/@shared/AssetTeaser/index.module.css b/src/components/@shared/AssetTeaser/index.module.css index ca468094f..c88f6f700 100644 --- a/src/components/@shared/AssetTeaser/index.module.css +++ b/src/components/@shared/AssetTeaser/index.module.css @@ -21,7 +21,7 @@ } .detailLine { - margin-bottom: calc(var(--spacer) / 2); + margin-bottom: calc(var(--spacer) / 4); } .content { @@ -43,8 +43,12 @@ overflow-wrap: break-word; } +.price { + margin-top: calc(var(--spacer) / 12); +} + .footer { - margin-top: calc(var(--spacer) / 4); + margin-top: calc(var(--spacer) / 12); } .typeLabel { diff --git a/src/components/@shared/AssetTeaser/index.tsx b/src/components/@shared/AssetTeaser/index.tsx index 191d02c89..f9d61504e 100644 --- a/src/components/@shared/AssetTeaser/index.tsx +++ b/src/components/@shared/AssetTeaser/index.tsx @@ -14,11 +14,15 @@ import { useUserPreferences } from '@context/UserPreferences' export declare type AssetTeaserProps = { asset: AssetExtended noPublisher?: boolean + noDescription?: boolean + noPrice?: boolean } export default function AssetTeaser({ asset, - noPublisher + noPublisher, + noDescription, + noPrice }: AssetTeaserProps): ReactElement { const { name, type, description } = asset.metadata const { datatokens } = asset @@ -53,16 +57,23 @@ export default function AssetTeaser({ {!noPublisher && } -
- - {removeMarkdown(description?.substring(0, 300) || '')} - -
- {isUnsupportedPricing || !asset.services.length ? ( - No pricing schema available - ) : ( - + {!noDescription && ( +
+ + {removeMarkdown(description?.substring(0, 300) || '')} + +
)} + {!noPrice && ( +
+ {isUnsupportedPricing || !asset.services.length ? ( + No pricing schema available + ) : ( + + )} +
+ )} +