Skip to content

Commit

Permalink
chore: cleanup post_title_language experiment (won) (#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelchris authored Sep 2, 2024
1 parent ada5052 commit c4d72b4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 64 deletions.
61 changes: 27 additions & 34 deletions packages/shared/src/components/filters/ContentTypesFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ import {
import { Divider } from '../utilities';
import { LanguageDropdown } from '../profile/LanguageDropdown';
import { useAuthContext } from '../../contexts/AuthContext';
import { useFeature } from '../GrowthBookProvider';
import { feature } from '../../lib/featureManagement';
import { useLanguage } from '../../hooks/useLanguage';

export function ContentTypesFilter(): ReactElement {
const postTitleLanguageFeature = useFeature(feature.postTitleLanguage);
const { advancedSettings, isLoading } = useFeedSettings();
const { selectedSettings, onToggleSettings } = useAdvancedSettings();
const { user } = useAuthContext();
Expand All @@ -28,37 +25,33 @@ export function ContentTypesFilter(): ReactElement {

return (
<div className="flex flex-col gap-4">
{postTitleLanguageFeature && (
<>
<section className="flex flex-col gap-4" aria-busy={isLoading}>
<div className="flex flex-col">
<Typography
tag={TypographyTag.H3}
color={TypographyColor.Primary}
type={TypographyType.Body}
bold
className="mb-1"
>
Preferred language
</Typography>
<Typography
color={TypographyColor.Tertiary}
type={TypographyType.Callout}
>
Choose your preferred language for the post titles on the feed
</Typography>
</div>
<LanguageDropdown
className={{ container: 'w-full max-w-60' }}
name="language"
defaultValue={user.language}
onChange={(value) => onLanguageChange(value)}
icon={null}
/>
</section>
<Divider className="bg-border-subtlest-tertiary" />
</>
)}
<section className="flex flex-col gap-4" aria-busy={isLoading}>
<div className="flex flex-col">
<Typography
tag={TypographyTag.H3}
color={TypographyColor.Primary}
type={TypographyType.Body}
bold
className="mb-1"
>
Preferred language
</Typography>
<Typography
color={TypographyColor.Tertiary}
type={TypographyType.Callout}
>
Choose your preferred language for the post titles on the feed
</Typography>
</div>
<LanguageDropdown
className={{ container: 'w-full max-w-60' }}
name="language"
defaultValue={user.language}
onChange={(value) => onLanguageChange(value)}
icon={null}
/>
</section>
<Divider className="bg-border-subtlest-tertiary" />
<section className="flex flex-col gap-4" aria-busy={isLoading}>
<div className="flex flex-col">
<Typography
Expand Down
25 changes: 4 additions & 21 deletions packages/shared/src/components/filters/FeedFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,13 @@ import { UnblockSourceCopy, UnblockTagCopy } from './UnblockCopy';
import { ContentTypesFilter } from './ContentTypesFilter';
import { Source } from '../../graphql/sources';
import { webappUrl } from '../../lib/constants';
import {
ViewSize,
useConditionalFeature,
useFeeds,
useViewSize,
} from '../../hooks';
import { feature } from '../../lib/featureManagement';
import { useAuthContext } from '../../contexts/AuthContext';
import { ViewSize, useFeeds, useViewSize } from '../../hooks';

enum FilterMenuTitle {
MyFeed = 'My feed',
Tags = 'Manage tags',
ManageCategories = 'Manage categories',
ContentTypes = 'Content types',
ContentTypes = 'Content & Language',
Blocked = 'Blocked items',
}

Expand All @@ -48,7 +41,6 @@ const unBlockPromptOptions: PromptOptions = {
};

export default function FeedFilters(props: FeedFiltersProps): ReactElement {
const { isLoggedIn } = useAuthContext();
const { showPrompt } = usePrompt();
const unBlockPrompt = async ({ action, source, tag }: UnblockItem) => {
const description = tag ? (
Expand All @@ -66,15 +58,6 @@ export default function FeedFilters(props: FeedFiltersProps): ReactElement {

const filtersTab = FilterMenuTitle.MyFeed;

const { value: postTitleLanguageFeature } = useConditionalFeature({
feature: feature.postTitleLanguage,
shouldEvaluate: isLoggedIn,
});

const contentTypesTab = postTitleLanguageFeature
? 'Content & Language'
: FilterMenuTitle.ContentTypes;

const tabs = [
{
title: filtersTab,
Expand Down Expand Up @@ -104,7 +87,7 @@ export default function FeedFilters(props: FeedFiltersProps): ReactElement {
options: { icon: <FilterIcon />, group: 'Preference' },
},
{
title: contentTypesTab,
title: FilterMenuTitle.ContentTypes,
options: { icon: <AppIcon />, group: 'Preference' },
},
{
Expand Down Expand Up @@ -145,7 +128,7 @@ export default function FeedFilters(props: FeedFiltersProps): ReactElement {
<Modal.Body view={FilterMenuTitle.ManageCategories}>
<AdvancedSettingsFilter />
</Modal.Body>
<Modal.Body view={contentTypesTab}>
<Modal.Body view={FilterMenuTitle.ContentTypes}>
<ContentTypesFilter />
</Modal.Body>
<Modal.Body view={FilterMenuTitle.Blocked}>
Expand Down
9 changes: 1 addition & 8 deletions packages/shared/src/components/profile/LanguageDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { Dropdown, DropdownClassName } from '../fields/Dropdown';
import { LanguageIcon } from '../icons';
import { BaseFieldProps } from '../fields/BaseFieldContainer';
import { ContentLanguage, contnetLanguageToLabelMap } from '../../lib/user';
import { withExperiment } from '../withExperiment';
import { feature } from '../../lib/featureManagement';
import { IconProps } from '../Icon';

type ClassName = {
Expand All @@ -22,7 +20,7 @@ type Props = {

const defaultIcon = <LanguageIcon className="ml-0 mr-1" />;

const LanguageDropdownDefault = ({
export const LanguageDropdown = ({
className = {},
onChange,
hint = '',
Expand Down Expand Up @@ -108,8 +106,3 @@ const LanguageDropdownDefault = ({
</div>
);
};

export const LanguageDropdown = withExperiment(LanguageDropdownDefault, {
feature: feature.postTitleLanguage,
value: true,
});
1 change: 0 additions & 1 deletion packages/shared/src/lib/featureManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const feature = {
showRoadmap: new Feature('show_roadmap', true),
onboardingChecklist: new Feature('onboarding_checklist', true),
searchUsers: new Feature('search_users', false),
postTitleLanguage: new Feature('post_title_language', false),
};

export { feature };

0 comments on commit c4d72b4

Please sign in to comment.