Skip to content

Commit

Permalink
Added url for user and issue on project detail page (#941)
Browse files Browse the repository at this point in the history
* ui: url for user and issue on project detail page

Signed-off-by: Akash Jaiswal <akashjaiswal3846@gmail.com>

* fix: in dark mode

Signed-off-by: Akash Jaiswal <akashjaiswal3846@gmail.com>

* fix: username of user if name is missing

Signed-off-by: Akash Jaiswal <akashjaiswal3846@gmail.com>

---------

Signed-off-by: Akash Jaiswal <akashjaiswal3846@gmail.com>
  • Loading branch information
jaiakash authored Feb 28, 2025
1 parent 3f167d4 commit 6b35f69
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions backend/apps/github/graphql/nodes/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Meta:
"author",
"comments_count",
"created_at",
"url",
"number",
"state",
"title",
Expand Down
1 change: 1 addition & 0 deletions backend/tests/github/graphql/nodes/issue_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_meta_configuration(self):
"created_at",
"number",
"state",
"url",
"title",
}
assert set(IssueNode._meta.fields) == expected_fields
2 changes: 2 additions & 0 deletions frontend/__tests__/e2e/data/mockHomeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const mockHomeData = {
author: {
avatarUrl: '/~https://avatars.githubusercontent.com/u/1?v=4',
name: 'Author 1',
url: '/~https://github.com/arkid15r',
__typename: 'UserNode',
},
__typename: 'IssueNode',
Expand All @@ -140,6 +141,7 @@ export const mockHomeData = {
author: {
avatarUrl: '/~https://avatars.githubusercontent.com/u/2?v=4',
name: 'Author 2',
url: '/~https://github.com/arkid15r',
__typename: 'UserNode',
},
__typename: 'IssueNode',
Expand Down
1 change: 1 addition & 0 deletions frontend/__tests__/unit/data/mockHomeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const mockGraphQLData = {
title: 'Documentation : Project Setup Documentation Update',
author: {
avatarUrl: '/~https://avatars.githubusercontent.com/u/134638667?v=4',
url: '/~https://github.com/arkid15r',
name: 'Raj gupta',
},
},
Expand Down
1 change: 1 addition & 0 deletions frontend/__tests__/unit/data/mockProjectDetailsData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const mockProjectDetailsData = {
author: {
avatarUrl: 'https://example.com/avatar4.png',
login: 'dave_debugger',
url: '/~https://github.com/arkid15r',
name: 'Dave Debugger',
},
},
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/api/queries/homeQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ export const GET_MAIN_PAGE_DATA = gql`
createdAt
number
title
url
author {
avatarUrl
login
name
url
}
}
recentReleases(limit: 5) {
Expand Down
15 changes: 11 additions & 4 deletions frontend/src/components/ItemCardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,25 @@ const ItemCardList = ({
{data.map((item, index) => (
<div key={index} className="mb-4 rounded-lg bg-gray-200 p-4 dark:bg-gray-700">
<h3 className="overflow-hidden text-ellipsis whitespace-nowrap font-semibold">
{item.title || item.name}
<a href={item?.url} className="text-blue-500 hover:underline dark:text-blue-400">
{item.title || item.name}
</a>
</h3>
<div className="flex flex-grow-0 flex-col justify-between lg:flex-row">
<div className="mt-2 flex items-center">
{item?.author?.name && (
<div className="flex items-center">
<img
src={item?.author?.avatarUrl}
alt={item?.author?.name}
className="mr-2 h-6 w-6 rounded-full"
/>
)}
<span>{item?.author?.name || item?.author?.login}</span>
<a
href={item?.author?.url}
className="text-blue-400 hover:underline dark:text-blue-200"
>
{item?.author?.name || item?.author?.login}
</a>
</div>
</div>
<div>{renderDetails(item)}</div>
</div>
Expand Down

0 comments on commit 6b35f69

Please sign in to comment.