diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/ActionBar.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/ActionBar.tsx index bde36cc658c0..32132acc06d3 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/ActionBar.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/ActionBar.tsx @@ -41,28 +41,28 @@ export function ActionBar(props: ActionBarProps) { } = useControlledDialog() if (!asset.value) return null - return ( - {!asset.value.is_owner && asset.value.is_auction ? ( + {!asset.value.is_owner && asset.value.is_auction && assetOrder.value ? ( - {t('plugin_collectible_place_bid')} + onClick={onOpenCheckoutDialog}> + {t('plugin_collectible_buy_now')} ) : null} - {!asset.value.is_owner && !asset.value.is_auction && assetOrder.value ? ( + {!asset.value.is_owner && asset.value.is_auction ? ( - {t('plugin_collectible_buy_now')} + onClick={onOpenOfferDialog}> + {t('plugin_collectible_place_bid')} ) : null} + {!asset.value.is_owner && !asset.value.is_auction ? ( { @@ -131,6 +131,13 @@ const useStyles = makeStyles()((theme) => { backgroundColor: '#eb5757', padding: theme.spacing(0.5, 2), }, + loading: { + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + height: '100%', + padding: theme.spacing(8, 0), + }, markdown: { 'text-overflow': 'ellipsis', display: '-webkit-box', @@ -163,7 +170,6 @@ export function Collectible(props: CollectibleProps) { ) //#endregion - if (asset.loading) return if (!asset.value) return ( @@ -189,6 +195,18 @@ export function Collectible(props: CollectibleProps) { , ] + const renderTab = (tabIndex: CollectibleTab) => { + const tabMap: Record = { + [CollectibleTab.ARTICLE]: , + [CollectibleTab.TOKEN]: , + [CollectibleTab.OFFER]: , + [CollectibleTab.LISTING]: , + [CollectibleTab.HISTORY]: , + } + + return tabMap[tabIndex] || null + } + const endDate = asset.value?.end_time return ( <> @@ -270,11 +288,11 @@ export function Collectible(props: CollectibleProps) { {tabs} - {tabIndex === CollectibleTab.ARTICLE ? : null} - {tabIndex === CollectibleTab.TOKEN ? : null} - {tabIndex === CollectibleTab.OFFER ? : null} - {tabIndex === CollectibleTab.LISTING ? : null} - {tabIndex === CollectibleTab.HISTORY ? : null} + {(asset.loading && ( +
+ +
+ )) || <>{renderTab(tabIndex)}}
diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx index 7a8349907354..58df9742162f 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/HistoryTab/index.tsx @@ -7,7 +7,7 @@ import { CollectibleState } from '../../hooks/useCollectibleState' import { Row } from './Row' import { CollectibleProvider } from '../../types' import { TableListPagination } from '../Pagination' -import { LoadingTable } from '../LoadingTable' +import { LoadingAnimation } from '@masknet/shared' const useStyles = makeStyles()((theme) => { return { @@ -52,7 +52,12 @@ export function HistoryTab(props: HistoryTabProps) { }, [events.value, provider]) //#endregion - if (events.loading) return + if (events.loading) + return ( +
+ +
+ ) if (!events.value || events.error || !events.value?.data.length) return (