Skip to content

Commit 633bf29

Browse files
authored
Merge pull request #278 from medyo/develop
Fix Rss card display
2 parents a064408 + cec4600 commit 633bf29

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

src/assets/App.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ a {
116116

117117
.Cards > * {
118118
flex: 0 0 calc((100% - ((var(--visible-cards)) * var(--cards-gap))) / var(--visible-cards));
119+
min-width: 0;
119120
}
120121

121122
.HorizontalScroll {
@@ -535,6 +536,8 @@ a {
535536
text-decoration: none;
536537
display: flex;
537538
flex-direction: row;
539+
word-break: break-word;
540+
overflow-wrap: anywhere;
538541
}
539542

540543
.rowTitle:hover {

src/components/Elements/Card/Card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import clsx from 'clsx'
22
import React, { useEffect, useState } from 'react'
33
import { AdvBanner } from 'src/features/adv'
4+
import { useAuth } from 'src/features/auth'
45
import { DesktopBreakpoint } from 'src/providers/DesktopBreakpoint'
56
import { MobileBreakpoint } from 'src/providers/MobileBreakpoint'
67
import { CardPropsType } from 'src/types'
@@ -27,6 +28,7 @@ export const Card = React.forwardRef<HTMLDivElement, RootCardProps>(
2728
) => {
2829
const { icon, label, badge } = meta
2930
const [canAdsLoad, setCanAdsLoad] = useState(true)
31+
const { user } = useAuth()
3032

3133
useEffect(() => {
3234
if (!withAds) {
@@ -65,7 +67,7 @@ export const Card = React.forwardRef<HTMLDivElement, RootCardProps>(
6567
{badge && <span className="blockHeaderBadge">{badge}</span>}
6668
</div>
6769

68-
{canAdsLoad && withAds && (
70+
{canAdsLoad && withAds && !user?.isSupporter && (
6971
<div className="ad-wrapper blockRow">
7072
<AdvBanner />
7173
</div>

src/features/auth/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export type User = {
44
connectedAt?: string
55
imageURL?: string
66
streak?: number
7+
isSupporter?: boolean
78
}

src/providers/AuthProvider.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,24 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
3838
: GithubAuthProvider.credential(token)
3939

4040
return signInWithCredential(firebaseAuth, authProvider)
41-
.then((userCredential) => {
41+
.then(async (userCredential) => {
4242
const user = userCredential.user
4343

44+
let isSupporter = false
45+
try {
46+
const idToken = await user.getIdTokenResult()
47+
isSupporter = Boolean(idToken.claims?.['supporter'])
48+
} catch (e) {
49+
console.error('Failed to fetch ID token', e)
50+
}
51+
4452
initState({
4553
user: {
4654
id: user.uid,
4755
connectedAt: new Date().toISOString(),
4856
name: user.displayName || 'Anonymous',
4957
imageURL: user.photoURL || '',
58+
isSupporter: isSupporter,
5059
},
5160
providerId: authProvider.providerId,
5261
})

0 commit comments

Comments
 (0)