Skip to content

Commit

Permalink
chore: adjust logic for displaying sidebar cards
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 4, 2024
1 parent d1c38f5 commit aaa6b6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
20 changes: 4 additions & 16 deletions src/components/creators/CreatorDashboardSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useFetchTotalStake } from 'src/rtk/features/creators/totalStakeHooks'
import { useMyAddress } from '../auth/MyAccountsContext'
import CreatePostCard from './cards/CreatePostCard'
import CreatorInfoCard from './cards/CreatorInfoCard'
import GetMoreSubCard from './cards/GetMoreSubCard'
import MyStakeCard from './cards/MyStakeCard'
import StakerRewardInfoCard from './cards/StakerRewardInfoCard'
import StakeSubCard from './cards/StakeSubCard'
Expand Down Expand Up @@ -79,7 +78,8 @@ function SpacePageSidebar({ space }: Extract<CreatorDashboardSidebarType, { name
return (
<>
{(() => {
if (!isCreatorSpace) return <SupportCreatorsCard />
if (!isCreatorSpace && !totalStake?.hasStaked) return <SupportCreatorsCard />

if (stakeData?.hasStaked) return <MyStakeCard space={space} />
else return <StakeSubCard space={space} />
})()}
Expand All @@ -91,27 +91,15 @@ function SpacePageSidebar({ space }: Extract<CreatorDashboardSidebarType, { name
function PostPageSidebar({ space }: Extract<CreatorDashboardSidebarType, { name: 'post-page' }>) {
const myAddress = useMyAddress() ?? ''
const { data, loading: loadingTotalStake } = useFetchTotalStake(myAddress)
const { isCreatorSpace, loading: loadingCreator } = useIsCreatorSpace(space.id)
const { loading: loadingCreator } = useIsCreatorSpace(space.id)

if (loadingCreator) {
return null
}

if (!isCreatorSpace) {
return (
<>
<CreatePostCard variant='posts' />
<GetMoreSubCard />
</>
)
}

return (
<>
{(() => {
if (!isCreatorSpace) return <CreatePostCard variant='posts' />
return <CreatorInfoCard showStakeButton={!data?.hasStaked} space={space} />
})()}
<CreatorInfoCard showStakeButton={!data?.hasStaked} space={space} />
{!loadingTotalStake &&
(data?.hasStaked ? <StakerRewardInfoCard /> : <StakeSubCard space={space} />)}
</>
Expand Down
3 changes: 1 addition & 2 deletions src/components/creators/cards/CreatorInfoCard.module.sass
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
margin-bottom: $space_small

.Title
font-size: $font_large
font-size: $font_semilarge
font-weight: $font_weight_semibold
line-height: normal
margin-bottom: $space_mini

.Subtitle
opacity: 0.8
Expand Down

0 comments on commit aaa6b6e

Please sign in to comment.