Skip to content

Commit

Permalink
Remmove another harcoded WPBeginner check
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiucelfilip committed Oct 24, 2024
1 parent 7786290 commit fbd3450
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions client/my-sites/plugins/categories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type Category = {
description?: string;
icon?: string;
separator?: boolean;
showOnlyActive?: boolean;
};

export type Plugin = {
Expand Down
1 change: 1 addition & 0 deletions client/my-sites/plugins/categories/use-categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ export const getCategories: () => Record< string, Category > = () => ( {
slug: 'wpbeginner',
tags: [ 'wpbeginner', 'Awesome Motive' ],
preview: [],
showOnlyActive: true,
},
} );

Expand Down
11 changes: 4 additions & 7 deletions client/my-sites/plugins/search-categories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,13 @@ const SearchCategories: FC< {
const getCategoryUrl = useGetCategoryUrl();
const categoriesRef = useRef< HTMLDivElement >( null );

const restrictedCategories = [ 'paid', 'popular', 'featured' ];
if ( category !== 'wpbeginner' ) {
restrictedCategories.push( 'wpbeginner' );
}
// We hide these special categories from the category selector
const displayCategories = ALLOWED_CATEGORIES.filter(
( v ) => restrictedCategories.indexOf( v ) < 0
( v ) => [ 'paid', 'popular', 'featured' ].indexOf( v ) < 0
);
const categories = Object.values( useCategories( displayCategories ) ).filter(
( item ) => ! item.showOnlyActive || item.slug === category
);

const categories = Object.values( useCategories( displayCategories ) );

// Update the search box with the value from the url everytime it changes
// This allows the component to be refilled with a keyword
Expand Down

0 comments on commit fbd3450

Please sign in to comment.