Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Fix an issue where creator page is blank (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
mycodecrafting authored Jun 18, 2021
1 parent 72d3b8e commit b8930ba
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 22 deletions.
60 changes: 38 additions & 22 deletions src/components/Creator/CreatorDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ import { Collection } from '../../reducer/slices/collections';
import { MinterButton } from '../common';
import lk from '../common/assets/link-icon.svg'

interface CreatorDisplay404Props {
ownedOnly: boolean;
}

function CreatorDisplay404(props: CreatorDisplay404Props) {
return (
<Flex w="100%" flex="1" flexDir="column" align="center">
<Flex
px={20}
py={10}
bg="gray.200"
textAlign="center"
align="center"
borderRadius="5px"
flexDir="column"
fontSize="xl"
color="gray.400"
mt={28}
>
<Wind />
<Text fontWeight="600" pt={5}>
{props.ownedOnly ? 'No owned tokens to display' : 'No tokens to display'}
</Text>
</Flex>
</Flex>
);
}

interface CreatorDisplayProps {
minter: string;
collections: { [key: string]: Collection };
Expand All @@ -45,12 +73,16 @@ export default function CreatorDisplay({
}, [dispatch, selectedCollection]);

if (!selectedCollection) {
return <></>;
return (
<CreatorDisplay404 ownedOnly={ownedOnly} />
);
}

const collection = collections[selectedCollection];
if (!collection) {
return <></>;
return (
<CreatorDisplay404 ownedOnly={ownedOnly} />
);
}

if (!collection.loaded) {
Expand All @@ -65,32 +97,16 @@ export default function CreatorDisplay({
}

if (collection.tokens === null) {
return <></>;
return (
<CreatorDisplay404 ownedOnly={ownedOnly} />
);
}

const tokens = collection.tokens;

if (tokens.length === 0) {
return (
<Flex w="100%" flex="1" flexDir="column" align="center">
<Flex
px={20}
py={10}
bg="gray.200"
textAlign="center"
align="center"
borderRadius="5px"
flexDir="column"
fontSize="xl"
color="gray.400"
mt={28}
>
<Wind />
<Text fontWeight="600" pt={5}>
{ownedOnly ? 'No owned tokens to display' : 'No tokens to display'}
</Text>
</Flex>
</Flex>
<CreatorDisplay404 ownedOnly={ownedOnly} />
);
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Creator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function Creator({ minter }: { minter: string }) {
creatorsCollections[addr] = collections.collections[addr];
return null;
});

return (
<Flex
flex="1"
Expand Down

0 comments on commit b8930ba

Please sign in to comment.