Skip to content
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

fixed issue #965 Corrected Link Redirection of recent issues, updated tests and UI change. #1001

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/__tests__/e2e/pages/Home.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ test.describe('Home Page', () => {
test('should have recent issues', async ({ page }) => {
await expect(page.getByRole('heading', { name: 'Recent Issues' })).toBeVisible()
await expect(page.getByRole('heading', { name: 'Issue 1' })).toBeVisible()
await expect(page.getByText('Author 1').first()).toBeVisible()
await expect(page.getByText('Feb 24,').first()).toBeVisible()
await expect(page.getByText('5 comments')).toBeVisible()
})
Expand Down
2 changes: 0 additions & 2 deletions frontend/__tests__/e2e/pages/ProjectDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ test.describe('Project Details Page', () => {
await expect(page.getByRole('heading', { name: 'Recent Issues' })).toBeVisible()
await expect(page.getByRole('heading', { name: 'Fix authentication bug' })).toBeVisible()
await expect(page.getByRole('img', { name: 'Dave Debugger' })).toBeVisible()
await expect(page.getByText('Dave Debugger')).toBeVisible()
await expect(page.getByText('Feb 5, 2025')).toBeVisible()
await expect(page.getByText('5 comments')).toBeVisible()
})
Expand All @@ -80,7 +79,6 @@ test.describe('Project Details Page', () => {
await expect(page.getByRole('heading', { name: 'Recent Releases' })).toBeVisible()
await expect(page.getByRole('heading', { name: 'V1.2.0' })).toBeVisible()
await expect(page.getByRole('img', { name: 'Charlie Dev' })).toBeVisible()
await expect(page.getByText('Charlie Dev')).toBeVisible()
await expect(page.getByText('Jan 20, 2025')).toBeVisible()
})

Expand Down
2 changes: 0 additions & 2 deletions frontend/__tests__/e2e/pages/RepositoryDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ test.describe('Repository Details Page', () => {
await expect(page.getByRole('heading', { name: 'Recent Issues' })).toBeVisible()
await expect(page.getByRole('heading', { name: 'Bug fix required' })).toBeVisible()
await expect(page.getByRole('img', { name: 'Test User 1' })).toBeVisible()
await expect(page.getByText('Test User 2')).toBeVisible()
await expect(page.getByText('Jan 2, 2024')).toBeVisible()
await expect(page.getByText('4 comments')).toBeVisible()
})
Expand All @@ -75,7 +74,6 @@ test.describe('Repository Details Page', () => {
await expect(page.getByRole('heading', { name: 'Recent Releases' })).toBeVisible()
await expect(page.getByRole('heading', { name: 'v1.0.0' })).toBeVisible()
await expect(page.getByRole('img', { name: 'Test User 2' })).toBeVisible()
await expect(page.getByText('Test User 2')).toBeVisible()
await expect(page.getByText('Jan 1, 2024', { exact: true })).toBeVisible()
})
})
2 changes: 0 additions & 2 deletions frontend/__tests__/unit/pages/ProjectDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ describe('ProjectDetailsPage', () => {
issues.forEach((issue) => {
expect(screen.getByText(issue.title)).toBeInTheDocument()

expect(screen.getAllByText(issue.author.name).length).toBeGreaterThan(0)

expect(screen.getByText(`${issue.commentsCount} comments`)).toBeInTheDocument()
})
})
Expand Down
2 changes: 0 additions & 2 deletions frontend/__tests__/unit/pages/RepositoryDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ describe('RepositoryDetailsPage', () => {
issues.forEach((issue) => {
expect(screen.getByText(issue.title)).toBeInTheDocument()

expect(screen.getAllByText(issue.author.name).length).toBeGreaterThan(0)

expect(screen.getByText(`${issue.commentsCount} comments`)).toBeInTheDocument()
})
})
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/api/queries/projectQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ export const GET_PROJECT_DATA = gql`
title
commentsCount
createdAt
url
author {
avatarUrl
login
name
url
}
}
recentReleases {
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/CardDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ const DetailsCard = ({
<div className="mt-2 flex items-center text-sm text-gray-600 dark:text-gray-400">
<FontAwesomeIcon icon={faCalendar} className="mr-2 h-4 w-4" />
<span>{formatDate(item.createdAt)}</span>
<FontAwesomeIcon icon={faFileCode} className="ml-4 mr-2 h-4 w-4" />
<span>{item.commentsCount} comments</span>
{item?.commentsCount ? (
<>
<FontAwesomeIcon icon={faFileCode} className="ml-4 mr-2 h-4 w-4" />
<span>{item.commentsCount} comments</span>
</>
) : null}
</div>
)}
/>
Expand Down
29 changes: 13 additions & 16 deletions frontend/src/components/ItemCardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,26 @@ const ItemCardList = ({
{data && data.length > 0 ? (
<div className="h-64 overflow-y-auto pr-2">
{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">
<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">
<div className="flex items-center">
<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">
<a
href={`/community/users/${item?.author?.login}`}
className="flex-shrink-0 text-blue-400 hover:underline dark:text-blue-200"
>
<img
src={item?.author?.avatarUrl}
alt={item?.author?.name}
className="mr-2 h-6 w-6 rounded-full"
/>
<a
href={item?.author?.url}
className="text-blue-400 hover:underline dark:text-blue-200"
>
{item?.author?.name || item?.author?.login}
</a>
<h3 className="flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-semibold">
<a href={item?.url} className="text-blue-500 hover:underline dark:text-blue-400">
{item.title || item.name}
</a>
</div>
</h3>
</div>
<div>{renderDetails(item)}</div>
<div className="ml-0.5 w-full">{renderDetails(item)}</div>
</div>
</div>
))}
Expand Down