Skip to content

Commit

Permalink
chore(fe): minor update to the admin problem table (#2070)
Browse files Browse the repository at this point in the history
chore(fe): show update time instead of the create time
  • Loading branch information
eunnbi authored Sep 4, 2024
1 parent 63a6b65 commit 9554d98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ColumnDef } from '@tanstack/react-table'
interface DataTableProblem {
id: number
title: string
createTime: string
updateTime: string
difficulty: string
submissionCount: number
acceptedRate: number
Expand Down Expand Up @@ -69,13 +69,12 @@ export const columns: ColumnDef<DataTableProblem>[] = [
}
},
{
accessorKey: 'createTime',
accessorKey: 'updateTime',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Update" />
),
cell: ({ row }) => {
const updateTime: string = row.getValue('createTime')
return <div>{updateTime.substring(2, 10)}</div>
return <div>{row.original.updateTime.substring(2, 10)}</div>
}
},
{
Expand Down
7 changes: 3 additions & 4 deletions apps/frontend/app/admin/problem/_components/Columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Tag {
interface DataTableProblem {
id: number
title: string
createTime: string
updateTime: string
difficulty: string
submissionCount: number
acceptedRate: number
Expand Down Expand Up @@ -118,13 +118,12 @@ export const columns: ColumnDef<DataTableProblem>[] = [
}
},
{
accessorKey: 'createTime',
accessorKey: 'updateTime',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Update" />
),
cell: ({ row }) => {
const updateTime: string = row.getValue('createTime')
return <div>{updateTime.substring(2, 10)}</div>
return <div>{row.original.updateTime.substring(2, 10)}</div>
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/graphql/problem/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const GET_PROBLEMS = gql(`
) {
id
title
createTime
updateTime
difficulty
submissionCount
acceptedRate
Expand Down

0 comments on commit 9554d98

Please sign in to comment.