MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / Intro

Function Intro

client/src/components/Intro/index.tsx:24–96  ·  view source on GitHub ↗
({
  isSignedIn,
  name,
  pending,
  complete,
  completedChallengeCount,
  slug,
  onLearnDonationAlertClick,
  isDonating
}: IntroProps)

Source from the content-addressed store, hash-verified

22}
23
24const Intro = ({
25 isSignedIn,
26 name,
27 pending,
28 complete,
29 completedChallengeCount,
30 slug,
31 onLearnDonationAlertClick,
32 isDonating
33}: IntroProps): JSX.Element => {
34 const { t } = useTranslation();
35 if (pending && !complete) {
36 return (
37 <>
38 <Spacer size='m' />
39 <Loader />
40 <Spacer size='m' />
41 </>
42 );
43 } else if (isSignedIn) {
44 const { quote, author } = randomQuote();
45 return (
46 <>
47 <Spacer size='m' />
48 <h1 id='content-start' className='text-center'>
49 {name
50 ? `${t('learn.welcome-1', { name: name })}`
51 : `${t('learn.welcome-2')}`}
52 </h1>
53 <Spacer size='m' />
54 <div className='text-center quote-partial'>
55 <blockquote className='blockquote' data-testid='quote-block'>
56 <span>
57 <q data-playwright-test-label='random-quote'>{quote}</q>
58 <footer className='quote-author'>
59 <cite data-playwright-test-label='random-author'>{author}</cite>
60 </footer>
61 </span>
62 </blockquote>
63 </div>
64 <LearnAlert
65 onLearnDonationAlertClick={onLearnDonationAlertClick}
66 isDonating={isDonating}
67 />
68 <EmailSignUpAlert />
69 {completedChallengeCount && slug && completedChallengeCount < 15 ? (
70 <div className='intro-description'>
71 <Spacer size='m' />
72 <p>
73 <Trans i18nKey='learn.start-at-beginning'>
74 <Link to={slug} />
75 </Trans>
76 </p>
77 </div>
78 ) : (
79 ''
80 )}
81 </>

Callers

nothing calls this directly

Calls 2

useTranslationFunction · 0.90
randomQuoteFunction · 0.90

Tested by

no test coverage detected