-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
188 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// 'use client'; | ||
|
||
import GridContainer from '@/components/GridContainer'; | ||
import { IoGitPullRequestSharp, IoGitMergeSharp } from 'react-icons/io5'; | ||
import { RiGitClosePullRequestLine } from 'react-icons/ri'; | ||
|
||
const PrIcon = ({ status }) => { | ||
if (status === 'MERGED') { | ||
return ( | ||
<div className="rounded bg-purple-500 p-[3px] text-white"> | ||
<IoGitMergeSharp /> | ||
</div> | ||
); | ||
} | ||
|
||
if (status === 'CLOSED') { | ||
return ( | ||
<div className="rounded bg-red-500 p-[3px] text-white"> | ||
<RiGitClosePullRequestLine /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="rounded bg-green-600 p-[3px] text-white"> | ||
<IoGitPullRequestSharp /> | ||
</div> | ||
); | ||
}; | ||
|
||
const TopContributions = ({ contributions }) => { | ||
return ( | ||
<GridContainer name="Top Contributions" className={'grid-cols-1 md:grid-cols-3'}> | ||
{contributions.map(({ repository, contributions }, i) => ( | ||
<div key={i} className="box flex flex-col gap-5 px-4 py-3 text-left"> | ||
<h3 className="flex items-center gap-2 text-lg font-bold"> | ||
<img className="mr-1 size-11 rounded-md" src={repository.owner.avatarUrl} /> | ||
|
||
<div> | ||
<p>{repository.name}</p> | ||
<p className="-mt-1 text-sm text-gray-400">@{repository.owner.login}</p> | ||
</div> | ||
|
||
<p className="ml-auto rounded-md border border-gray-600 bg-gray-700 p-1.5"> | ||
{contributions.totalCount < 10 ? `0${contributions.totalCount}` : contributions.totalCount} | ||
</p> | ||
</h3> | ||
|
||
<ul className="space-y-1"> | ||
{contributions.nodes.splice(0, 3).map(({ pullRequest }, i) => ( | ||
<div key={i} className="flex items-center justify-between gap-2 "> | ||
<p className="line-clamp-1 font-medium">{pullRequest.title}</p> | ||
<PrIcon status={pullRequest.state} /> | ||
</div> | ||
))} | ||
</ul> | ||
</div> | ||
))} | ||
|
||
|
||
</GridContainer> | ||
); | ||
}; | ||
|
||
export default TopContributions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { VscRepo } from 'react-icons/vsc'; | ||
import { GoRepoForked } from 'react-icons/go'; | ||
import { GoIssueOpened } from 'react-icons/go'; | ||
import { FaRegStar } from 'react-icons/fa'; | ||
import { FaCodePullRequest } from 'react-icons/fa6'; | ||
|
||
const RepoCard = props => { | ||
return ( | ||
<div className="box flex flex-col px-4 py-3 text-left"> | ||
<h3 className="flex items-center gap-2 text-lg font-bold"> | ||
<VscRepo /> {props.name} | ||
</h3> | ||
<p className="mb-3 mt-2 line-clamp-3 text-sm font-medium text-gray-400"> | ||
{props.description || 'No description'} | ||
</p> | ||
|
||
<div className="mt-auto flex items-center justify-between gap-4 text-sm font-medium md:justify-start"> | ||
<p className="flex items-center gap-2 text-gray-300"> | ||
<span | ||
className="size-3 rounded-full" | ||
style={{ | ||
backgroundColor: props.primaryLanguage?.color || '#ccc', | ||
}} | ||
></span> | ||
<span>{props.primaryLanguage?.name || 'Unknown'}</span> | ||
</p> | ||
<p className="flex items-center gap-1"> | ||
<FaRegStar /> {props.stargazerCount} | ||
</p> | ||
<p className="flex items-center gap-1"> | ||
<GoRepoForked /> {props.forkCount} | ||
</p> | ||
<p className="hidden items-center gap-1 md:flex"> | ||
<GoIssueOpened /> {props.issues.totalCount} | ||
</p> | ||
<p className="flex items-center gap-1"> | ||
<FaCodePullRequest /> {props.pullRequests.totalCount} | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RepoCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters