Download wp-calypso/client/my-sites/patterns/paths.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 909 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/patterns/paths.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/my-sites/patterns/paths.ts
-
curl -L -o paths.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/my-sites/patterns/paths.ts
909 Bytes
| import { addLocaleToPathLocaleInFront, localizeUrl } from '@automattic/i18n-utils'; | |
| import { PatternTypeFilter } from 'calypso/my-sites/patterns/types'; | |
| import type { Locale } from '@automattic/i18n-utils'; | |
| export const URL_REFERRER_PARAM = 'pattern-library'; | |
| export function getCategoryUrlPath( | |
| categorySlug: string, | |
| type: PatternTypeFilter, | |
| includeLocale = true, | |
| isGridView = false | |
| ) { | |
| const href = | |
| type === PatternTypeFilter.PAGES | |
| ? `/patterns/layouts/${ categorySlug }` | |
| : `/patterns/${ categorySlug }`; | |
| const hrefWithLocale = includeLocale ? addLocaleToPathLocaleInFront( href ) : href; | |
| return hrefWithLocale + ( isGridView ? '?grid=1' : '' ); | |
| } | |
| export function getOnboardingUrl( locale: Locale, isLoggedIn: boolean ) { | |
| const refQuery = new URLSearchParams( { | |
| ref: URL_REFERRER_PARAM, | |
| } ); | |
| return localizeUrl( `https://wordpress.com/start?${ refQuery }`, locale, isLoggedIn ); | |
| } | |