Skip to content
Merged
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 @@ -20,7 +20,6 @@ const QuestionLayout: React.FC<PropsWithChildren<Props>> = ({
return (
<QuestionLayoutProvider>
<QuestionVariantComposer
postData={postData}
consumer={
<ConsumerQuestionLayout
postData={postData}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const QuestionInfo: React.FC<Props> = ({
)}

<QuestionVariantComposer
postData={postData}
forecaster={<PostScoreData post={postData} />}
consumer={
<div className="hidden sm:block">
Expand All @@ -65,7 +64,6 @@ const QuestionInfo: React.FC<Props> = ({
<BackgroundInfo post={postData} />

<QuestionVariantComposer
postData={postData}
consumer={
isGroupOfQuestionsPost(postData) &&
postData.group_of_questions.graph_type ===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import { useFeatureFlagVariantKey } from "posthog-js/react";
import { ReactNode } from "react";

import { useAuth } from "@/contexts/auth_context";
import { PostWithForecasts } from "@/types/post";
import { CurrentUser, InterfaceType } from "@/types/users";
import { isConditionalPost, isNotebookPost } from "@/utils/questions/helpers";

type Variant = "forecaster" | "consumer";
const FLAG_KEY = "logged_out_question_view_variant";

export type QuestionVariantComposerProps = {
postData: PostWithForecasts;
consumer: ReactNode;
forecaster: ReactNode;
};
Expand All @@ -26,7 +23,6 @@ function getVariantFromUser(user: CurrentUser | null): Variant | null {
}

export const QuestionVariantComposer = ({
postData,
consumer,
forecaster,
}: QuestionVariantComposerProps) => {
Expand All @@ -38,10 +34,7 @@ export const QuestionVariantComposer = ({
return <>{forcedByUser === "consumer" ? consumer : forecaster}</>;
}

const isEligibleLoggedOut =
isNil(user) && !isNotebookPost(postData) && !isConditionalPost(postData);

if (isEligibleLoggedOut) {
if (isNil(user)) {
const v = flagVariant === "forecaster" ? "forecaster" : "consumer";
return <>{v === "consumer" ? consumer : forecaster}</>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const QuestionView: React.FC<Props> = ({
}) => {
return (
<QuestionVariantComposer
postData={postData}
consumer={<ConsumerQuestionView postData={postData} />}
forecaster={
<ForecasterQuestionView
Expand Down
1 change: 0 additions & 1 deletion front_end/src/components/posts_feed/paginated_feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ const PaginatedPostsFeed: FC<Props> = ({

return (
<QuestionVariantComposer
postData={post}
consumer={
<ConsumerPostCard
post={post}
Expand Down
Loading