Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Badge: Remove unused component files" #78941

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
5509801
Checkout: Increase specificity of checkout padding override (#78760)
sirbrillig Jun 29, 2023
f7adc32
BulkDomainTransfer: improve default error message (#78750)
heavyweight Jun 29, 2023
397a28d
Newsletters: Update style and text on intro screen (#78751)
edanzer Jun 29, 2023
5927e68
desktop: bump version to v8.0.0 (#78507)
nsakaimbo Jun 29, 2023
caa1d5b
Hotjar script added to /advertising page (#78778)
paulopmt1 Jun 29, 2023
7f7643a
Jetpack Connection: fix sign-up as a different user (#78036)
sergeymitr Jun 29, 2023
d63941d
Update Congrats page for single/multiple plugins (#78671)
candy02058912 Jun 29, 2023
3244faa
Edge Cache: Disable toggle if the site isn't public (#78777)
danielbachhuber Jun 29, 2023
8a75eee
Update label to account for updated Cache block features (#78779)
wojtekn Jun 29, 2023
a475fe2
Checkout: add ad-free experience to plan features (#78574)
aneeshd16 Jun 30, 2023
acf051f
Sidebar: refresh Manage all domains button (#78803)
zaguiini Jun 30, 2023
c548f2e
Colors and Fonts variations - Layout and alignment fixes (#78734)
miksansegundo Jun 30, 2023
8e6cba0
My Home: Add Manage all domains quick link (#78804)
zaguiini Jun 30, 2023
439626e
Deprecate design preview option viewport_width (#78823)
taipeicoder Jun 30, 2023
3730574
Social: Change multi-connection feature flag to a site feature (#76900)
pablinos Jun 30, 2023
11c50f4
Cookie Banner: Remove Advertising From Being Selected By Default (#78…
Jun 30, 2023
d494ee7
Add Jetpack connect screen loading screens and minor UI update (#78831)
chihsuan Jun 30, 2023
746313a
Reader: Add read feed search query hook (#78827)
mashikag Jun 30, 2023
9519dd8
Switch default start-writing theme to hey from livro (#78819)
lsl Jun 30, 2023
52cae38
Domains: Add empty state to All Domains page (#78841)
zaguiini Jun 30, 2023
e4686f9
Replace search component with one from sites page (#78776)
timur987 Jun 30, 2023
6ab73a6
Checkout: Show full "renewal" TOS for domain transfers (#78808)
sirbrillig Jun 30, 2023
ed54687
Fixes the Blaze credits for atomic sites using the Blaze Dashboard ap…
sbarbosa Jun 30, 2023
08136eb
My Sites: Remove manage domains from site selector (#78857)
ebinnion Jun 30, 2023
70949b8
Add tracks to the Blaze Dashboard app (#78807)
sbarbosa Jun 30, 2023
eece33f
Bulk Domain Transfer: Handle status 400 from auth code endpoint (#78859)
alshakero Jun 30, 2023
a00269a
Reader: Update sidebar to use ReaderAvatar component (#78788)
eoigal Jun 30, 2023
2ab46b7
Reader: update Feed/Site stream header and sidebar (#78818)
creativecoder Jun 30, 2023
78b8c25
Hosting onboarding: preserve hosting flow even for non-developers (#7…
zaguiini Jun 30, 2023
028936f
Sending hotjarSiteSettings to BlazePress.render call (#78851)
paulopmt1 Jun 30, 2023
5643b82
Hosting onboarding: hide masterbar (#78863)
zaguiini Jun 30, 2023
f7a9d10
Hosting onboarding: allow going back when in the onboarding flow (#78…
zaguiini Jun 30, 2023
c349702
Adding truncation to site titles in reader sidebar (#78858)
davemart-in Jun 30, 2023
e28d9be
Reader: remove unused showPostHeader prop (#78606)
creativecoder Jun 30, 2023
4ce2d21
Subscribers Page: Fix expanding width on add subscriber modal. (#78870)
yansern Jul 1, 2023
18f4560
add null check to fix issue on wordpress.com (#78878)
roo2 Jul 3, 2023
9375f84
reader: fix related sites on tags page (#78879)
roo2 Jul 3, 2023
477a109
Components: Adjust the Pricing Slider component styling (#78766)
dognose24 Jul 3, 2023
ed25594
CI: add retry to Calypso E2E and Gutenberg E2E specs. (#78528)
worldomonation Jul 3, 2023
3c09561
Remove an redundant "support via email" feature listed for Personal (…
southp Jul 3, 2023
3d6ad33
Growth: Minimal stepper onboarding flow (#77801)
chriskmnds Jul 3, 2023
1a62a85
Limited GS on Personal: Load styles for treatment group (take 2) (#78…
mmtr Jul 3, 2023
644b8d1
Subscribers Page: Hide `SubscribersHeaderPopover` when there are no s…
ivan-ottinger Jul 3, 2023
6aebe8e
Plans 2023: (foundation) Sync plans grid views across signup/tailored…
chriskmnds Jul 3, 2023
9f10042
Jetpack Pro Dashboard: Fix license card layout for Woo products expan…
atanas-dev Jul 3, 2023
f77f257
Bulk Domain Transfer Flow - Flow redesign (#78822)
agrullon95 Jul 3, 2023
e906e2e
Hosting onboarding: use `ref=hosting-flow` in Sites CTAs (#78866)
zaguiini Jul 3, 2023
9713aa6
Global Styles on Personal A/B: Prepare hook (#78895)
mmtr Jul 3, 2023
a60e077
Global Styles on Personal A/B: Do not fetch assigment on LOTS (#78906)
mmtr Jul 3, 2023
3846414
Update task to point to the edit canvas (#78742)
sixhours Jul 3, 2023
fa16b45
Site Transfers: Launch Site Transfers Feature (#78907)
katinthehatsite Jul 3, 2023
f501820
Alternative Support Widget Experiment (#78282)
AllTerrainDeveloper Jul 3, 2023
121161a
Subscription Management: Refactor - introduce SiteSubscriptionsQueryC…
mashikag Jul 3, 2023
c87072d
Add checkout included features list for new Stats products (#78868)
elliottprogrammer Jul 3, 2023
4bed13f
Excerpt and Permalink: Update and localize Learn More (#78908)
escapemanuele Jul 3, 2023
6e5e450
reader: add signup link to logged out tags page (#78880)
roo2 Jul 3, 2023
f5a9963
Update page title on tag pages (#78412)
roo2 Jul 3, 2023
0c4f297
Enable localization of read/search page with url param (#78656)
roo2 Jul 3, 2023
c909f5e
remove search.en.wordpress.com redirect (#78166)
roo2 Jul 3, 2023
ebc4810
Quick links: list Jetpack functionalities for Business or Commerce si…
mpkelly Jul 4, 2023
0b84765
Design Preview: Fix style variations might not work (#78924)
arthur791004 Jul 4, 2023
7910678
Stats: Add Jetpack Stats products supporting check (#78657)
kangzj Jul 4, 2023
1ffd728
Domains: Allow bulk domain transfer of domains that are already conne…
leonardost Jul 4, 2023
8a1d479
Subscription management: Refactor SiteSubscriptionsList to allow for …
mashikag Jul 4, 2023
e3bc413
All sites using the assembler set the option wpcom_site_setup (#78852)
miksansegundo Jul 4, 2023
9da9094
GS on Personal A/B: Neutralise style variation wording in assembler (…
dsas Jul 4, 2023
e4df0d8
Bulk Domain Transfer: Apply new routing (#78806)
heavyweight Jul 4, 2023
40a6b50
GS on personal A/B: Show correct upgrade message in the launch banner…
rcrdortiz Jul 4, 2023
9c2983c
GS on Personal A/B: Privacy Settings Implement A/B testing for Globa…
rcrdortiz Jul 4, 2023
611b09c
Site Transfers: Tweak design of `<ChooseUserLoadingPlaceholder />` (#…
danielbachhuber Jul 4, 2023
275999c
Global Styles: Avoid registering core blocks multiple times (#78925)
arthur791004 Jul 4, 2023
5f32e31
rework `useHelpSearchQuery` & remove unnecessary code (#78729)
Jul 4, 2023
170bda7
Move Badge component to @automattic/components (#78809)
sixhours Jul 4, 2023
d011b19
Domain transfer: Handle 400 error from code EP (#78932)
alshakero Jul 4, 2023
efaf76f
Jetpack icon aligned on desktop (#78936)
escapemanuele Jul 4, 2023
1938974
Fixes a styling issue in the Blaze Dashboard app (#78862)
sbarbosa Jul 4, 2023
a89909c
Update domain thank-you checkout to point to home if keep building is…
sixhours Jul 4, 2023
88fb1f3
Update references to point to new package component
sixhours Jun 29, 2023
7ce0b41
Ignore eslint warnings or the purposes of this PR
sixhours Jun 29, 2023
f392cc0
update playground scope
sixhours Jun 29, 2023
41ffe91
Fix ref
sixhours Jun 29, 2023
c6d84c6
Remove unused badge files (#78814)
sixhours Jul 4, 2023
8b75da7
Revert "Remove unused badge files (#78814)"
valterlorran Jul 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable localization of read/search page with url param (#78656)
  • Loading branch information
roo2 authored Jul 3, 2023
commit 0c4f29770fef59179c9fdc4532ee037e48cf23f0
7 changes: 6 additions & 1 deletion client/blocks/reader-post-card/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Card } from '@automattic/components';
import { localeRegexString } from '@automattic/i18n-utils';
import classnames from 'classnames';
import closest from 'component-closest';
import { truncate, get } from 'lodash';
Expand Down Expand Up @@ -143,7 +144,11 @@ class ReaderPostCard extends Component {
const isDiscover = post.is_discover;
const title = truncate( post.title, { length: 140, separator: /,? +/ } );
const isConversations = currentRoute.startsWith( '/read/conversations' );
const isReaderSearchPage = currentRoute.startsWith( '/read/search' );

const isReaderSearchPage = new RegExp( `^(/${ localeRegexString })?/read/search` ).test(
currentRoute
);

const classes = classnames( 'reader-post-card', {
'has-thumbnail': !! post.canonical_media,
'is-photo': isPhotoPost,
Expand Down
4 changes: 2 additions & 2 deletions client/controller/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ProviderWrappedLoggedOutLayout = ( {
currentQuery,
primary,
secondary,
headerSection,
renderHeaderSection,
redirectUri,
i18n,
showGdprBanner,
Expand All @@ -52,7 +52,7 @@ const ProviderWrappedLoggedOutLayout = ( {
<LayoutLoggedOut
primary={ primary }
secondary={ secondary }
headerSection={ headerSection }
renderHeaderSection={ renderHeaderSection }
redirectUri={ redirectUri }
showGdprBanner={ showGdprBanner }
/>
Expand Down
4 changes: 2 additions & 2 deletions client/controller/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ProviderWrappedLayout = ( {
currentQuery,
primary,
secondary,
headerSection,
renderHeaderSection,
redirectUri,
} ) => {
const state = store.getState();
Expand All @@ -47,7 +47,7 @@ export const ProviderWrappedLayout = ( {
primary={ primary }
secondary={ secondary }
redirectUri={ redirectUri }
headerSection={ headerSection }
renderHeaderSection={ renderHeaderSection }
/>
);

Expand Down
5 changes: 2 additions & 3 deletions client/controller/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function makeLayoutMiddleware( LayoutComponent ) {
query,
primary,
secondary,
headerSection,
renderHeaderSection,
showGdprBanner,
cachedMarkup,
} = context;
Expand All @@ -36,7 +36,7 @@ export function makeLayoutMiddleware( LayoutComponent ) {
currentQuery={ query }
primary={ primary }
secondary={ secondary }
headerSection={ headerSection }
renderHeaderSection={ renderHeaderSection }
redirectUri={ context.originalUrl }
showGdprBanner={ showGdprBanner }
/>
Expand Down Expand Up @@ -70,7 +70,6 @@ export function setLocaleMiddleware( param = 'lang' ) {
context.lang = paramsLocale;
context.store.dispatch( setLocale( paramsLocale ) );
}

next();
};
}
Expand Down
18 changes: 13 additions & 5 deletions client/layout/logged-out.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import config from '@automattic/calypso-config';
import { useLocalizeUrl, removeLocaleFromPathLocaleInFront } from '@automattic/i18n-utils';
import {
useLocalizeUrl,
removeLocaleFromPathLocaleInFront,
localeRegexString,
} from '@automattic/i18n-utils';
import { UniversalNavbarHeader, UniversalNavbarFooter } from '@automattic/wpcom-template-parts';
import classNames from 'classnames';
import { localize } from 'i18n-calypso';
Expand Down Expand Up @@ -49,7 +53,7 @@ const LayoutLoggedOut = ( {
oauth2Client,
primary,
secondary,
headerSection,
renderHeaderSection,
sectionGroup,
sectionName,
sectionTitle,
Expand Down Expand Up @@ -77,13 +81,15 @@ const LayoutLoggedOut = ( {

const isReaderTagPage = sectionName === 'reader' && currentRoute.startsWith( '/tag/' );

const isReaderSearchPage = sectionName === 'reader' && currentRoute.startsWith( '/read/search' );
const isReaderSearchPage =
sectionName === 'reader' &&
currentRoute.match( new RegExp( `^(/${ localeRegexString })?/read/search` ) );

const classes = {
[ 'is-group-' + sectionGroup ]: sectionGroup,
[ 'is-section-' + sectionName ]: sectionName,
'focus-content': true,
'has-header-section': headerSection,
'has-header-section': renderHeaderSection,
'has-no-sidebar': ! secondary,
'has-no-masterbar': masterbarIsHidden,
'is-jetpack-login': isJetpackLogin,
Expand Down Expand Up @@ -161,7 +167,9 @@ const LayoutLoggedOut = ( {
<BodySectionCssClass group={ sectionGroup } section={ sectionName } bodyClass={ bodyClass } />
<div className="layout__header-section">
{ masterbar }
{ headerSection && <div className="layout__header-section-content">{ headerSection }</div> }
{ renderHeaderSection && (
<div className="layout__header-section-content">{ renderHeaderSection() }</div>
) }
</div>
{ isJetpackCloud() && (
<AsyncLoad require="calypso/jetpack-cloud/style" placeholder={ null } />
Expand Down
6 changes: 5 additions & 1 deletion client/reader/search-stream/suggestion.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { retrieveLocaleFromPathLocaleInFront } from '@automattic/i18n-utils';
import PropTypes from 'prop-types';
import { stringify } from 'qs';
import { Component } from 'react';
Expand Down Expand Up @@ -35,8 +36,11 @@ export class Suggestion extends Component {
q: suggestion,
sort,
};
const localeFromPath = retrieveLocaleFromPathLocaleInFront( window.location.pathname );

const searchUrl = '/read/search?' + stringify( args );
const searchUrl = localeFromPath
? `/${ localeFromPath }/read/search?${ stringify( args ) }`
: `/read/search?${ stringify( args ) }`;

return (
<a onClick={ this.handleSuggestionClick } href={ searchUrl }>
Expand Down
2 changes: 1 addition & 1 deletion client/reader/search/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const exported = {
function reportSortChange( newSort ) {
replaceSearchUrl( searchSlug, newSort !== 'relevance' ? newSort : undefined );
}
context.headerSection = renderHeaderSection();
context.renderHeaderSection = renderHeaderSection;

context.primary = (
<AsyncLoad
Expand Down
16 changes: 15 additions & 1 deletion client/reader/search/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { getLanguageRouteParam, removeLocaleFromPathLocaleInFront } from '@automattic/i18n-utils';
import page from 'page';
import { makeLayout, render as clientRender } from 'calypso/controller';
import { setLocaleMiddleware } from 'calypso/controller/shared';
import { sidebar, updateLastRoute } from 'calypso/reader/controller';
import { isUserLoggedIn } from 'calypso/state/current-user/selectors';
import { fetchTrendingTags } from '../tags/controller';
Expand All @@ -12,12 +14,24 @@ const fetchTrendingTagsIfLoggedOut = ( context, next ) => {
next();
};

const redirectLoggedInUrl = ( context, next ) => {
if ( isUserLoggedIn( context.store.getState() ) ) {
const pathWithoutLocale = removeLocaleFromPathLocaleInFront( context.path );
if ( pathWithoutLocale !== context.path ) {
return page.redirect( pathWithoutLocale );
}
}
next();
};
export default function () {
const langParam = getLanguageRouteParam();
// Old recommendations page
page( '/recommendations', '/read/search' );

page(
'/read/search',
[ '/read/search', `/${ langParam }/read/search` ],
redirectLoggedInUrl,
setLocaleMiddleware(),
fetchTrendingTagsIfLoggedOut,
updateLastRoute,
sidebar,
Expand Down
3 changes: 2 additions & 1 deletion client/reader/stats.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { localeRegexString } from '@automattic/i18n-utils';
import debugFactory from 'debug';
import { pick } from 'lodash';
import { gaRecordEvent } from 'calypso/lib/analytics/ga';
Expand Down Expand Up @@ -77,7 +78,7 @@ function getLocation( path ) {
if ( path.indexOf( '/read/recommendations/posts' ) === 0 ) {
return 'recommended_posts';
}
if ( path.indexOf( '/read/search' ) === 0 ) {
if ( path.match( new RegExp( `^(/${ localeRegexString })?/read/search` ) ) ) {
return 'search';
}
if ( path.indexOf( '/read/conversations/a8c' ) === 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion client/reader/tag-stream/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const tagListing = ( context, next ) => {
} );

if ( ! isUserLoggedIn( context.store.getState() ) ) {
context.headerSection = renderHeaderSection();
context.renderHeaderSection = renderHeaderSection;
}
context.primary = (
<>
Expand Down
8 changes: 4 additions & 4 deletions client/reader/tags/controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface AlphabeticTagsResult {

export const tagsListing = ( context: PageJSContext, next: () => void ) => {
if ( ! isUserLoggedIn( context.store.getState() ) ) {
context.headerSection = renderHeaderSection();
context.renderHeaderSection = renderHeaderSection;
}
context.primary = (
<>
Expand Down Expand Up @@ -64,16 +64,16 @@ export const fetchTrendingTags = ( context: PageJSContext, next: ( e?: Error ) =
}
performanceMark( context as PartialContext, 'fetchTrendingTags' );

const currentUserLocale = getCurrentUserLocale( context.store.getState() );
const localeSlug = getCurrentUserLocale( context.store.getState() ) || context.lang;

context.queryClient
.fetchQuery(
[ 'trending-tags', currentUserLocale ?? '' ],
[ 'trending-tags', localeSlug ?? '' ],
() => {
return wpcom.req.get( '/read/trending/tags', {
apiVersion: '1.2',
count: '6',
lang: currentUserLocale, // Note: undefined will be omitted by the query string builder.
lang: localeSlug, // Note: undefined will be omitted by the query string builder.
} );
},
{ staleTime: 86400000 } // 24 hours
Expand Down
2 changes: 1 addition & 1 deletion client/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const sections = [
},
{
name: 'reader',
paths: [ '/read/search', '/recommendations' ],
paths: [ '/read/search', '/([a-z]{2,3}|[a-z]{2}-[a-z]{2})/read/search', '/recommendations' ],
module: 'calypso/reader/search',
group: 'reader',
enableLoggedOut: true,
Expand Down
5 changes: 4 additions & 1 deletion client/state/data-layer/wpcom/read/streams/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import warn from '@wordpress/warning';
import i18n from 'i18n-calypso';
import { random, map, includes, get } from 'lodash';
import { getDiscoverStreamTags } from 'calypso/reader/discover/helper';
import { keyForPost } from 'calypso/reader/post-key';
Expand Down Expand Up @@ -329,14 +330,16 @@ export function requestPage( action ) {
// eslint-disable-next-line no-extra-boolean-cast
const number = !! gap ? PER_GAP : fetchCount;

const lang = i18n.getLocaleSlug();

return http( {
method: 'GET',
path: path( { ...action.payload } ),
apiVersion,
apiNamespace: api.apiNamespace ?? null,
query: isPoll
? pollQuery( [], { ...algorithm } )
: query( { ...pageHandle, ...algorithm, number }, action.payload ),
: query( { ...pageHandle, ...algorithm, number, lang }, action.payload ),
onSuccess: action,
onFailure: action,
} );
Expand Down
3 changes: 3 additions & 0 deletions client/state/data-layer/wpcom/read/streams/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe( 'streams', () => {
meta: QUERY_META,
number: INITIAL_FETCH,
content_width: 675,
lang: 'en',
};

it( 'should return an http request', () => {
Expand Down Expand Up @@ -143,6 +144,7 @@ describe( 'streams', () => {
query: {
sort: 'date',
q: 'foo',
lang: 'en',
number: INITIAL_FETCH,
content_width: 675,
},
Expand All @@ -157,6 +159,7 @@ describe( 'streams', () => {
query: {
sort: 'relevance',
q: 'foo:bar',
lang: 'en',
number: INITIAL_FETCH,
content_width: 675,
},
Expand Down
10 changes: 7 additions & 3 deletions packages/i18n-utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import i18n, { getLocaleSlug } from 'i18n-calypso';
import { find, map, pickBy, includes } from 'lodash';

/**
* This regex is defined as a string so that it can be combined with other regexes.
*
* a locale can consist of three component
* aa: language code
* -bb: regional code
* _cc: variant suffix
* while the language code is mandatory, the other two are optional.
*/
const localeRegex = /^[A-Z]{2,3}(-[A-Z]{2,3})?(_[A-Z]{2,6})?$/i;
export const localeRegexString = '[a-zA-Z]{2,3}(-[a-zA-Z]{2,3})?(_[a-zA-Z]{2,6})?';

const localeOnlyRegex = new RegExp( '^' + localeRegexString + '$' );

export function getPathParts( path: string ) {
// Remove trailing slash then split. If there is a trailing slash,
Expand Down Expand Up @@ -124,9 +128,9 @@ export function getLanguageRouteParam( name = 'lang', optional = true ) {
*/
export function getLanguage( langSlug: string | undefined ): Language | undefined {
langSlug = getMappedLanguageSlug( langSlug );
if ( langSlug && localeRegex.test( langSlug ) ) {
if ( langSlug && localeOnlyRegex.test( langSlug ) ) {
// Find for the langSlug first. If we can't find it, split it and find its parent slug.
// Please see the comment above `localeRegex` to see why we can split by - or _ and find the parent slug.
// Please see the comment above `localeOnlyRegex` to see why we can split by - or _ and find the parent slug.
return ( find( languages, { langSlug } ) ||
find( languages, { langSlug: langSlug.split( /[-_]/ )[ 0 ] } ) ) as Language | undefined;
}
Expand Down