diff --git a/packages/shared/src/components/ExtensionOnboarding.tsx b/packages/shared/src/components/ExtensionOnboarding.tsx index f53843fbbad..8643c51420e 100644 --- a/packages/shared/src/components/ExtensionOnboarding.tsx +++ b/packages/shared/src/components/ExtensionOnboarding.tsx @@ -12,9 +12,9 @@ const ExtensionOnboarding = (): ReactElement => { const { setCurrentPage } = useExtensionContext(); useEffect(() => { - setCurrentPage('/hijacking'); + setCurrentPage!('/hijacking'); return () => { - setCurrentPage('/'); + setCurrentPage!('/'); }; }, [setCurrentPage]); diff --git a/packages/shared/src/components/cards/brief/BriefCard/BriefCardLoading.tsx b/packages/shared/src/components/cards/brief/BriefCard/BriefCardLoading.tsx index fae434e7bd5..4414396722c 100644 --- a/packages/shared/src/components/cards/brief/BriefCard/BriefCardLoading.tsx +++ b/packages/shared/src/components/cards/brief/BriefCard/BriefCardLoading.tsx @@ -37,12 +37,12 @@ export const BriefCardLoading = ({ >
{ - const shouldShowVotes = numPollVotes > MIN_VOTES_REQUIRED || isAuthor; + const votes = numPollVotes ?? 0; + const shouldShowVotes = votes > MIN_VOTES_REQUIRED || isAuthor; const pollHasEnded = endsAt && isAfter(new Date(), new Date(endsAt)); return ( @@ -49,7 +50,7 @@ const PollMetadata = ({ {shouldShowVotes && ( <> - {largeNumberFormat(numPollVotes)}{' '} + {largeNumberFormat(votes)}{' '} {pollHasEnded ? 'total votes' : 'votes'} diff --git a/packages/shared/src/components/cards/common/RaisedLabel.tsx b/packages/shared/src/components/cards/common/RaisedLabel.tsx index 3036a6253d1..def83ac0611 100644 --- a/packages/shared/src/components/cards/common/RaisedLabel.tsx +++ b/packages/shared/src/components/cards/common/RaisedLabel.tsx @@ -56,7 +56,7 @@ export function RaisedLabel({ )} > 0} + condition={!!description} wrapper={(children) => ( {children} )} @@ -84,7 +84,7 @@ export function RaisedLabel({ )} > 0} + condition={!!description} wrapper={(children) => ( {children} )} diff --git a/packages/shared/src/components/cards/common/SourceButton.tsx b/packages/shared/src/components/cards/common/SourceButton.tsx index 81f0f909f5e..830f777f631 100644 --- a/packages/shared/src/components/cards/common/SourceButton.tsx +++ b/packages/shared/src/components/cards/common/SourceButton.tsx @@ -64,7 +64,7 @@ export default function SourceButton({ className={className} picture={{ size, rounded: 'full' }} user={{ - id: source.id, + id: source.id!, image: source.image, permalink: source.permalink, username: source.handle, @@ -86,7 +86,7 @@ export default function SourceButton({ className={className} picture={{ size, rounded: 'full' }} user={{ - id: source.id, + id: source.id!, image: source.image, permalink: source.permalink, username: source.handle, diff --git a/packages/shared/src/components/cards/common/list/PostCardHeader.tsx b/packages/shared/src/components/cards/common/list/PostCardHeader.tsx index 73d9a06c22b..fc7599e1060 100644 --- a/packages/shared/src/components/cards/common/list/PostCardHeader.tsx +++ b/packages/shared/src/components/cards/common/list/PostCardHeader.tsx @@ -113,11 +113,11 @@ export const PostCardHeader = ({ <> {showCTA && ( } - href={postLink} + href={postLink ?? ''} onClick={onReadArticleClick} openNewTab={openNewTab} /> diff --git a/packages/shared/src/components/cards/share/SharedPostPreview.tsx b/packages/shared/src/components/cards/share/SharedPostPreview.tsx index 38e79f886b7..9ca0fb77f8e 100644 --- a/packages/shared/src/components/cards/share/SharedPostPreview.tsx +++ b/packages/shared/src/components/cards/share/SharedPostPreview.tsx @@ -78,7 +78,7 @@ export function SharedPostPreview({ - {isUnknownSource ? unknownSource : source.name} + {isUnknownSource ? unknownSource : source!.name}
)} diff --git a/packages/shared/src/components/comments/PlaceholderCommentList.tsx b/packages/shared/src/components/comments/PlaceholderCommentList.tsx index cd6c94a572e..f56881fd472 100644 --- a/packages/shared/src/components/comments/PlaceholderCommentList.tsx +++ b/packages/shared/src/components/comments/PlaceholderCommentList.tsx @@ -13,8 +13,7 @@ export default function PlaceholderCommentList({ placeholderAmount, ...props }: PlaceholderCommentListProps): ReactElement { - const amount = - placeholderAmount <= MAX_DISPLAY ? placeholderAmount : MAX_DISPLAY; + const amount = Math.min(placeholderAmount ?? MAX_DISPLAY, MAX_DISPLAY); return ( <> diff --git a/packages/shared/src/components/streak/ReadingStreakButton.tsx b/packages/shared/src/components/streak/ReadingStreakButton.tsx index a957620833b..fb584a49638 100644 --- a/packages/shared/src/components/streak/ReadingStreakButton.tsx +++ b/packages/shared/src/components/streak/ReadingStreakButton.tsx @@ -57,7 +57,7 @@ function CustomStreaksTooltip({ className: 'border border-border-subtlest-tertiary rounded-16', }} content={} - onClickOutside={() => setShouldShowStreaks(false)} + onClickOutside={() => setShouldShowStreaks!(false)} > {children} @@ -70,7 +70,7 @@ export function ReadingStreakButton({ compact, iconPosition, className, -}: ReadingStreakButtonProps): ReactElement { +}: ReadingStreakButtonProps): ReactElement | null { const { logEvent } = useLogContext(); const { user } = useAuthContext(); const isLaptop = useViewSize(ViewSize.Laptop); @@ -78,7 +78,7 @@ export function ReadingStreakButton({ const [shouldShowStreaks, setShouldShowStreaks] = useState(false); const hasReadToday = streak?.lastViewAt && - isSameDayInTimezone(new Date(streak.lastViewAt), new Date(), user.timezone); + isSameDayInTimezone(new Date(streak.lastViewAt), new Date(), user!.timezone); const isTimezoneOk = useStreakTimezoneOk(); const handleToggle = useCallback(() => {