Skip to content

Commit

Permalink
chore: cleanup experiment upvote counter always visible (#4030)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshanzel authored Jan 2, 2025
1 parent 9f1aebf commit 3fbbfb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ import { BookmarkButton } from '../../buttons';
import { IconSize } from '../../Icon';
import { useBlockPostPanel } from '../../../hooks/post/useBlockPostPanel';
import { useFeature } from '../../GrowthBookProvider';
import {
feedActionSpacing,
featureUpvoteCounter,
} from '../../../lib/featureManagement';
import { feedActionSpacing } from '../../../lib/featureManagement';

export interface ActionButtonsProps {
post: Post;
Expand All @@ -53,9 +50,7 @@ const ActionButtons = ({
const isDownvoteActive = post.userState?.vote === UserVote.Down;
const { onShowPanel, onClose } = useBlockPostPanel(post);
const feedActionSpacingExp = useFeature(feedActionSpacing);
const alwaysShowUpvoteCounter = useFeature(featureUpvoteCounter);
const isCounterVisible =
post.numUpvotes || alwaysShowUpvoteCounter || feedActionSpacingExp;
const isCounterVisible = post.numUpvotes || feedActionSpacingExp;

if (isFeedPreview) {
return null;
Expand Down Expand Up @@ -102,10 +97,7 @@ const ActionButtons = ({
<InteractionCounter
className={classNames(
'ml-1.5 tabular-nums',
!post.numUpvotes &&
feedActionSpacingExp &&
!alwaysShowUpvoteCounter &&
'invisible',
!post.numUpvotes && feedActionSpacingExp && 'invisible',
)}
value={post.numUpvotes}
/>
Expand Down
14 changes: 3 additions & 11 deletions packages/shared/src/components/cards/common/list/ActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ import type { ActionButtonsProps } from '../../ActionsButtons';
import { UpvoteButtonIcon } from '../../ActionsButtons/UpvoteButtonIcon';
import { BookmarkButton } from '../../../buttons';
import { useFeature } from '../../../GrowthBookProvider';
import {
feedActionSpacing,
featureUpvoteCounter,
} from '../../../../lib/featureManagement';
import { feedActionSpacing } from '../../../../lib/featureManagement';

interface ActionButtonsPropsList extends ActionButtonsProps {
onDownvoteClick?: (post: Post) => unknown;
Expand All @@ -45,9 +42,7 @@ export default function ActionButtons({
const { data, onShowPanel, onClose } = useBlockPostPanel(post);
const feedActionSpacingExp = useFeature(feedActionSpacing);
const { showTagsPanel } = data;
const alwaysShowUpvoteCounter = useFeature(featureUpvoteCounter);
const isCounterVisible =
post?.numUpvotes || alwaysShowUpvoteCounter || feedActionSpacingExp;
const isCounterVisible = post?.numUpvotes || feedActionSpacingExp;

if (isFeedPreview) {
return null;
Expand Down Expand Up @@ -109,10 +104,7 @@ export default function ActionButtons({
<InteractionCounter
className={classNames(
'ml-1.5 tabular-nums',
!post.numUpvotes &&
feedActionSpacingExp &&
!alwaysShowUpvoteCounter &&
'invisible',
!post.numUpvotes && feedActionSpacingExp && 'invisible',
)}
value={post?.numUpvotes}
/>
Expand Down
4 changes: 0 additions & 4 deletions packages/shared/src/lib/featureManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ export const plusImprovedEntryPoint = new Feature(
);
export const feedActionSpacing = new Feature('feed_action_spacing', false);
export const featureAutorotateAds = new Feature('autorotate_ads', 0);
export const featureUpvoteCounter = new Feature(
'always_visible_upvote_counter',
false,
);

export const featureOnboardingExtension = new Feature(
'onboarding_extension',
Expand Down

0 comments on commit 3fbbfb3

Please sign in to comment.