Skip to content

Commit 857041c

Browse files
committed
implemented suggestions
1 parent ce1c571 commit 857041c

File tree

11 files changed

+52
-27
lines changed

11 files changed

+52
-27
lines changed

frontend/__tests__/unit/components/CardDetailsPage.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ describe('CardDetailsPage', () => {
518518

519519
const mockPullRequests = [
520520
{
521+
id: 'mock-pull-request-1',
521522
author: mockUser,
522523
createdAt: new Date(Date.now() - 172800000).toISOString(),
523524
organizationName: 'test-org',

frontend/__tests__/unit/components/ItemCardList.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ const mockMilestone: Milestone = {
148148
}
149149

150150
const mockPullRequest: PullRequest = {
151+
id: 'mock-pull-request-id',
151152
author: {
152153
...mockUser,
153154
login: 'author3',

frontend/__tests__/unit/components/RecentPullRequests.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const mockUser = {
4040

4141
const minimalData = [
4242
{
43+
id: 'mock-pull-request',
4344
author: mockUser,
4445
createdAt: '2024-06-01T12:00:00Z',
4546
organizationName: 'test-org',
@@ -51,6 +52,7 @@ const minimalData = [
5152

5253
const noRepoData = [
5354
{
55+
id: 'mock-pull-request',
5456
author: mockUser,
5557
createdAt: '2024-06-01T12:00:00Z',
5658
organizationName: 'test-org',

frontend/__tests__/unit/data/mockOrganizationData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const mockOrganizationDetailsData = {
7676
],
7777
recentPullRequests: [
7878
{
79+
id: 'mock-org-pr-1',
7980
title: 'Test Pull Request 1',
8081
createdAt: 1727390000,
8182
url: 'https://github.com/test-org/test-repo-1/pull/1',
@@ -85,6 +86,7 @@ export const mockOrganizationDetailsData = {
8586
},
8687
},
8788
{
89+
id: 'mock-org-pr-2',
8890
title: 'Test Pull Request 2',
8991
createdAt: 1727380000,
9092
url: 'https://github.com/test-org/test-repo-2/pull/2',

frontend/__tests__/unit/data/mockProjectDetailsData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const mockProjectDetailsData = {
101101
],
102102
recentPullRequests: [
103103
{
104+
id: 'mock-project-pr-1',
104105
author: {
105106
avatarUrl: 'https://avatars.githubusercontent.com/u/11111?v=4',
106107
login: 'user1',
@@ -110,6 +111,7 @@ export const mockProjectDetailsData = {
110111
url: 'https://github.com/test-org/test-repo-1/pull/1',
111112
},
112113
{
114+
id: 'mock-project-pr-2',
113115
author: {
114116
avatarUrl: 'https://avatars.githubusercontent.com/u/22222?v=4',
115117
login: 'user2',

frontend/__tests__/unit/data/mockRepositoryData.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const mockRepositoryData = {
6262
},
6363
recentPullRequests: [
6464
{
65+
id: 'mock-repo-pr-1',
6566
title: 'Test Pull Request 1',
6667
createdAt: 1727390000,
6768
url: 'https://github.com/test-org/test-repo-1/pull/1',
@@ -71,6 +72,7 @@ export const mockRepositoryData = {
7172
},
7273
},
7374
{
75+
id: 'mock-repo-pr-2',
7476
title: 'Test Pull Request 2',
7577
createdAt: 1727380000,
7678
url: 'https://github.com/test-org/test-repo-2/pull/2',

frontend/__tests__/unit/data/mockUserDetails.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const mockUserDetailsData = {
4545
],
4646
recentPullRequests: [
4747
{
48+
id: 'mock-user-pr-1',
4849
createdAt: 1723002473,
4950
repositoryName: 'test-repo-3',
5051
title: 'Test Pull Request',

frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/issues/[issueId]/page.tsx

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,17 @@ const ModuleIssueDetailsPage = () => {
160160
href={`/members/${a.login}`}
161161
className="inline-flex items-center gap-2 text-blue-600 hover:underline dark:text-blue-400"
162162
>
163-
<Image
164-
src={a.avatarUrl}
165-
alt={a.login}
166-
width={32}
167-
height={32}
168-
className="rounded-full"
169-
/>
163+
{a.avatarUrl ? (
164+
<Image
165+
src={a.avatarUrl}
166+
alt={a.login}
167+
width={32}
168+
height={32}
169+
className="rounded-full"
170+
/>
171+
) : (
172+
<div className="h-8 w-8 rounded-full bg-gray-400" aria-hidden="true" />
173+
)}
170174
<span className="text-sm font-medium">{a.login || a.name}</span>
171175
</Link>
172176
<button
@@ -204,13 +208,17 @@ const ModuleIssueDetailsPage = () => {
204208
className="flex items-center justify-between gap-3 rounded-lg bg-gray-200 p-4 dark:bg-gray-700"
205209
>
206210
<div className="flex items-center gap-3">
207-
<Image
208-
src={pr.author?.avatarUrl}
209-
alt={pr.author?.login || 'Unknown'}
210-
width={32}
211-
height={32}
212-
className="rounded-full"
213-
/>
211+
{pr.author?.avatarUrl ? (
212+
<Image
213+
src={pr.author.avatarUrl}
214+
alt={pr.author?.login || 'Unknown'}
215+
width={32}
216+
height={32}
217+
className="rounded-full"
218+
/>
219+
) : (
220+
<div className="h-8 w-8 rounded-full bg-gray-400" aria-hidden="true" />
221+
)}
214222
<div className="min-w-0 flex-1">
215223
<Link
216224
href={pr.url}
@@ -255,13 +263,17 @@ const ModuleIssueDetailsPage = () => {
255263
className="flex items-center justify-between gap-2 rounded-lg bg-gray-200 p-3 dark:bg-gray-700"
256264
>
257265
<div className="inline-flex items-center gap-2">
258-
<Image
259-
src={u.avatarUrl}
260-
alt={u.login}
261-
width={32}
262-
height={32}
263-
className="rounded-full"
264-
/>
266+
{u.avatarUrl ? (
267+
<Image
268+
src={u.avatarUrl}
269+
alt={u.login}
270+
width={32}
271+
height={32}
272+
className="rounded-full"
273+
/>
274+
) : (
275+
<div className="h-8 w-8 rounded-full bg-gray-400" aria-hidden="true" />
276+
)}
265277
<span className="text-sm font-medium">@{u.login}</span>
266278
</div>
267279
<button

frontend/src/app/my/mentorship/programs/[programKey]/modules/[moduleKey]/issues/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ const IssuesPage = () => {
9292
trigger: 'bg-gray-200 dark:bg-[#323232] pl-0 text-nowrap w-40',
9393
popoverContent: 'text-md min-w-40 dark:bg-[#323232] rounded-none p-0',
9494
}}
95-
selectedKeys={[selectedLabel]}
96-
onChange={(e) => handleLabelChange((e.target as HTMLSelectElement).value)}
95+
selectedKeys={new Set([selectedLabel])}
96+
onSelectionChange={(keys) => {
97+
const [key] = Array.from(keys as Set<string>)
98+
if (key) handleLabelChange(key)
99+
}}
97100
>
98101
{[LABEL_ALL, ...allLabels].map((l) => (
99102
<SelectItem

frontend/src/components/CardDetailsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const DetailsCard = ({
8787
<div className="flex items-center gap-2">
8888
<button
8989
type="button"
90-
className="dark:hover:text-white' flex items-center justify-center gap-2 rounded-md border border-[#1D7BD7] bg-transparent px-2 py-2 text-nowrap text-[#1D7BD7] hover:bg-[#1D7BD7] hover:text-white"
90+
className="flex items-center justify-center gap-2 rounded-md border border-[#1D7BD7] bg-transparent px-2 py-2 text-nowrap text-[#1D7BD7] hover:bg-[#1D7BD7] hover:text-white dark:hover:text-white"
9191
onClick={() => {
9292
router.push(`${window.location.pathname}/issues`)
9393
}}
@@ -96,7 +96,7 @@ const DetailsCard = ({
9696
</button>
9797
<button
9898
type="button"
99-
className="dark:hover:text-white' flex items-center justify-center gap-2 rounded-md border border-[#1D7BD7] bg-transparent px-2 py-2 text-nowrap text-[#1D7BD7] hover:bg-[#1D7BD7] hover:text-white"
99+
className="flex items-center justify-center gap-2 rounded-md border border-[#1D7BD7] bg-transparent px-2 py-2 text-nowrap text-[#1D7BD7] hover:bg-[#1D7BD7] hover:text-white dark:hover:text-white"
100100
onClick={() => {
101101
router.push(`${window.location.pathname}/edit`)
102102
}}

0 commit comments

Comments
 (0)