Skip to content

Commit

Permalink
chore: merge latest of develop
Browse files Browse the repository at this point in the history
  • Loading branch information
heldrida committed Jul 12, 2022
2 parents 06f465f + d2a1438 commit 52e324e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .scripts/kyasshu/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
host=$1

if [[ -z $host || "$host" == "local" ]]; then
export CAP_ID=$(cd nft-marketplace/cap && dfx canister id ic-history-router)
export CAP_ID=$(cd nft-marketplace/cap && dfx canister id cap-router)
export MARKETPLACE_CANISTER_ID=$(cd nft-marketplace && dfx canister id marketplace)
export NFT_CANISTER_ID=$(cd nft-marketplace/crowns && dfx canister id crowns)
export NFT_CANISTER_STANDARD='DIP721v2'
Expand Down
2 changes: 1 addition & 1 deletion .scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if [[ $env == "development" ]]; then
MKP_ID=$(cd nft-marketplace && dfx canister id marketplace)
CROWNS_ID=$(cd nft-marketplace/crowns && dfx canister id crowns)
WICP_ID=$(cd nft-marketplace/wicp && dfx canister id wicp)
CAP_ID=$(cd nft-marketplace/cap && dfx canister id ic-history-router)
CAP_ID=$(cd nft-marketplace/cap && dfx canister id cap-router)

printf "🤖 Marketplace id (%s), CrownsId (%s), WicpId (%s), CapId (%s)\n" "$MKP_ID" "$CROWNS_ID" "$WICP_ID" "$CAP_ID"

Expand Down
26 changes: 14 additions & 12 deletions src/components/core/accordions/offer-accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const OnConnected = ({
}: ConnectedProps) => {
const { id } = useParams();
const dispatch = useAppDispatch();
const [loadingOffers, setLoadingOffers] = useState<boolean>(true);
const { principalId: plugPrincipalId } = usePlugStore();

const recentlyAcceptedOffers = useSelector(
Expand Down Expand Up @@ -108,10 +109,6 @@ const OnConnected = ({
[id, tokenOffers, plugPrincipalId],
);

const offersLoaded = useSelector(
(state: RootState) => state.marketplace.offersLoaded,
);

useEffect(() => {
// TODO: handle the error gracefully when there is no id
if (!id || !plugPrincipalId) return;
Expand All @@ -120,6 +117,10 @@ const OnConnected = ({
marketplaceActions.getTokenOffers({
ownerTokenIdentifiers: [BigInt(id)],

onSuccess: () => {
setLoadingOffers(false);
},

onFailure: () => {
// TODO: handle failure messages
},
Expand Down Expand Up @@ -149,7 +150,7 @@ const OnConnected = ({
<MakeOfferModal
isNFTListed={isListed}
isTriggerVisible={Boolean(
showNonOwnerButtons && !offersLoaded && !userMadeOffer,
showNonOwnerButtons && !loadingOffers && !userMadeOffer,
)}
/>
</ButtonDetailsWrapper>
Expand All @@ -159,11 +160,11 @@ const OnConnected = ({
isNFTListed={isListed}
offerPrice={userMadeOffer?.price}
isTriggerVisible={Boolean(
showNonOwnerButtons && !offersLoaded && userMadeOffer,
showNonOwnerButtons && !loadingOffers && userMadeOffer,
)}
/>
</ButtonDetailsWrapper>
{showNonOwnerButtons && !offersLoaded && userMadeOffer && (
{showNonOwnerButtons && !loadingOffers && userMadeOffer && (
<ButtonDetailsWrapper>
<CancelOfferModal
item={userMadeOffer?.item}
Expand Down Expand Up @@ -192,17 +193,14 @@ export const OfferAccordion = ({
const { t } = useTranslation();
const { id } = useParams();
const dispatch = useAppDispatch();
const [loadingOffers, setLoadingOffers] = useState<boolean>(true);
// TODO: On loading and awaiting for token offers response
// should display a small loader in the place of price
const [isAccordionOpen, setIsAccordionOpen] = useState(true);
const [marketPrice, setMarketPrice] = useState<
string | undefined
>();

const offersLoaded = useSelector(
(state: RootState) => state.marketplace.offersLoaded,
);

const {
isConnected,
principalId: plugPrincipal,
Expand All @@ -226,6 +224,10 @@ export const OfferAccordion = ({
marketplaceActions.getTokenOffers({
ownerTokenIdentifiers: [BigInt(id as string)],

onSuccess: () => {
setLoadingOffers(false);
},

onFailure: () => {
// TODO: handle failure messages
},
Expand Down Expand Up @@ -298,7 +300,7 @@ export const OfferAccordion = ({
<OfferLabel>
{t('translation:accordions.offer.header.topOffer')}
</OfferLabel>
{(!offersLoaded && (
{(!loadingOffers && (
<OfferPrice>
{(topOffer?.price &&
`${parseE8SAmountToWICP(
Expand Down

0 comments on commit 52e324e

Please sign in to comment.