MCPcopy Create free account
hub / github.com/dailydotdev/apps / PlusInfo

Function PlusInfo

packages/shared/src/components/plus/PlusInfo.tsx:131–323  ·  view source on GitHub ↗
({
  productOptions,
  selectedOption,
  onChange,
  onContinue,
  shouldShowPlusHeader = true,
  showPlusList = true,
  showDailyDevLogo = false,
  showGiftButton = true,
  showTrustReviews = true,
  title,
  description,
  subtitle,
  continueEnabled = true,
  isContinueLoading = false,
}: PlusInfoProps & CommonPlusPageProps)

Source from the content-addressed store, hash-verified

129};
130
131export const PlusInfo = ({
132 productOptions,
133 selectedOption,
134 onChange,
135 onContinue,
136 shouldShowPlusHeader = true,
137 showPlusList = true,
138 showDailyDevLogo = false,
139 showGiftButton = true,
140 showTrustReviews = true,
141 title,
142 description,
143 subtitle,
144 continueEnabled = true,
145 isContinueLoading = false,
146}: PlusInfoProps & CommonPlusPageProps): ReactElement => {
147 const router = useRouter();
148 const { giftOneYear, isOrganization, checkoutItemsLoading } =
149 usePaymentContext();
150 const { openModal } = useLazyModal();
151 const { logSubscriptionEvent } = usePlusSubscription();
152 const { giftToUser } = useGiftUserContext();
153
154 const [itemQuantity, setItemQuantity] = useState<number>(1);
155
156 const plusType = getPlusType({
157 isGift: !!giftToUser,
158 isOrganization,
159 });
160 const defaultCopy = plusInfoCopyApi[plusType];
161 const titleCopy = title || defaultCopy.title;
162 const descriptionCopy = description || defaultCopy.description;
163 const subtitleCopy = subtitle || defaultCopy.subtitle;
164
165 const isOnboarding = router.pathname.startsWith('/onboarding');
166 const showBuyAsAGiftButton =
167 !giftToUser && showGiftButton && !!giftOneYear && !isOnboarding;
168 let plusListContent: ReactElement;
169 if (isOrganization) {
170 plusListContent = <PlusList items={plusOrganizationFeatureList} />;
171 } else if (plusType === PlusType.Self) {
172 plusListContent = <PlusList items={plusFeatureListApiFirst} />;
173 } else {
174 plusListContent = <PlusList />;
175 }
176
177 return (
178 <>
179 {shouldShowPlusHeader && (
180 <div className="mb-6 flex items-center">
181 {showDailyDevLogo && <Logo logoClassName={{ container: 'h-5' }} />}
182 </div>
183 )}
184 <Typography
185 tag={TypographyTag.H1}
186 color={TypographyColor.Primary}
187 type={TypographyType.LargeTitle}
188 className="mb-2"

Callers

nothing calls this directly

Calls 9

usePaymentContextFunction · 0.90
useLazyModalFunction · 0.90
usePlusSubscriptionFunction · 0.90
useGiftUserContextFunction · 0.90
isIOSNativeFunction · 0.90
getPlusTypeFunction · 0.85
pushMethod · 0.80
useRouterFunction · 0.50
onChangeFunction · 0.50

Tested by

no test coverage detected