Skip to content

Fix Recent Releases Card: Show Tag as Fallback and Correct Release URLs #1566

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
19 changes: 11 additions & 8 deletions frontend/src/components/RecentReleases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ const RecentReleases: React.FC<RecentReleasesProps> = ({
<div key={index} className="mb-4 w-full rounded-lg bg-gray-200 p-4 dark:bg-gray-700">
<div className="flex w-full flex-col justify-between">
<div className="flex w-full items-center">
{showAvatar && (
{showAvatar && item?.author && (
<Tooltip
closeDelay={100}
content={item?.author?.name || item?.author?.login}
content={item?.author?.name ?? item?.author?.login}
id={`avatar-tooltip-${index}`}
delay={100}
placement="bottom"
showArrow
>
<Link
className="flex-shrink-0 text-blue-400 hover:underline"
href={`/members/${item?.author?.login}`}
href={item?.author?.login ? `/members/${item?.author?.login}` : '#'}
>
<Image
alt={item?.author?.name || 'author'}
alt={item?.author?.name ?? 'author'}
className="mr-2 h-6 w-6 rounded-full"
height={24}
src={item?.author?.avatarUrl || ''}
src={item?.author?.avatarUrl ?? ''}
width={24}
/>
</Link>
Expand All @@ -67,11 +67,14 @@ const RecentReleases: React.FC<RecentReleasesProps> = ({
<h3 className="flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-semibold">
<Link
className="text-blue-400 hover:underline"
href={item?.url || '/'}
href={
item.url ??
`https://github.com/${item.organizationName}/${item.repositoryName}/releases/tag/${item.tagName}`
}
target="_blank"
rel="noopener noreferrer"
>
<TruncatedText text={item?.name} />
<TruncatedText text={item?.name || item?.tagName} />
</Link>
</h3>
</div>
Expand All @@ -86,7 +89,7 @@ const RecentReleases: React.FC<RecentReleasesProps> = ({
className="cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap text-gray-600 hover:underline dark:text-gray-400"
onClick={() =>
router.push(
`/organizations/${item?.organizationName}/repositories/${item.repositoryName || ''}`
`/organizations/${item?.organizationName}/repositories/${item.repositoryName ?? ''}`
)
}
>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/server/queries/repositoryQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const GET_REPOSITORY_DATA = gql`
name
login
}
url
isPreRelease
name
organizationName
Expand Down