Skip to content

Commit

Permalink
feat(membership): show special messages to paid and lifetime members
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjavi committed Sep 2, 2024
1 parent 18b5488 commit 1ddb4ca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"christian-kohler.path-intellisense",
"eliostruyf.vscode-front-matter"
"christian-kohler.path-intellisense"
],
"unwantedRecommendations": ["eamodio.gitlens"]
}
31 changes: 24 additions & 7 deletions src/features/users/views/PatreonMembership.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,34 @@ export function PatreonMembership(): JSX.Element | null {
const hasLinkedPatreon = membership.patreonUserId !== null
const _expirationDate = membership.expiresAt ? new Date(membership.expiresAt) : null
const isPaidMember = membership.isSubscriptionTier
const isLifetime = membership.expiresAt === null && membership.patronStatus === 'gift_patron'
const isMember = isPaidMember || isLifetime
const patreonTierName = isPaidMember ? (
`Patreon - ${patreonTiers[membership.currentTier].name}`
) : (
<span style={{ color: '#aaa' }}>(none)</span>
)
const tierTitle = isLifetime ? 'Lifetime Membership' : patreonTierName
const perksTitle = isMember ? 'Unlocked Perks' : 'Account Limits'

return (
<UserRestrictedArea>
<p>
<b>Patreon Membership: </b>
<code style={{ color: 'var(--color-blueberry-accent)' }}>{patreonTiers[membership.currentTier].name}</code>
{isPaidMember && (
<b>Membership: </b>
<code style={{ color: 'var(--color-blueberry-accent)' }}>{tierTitle}</code>
{isMember && (
<i
className="icon-pkg-shiny"
className={isPaidMember ? 'icon-pkg-shiny' : 'icon-pkg-ribbon'}
style={{
color: 'orange',
color: isPaidMember ? 'orange' : 'cyan',
fontSize: '1.2rem',
marginLeft: '0.2rem',
}}
/>
)}
</p>
<p>
<b>Entitled Rewards: </b>
<b>{perksTitle}: </b>
<code style={{ color: 'var(--color-blueberry-accent)' }}>
{membership.rewardMaxDexes} dexes
{membership.rewardFeaturedStreamer ? ', featured streamer' : ''}
Expand Down Expand Up @@ -85,7 +94,15 @@ export function PatreonMembership(): JSX.Element | null {
</>
)}
<small style={{ fontStyle: 'italic', color: 'rgba(255,255,255,0.6)' }}>
Link your Patreon account and become a patron to unlock extras in the website and Discord.
{!isMember && (
<>
Link your Patreon account and subscribe to one of our plans to unlock extras in the website (e.g. more
dexes, early access to new features, etc.), and in Discord (special role and channel access).
<br />
<br />
</>
)}
By linking your account, you will also be able to login to the website via Patreon.
</small>
</>
)}
Expand Down

1 comment on commit 1ddb4ca

@vercel
Copy link

@vercel vercel bot commented on 1ddb4ca Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.