Added Recommendations settings placeholder under feature flag (#17855)

refs https://github.com/TryGhost/Product/issues/3787

- Added Recommendations feature flag
- Added an empty placeholder settings section for Recommendations under the feature flag
This commit is contained in:
Djordje Vlaisavljevic 2023-08-29 12:36:50 +01:00 committed by GitHub
parent 8914976010
commit 8416278ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 2 deletions

View File

@ -21,6 +21,7 @@ const Sidebar: React.FC = () => {
};
const hasTipsAndDonations = useFeatureFlag('tipsAndDonations');
const hasRecommendations = useFeatureFlag('recommendations');
return (
<div className="hidden md:!visible md:!block md:h-[calc(100vh-5vmin-84px)] md:w-[240px] md:overflow-y-scroll md:pt-[32px]">
@ -45,6 +46,7 @@ const Sidebar: React.FC = () => {
{/* <SettingNavItem navid='theme' title="Theme" onClick={handleSectionClick} /> */}
<SettingNavItem navid='design' title="Branding and design" onClick={handleSectionClick} />
<SettingNavItem navid='navigation' title="Navigation" onClick={handleSectionClick} />
{hasRecommendations && <SettingNavItem navid='recommendations' title="Recommendations" onClick={handleSectionClick} />}
</SettingNavSection>
<SettingNavSection title="Membership">

View File

@ -55,6 +55,10 @@ const features = [{
title: 'Tips & donations',
description: 'Enables publishers to collect one-time payments',
flag: 'tipsAndDonations'
},{
title: 'Recommendations',
description: 'Enables publishers to recommend sites to their audience',
flag: 'recommendations'
}];
const AlphaFeatures: React.FC = () => {

View File

@ -0,0 +1,25 @@
import React from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import useSettingGroup from '../../../hooks/useSettingGroup';
const Recommendations: React.FC<{ keywords: string[] }> = ({keywords}) => {
const {
saveState,
handleSave
} = useSettingGroup();
return (
<SettingGroup
description="Recommend sites to your audience, and get recommended by others."
keywords={keywords}
navid='recommendations'
saveState={saveState}
testId='recommendations'
title="Recommendations"
onSave={handleSave}
>
</SettingGroup>
);
};
export default Recommendations;

View File

@ -1,22 +1,27 @@
import DesignSetting from './DesignSetting';
import Navigation from './Navigation';
import React from 'react';
import Recommendations from './Recommendations';
import SettingSection from '../../../admin-x-ds/settings/SettingSection';
import useFeatureFlag from '../../../hooks/useFeatureFlag';
// import Theme from './Theme';
const searchKeywords = {
theme: ['themes', 'design', 'appearance', 'style'],
design: ['design', 'branding', 'logo', 'cover', 'colors', 'fonts', 'background'],
navigation: ['navigation', 'menus', 'primary', 'secondary', 'links']
navigation: ['navigation', 'menus', 'primary', 'secondary', 'links'],
recommendations: ['recommendation', 'recommend', 'blog roll', 'recommending']
};
const SiteSettings: React.FC = () => {
const hasRecommendations = useFeatureFlag('recommendations');
return (
<>
<SettingSection keywords={Object.values(searchKeywords).flat()} title="Site">
{/* <Theme keywords={searchKeywords.theme} /> */}
<DesignSetting keywords={searchKeywords.design} />
<Navigation keywords={searchKeywords.navigation} />
{hasRecommendations && <Recommendations keywords={searchKeywords.navigation} />}
</SettingSection>
</>
);

View File

@ -78,6 +78,7 @@ export default class FeatureService extends Service {
@feature('importMemberTier') importMemberTier;
@feature('tipsAndDonations') tipsAndDonations;
@feature('convertToLexical') convertToLexical;
@feature('recommendations') recommendations;
_user = null;

View File

@ -366,6 +366,20 @@
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Recommendations</h4>
<p class="gh-expandable-description">
Enables publishers to recommend sites to their audience
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="recommendations" />
</div>
</div>
</div>
</div>
</div>
{{/if}}

View File

@ -42,7 +42,8 @@ const ALPHA_FEATURES = [
'collectionsCard',
'tipsAndDonations',
'importMemberTier',
'convertToLexical'
'convertToLexical',
'recommendations'
];
module.exports.GA_KEYS = [...GA_FEATURES];