Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add placeholder to contribution panel #675

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -8,15 +8,17 @@ import { DescriptionProps } from "./description.types";
const Emoji = dynamic(() => import("react-emoji-render"));

export function Description({ description }: DescriptionProps) {
if (!description) return null;

return (
<Paper size={"lg"} border={"primary"} classNames={{ base: "flex flex-col gap-lg" }}>
<Typo size={"sm"} weight={"medium"} translate={{ token: "common:description" }} />

<Typo as={"p"} size={"xs"} color={"secondary"}>
<Emoji>{description}</Emoji>
</Typo>
{description ? (
<Typo as={"p"} size={"xs"} color={"secondary"}>
<Emoji>{description}</Emoji>
</Typo>
) : (
<Typo as={"p"} size={"xs"} color={"secondary"} translate={{ token: "panels:contribution.description.empty" }} />
)}
</Paper>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,27 @@ function LinkedIssues({ issueIds }: { issueIds?: string[] }) {
);
}

export function IssueOverview({ contribution }: IssueOverviewProps) {
if (contribution.isPullRequest()) {
return (
<LinkedIssues issueIds={contribution.linkedIssues?.map(issue => issue.contributionUuid ?? "").filter(Boolean)} />
);
}

export function IssueOverview({ contribution, showLinkedIssues }: IssueOverviewProps) {
return (
<Card
type={contribution.type}
githubTitle={contribution.githubTitle}
githubStatus={contribution.githubStatus}
githubNumber={contribution.githubNumber}
lastUpdatedAt={contribution.lastUpdatedAt}
githubLabels={contribution.githubLabels}
languages={contribution.languages}
repo={contribution.repo}
linkedIssues={contribution.linkedIssues}
rewardUsdAmount={contribution.totalRewardedUsdAmount}
/>
<>
<Card
type={contribution.type}
githubTitle={contribution.githubTitle}
githubStatus={contribution.githubStatus}
githubNumber={contribution.githubNumber}
lastUpdatedAt={contribution.lastUpdatedAt}
githubLabels={contribution.githubLabels}
languages={contribution.languages}
repo={contribution.repo}
linkedIssues={contribution.linkedIssues}
haydencleary marked this conversation as resolved.
Show resolved Hide resolved
rewardUsdAmount={contribution.totalRewardedUsdAmount}
/>

{showLinkedIssues && contribution.isPullRequest() ? (
<LinkedIssues
issueIds={contribution.linkedIssues?.map(issue => issue.contributionUuid ?? "").filter(Boolean)}
/>
) : null}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import { ContributionActivityInterface } from "@/core/domain/contribution/models

export interface IssueOverviewProps {
contribution: ContributionActivityInterface;
showLinkedIssues?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,8 @@
},
"githubComment": {
"title": "Github comment"
},
"description": {
"empty": "No description provided"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function useContributionBlocksAsContributor({ contribution }: UseContributionBlo
if (contribution.isToReview()) {
return (
<>
<IssueOverview contribution={contribution} />
<IssueOverview contribution={contribution} showLinkedIssues={true} />
<RewardedCardWrapper contribution={contribution} recipientIds={recipientIds} />
<Description description={contribution.githubBody} />
{/*// Timeline*/}
Expand All @@ -163,7 +163,7 @@ function useContributionBlocksAsContributor({ contribution }: UseContributionBlo
if (contribution.isArchived() || contribution.isDone()) {
return (
<>
<IssueOverview contribution={contribution} />
<IssueOverview contribution={contribution} showLinkedIssues={true} />
<RewardedCardWrapper contribution={contribution} recipientIds={recipientIds} />
<UserCard
title={{ translate: { token: "panels:contribution.userCard.mergedBy" } }}
Expand Down