repo
stringlengths
7
64
file_url
stringlengths
81
338
file_path
stringlengths
5
257
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:25:31
2026-01-05 01:50:38
truncated
bool
2 classes
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/profile/components/camper.tsx
client/src/components/profile/components/camper.tsx
import React from 'react'; import { useTranslation } from 'react-i18next'; import { Spacer } from '@freecodecamp/ui'; import type { User } from '../../../redux/prop-types'; import { FullWidthRow } from '../../helpers'; import './camper.css'; import SupporterBadgeEmblem from '../../../assets/icons/supporter-badge-emblem...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/profile/components/utils/certification.ts
client/src/components/profile/components/utils/certification.ts
import { Certification } from '../../../../../../shared-dist/config/certification-settings'; import { User } from '../../../../redux/prop-types'; export const getCertifications = (user: User) => { const { isA2EnglishCert, isB1EnglishCert, isRespWebDesignCert, isRespWebDesignCertV9, is2018DataVisC...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/profile/components/utils/utils.ts
client/src/components/profile/components/utils/utils.ts
import type { TFunction } from 'i18next'; import { getLangCode } from '../../../../../../shared-dist/config/i18n'; import envData from '../../../../../config/env.json'; const { clientLocale } = envData; const localeCode = getLangCode(clientLocale); const parseDate = (joinDate: string, t: TFunction): string => { con...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/profile/components/utils/index.ts
client/src/components/profile/components/utils/index.ts
export { parseDate } from './utils';
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/layouts/default.tsx
client/src/components/layouts/default.tsx
import React, { ReactNode, useEffect } from 'react'; import Helmet from 'react-helmet'; import { useTranslation, withTranslation } from 'react-i18next'; import { useMediaQuery } from 'react-responsive'; import { connect } from 'react-redux'; import { bindActionCreators, Dispatch } from 'redux'; import { createSelector ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/layouts/learn.tsx
client/src/components/layouts/learn.tsx
import React, { useEffect } from 'react'; import { Helmet } from 'react-helmet'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { Loader } from '../../components/helpers'; import { tryToShowDonationModal } from '../../redux/actions'; import { userFetchStateSelector } from '../....
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/layouts/certification.tsx
client/src/components/layouts/certification.tsx
import React, { Component } from 'react'; import Helmet from 'react-helmet'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { fetchUser } from '../../redux/actions'; import { isSignedInSelector } from '../../redux/selectors'; interface CertificationProps { children?: React....
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Intro/learn-alert.tsx
client/src/components/Intro/learn-alert.tsx
import React from 'react'; import { Spacer } from '@freecodecamp/ui'; import { useFeature } from '@growthbook/growthbook-react'; import { useTranslation } from 'react-i18next'; import { Link } from '../helpers'; import { ProgressBar } from '../Progress/progress-bar'; import './learn-alert.css'; interface LearnAlertPr...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Intro/intro.test.tsx
client/src/components/Intro/intro.test.tsx
import React from 'react'; import { Provider } from 'react-redux'; import { render, screen } from '@testing-library/react'; import { describe, expect, it, vi } from 'vitest'; import { createStore } from '../../redux/create-store'; import Intro from '.'; vi.mock('../../analytics'); vi.mock('@growthbook/growthbook-reac...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Intro/index.tsx
client/src/components/Intro/index.tsx
import React from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { Spacer } from '@freecodecamp/ui'; import { randomQuote } from '../../utils/get-words'; import Login from '../Header/components/login'; import { Link, Loader } from '../helpers'; import './intro.css'; import EmailSignUpAlert from...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Intro/email-sign-up-alert.tsx
client/src/components/Intro/email-sign-up-alert.tsx
import React from 'react'; import { connect } from 'react-redux'; import { Container } from '@freecodecamp/ui'; import EmailOptions from '../email-options'; import { updateMyQuincyEmail } from '../../redux/settings/actions'; import { userSelector, isSignedInSelector } from '../../redux/selectors'; import { CompletedCha...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/formHelpers/form-validators.test.ts
client/src/components/formHelpers/form-validators.test.ts
import { describe, test, expect } from 'vitest'; import { editorValidator, fCCValidator, localhostValidator, httpValidator, pathValidator } from './form-validators'; describe('Form validators', () => { test('editorValidator', () => { const editorAddresses = [ 'repl.it/@username', 'repl.it/j...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/formHelpers/form.tsx
client/src/components/formHelpers/form.tsx
import React, { FormEvent } from 'react'; import { Form } from 'react-final-form'; import normalizeUrl from 'normalize-url'; import BlockSaveButton from '../helpers/form/block-save-button'; import { localhostValidator, editorValidator, composeValidators, fCCValidator, httpValidator, sourceCodeLinkExistsVal...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/formHelpers/form-fields.tsx
client/src/components/formHelpers/form-fields.tsx
import { FormControl, FormGroup, ControlLabel, Alert, HelpBlock } from '@freecodecamp/ui'; import normalizeUrl from 'normalize-url'; import React from 'react'; import { Field } from 'react-final-form'; import { editorValidator, localhostValidator, composeValidators, fCCValidator, httpValidator, pa...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/formHelpers/form-ip-utils.ts
client/src/components/formHelpers/form-ip-utils.ts
/* This software is licensed under the MIT License. Copyright Fedor Indutny, 2012. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/formHelpers/form.test.tsx
client/src/components/formHelpers/form.test.tsx
import { describe, test, expect, vi } from 'vitest'; import { render, fireEvent, screen } from '@testing-library/react'; import React from 'react'; import { StrictSolutionForm, StrictSolutionFormProps } from './form'; const defaultTestProps: StrictSolutionFormProps = { buttonText: 'Submit', formFields: [ { na...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/formHelpers/form-validators.tsx
client/src/components/formHelpers/form-validators.tsx
import React from 'react'; import { Trans } from 'react-i18next'; import { isPrivate } from './form-ip-utils'; // Matches editor links for: Replit, Glitch, CodeSandbox, GitHub. NOT Codespaces, and NOT Gitpod/Ona yet // Once safari allows negative lookbehinds, this can be used: // |(?<!\.app)\.github\.dev const editorR...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Progress/progress.tsx
client/src/components/Progress/progress.tsx
import React, { useEffect } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { createSelector } from 'reselect'; import { TFunction } from 'i18next'; import { withTranslation } from 'react-i18next'; import { useStaticQuery, graphql } from 'gatsby'; import { challengeMetaSelector, current...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Progress/index.tsx
client/src/components/Progress/index.tsx
export { default } from './progress';
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Progress/progress-inner.tsx
client/src/components/Progress/progress-inner.tsx
import React, { useState, useEffect, useRef, useMemo } from 'react'; import BezierEasing from 'bezier-easing'; import { ProgressBar } from './progress-bar'; interface ProgressInnerProps { completedPercent: number; title: string; meta: string; } const easing = BezierEasing(0.2, 0.5, 0.4, 1); const intervalLengt...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Progress/progress-bar.tsx
client/src/components/Progress/progress-bar.tsx
import React from 'react'; export function ProgressBar({ now }: { now: number }) { return ( <> <div className='progress-bar-background'></div> <div className='progress-bar-percent' data-testid='fcc-progress-bar-percent' style={{ width: `${now}%` }} ></div> </> ); }...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Flash/index.tsx
client/src/components/Flash/index.tsx
import { Alert, CloseButton, type AlertProps } from '@freecodecamp/ui'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { TransitionGroup, CSSTransition } from 'react-transition-group'; import { FlashState } from '../../redux/types'; import { removeFlashMessage } from './redux'; impor...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Flash/redux/flash-messages.ts
client/src/components/Flash/redux/flash-messages.ts
export enum FlashMessages { AccountDeleted = 'flash.account-deleted', AddNameSuccess = 'flash.add-name', AlreadyClaimed = 'flash.already-claimed', CertClaimSuccess = 'flash.cert-claim-success', CertificateMissing = 'flash.certificate-missing', CertsPrivate = 'flash.certs-private', CertsClaimable = 'flash....
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Flash/redux/index.ts
client/src/components/Flash/redux/index.ts
import { nanoid } from 'nanoid'; import { FlashState, State, FlashApp, FlashMessageArg, LocalStorageThemes } from '../../../redux/types'; import { playTone } from '../../../utils/tone'; import { FlashMessages } from './flash-messages'; export const flashMessageSelector = (state: State): FlashState['message'...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/with-instant-search.tsx
client/src/components/search/with-instant-search.tsx
import { Location } from '@gatsbyjs/reach-router'; import type { WindowLocation } from '@gatsbyjs/reach-router'; import type { SearchOptions } from 'instantsearch.js'; import algoliasearch, { type SearchClient } from 'algoliasearch/lite'; import React, { useEffect, useRef } from 'react'; import type { ReactNode } from ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/search-bar-optimized.tsx
client/src/components/search/searchBar/search-bar-optimized.tsx
import React, { useState, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import Magnifier from '../../../assets/icons/magnifier'; import InputReset from '../../../assets/icons/input-reset'; import { searchPageUrl } from '../../../utils/algolia-locale-setup'; const SearchBarOptimized = ({ inne...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/search-bar-footer.tsx
client/src/components/search/searchBar/search-bar-footer.tsx
import React from 'react'; import { useTranslation } from 'react-i18next'; import { searchPageUrl } from '../../../utils/algolia-locale-setup'; import NoHitsSuggestion from './no-hits-suggestion'; interface SearchBarFooterProps { hasHits: boolean; query?: string; isSelected: boolean; onMouseEnter: (e: React.Sy...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/search-suggestion.tsx
client/src/components/search/searchBar/search-suggestion.tsx
import React from 'react'; import { Highlight } from 'react-instantsearch'; import type { Hit } from './types'; interface SuggestionProps { hit: Hit; handleMouseEnter: (e: React.SyntheticEvent<HTMLElement, Event>) => void; handleMouseLeave: (e: React.SyntheticEvent<HTMLElement, Event>) => void; } const Suggesti...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/search-bar.tsx
client/src/components/search/searchBar/search-bar.tsx
import { isEqual } from 'lodash-es'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { HotKeys, ObserveKeys } from 'react-hotkeys'; import { useTranslation, withTranslation } from 'react-i18next'; import { SearchBox } from 'react-instantsearch'; import { connect } from 'react-redux'; imp...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/search-hits.tsx
client/src/components/search/searchBar/search-hits.tsx
import { isEmpty } from 'lodash-es'; import React, { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { useHits } from 'react-instantsearch'; import Suggestion from './search-suggestion'; import type { Hit } from './types'; import SearchBarFooter from './search-bar-footer'; interface Se...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/search-bar.test.tsx
client/src/components/search/searchBar/search-bar.test.tsx
import React from 'react'; import ShallowRenderer from 'react-test-renderer/shallow'; import { describe, it, expect, vi } from 'vitest'; import { SearchBar } from './search-bar'; describe('<SearchBar />', () => { it('renders to the DOM', () => { const utils = ShallowRenderer.createRenderer(); utils.render(<...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/types.ts
client/src/components/search/searchBar/types.ts
import type { Hit as InstantSearchHit } from 'instantsearch.js'; export interface Hit extends InstantSearchHit { url: string; title?: string; }
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/search/searchBar/no-hits-suggestion.tsx
client/src/components/search/searchBar/no-hits-suggestion.tsx
import React from 'react'; interface NoHitsSuggestionProps { title: string; } const NoHitsSuggestion = ({ title }: NoHitsSuggestionProps): JSX.Element => { return ( <li className='ais-Hits-item'> <div className={'no-hits-footer fcc_suggestion_item'} role='region'> <span className='hit-name'>{tit...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/daily-coding-challenge/widget.tsx
client/src/components/daily-coding-challenge/widget.tsx
import React from 'react'; import { useTranslation } from 'react-i18next'; import { Spacer } from '@freecodecamp/ui'; import { ButtonLink } from '../helpers'; import DailyCodingChallengeIcon from '../../assets/icons/daily-coding-challenge'; import LinkButton from '../../assets/icons/link-button'; import CalendarIcon f...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/daily-coding-challenge/helpers.ts
client/src/components/daily-coding-challenge/helpers.ts
import { parse, isValid, format } from 'date-fns'; import { toZonedTime } from 'date-fns-tz'; interface formatDateProps { month: number; day: number; year: number; } // Format month, day, and year as "YYYY-MM-DD" with leading zeros export function formatDate({ year, month, day }: formatDateProps) { return `${...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/daily-coding-challenge/not-found.tsx
client/src/components/daily-coding-challenge/not-found.tsx
import React from 'react'; import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; import { Button, Container, Col, Row, Spacer } from '@freecodecamp/ui'; import { randomQuote } from '../../utils/get-words'; import { Link } from '../helpers'; import notFoundLogo from '../../assets/images/free...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/daily-coding-challenge/calendar-day.tsx
client/src/components/daily-coding-challenge/calendar-day.tsx
import React from 'react'; import { useTranslation } from 'react-i18next'; import { Spacer } from '@freecodecamp/ui'; import { Link } from '../helpers'; import GreenPass from '../../assets/icons/green-pass'; import GreenNotCompleted from '../../assets/icons/green-not-completed'; import JavaScriptIcon from '../../assets...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/daily-coding-challenge/calendar.tsx
client/src/components/daily-coding-challenge/calendar.tsx
import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import { useTranslation } from 'react-i18next'; import { Button, Callout, Container, Col, Row, Spacer } from '@freecodecamp/ui'; import { completedDailyCodingChallengesSelector, isSignedInSelector } from '../../redux/selector...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/OfflineWarning/offline-warning.tsx
client/src/components/OfflineWarning/offline-warning.tsx
import React from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { Alert, Spacer } from '@freecodecamp/ui'; import './offline-warning.css'; const delayInMilliSeconds = 5000; let id: ReturnType<typeof setTimeout>; interface OfflineWarningProps { isOnline: boolean; isServerOnline: boolean; ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/OfflineWarning/index.tsx
client/src/components/OfflineWarning/index.tsx
export { default } from './offline-warning';
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/OfflineWarning/offline-warning.test.tsx
client/src/components/OfflineWarning/offline-warning.test.tsx
import React from 'react'; import { render, act, screen } from '@testing-library/react'; import { describe, it, expect, vi } from 'vitest'; import OfflineWarning from './offline-warning'; vi.useFakeTimers(); describe('<OfflineWarning />', () => { it('renders null when isOnline, isServerOnline and isSignedIn are tr...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/index.tsx
client/src/components/Header/index.tsx
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/unbound-method */ import React from 'react'; import { ConnectedProps, connect } from 'react-redux'; import {...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/header.test.tsx
client/src/components/Header/header.test.tsx
import React from 'react'; import { create, ReactTestRendererJSON } from 'react-test-renderer'; import { describe, expect, it, vi } from 'vitest'; import AuthOrProfile from './components/auth-or-profile'; const defaultUserProps = { user: { username: 'test-user', picture: 'https://freecodecamp.org/image.png',...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/menu-button.tsx
client/src/components/Header/components/menu-button.tsx
import React, { RefObject } from 'react'; import { useTranslation } from 'react-i18next'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBars } from '@fortawesome/free-solid-svg-icons'; interface MenuButtonProps { className?: string; displayMenu?: boolean; innerRef?: RefObject<HTMLB...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/exam-nav.tsx
client/src/components/Header/components/exam-nav.tsx
import React from 'react'; import { useTranslation } from 'react-i18next'; import FreeCodeCampLogo from '../../../assets/icons/freecodecamp-logo'; import MicrosoftLogo from '../../../assets/icons/microsoft-logo'; import './exam-nav.css'; const ExamNav = (): JSX.Element => { const { t } = useTranslation(); return...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/universal-nav.tsx
client/src/components/Header/components/universal-nav.tsx
import Loadable from '@loadable/component'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { useMediaQuery } from 'react-responsive'; import { isLanding } from '../../../utils/path-parsers'; import { Link, SkeletonSprite } from '../../helpers'; import { SEARCH_EXPOSED_WIDTH } from '.....
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/nav-links.tsx
client/src/components/Header/components/nav-links.tsx
import { faCheckSquare, faSquare, faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; import { useTranslation, withTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { createSelect...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/language-list.tsx
client/src/components/Header/components/language-list.tsx
import React, { useState, useRef, useEffect } from 'react'; import type { TFunction } from 'i18next'; import { connect } from 'react-redux'; import { withTranslation } from 'react-i18next'; import { clientLocale } from '../../../../config/env.json'; import { availableLangs, LangNames, LangCodes, hiddenLangs } f...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/auth-or-profile.tsx
client/src/components/Header/components/auth-or-profile.tsx
import React from 'react'; import { useTranslation } from 'react-i18next'; import { Link, AvatarRenderer } from '../../helpers'; import Login from './login'; interface AuthOrProfileProps { user?: { isDonating: boolean; username: string; picture: string; yearsTopContributor: string[]; }; } const Aut...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Header/components/login.tsx
client/src/components/Header/components/login.tsx
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faRightToBracket } from '@fortawesome/free-solid-svg-icons'; import React, { ReactNode } from 'react'; import { useTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import envD...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/Map/index.tsx
client/src/components/Map/index.tsx
import i18next from 'i18next'; import React, { Fragment } from 'react'; import { Spacer } from '@freecodecamp/ui'; import { useTranslation, Trans } from 'react-i18next'; import { type SuperBlocks, SuperBlockStage, getStageOrder, superBlockStages, archivedSuperBlocks } from '../../../../shared-dist/config/cur...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/FourOhFour/index.tsx
client/src/components/FourOhFour/index.tsx
import { RouteComponentProps } from '@gatsbyjs/reach-router'; import React from 'react'; import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; import { Spacer } from '@freecodecamp/ui'; import notFoundLogo from '../../assets/images/freeCodeCamp-404.svg'; import { randomQuote } from '../../...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/math-jax.ts
client/src/utils/math-jax.ts
import { SuperBlocks } from '../../../shared-dist/config/curriculum'; import { scriptLoader } from './script-loaders'; export const mathJaxSrc = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML'; export const isMathJaxAllowed = (pathname: string) => superBlocksWithMathJax.some(...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/get-completion-percentage.ts
client/src/utils/get-completion-percentage.ts
import { AllChallengesInfo } from '../redux/prop-types'; import { isProjectBased } from './curriculum-layout'; export function getCompletedPercentage( completedChallengesIds: string[] = [], currentBlockIds: string[] = [], currentChallengeId: string ): number { const completedChallengesInBlock = getCompletedCha...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/handled-error.test.ts
client/src/utils/handled-error.test.ts
import { describe, it, expect } from 'vitest'; import { isObject } from 'lodash-es'; import { isHandledError, wrapHandledError, unwrapHandledError, handledErrorSymbol } from './handled-error'; import type { HandledError } from './handled-error'; describe('client/src utilities', () => { describe('handled-err...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/create-types.test.ts
client/src/utils/create-types.test.ts
import { describe, it, expect } from 'vitest'; import { createTypes, createAsyncTypes } from './create-types'; describe('Create types utility (createTypes)', () => { it('should generate an object with action types', () => { const types = ['lorem', 'ipsum']; const ns = 'namespace'; expect(createTypes(typ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/daily-coding-challenge-validator.ts
client/src/utils/daily-coding-challenge-validator.ts
import Joi from 'joi'; interface DailyCodingChallengeLanguageFromDb { tests: { text: string; testString: string; }[]; challengeFiles: { fileKey: string; contents: string; }[]; } export interface DailyCodingChallengeFromDb { id: string; challengeNumber: number; title: string; date: stri...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/replace-apple-quotes.ts
client/src/utils/replace-apple-quotes.ts
export function replaceAppleQuotes(text: string): string { return typeof text !== 'string' ? text : text.replace(/[“”]/g, '"').replace(/[‘’]/g, "'"); }
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/analytics-strings.ts
client/src/utils/analytics-strings.ts
import { PaymentContext, PaymentProvider } from '../components/Donation/types'; export function stringifyDonationEvents( paymentContext: PaymentContext, paymentProvider: PaymentProvider ): string { const donationString = `${paymentContext} ${paymentProvider} payment ${ paymentProvider === 'patreon' ? 'redire...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/error-messages.ts
client/src/utils/error-messages.ts
import { FlashMessages } from '../components/Flash/redux/flash-messages'; export const standardErrorMessage = { type: 'danger', message: FlashMessages.WentWrong }; export const reallyWeirdErrorMessage = { type: 'danger', message: FlashMessages.ReallyWeird }; export const reportedErrorMessage = { type: 'dan...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/version.test.ts
client/src/utils/version.test.ts
import { describe, it, expect } from 'vitest'; import envData from '../../config/env.json'; import { getVersion, getVersionObject } from './version'; describe('version utility', () => { it('should return version string', () => { const version = getVersion(); expect(typeof version).toBe('string'); expect(...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/get-completion-percentage.test.ts
client/src/utils/get-completion-percentage.test.ts
import { describe, it, expect } from 'vitest'; import type { AllChallengesInfo, ChallengeNode } from '../redux/prop-types'; import { challengeTypes } from '../../../shared-dist/config/challenge-types'; import { getCompletedPercentage, getCompletedChallengesInBlock, getCurrentBlockIds } from './get-completion-perc...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/session-storage.test.ts
client/src/utils/session-storage.test.ts
// @vitest-environment jsdom /* eslint-disable @typescript-eslint/unbound-method */ import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest'; import { CURRENT_COUNT_KEY, SAVED_COUNT_KEY, getSessionChallengeData, incrementCurrentCount, saveCurrentCount } from './session-storage'; describe('S...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/handled-error.ts
client/src/utils/handled-error.ts
import { has } from 'lodash-es'; interface ErrorData { type?: string; message?: string; redirectTo?: string | null; } export const handledErrorSymbol = Symbol('handledError'); export type HandledError = Error & { [handledErrorSymbol]: ErrorData; }; export function isHandledError(err: unknown): err is Handle...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/algolia-locale-setup.ts
client/src/utils/algolia-locale-setup.ts
import envData from '../../config/env.json'; const { clientLocale } = envData as { clientLocale: keyof typeof algoliaIndices; }; const algoliaIndices = { english: { name: 'news', searchPage: 'https://www.freecodecamp.org/news/search/' }, espanol: { name: 'news-es', searchPage: 'https://www.fre...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/solution-display-type.ts
client/src/utils/solution-display-type.ts
import type { CompletedChallenge } from '../redux/prop-types'; import { challengeTypes } from '../../../shared-dist/config/challenge-types'; import { hasProtocolRE } from '.'; type DisplayType = | 'none' | 'showMultifileProjectSolution' | 'showUserCode' | 'showProjectAndGithubLinks' | 'showProjectLink' | '...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/is-contained.ts
client/src/utils/is-contained.ts
// Performs a check if the items in `value` exist in `other` export function isContained(value: string[], other: string[]): boolean { return value.every(i => other.includes(i)); }
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/solution-display-type.test.ts
client/src/utils/solution-display-type.test.ts
import { describe, it, expect } from 'vitest'; import { bothLinks, invalidGithubLink, legacySolution, multifilePythonSolution, multifileSolution, onlyGithubLink, onlySolution, withChallenges } from './__fixtures__/completed-challenges'; import { getSolutionDisplayType } from './solution-display-type'; ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/report-error.ts
client/src/utils/report-error.ts
export function reportClientSideError( e: Error, message = 'Unhandled error' ): void { console.error(`Client: ${message}`, e); }
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/ajax.ts
client/src/utils/ajax.ts
import cookies from 'browser-cookies'; import { createApi, fetchBaseQuery, retry } from '@reduxjs/toolkit/query/react'; import envData from '../../config/env.json'; import type { ChallengeFile, ChallengeFiles, CompletedChallenge, ExamTokenResponse, GenerateExamResponseWithData, SavedChallenge, SavedChall...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/growthbook-cookie.ts
client/src/utils/growthbook-cookie.ts
export const getUUID = () => { const COOKIE_NAME = 'gbuuid'; const COOKIE_DAYS = 400; // 400 days is the max cookie duration for chrome // use the browsers crypto.randomUUID if set const genUUID = () => { if (window?.crypto?.randomUUID) return window.crypto.randomUUID(); // return a random UUID style ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/create-types.ts
client/src/utils/create-types.ts
type ActionTypes = { [action: string]: string; }; /** * Creates an object in which the `keys` represent the action names and the * `values` represent the action type. * { * action: actionType, * ... * } * @param {array} types Names of the actions. * @param {string} ns Name of the namespace. * @returns {...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/curriculum-layout.ts
client/src/utils/curriculum-layout.ts
import { challengeTypes } from '../../../shared-dist/config/challenge-types'; // Show a single project in a certification layout const projectBasedChallengeTypes = [ challengeTypes.frontEndProject, challengeTypes.backEndProject, challengeTypes.jsProject, challengeTypes.pythonProject, challengeTypes.codeAlly...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/random-between.ts
client/src/utils/random-between.ts
// returns a random number between x and y export const randomBetween = (x: number, y: number): number => Math.floor(Math.random() * (y - x + 1)) + x;
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/analytics-strings.test.ts
client/src/utils/analytics-strings.test.ts
import { describe, it, expect } from 'vitest'; import { stringifyDonationEvents } from './analytics-strings'; describe('Analytics donation strings', () => { it('Should return correct string for modal patreon payment', () => { expect(stringifyDonationEvents('modal', 'patreon')).toEqual( 'Modal Patreon Payme...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/path-parsers.ts
client/src/utils/path-parsers.ts
import { WindowLocation } from '@gatsbyjs/reach-router'; import { i18nConstants } from '../../../shared-dist/config/constants'; const splitPath = (pathname: string): string[] => pathname.split('/').filter(x => x); export const isLanding = (pathname: string): boolean => { const pathArray = splitPath(pathname); c...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/is-contained.test.ts
client/src/utils/is-contained.test.ts
import { describe, it, expect } from 'vitest'; import { isContained } from './is-contained'; describe('client/src isContained', () => { it('returns true if `arr1` values are contained in `arr2`', () => { const arr1 = ['dog', 'cat']; const arr2 = ['cat', 'dog']; expect(isContained(arr1, arr2)).toEqual(tru...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/version.ts
client/src/utils/version.ts
/** * Version information object matching API's /status/version format */ export interface VersionInfo { version: string; } import envData from '../../config/env.json'; /** * Get the client deployment version as a string * * @returns The deployment version or "unknown" if not set * */ export function getVers...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/path-parsers.test.ts
client/src/utils/path-parsers.test.ts
import { describe, it, expect } from 'vitest'; import { isLanding } from './path-parsers'; const pathnames = { english: { landing: '/', superBlock: '/learn/responsive-web-design', challenge: '/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements' }, englishWithYear: { ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/script-loaders.ts
client/src/utils/script-loaders.ts
export function scriptLoader( id: string, async: boolean, src: string, onload: (() => void) | null, text: string ): void { const s = document.createElement('script'); s.type = 'text/javascript'; s.id = id; s.async = async; s.onload = onload; s.src = src; s.text = text; document.getElementsByTa...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/format-seconds.ts
client/src/utils/format-seconds.ts
export function formatSecondsToTime(s: number) { const hourInSeconds = 60 * 60; const minuteInSeconds = 60; const h = Math.floor(s / hourInSeconds); s -= h * hourInSeconds; const minutes = Math.floor(s / minuteInSeconds); s -= minutes * minuteInSeconds; const mm = minutes < 10 && h >= 1 ? `0${minutes}` ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/scrollbar-width.ts
client/src/utils/scrollbar-width.ts
import store from 'store'; export function getScrollbarWidth(): number { const storedWidth = store.get('monacoScrollbarWidth') as number; return storedWidth >= 5 || storedWidth <= 25 ? storedWidth : 5; }
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/growthbook-cookie.test.ts
client/src/utils/growthbook-cookie.test.ts
// @vitest-environment jsdom import { describe, it, expect } from 'vitest'; import { getUUID } from './growthbook-cookie'; describe('getUUID', () => { it('should generate a new UUID if none exists', () => { const uuid = getUUID(); expect(uuid).toBeDefined(); expect(document.cookie).toContain('gbuuid=' + ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/format.test.ts
client/src/utils/format.test.ts
import { describe, it, expect } from 'vitest'; import { format } from './format'; function simpleFun() { // eslint-disable-next-line no-var, @typescript-eslint/no-unused-vars var x = 'y'; } /* format uses util.inspect to do almost everything, the tests are just there to warn us if util.inspect ever changes */ des...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/to-learn-path.ts
client/src/utils/to-learn-path.ts
import { withPrefix } from 'gatsby'; interface ToLearnPathKwargs { block?: string; challenge?: string; superBlock?: string; } /** * Builds a learning url path from folders. * - /learn/:superBlock/:block/:challenge * @params {Object} Path kwargs. * @returns {string} A learning url path. */ export default fu...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/is-a-cert.ts
client/src/utils/is-a-cert.ts
import { SuperBlocks } from '../../../shared-dist/config/curriculum'; export function isRelationalDbCert(superBlock: string): boolean { return superBlock === String(SuperBlocks.RelationalDb); } export function isExamCert(superBlock: string): boolean { return superBlock === String(SuperBlocks.FoundationalCSharp); ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/index.ts
client/src/utils/index.ts
/* * This regex is not for validation, it is purely to see * if we are looking at something like what we want to validate * before we try to validate. */ export const maybeEmailRE = /.*@.*\.\w\w/; export const maybeUrlRE = /https?:\/\/.*\..*/; export const hasProtocolRE = /^http/;
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/get-words.ts
client/src/utils/get-words.ts
// this lets us do dynamic work ahead of time, inlining motivation.json, so // that Webpack will never try to include locales that we know are not used. interface Quote { quote: string; author: string; } interface Motivation { compliments: string[]; motivationalQuotes: Quote[]; } declare const preval: (s: Te...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/challenge-request-helpers.ts
client/src/utils/challenge-request-helpers.ts
import { ChallengeFiles } from '../redux/prop-types'; /* * Express's body-parser has a default size limit of 102400 bytes for a request body. * These helper functions make sure the request body isn't too big when saving or submitting multifile cert projects */ export const MAX_BODY_SIZE = 102400; interface Standa...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/session-storage.ts
client/src/utils/session-storage.ts
const parseCount = (rawCount: string | null) => rawCount == null ? 0 : parseInt(rawCount, 10); export const CURRENT_COUNT_KEY = 'session-completed-challenges'; export const SAVED_COUNT_KEY = 'saved-session-completed-challenges'; const getCurrentCount = () => parseCount(sessionStorage.getItem(CURRENT_COUNT_KEY)); ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/to-learn-path.test.ts
client/src/utils/to-learn-path.test.ts
import { withPrefix } from 'gatsby'; import { describe, it, expect } from 'vitest'; import toLearnPath from './to-learn-path'; describe('To learn path utility (toLearnPath)', () => { const learn = withPrefix('/learn'); it('should include /learn', () => { expect(toLearnPath({})).toMatch(`${learn}`); }); ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/fire-confetti.ts
client/src/utils/fire-confetti.ts
import confetti from 'canvas-confetti'; export const fireConfetti = () => { const count = 200; const defaults = { origin: { y: 0.7 }, zIndex: 10000 }; function fire( particleRatio: number, opts: { spread?: number; startVelocity?: number; decay?: number; scalar?: number;...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/stripe.ts
client/src/utils/stripe.ts
import { loadStripe } from '@stripe/stripe-js'; import envData from '../../config/env.json'; const { stripePublicKey } = envData; export const stripe = stripePublicKey ? loadStripe(stripePublicKey) : null;
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/replace-apple-quotes.test.ts
client/src/utils/replace-apple-quotes.test.ts
import { describe, it, expect } from 'vitest'; import { replaceAppleQuotes } from './replace-apple-quotes'; describe('replaceAppleQuotes()', () => { it('replaces apple quotes with regular quotes', () => { expect(replaceAppleQuotes('“double” quotes and ‘single’ quotes')).toBe( `"double" quotes and 'single' ...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/tone/editor-notes.ts
client/src/utils/tone/editor-notes.ts
export const editorNotes = [ 'C1', 'D1', 'E1', 'F1', 'G1', 'A1', 'B1', 'C2', 'D2', 'E2', 'F2', 'G2', 'A2', 'B2', 'C3', 'D3', 'E3', 'F3', 'G3', 'A3', 'B3', 'C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5', 'D5', 'E5', 'F5', 'G5', 'A5', 'B5', 'C6', '...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/tone/editor-config.ts
client/src/utils/tone/editor-config.ts
export const editorToneOptions = { urls: { C1: 'Guitar-Sample-01.mp3', D1: 'Guitar-Sample-02.mp3', E1: 'Guitar-Sample-03.mp3', F1: 'Guitar-Sample-04.mp3', G1: 'Guitar-Sample-05.mp3', A1: 'Guitar-Sample-06.mp3', B1: 'Guitar-Sample-07.mp3', C2: 'Guitar-Sample-08.mp3', D2: 'Guitar-Sam...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/tone/index.ts
client/src/utils/tone/index.ts
import store from 'store'; import { FlashMessages } from '../../components/Flash/redux/flash-messages'; import { LocalStorageThemes } from '../../redux/types'; const TRY_AGAIN = 'https://campfire-mode.freecodecamp.org/try-again.mp3'; const CHAL_COMP = 'https://campfire-mode.freecodecamp.org/chal-comp.mp3'; const toneU...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/__fixtures__/completed-challenges.ts
client/src/utils/__fixtures__/completed-challenges.ts
import { challengeFiles } from '../../../utils/__fixtures__/challenges'; import { challengeTypes } from '../../../../shared-dist/config/challenge-types'; const baseChallenge = { id: '1', completedDate: 1, challengeFiles: [] } export const onlySolution = { ...baseChallenge, solution: 'https://some-url.com' }...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/utils/__mocks__/get-words.ts
client/src/utils/__mocks__/get-words.ts
import { vi } from 'vitest'; export const randomQuote = vi.fn(() => ({ quote: 'Test quote', author: 'Test author' })); export const randomCompliment = vi.fn(() => 'Great job!');
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false
freeCodeCamp/freeCodeCamp
https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/__tests__/integration/handled-error.test.ts
client/src/__tests__/integration/handled-error.test.ts
import { describe, it, expect } from 'vitest'; import { wrapHandledError, unwrapHandledError } from '../../utils/handled-error'; describe('handled-error integration', () => { const handledA = { type: 'info', message: 'something helpful', redirectTo: '/a-path-we-choose' }; const handledB = { t...
typescript
BSD-3-Clause
7d58ef2062b457d9370a7f730fc875f92ad28a80
2026-01-04T15:25:31.297347Z
false