Skip to content

Commit

Permalink
Dao 615 (#146)
Browse files Browse the repository at this point in the history
* DAO-615 fix: user should be able to see his NFT in the user's page.

* fix: JoinACommunity.tsx will redirect to communities page
  • Loading branch information
Freshenext authored Aug 29, 2024
1 parent 4f2b603 commit 6b5c38a
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 62 deletions.
12 changes: 12 additions & 0 deletions src/app/communities/communityUtils.ts

Large diffs are not rendered by default.

14 changes: 1 addition & 13 deletions src/app/communities/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@
import { MainContainer } from '@/components/MainContainer/MainContainer'
import Image from 'next/image'
import { CommunityItem } from '@/app/communities/CommunityItem'
import { firstNft } from '@/app/communities/communityUtils'
import { nftContracts } from '@/lib/contracts'

// @TODO remove and dynamically fetch the community
const firstCommunity = {
leftImageSrc: firstNft.imageSrc,
title: 'Early Adopters',
subtitle: 'DeFi',
description:
'The Early Adopters collection features a vibrant array of digital pioneers, each uniquely crafted to embody the spirit of innovation and community in the blockchain world.',
nftAddress: nftContracts.EA,
numberOfMembers: 0,
}
import { firstCommunity } from '@/app/communities/communityUtils'

export default function Communities() {
return (
Expand Down
106 changes: 86 additions & 20 deletions src/app/user/Communities/CommunitiesSection.tsx

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions src/app/user/Communities/CommunityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ import { CommunityCardProps } from '@/app/user/types'
import Image from 'next/image'

export const CommunityCard: FC<CommunityCardProps> = ({ img, title, description, members }) => (
<div className="rounded bg-input-bg px-[14px] py-[14px]">
<div className="rounded bg-input-bg px-[14px] py-[14px] w-[300px]">
{/* image */}
<Image
src={`data:image/png;base64, ${img}`}
src={img}
alt="An image that contains a community logo"
className="w-full mb-[20px]"
className="mb-[20px]"
width={300}
height={300}
/>
{/* community title */}
<Paragraph className="text-[18px]">{title}</Paragraph>
<Paragraph className="text-[18px] mb-[5px]">{title}</Paragraph>
{/* description */}
<Paragraph variant="light" className="text-[12px]">
{description}
</Paragraph>
<Paragraph className="text-[14px] font-normal">{description}</Paragraph>
{/* members */}
<Paragraph className="text-[14px] mt-[7px]">{members} members</Paragraph>
</div>
)
44 changes: 24 additions & 20 deletions src/app/user/Communities/JoinACommunity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@ import { Paragraph } from '@/components/Typography/Paragraph'
import { Button } from '@/components/Button'
import { Header } from '@/components/Typography'
import { LuUsers } from 'react-icons/lu'
import { useRouter } from 'next/navigation'

export const JoinACommunity = () => (
<div className="flex justify-center align-center">
<div className="w-[506px] flex align-middle items-center flex-col">
<div
style={{
boxShadow: '0px 0px 16.4px 0px rgba(123,87,252,0.68)',
padding: 17,
borderRadius: '30%',
backgroundColor: 'white',
}}
>
<LuUsers size={48} color="#665EF6" />
export const JoinACommunity = () => {
const router = useRouter()
return (
<div className="flex justify-center align-center">
<div className="w-[506px] flex align-middle items-center flex-col">
<div
style={{
boxShadow: '0px 0px 16.4px 0px rgba(123,87,252,0.68)',
padding: 17,
borderRadius: '30%',
backgroundColor: 'white',
}}
>
<LuUsers size={48} color="#665EF6" />
</div>
<Header className="mt-[42px] mb-[8px] text-[24px]">Join a Community</Header>
<Paragraph variant="normal" className="text-center pb-[40px] text-[16px]">
You&apos;re not currently part of any communities. Join a community to connect with like-minded
individuals, participate in discussions, and gain access to exclusive content.
</Paragraph>
<Button onClick={() => router.push('/communities')}>Explore Communities</Button>
</div>
<Header className="mt-[42px] mb-[8px] text-[24px]">Join a Community</Header>
<Paragraph variant="normal" className="text-center pb-[40px] text-[16px]">
You&apos;re not currently part of any communities. Join a community to connect with like-minded
individuals, participate in discussions, and gain access to exclusive content.
</Paragraph>
<Button>Explore Communities</Button>
</div>
</div>
)
)
}
5 changes: 3 additions & 2 deletions src/shared/hooks/useCommunity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useContractData = (nftAddress?: Address) => {
}

// load data from the contract view functions
const { data, refetch } = useReadContracts(
const { data, refetch, isLoading } = useReadContracts(
address &&
nftAddress && {
contracts: [
Expand All @@ -61,8 +61,9 @@ export const useContractData = (nftAddress?: Address) => {
nftName: nftName?.result,
nftSymbol: symbol?.result,
nftUri: nftUri?.result,
isLoading,
}
}, [data, refetch])
}, [data, refetch, isLoading])
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ export interface CommunityData {
* NFT Metadata
*/
nftMeta: NftMeta | undefined
isLoading: boolean
}

0 comments on commit 6b5c38a

Please sign in to comment.