Skip to content

Commit

Permalink
feat(GalaxyRequirement): use Tailwind CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Oct 7, 2024
1 parent 598fc99 commit e37a607
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/requirements/Galaxy/GalaxyRequirement.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, Text } from "@chakra-ui/react"
import { Anchor } from "@/components/ui/Anchor"
import {
Requirement,
RequirementProps,
Expand All @@ -8,42 +8,43 @@ import { DataBlock } from "components/common/DataBlock"
import { useGalaxyCampaign } from "./hooks/useGalaxyCampaigns"

const GalaxyRequirement = (props: RequirementProps): JSX.Element => {
const requirement = useRequirementContext()
const requirement = useRequirementContext<"GALAXY" | "GALAXY_PARTICIPATION">()

const { campaign, isLoading } = useGalaxyCampaign(requirement?.data?.galaxyId)
const { campaign, isLoading } = useGalaxyCampaign(requirement.data.galaxyId)

return (
<Requirement image={campaign?.thumbnail} isImageLoading={isLoading} {...props}>
<Text as="span">
<span>
{requirement.type === "GALAXY_PARTICIPATION"
? "Participate in the "
: "Hold a(n) "}
</Text>
</span>
{!campaign || isLoading ? (
<DataBlock
isLoading={isLoading}
error={
!campaign && !isLoading && "API error, please contact Galxe to report."
!campaign && !isLoading
? "API error, please contact Galxe to report."
: undefined
}
>
{requirement.data.galaxyId}
</DataBlock>
) : (
<Link
href={`https://app.galxe.com/quest/${campaign.space.alias}/${campaign.id}`}
isExternal
display="inline"
colorScheme="blue"
fontWeight="medium"
<Anchor
href={`https://app.galxe.com/quest/${campaign.space?.alias}/${campaign.id}`}
showExternal
variant="highlighted"
className="break-words"
>
{campaign.name}
</Link>
</Anchor>
)}
<Text as="span">
<span>
{requirement.type === "GALAXY_PARTICIPATION"
? " Galxe campaign"
: " Galxe NFT"}
</Text>
</span>
</Requirement>
)
}
Expand Down

0 comments on commit e37a607

Please sign in to comment.