Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/shared/src/components/ExtensionOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const ExtensionOnboarding = (): ReactElement => {
const { setCurrentPage } = useExtensionContext();

useEffect(() => {
setCurrentPage('/hijacking');
setCurrentPage!('/hijacking');
return () => {
setCurrentPage('/');
setCurrentPage!('/');
};
}, [setCurrentPage]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ export const BriefCardLoading = ({
>
<LottieAnimation
className="float-animation -mb-6 h-20 w-20"
src={animationSrc}
src={animationSrc ?? ''}
/>
<div className="w-20">
<ProgressBar
shouldShowBg
percentage={progressPercentage}
percentage={progressPercentage ?? 0}
className={{
wrapper: 'rounded-12 bg-border-subtlest-tertiary',
bar: 'h-1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const CollectionCardHeader = ({
highlightBookmarkedPost && headerHiddenClassName,
),
}}
sources={sources}
totalSources={totalSources}
sources={sources ?? []}
totalSources={totalSources ?? 0}
>
<div className="flex-1" />
<PostOptionButton
Expand Down
5 changes: 3 additions & 2 deletions packages/shared/src/components/cards/common/PollMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const PollMetadata = ({
isAuthor,
numPollVotes,
}: PollMetadataProps) => {
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 (
Expand Down Expand Up @@ -49,7 +50,7 @@ const PollMetadata = ({
{shouldShowVotes && (
<>
<Typography tag={TypographyTag.Span} type={TypographyType.Footnote}>
{largeNumberFormat(numPollVotes)}{' '}
{largeNumberFormat(votes)}{' '}
{pollHasEnded ? 'total votes' : 'votes'}
</Typography>
<Separator />
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/components/cards/common/RaisedLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function RaisedLabel({
)}
>
<ConditionalWrapper
condition={description?.length > 0}
condition={!!description}
wrapper={(children) => (
<Tooltip content={description}>{children}</Tooltip>
)}
Expand Down Expand Up @@ -84,7 +84,7 @@ export function RaisedLabel({
)}
>
<ConditionalWrapper
condition={description?.length > 0}
condition={!!description}
wrapper={(children) => (
<Tooltip content={description}>{children}</Tooltip>
)}
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/src/components/cards/common/SourceButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export const PostCardHeader = ({
<>
{showCTA && (
<ReadArticleButton
content={readButtonContent ?? postButtonText}
content={readButtonContent ?? postButtonText ?? ''}
className="mr-2"
variant={ButtonVariant.Tertiary}
icon={readButtonIcon ?? <OpenLinkIcon />}
href={postLink}
href={postLink ?? ''}
onClick={onReadArticleClick}
openNewTab={openNewTab}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function SharedPostPreview({
<SourceAvatar
source={{
image: sourceImage,
handle: isUnknownSource ? unknownSource : source.handle,
handle: isUnknownSource ? unknownSource : source!.handle,
}}
size={ProfileImageSize.Size16}
className="shrink-0"
Expand All @@ -89,7 +89,7 @@ export function SharedPostPreview({
color={TypographyColor.Primary}
className="truncate font-bold"
>
{isUnknownSource ? unknownSource : source.name}
{isUnknownSource ? unknownSource : source!.name}
</Typography>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/src/components/streak/ReadingStreakButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function CustomStreaksTooltip({
className: 'border border-border-subtlest-tertiary rounded-16',
}}
content={<ReadingStreakPopup streak={streak} />}
onClickOutside={() => setShouldShowStreaks(false)}
onClickOutside={() => setShouldShowStreaks!(false)}
>
{children}
</SimpleTooltip>
Expand All @@ -70,15 +70,15 @@ export function ReadingStreakButton({
compact,
iconPosition,
className,
}: ReadingStreakButtonProps): ReactElement {
}: ReadingStreakButtonProps): ReactElement | null {
const { logEvent } = useLogContext();
const { user } = useAuthContext();
const isLaptop = useViewSize(ViewSize.Laptop);
const isMobile = useViewSize(ViewSize.MobileL);
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(() => {
Expand Down
Loading