-
Notifications
You must be signed in to change notification settings - Fork 292
Expand file tree
/
Copy pathCustomFeedEmptyScreen.tsx
More file actions
130 lines (128 loc) · 4.65 KB
/
CustomFeedEmptyScreen.tsx
File metadata and controls
130 lines (128 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import type { Dispatch, ReactElement, SetStateAction } from 'react';
import React from 'react';
import { EmptyScreenIcon } from './EmptyScreen';
import { DevPlusIcon, HashtagIcon } from './icons';
import { PageContainer, SharedFeedPage } from './utilities';
import { ButtonSize, ButtonVariant } from './buttons/common';
import { plusUrl } from '../lib/constants';
import {
DEFAULT_ALGORITHM_INDEX,
DEFAULT_ALGORITHM_KEY,
SearchControlHeader,
} from './layout/common';
import usePersistentContext from '../hooks/usePersistentContext';
import {
Typography,
TypographyColor,
TypographyTag,
TypographyType,
} from './typography/Typography';
import { LogEvent, TargetId } from '../lib/log';
import { Button } from './buttons/Button';
import { useConditionalFeature, usePlusSubscription } from '../hooks';
import { IconSize } from './Icon';
import { featurePlusApiLanding } from '../lib/featureManagement';
import Link from './utilities/Link';
export const CustomFeedEmptyScreen = (): ReactElement => {
const { logSubscriptionEvent, isPlus } = usePlusSubscription();
const { value: isApiLanding } = useConditionalFeature({
feature: featurePlusApiLanding,
shouldEvaluate: !isPlus,
});
const plusCta = isApiLanding ? 'Get API Access' : 'Level Up with Plus';
const [selectedAlgo, setSelectedAlgo] = usePersistentContext(
DEFAULT_ALGORITHM_KEY,
DEFAULT_ALGORITHM_INDEX,
[0, 1],
DEFAULT_ALGORITHM_INDEX,
);
const setSelectedAlgoState: Dispatch<SetStateAction<number>> = (value) => {
const nextValue = typeof value === 'function' ? value(selectedAlgo) : value;
return setSelectedAlgo(nextValue);
};
const algoState: [number, Dispatch<SetStateAction<number>>] = [
selectedAlgo,
setSelectedAlgoState,
];
return (
<div className="flex w-full flex-col">
<div className="mr-auto mt-0 flex gap-3 tablet:mr-0 tablet:mt-2 laptop:mr-auto laptop:w-auto">
<SearchControlHeader
algoState={algoState}
feedName={SharedFeedPage.Custom}
/>
</div>
<PageContainer className="mx-auto">
<div className="mt-16 flex max-h-full w-full max-w-screen-tablet flex-col items-center justify-center gap-4 px-6 text-center">
<HashtagIcon
className={EmptyScreenIcon.className}
style={EmptyScreenIcon.style}
/>
{!isPlus ? (
<>
<Typography
tag={TypographyTag.Span}
type={TypographyType.Caption1}
className="flex gap-0.5 rounded-4 bg-action-plus-float p-0.5 pr-1"
color={TypographyColor.Plus}
>
<DevPlusIcon size={IconSize.Size16} /> Plus
</Typography>
<Typography
type={TypographyType.Title1}
color={TypographyColor.Primary}
bold
>
Custom feeds got a massive upgrade!
</Typography>
<Typography
type={TypographyType.Callout}
color={TypographyColor.Tertiary}
>
{`Custom Feeds is now more powerful than ever before, with
advanced filters, extensive customization options, and complete
feed control. Upgrade to Plus to unlock this ultimate tool for
tailoring your content.`}
</Typography>
<Link href={plusUrl} passHref>
<Button
className="mt-10"
tag="a"
type="button"
variant={ButtonVariant.Primary}
size={ButtonSize.Medium}
icon={<DevPlusIcon className="text-action-plus-default" />}
onClick={() => {
logSubscriptionEvent({
event_name: LogEvent.UpgradeSubscription,
target_id: TargetId.CustomFeed,
});
}}
>
{plusCta}
</Button>
</Link>
</>
) : (
<>
<Typography
type={TypographyType.Title1}
color={TypographyColor.Primary}
bold
>
Your feed filters are too specific.
</Typography>
<Typography
type={TypographyType.Callout}
color={TypographyColor.Tertiary}
>
We couldn't fetch enough posts based on your selected tags.
Try adding more tags using the feed settings.
</Typography>
</>
)}
</div>
</PageContainer>
</div>
);
};