Skip to content

Commit

Permalink
Merge pull request #204 from dappforce/improvement/reward
Browse files Browse the repository at this point in the history
Unify staker and creator reward info
  • Loading branch information
teodorus-nathaniel authored Jan 26, 2024
2 parents 37ecb1f + 37b5c86 commit c16a40f
Show file tree
Hide file tree
Showing 14 changed files with 334 additions and 461 deletions.
8 changes: 4 additions & 4 deletions public/images/databases.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 4 additions & 8 deletions src/components/creators/CreatorDashboardSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import CreatorInfoCard from './cards/CreatorInfoCard'
import MyStakeCard from './cards/MyStakeCard'
import StakeSubCard from './cards/StakeSubCard'
import SupportCreatorsCard from './cards/SupportCreatorsCard'
import CreatorRewardInfoCard from './creator-rewards/CreatorRewardInfoCard'
import StakerRewardInfoCard from './staker-rewards/StakerRewardInfoCard'
import RewardInfoCard from './rewards/RewardInfoCard'

export type CreatorDashboardHomeVariant = 'posts' | 'spaces'
export type CreatorDashboardSidebarType =
Expand Down Expand Up @@ -56,12 +55,11 @@ function HomePageSidebar({ variant }: Extract<CreatorDashboardSidebarType, { nam
{data?.hasStaked ? (
<>
<CreatePostCard variant={variant} />
<StakerRewardInfoCard />
<RewardInfoCard />
</>
) : (
<SupportCreatorsCard />
)}
<CreatorRewardInfoCard />
</>
)
}
Expand Down Expand Up @@ -89,8 +87,7 @@ function SpacePageSidebar({ space }: Extract<CreatorDashboardSidebarType, { name
return (
<>
{renderTopCard()}
{!loadingTotalStake && totalStake?.hasStaked && <StakerRewardInfoCard />}
<CreatorRewardInfoCard />
{!loadingTotalStake && totalStake?.hasStaked && <RewardInfoCard />}
</>
)
}
Expand All @@ -108,8 +105,7 @@ function PostPageSidebar({ space }: Extract<CreatorDashboardSidebarType, { name:
<>
<CreatorInfoCard showStakeButton={data?.hasStaked} space={space} />
{!loadingTotalStake &&
(data?.hasStaked ? <StakerRewardInfoCard /> : <StakeSubCard space={space} />)}
<CreatorRewardInfoCard />
(data?.hasStaked ? <RewardInfoCard /> : <StakeSubCard space={space} />)}
</>
)
}
4 changes: 2 additions & 2 deletions src/components/creators/MobileActiveStakingSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps } from 'react'
import { useIsMobileWidthOrDevice } from '../responsive'
import MobileStakerRewardDashboard from './MobileStakerRewardDashboard'
import MobileRewardDashboard from './MobileRewardDashboard'
import TopUsersCard from './TopUsersCard'

export type MobileActiveStakingSectionProps = ComponentProps<'div'> & {
Expand Down Expand Up @@ -31,7 +31,7 @@ export default function MobileActiveStakingSection({
...props.style,
}}
>
<MobileStakerRewardDashboard />
<MobileRewardDashboard />
</div>
{showTopUsers && <TopUsersCard style={{ margin: `0 ${offsetX}px`, background: 'white' }} />}
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'src/styles/subsocial-vars.scss'

.MobileStakerRewardDashboard
.MobileRewardDashboard
position: relative

.Summary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { useFetchTotalStake } from 'src/rtk/features/creators/totalStakeHooks'
import { getAmountRange } from 'src/utils/analytics'
import { getSubIdCreatorsLink } from 'src/utils/links'
import { useMyAddress } from '../auth/MyAccountsContext'
import styles from './MobileStakerRewardDashboard.module.sass'
import StakerRewardInfo, { StakerSuperLikeCount } from './staker-rewards/StakerRewardInfo'
import StakerRewardProgressBar from './staker-rewards/StakerRewardProgressBar'
import styles from './MobileRewardDashboard.module.sass'
import RewardInfo, { StakerSuperLikeCount } from './rewards/RewardInfo'
import StakerRewardProgressBar from './rewards/StakerRewardProgressBar'

export type MobileStakerRewardDashboardProps = ComponentProps<'div'>
export type MobileRewardDashboardProps = ComponentProps<'div'>

export default function MobileStakerRewardDashboard(props: MobileStakerRewardDashboardProps) {
export default function MobileRewardDashboard(props: MobileRewardDashboardProps) {
const myAddress = useMyAddress() ?? ''
const { data: totalStake, loading } = useFetchTotalStake(myAddress)

Expand All @@ -29,12 +29,12 @@ export default function MobileStakerRewardDashboard(props: MobileStakerRewardDas
return <StakerRewardDashboard {...props} />
}

function StakeSubBanner(props: MobileStakerRewardDashboardProps) {
function StakeSubBanner(props: MobileRewardDashboardProps) {
const sendEvent = useSendEvent()
return (
<div
{...props}
className={clsx(props.className, styles.MobileStakerRewardDashboard, styles.StakeSubBanner)}
className={clsx(props.className, styles.MobileRewardDashboard, styles.StakeSubBanner)}
>
<div className={clsx(styles.Summary, 'py-2')}>
<div className={styles.Content}>
Expand Down Expand Up @@ -62,7 +62,7 @@ function StakeSubBanner(props: MobileStakerRewardDashboardProps) {
)
}

function StakerRewardDashboard(props: MobileStakerRewardDashboardProps) {
function StakerRewardDashboard(props: MobileRewardDashboardProps) {
const sendEvent = useSendEvent()
const { data: rewardReport } = useFetchUserRewardReport()
const likesCount = rewardReport?.superLikesCount ?? 0
Expand All @@ -76,7 +76,7 @@ function StakerRewardDashboard(props: MobileStakerRewardDashboardProps) {
const isOpenClassName = isOpen && styles.IsOpen

return (
<div {...props} className={clsx(props.className, styles.MobileStakerRewardDashboard)}>
<div {...props} className={clsx(props.className, styles.MobileRewardDashboard)}>
<div className={clsx(styles.Summary)}>
<div
className={clsx(styles.Content, 'cursor-pointer')}
Expand Down Expand Up @@ -106,12 +106,7 @@ function StakerRewardDashboard(props: MobileStakerRewardDashboardProps) {
<div className={clsx(styles.Gradient, isOpenClassName)} />
</div>
<div className={clsx(styles.RewardInfo, isOpenClassName)}>
<StakerRewardInfo
withOffsetForFooterButton
size='small'
className='pt-1 position-relative'
style={{ zIndex: 1 }}
/>
<RewardInfo size='small' className='pt-1 position-relative' style={{ zIndex: 1 }} />
<div className={clsx(styles.GradientOuter, isOpenClassName)} />
</div>
</div>
Expand Down

This file was deleted.

Loading

0 comments on commit c16a40f

Please sign in to comment.