Skip to content

Commit

Permalink
misc marketplace tab refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
scandycuz committed Nov 16, 2024
1 parent c59bbb2 commit 15f13cb
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions apps/studio/src/pages/home/library/MarketplaceTab/Sale.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export const Sale = () => {
} = useGetSalesQuery(
{
addresses: [walletAddress],
limit: 1,
saleStatuses: [SaleStatus.Started],
songIds: [songId],
},
Expand All @@ -52,7 +51,7 @@ export const Sale = () => {
isHasTokensLoading ||
isGetActiveSalesLoading;

const hasActiveSale = activeOwnedSales.length > 0;
const activeSale = activeOwnedSales[0];

/**
* Handle the pending state for sale start.
Expand Down Expand Up @@ -88,8 +87,7 @@ export const Sale = () => {
}, [songId]);

/**
* Refetch sales when pending status changes or the
* wallet address changes.
* Refetch sales when the pending status changes.
*/
useEffect(() => {
if (!isGetSalesUninitialized) {
Expand All @@ -103,7 +101,7 @@ export const Sale = () => {
]);

/**
* Gets an address from the wallet updates the state.
* Gets an address from the wallet and updates the state.
*/
useEffect(() => {
if (!wallet) return;
Expand Down Expand Up @@ -136,7 +134,7 @@ export const Sale = () => {
return <MarketplaceTabSkeleton />;
}

if (!isConnected || (!hasActiveSale && !hasTokens)) {
if (!isConnected || (!activeSale && !hasTokens)) {
return <ConnectWallet />;
}

Expand All @@ -148,9 +146,5 @@ export const Sale = () => {
return <SaleEndPending />;
}

return hasActiveSale ? (
<ActiveSale sale={ activeOwnedSales[0] } />
) : (
<CreateSale />
);
return activeSale ? <ActiveSale sale={ activeSale } /> : <CreateSale />;
};

0 comments on commit 15f13cb

Please sign in to comment.