Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { FC } from "react";
import { useKeyFactorDelete } from "@/app/(main)/questions/[id]/components/key_factors/hooks";
import { KeyFactorItem } from "@/app/(main)/questions/[id]/components/key_factors/item_view";
import KeyFactorsCarousel from "@/app/(main)/questions/[id]/components/key_factors/key_factors_carousel";
import { useShouldHideKeyFactors } from "@/app/(main)/questions/[id]/components/key_factors/use_should_hide_key_factors";
import { useQuestionLayoutSafe } from "@/app/(main)/questions/[id]/components/question_layout/question_layout_context";
import { useAuth } from "@/contexts/auth_context";
import { KeyFactor } from "@/types/comment";
Expand All @@ -32,15 +31,13 @@ const KeyFactorsCommentSection: FC<Props> = ({
const { user } = useAuth();
const questionLayout = useQuestionLayoutSafe();
const { openDeleteModal } = useKeyFactorDelete();
const shouldHideKeyFactors = useShouldHideKeyFactors();

const canEdit =
user?.id === authorId || permission === ProjectPermissions.ADMIN;

const kfPostUrl = `${getPostLink(post)}#key-factors`;

// Don't render if there are no key factors for this comment or if hidden by A/B test
if (keyFactors.length === 0 || shouldHideKeyFactors) {
if (keyFactors.length === 0) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import KeyFactorDetailOverlay from "./key_factor_detail_overlay";
import KeyFactorsCarousel from "./key_factors_carousel";
import KeyFactorsConsumerCarousel from "./key_factors_consumer_carousel";
import { useShouldHideKeyFactors } from "./use_should_hide_key_factors";
import { useQuestionLayout } from "../question_layout/question_layout_context";

type Props = {
Expand All @@ -33,15 +32,12 @@ const KeyFactorsQuestionConsumerSection: FC<Props> = ({ post }) => {
openKeyFactorOverlay,
closeKeyFactorOverlay,
} = useQuestionLayout();
const shouldHideKeyFactors = useShouldHideKeyFactors();

const { items: topItems, totalCount } = useTopKeyFactorsCarouselItems({
keyFactors,
limit: MAX_TOP_KEY_FACTORS,
});

if (shouldHideKeyFactors) return null;

if (post.status === PostStatus.RESOLVED) return null;

const postForecastAvailability = isQuestionPost(post)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { sendAnalyticsEvent } from "@/utils/analytics";
import { getKeyFactorsLimits } from "./hooks";
import { useTopKeyFactorsCarouselItems } from "./hooks/use_top_key_factors_carousel_items";
import KeyFactorsConsumerCarousel from "./key_factors_consumer_carousel";
import { useShouldHideKeyFactors } from "./use_should_hide_key_factors";

type KeyFactorsQuestionSectionProps = {
post: PostWithForecasts;
Expand Down Expand Up @@ -46,7 +45,6 @@ const KeyFactorsQuestionSection: FC<KeyFactorsQuestionSectionProps> = ({
const { user } = useAuth();
const { keyFactorsExpanded } = useQuestionLayoutSafe() ?? {};
const { combinedKeyFactors } = useCommentsFeed();
const shouldHideKeyFactors = useShouldHideKeyFactors();
const [isSectionExpanded, setIsSectionExpanded] = useState(false);
const { aggregateCoherenceLinks } = useCoherenceLinksContext();

Expand Down Expand Up @@ -80,8 +78,6 @@ const KeyFactorsQuestionSection: FC<KeyFactorsQuestionSectionProps> = ({
}
}, [combinedKeyFactors]);

if (shouldHideKeyFactors) return null;

if (
CLOSED_STATUSES.includes(postStatus) &&
combinedKeyFactors.length === 0 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
KeyFactorTileQuestionLinkView,
type Props as KfDisplayProps,
} from "./key_factor_tile_view";
import { useShouldHideKeyFactors } from "../use_should_hide_key_factors";
import { isDisplayableQuestionLink } from "../utils";

type Props = {
Expand Down Expand Up @@ -67,7 +66,6 @@ const KeyFactorsTileView: React.FC<Props> = ({
className,
}) => {
const t = useTranslations();
const shouldHideKeyFactors = useShouldHideKeyFactors();
const [expandedIds, setExpandedIds] = useState<Array<KeyFactor["id"]>>([]);
const [isQuestionLinkExpanded, setIsQuestionLinkExpanded] = useState(false);

Expand Down Expand Up @@ -227,8 +225,6 @@ const KeyFactorsTileView: React.FC<Props> = ({
);
}, []);

if (shouldHideKeyFactors) return null;

if (post.status === PostStatus.RESOLVED) return null;

if (items.length === 0 && !questionLinkDisplay) return null;
Expand Down

This file was deleted.

Loading