Skip to content

Commit

Permalink
feat: Centered in Error notebook (#841)
Browse files Browse the repository at this point in the history
* fix: 解决输入空格导致下拉框启用的问题

* feat: "centered in error notebook"

---------

Co-authored-by: 名称 <邮箱>
Co-authored-by: boy <boy@123>
  • Loading branch information
rainnoon and boy authored Sep 4, 2024
1 parent 33a9289 commit 0fb69f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pages/ErrorBook/ErrorRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ErrorRow: FC<IErrorRowProps> = ({ record, onDelete }) => {
<span className="basis-6/12 break-normal">
{word ? word.trans.join(';') : <LoadingWordUI isLoading={isLoading} hasError={hasError} />}
</span>
<span className="basis-1/12 break-normal ">{record.wrongCount}</span>
<span className="basis-1/12 break-normal pl-8">{record.wrongCount}</span>
<span className="basis-1/12 break-normal">{dictInfo?.name}</span>
<span
className="basis-1/12 break-normal"
Expand Down
11 changes: 8 additions & 3 deletions src/pages/Gallery-N/ErrorTable/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,21 @@ export const errorColumns = (onDelete: (word: string) => Promise<void>): ColumnD
</Button>
)
},
cell: ({ row }) => {
return <span className="flex justify-center">{row.original.errorCount} </span>
},
},
{
accessorKey: 'errorChar',
header: '易错字母',
size: 80,
size: 100,
cell: ({ row }) => {
return (
<p>
{(row.getValue('errorChar') as string[]).map((char, index) => (
<kbd key={`${char}-${index}`}>{char + ' '}</kbd>
<kbd className="flex justify-center" key={`${char}-${index}`}>
{char + ' '}
</kbd>
))}
</p>
)
Expand All @@ -59,7 +64,7 @@ export const errorColumns = (onDelete: (word: string) => Promise<void>): ColumnD
{
accessorKey: 'delete',
header: '',
size: 80,
size: 40,
cell: ({ row }) => {
return (
<TooltipProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Gallery-N/ErrorTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function ErrorTable({ data, isLoading, error, onDelete }: DataTableProps)
))
) : (
<TableRow>
<TableCell colSpan={errorColumns.length} className="h-[28rem] text-center">
<TableCell colSpan={table.getAllColumns().length} className="h-[22rem] text-center">
{isLoading ? <LoadingUI /> : error ? '好像遇到错误啦!尝试刷新下' : '暂无数据, 快去练习吧!'}
</TableCell>
</TableRow>
Expand Down

0 comments on commit 0fb69f8

Please sign in to comment.