Skip to content
Merged
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
2 changes: 1 addition & 1 deletion service/app/src/app/admin/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function AdminLayout({
return (
<div>
<AdminNavigation />
{children}
<main className="h-screen pt-[90px]">{children}</main>
</div>
)
}
27 changes: 15 additions & 12 deletions service/app/src/app/admin/reports/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,22 @@ export default function AdminReportsPage() {
}

return (
<div className="mt-[90px] flex w-full flex-col items-center gap-52 bg-background-interactive-primary-disabled p-40">
<div className="flex size-full flex-col items-start gap-52 rounded-20 bg-background-interactive-primary-sub px-[62px] py-[70px]">
<h1 className="typography-heading-2xl-extrabold">신고접수</h1>
<ReportedGamesTable items={games} onRowClick={handleRowClick} />
<div className="flex h-full flex-col items-center bg-background-interactive-primary-disabled p-40">
<div className="flex size-full flex-col justify-between gap-52 rounded-20 bg-background-interactive-primary-sub px-[62px] pb-[34px] pt-60">
<div className="flex w-full flex-col items-start gap-52 overflow-y-auto">
<h1 className="typography-heading-2xl-extrabold">신고접수</h1>
<ReportedGamesTable items={games} onRowClick={handleRowClick} />
</div>
<div className="flex w-full justify-center">
{totalPages > 0 && (
<Pagination
currentPage={currentPage}
totalPages={totalPages}
onPageChange={handlePageChange}
/>
)}
</div>
</div>

{totalPages > 0 && (
<Pagination
currentPage={currentPage}
totalPages={totalPages}
onPageChange={handlePageChange}
/>
)}
</div>
)
}
2 changes: 1 addition & 1 deletion service/app/src/entities/report/hooks/useAdminReports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useAdminReports = ({
})

const games: ReportedGame[] =
data?.report.map((report) => mapAdminReportToReportedGame(report)) ?? []
data?.content.map((report) => mapAdminReportToReportedGame(report)) ?? []
Comment on lines 36 to +37

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

contentundefined일 경우 런타임 에러 발생 가능

data?.content.map(...)에서 data가 존재하지만 contentundefined인 경우 TypeError: Cannot read properties of undefined가 발생할 수 있습니다.

🛡️ 방어적 코딩 제안
  const games: ReportedGame[] =
-    data?.content.map((report) => mapAdminReportToReportedGame(report)) ?? []
+    data?.content?.map((report) => mapAdminReportToReportedGame(report)) ?? []
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const games: ReportedGame[] =
data?.report.map((report) => mapAdminReportToReportedGame(report)) ?? []
data?.content.map((report) => mapAdminReportToReportedGame(report)) ?? []
const games: ReportedGame[] =
data?.content?.map((report) => mapAdminReportToReportedGame(report)) ?? []
🤖 Prompt for AI Agents
In `@service/app/src/entities/report/hooks/useAdminReports.ts` around lines 36 -
37, In useAdminReports the expression data?.content.map(...) can throw if data
exists but content is undefined; change the construction that builds games so it
safely handles missing content by mapping over a guaranteed array (e.g., use
(data?.content ?? []) before calling map) when producing ReportedGame[] for
games and keep using mapAdminReportToReportedGame to transform each report.


return {
games,
Expand Down
2 changes: 1 addition & 1 deletion service/app/src/entities/report/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ReportedGame {
}

export interface AdminReportsResponse {
report: AdminReport[]
content: AdminReport[]
page: number
size: number
totalElements: number
Expand Down
2 changes: 1 addition & 1 deletion service/app/src/mocks/handlers/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const createAdminHandlers = (initialReports: AdminReport[]) => {
const hasNext = page < totalPages - 1

const response: AdminReportsResponse = {
report: paginatedReports,
content: paginatedReports,
page,
size: PAGE_SIZE,
totalElements,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const ReportedGamesTable = ({
onRowClick,
}: ReportedGamesTableProps) => {
return (
<AdminTableRoot ariaLabel="신고접수 테이블">
<AdminTableRoot ariaLabel="신고접수 테이블" className="overflow-y-auto">
<AdminTableRow
variant="header"
className="gap-72"
Expand Down
Loading