Skip to content

Commit

Permalink
fix: excluded OSCR from old contributor card list component (#3901)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline authored Aug 8, 2024
1 parent 28ec073 commit 446f27c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
25 changes: 19 additions & 6 deletions components/organisms/ContributorCard/contributor-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,21 @@ interface ContributorCardProps {
topic: string;
repositories?: number[];
range?: string;
// whether to show the OSCR rating or the login button
showOscr: boolean;
// exclude OSCR rating from the card
excludeOscr?: boolean;
}

const ContributorCard = ({ className, contributor, topic, repositories, range, showOscr }: ContributorCardProps) => {
const ContributorCard = ({
className,
contributor,
topic,
repositories,
range,
showOscr,
excludeOscr = false,
}: ContributorCardProps) => {
const username = "author_login" in contributor ? contributor.author_login : contributor.login;
const [showPRs, setShowPRs] = useState(false);
const githubAvatar = getAvatarByUsername(username);
Expand Down Expand Up @@ -59,11 +70,13 @@ const ContributorCard = ({ className, contributor, topic, repositories, range, s
<Link href={`/u/${username}`} as={`/u/${username}`}>
<Text className="!text-base !text-black">{username}</Text>
</Link>
<OscrPill
rating={contributor.oscr}
hideRating={!showOscr}
calculated={contributor.devstats_updated_at !== INITIAL_DEV_STATS_TIMESTAMP}
/>
{excludeOscr ? null : (
<OscrPill
rating={contributor.oscr}
hideRating={!showOscr}
calculated={contributor.devstats_updated_at !== INITIAL_DEV_STATS_TIMESTAMP}
/>
)}
</div>
<div className="flex gap-2 text-xs mt-1">
<div className="flex items-center gap-1 text-xs text-light-slate-11">
Expand Down
1 change: 1 addition & 0 deletions components/organisms/Contributors/contributors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ const Contributors = ({
topic={topic}
repositories={repositories}
showOscr={loggedIn}
excludeOscr={true}
/>
))}
</div>
Expand Down

0 comments on commit 446f27c

Please sign in to comment.