-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix: stats layout and add tooltips #101
Changes from 1 commit
accbff5
8d3e6ed
23010eb
08e2254
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,58 +13,86 @@ export const RepositoryContributionsCard = ({ | |
contributions: Contributions; | ||
}) => { | ||
return ( | ||
<div className="card bg-base-100"> | ||
<div className="card-body"> | ||
<h2 className="card-title flex justify-between"> | ||
<div className="flex justify-center items-center gap-2"> | ||
<Image | ||
src={repository.owner.avatarUrl} | ||
alt={repository.owner.login} | ||
width={40} | ||
height={40} | ||
className="rounded-full" | ||
/> | ||
<Link | ||
href={`https://github.com/${repository.owner.login}/${repository.name}`} | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
className="hover:underline" | ||
aria-label={`${repository.name}`} | ||
> | ||
{repository.owner.login}/{repository.name} | ||
</Link> | ||
</div> | ||
<div className="tooltip tooltip-left" data-tip="Total contributions"> | ||
<div className="rounded outline outline-1 cursor-default px-2"> | ||
{totalCount} | ||
</div> | ||
</div> | ||
</h2> | ||
<div className="max-h-[22rem] hide-scrollbar overflow-auto flex flex-col gap-1"> | ||
{nodes?.map(({ pullRequest: { state, title, id, url } }: any) => ( | ||
<div key={id} className="flex items-center justify-between gap-2"> | ||
<a href={url} target="_blank" className="truncate" title={title}> | ||
{title} | ||
</a> | ||
<span | ||
className={`h-fit rounded p-1 ${ | ||
state === "MERGED" | ||
? "bg-purple-500" | ||
: state === "CLOSED" | ||
? "bg-red-500" | ||
: "bg-green-500" | ||
}`} | ||
<div className="card bg-base-100 overflow-visible"> | ||
<div className="sm:w-auto card bg-base-100 repository-card"> | ||
<div className="card-body"> | ||
<div className="card-title flex items-center justify-between"> | ||
<div className="flex items-center space-x-2 flex-grow"> | ||
<Image | ||
src={repository.owner.avatarUrl} | ||
alt={repository.owner.login} | ||
width={40} | ||
height={40} | ||
className="rounded-full" | ||
/> | ||
<div | ||
className="grid grid-flow-col gap-2 flex-grow tooltip text-left" | ||
data-tip={`${repository.owner.login}/${repository.name}`} | ||
> | ||
{state === "MERGED" ? ( | ||
<FaCodeMerge size={18} /> | ||
) : state === "CLOSED" ? ( | ||
<IoIosCloseCircleOutline size={18} /> | ||
) : ( | ||
<GoIssueOpened size={18} /> | ||
)} | ||
</span> | ||
<Link | ||
href={`https://github.com/${repository.owner.login}/${repository.name}`} | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
className="hover:underline truncate flex-grow" | ||
aria-label={`${repository.name}`} | ||
> | ||
<h3 className="logged-user truncate"> | ||
{repository.owner.login}/{repository.name} | ||
</h3> | ||
</Link> | ||
</div> | ||
<div | ||
className="tooltip tooltip-left" | ||
data-tip="Total contributions" | ||
> | ||
<div className="rounded outline outline-1 cursor-default px-2"> | ||
{totalCount} | ||
</div> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
<div className="max-h-[22rem] hide-scrollbar overflow-auto flex flex-col gap-1"> | ||
{nodes?.map( | ||
( | ||
{ pullRequest: { state, title, id, url } }: any, | ||
index: number | ||
) => ( | ||
<div | ||
key={id} | ||
className={`flex items-center justify-between gap-2 tooltip text-left ${ | ||
index === 0 ? "tooltip-bottom" : "tooltip-top" | ||
}`} | ||
data-tip={title} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a workaround for correctly displaying the tooltips. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The workaround is fine if you have 2+ PRs, but in case you only have one it won't appear. We need to find a different solution There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ouch, I didn't notice it. And it makes sense it doesn't work. We need to find another way 🤔 |
||
> | ||
<a | ||
href={url} | ||
target="_blank" | ||
className="truncate" | ||
title={title} | ||
> | ||
{title} | ||
</a> | ||
<span | ||
className={`h-fit rounded p-1 ${ | ||
state === "MERGED" | ||
? "bg-purple-500" | ||
: state === "CLOSED" | ||
? "bg-red-500" | ||
: "bg-green-500" | ||
}`} | ||
> | ||
{state === "MERGED" ? ( | ||
<FaCodeMerge size={18} /> | ||
) : state === "CLOSED" ? ( | ||
<IoIosCloseCircleOutline size={18} /> | ||
) : ( | ||
<GoIssueOpened size={18} /> | ||
)} | ||
</span> | ||
</div> | ||
) | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add a better type here than
any
, I think there's already a type intypes/github.ts
for that