Skip to content

Commit bb02233

Browse files
committed
Refactor BasicPostControls to use minimalistic prop
1 parent d722912 commit bb02233

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

front_end/src/components/post_card/basic_post_card/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const BasicPostCard: FC<PropsWithChildren<Props>> = ({
8484
{children}
8585
</Link>
8686
<div className="mt-auto" />
87-
<BasicPostControls post={post} withVoter={!minimalistic} />
87+
<BasicPostControls post={post} minimalistic={minimalistic} />
8888
{!minimalistic && isQuestionPost(post) && (
8989
<CoherenceLinksProvider post={post}>
9090
<KeyFactorsTileView post={post} />

front_end/src/components/post_card/basic_post_card/post_controls.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import PostVoter from "./post_voter";
1414

1515
type Props = {
1616
post: Post;
17-
withVoter?: boolean;
17+
minimalistic?: boolean;
1818
};
1919

2020
const BasicPostControls: FC<PropsWithChildren<Props>> = ({
2121
post,
22-
withVoter = true,
22+
minimalistic = false,
2323
}) => {
2424
const resolutionData = extractPostResolution(post);
2525
const defaultProject = post.projects.default_project;
@@ -29,12 +29,14 @@ const BasicPostControls: FC<PropsWithChildren<Props>> = ({
2929
const projectNameLength = defaultProject?.name.length ?? 0;
3030

3131
const shouldUseCompactPostStatus =
32-
projectNameLength >= 30 || (hasUnreadMessages && projectNameLength > 15);
32+
projectNameLength >= 30 ||
33+
(hasUnreadMessages && projectNameLength > 15) ||
34+
minimalistic;
3335

3436
return (
3537
<div className="mt-3 flex items-center justify-between rounded-ee rounded-es dark:border-blue-400-dark max-lg:flex-1">
3638
<div className="flex items-center gap-1.5 md:gap-2">
37-
{withVoter && <PostVoter post={post} />}
39+
{!minimalistic && <PostVoter post={post} />}
3840

3941
{/* CommentStatus - compact on small screens, full on large screens */}
4042
<CommentStatus
@@ -74,12 +76,14 @@ const BasicPostControls: FC<PropsWithChildren<Props>> = ({
7476
/>
7577
<ForecastersCounter
7678
forecasters={post.nr_forecasters}
77-
compact={false}
79+
compact={minimalistic}
7880
className="hidden md:flex"
7981
/>
8082
</div>
8183
<div className="hidden overflow-hidden lg:inline-flex">
82-
<PostDefaultProject defaultProject={defaultProject} />
84+
{!minimalistic && (
85+
<PostDefaultProject defaultProject={defaultProject} />
86+
)}
8387
</div>
8488
</div>
8589
);

0 commit comments

Comments
 (0)