3
3
Center ,
4
4
Flex ,
5
5
Group ,
6
- Loader ,
7
6
Popover ,
8
7
Progress ,
9
8
Stack ,
@@ -16,7 +15,7 @@ import { IconFileDownload } from '@tabler/icons-react';
16
15
import dayjs from 'dayjs' ;
17
16
import duration from 'dayjs/plugin/duration' ;
18
17
import relativeTime from 'dayjs/plugin/relativeTime' ;
19
- import { MRT_TableContainer , useMantineReactTable , type MRT_ColumnDef } from 'mantine-react-table' ;
18
+ import { type MRT_ColumnDef , MRT_TableContainer , useMantineReactTable } from 'mantine-react-table' ;
20
19
import { useTranslation } from 'next-i18next' ;
21
20
import { useMemo } from 'react' ;
22
21
import { MIN_WIDTH_MOBILE } from '~/constants/constants' ;
@@ -29,6 +28,7 @@ import {
29
28
30
29
import { useGetDownloadClientsQueue } from '../download-speed/useGetNetworkSpeed' ;
31
30
import { defineWidget } from '../helper' ;
31
+ import { WidgetLoading } from '../loading' ;
32
32
import { IWidget } from '../widgets' ;
33
33
import { TorrentQueuePopover } from './TorrentQueueItem' ;
34
34
@@ -69,6 +69,18 @@ const definition = defineWidget({
69
69
defaultValue : true ,
70
70
info : true ,
71
71
} ,
72
+ columns : {
73
+ type : 'multi-select' ,
74
+ defaultValue : [ 'up' , 'down' , 'eta' , 'progress' ] ,
75
+ data : [ { value : 'up' } , { value : 'down' } , { value : 'eta' } , { value : 'progress' } ] ,
76
+ } ,
77
+ nameColumnSize : {
78
+ type : 'slider' ,
79
+ defaultValue : 2 ,
80
+ min : 1 ,
81
+ max : 4 ,
82
+ step : 1 ,
83
+ } ,
72
84
} ,
73
85
gridstack : {
74
86
minWidth : 2 ,
@@ -146,8 +158,7 @@ function TorrentTile({ widget }: TorrentTileProps) {
146
158
</ Popover . Dropdown >
147
159
</ Popover >
148
160
) ,
149
- maxSize : 1 ,
150
- size : 1 ,
161
+ maxSize : widget . properties . nameColumnSize ,
151
162
} ,
152
163
{
153
164
accessorKey : 'totalSelected' ,
@@ -184,7 +195,7 @@ function TorrentTile({ widget }: TorrentTileProps) {
184
195
Cell : ( { cell, row } ) => (
185
196
< Flex >
186
197
< Text className = { useStyles ( ) . classes . noTextBreak } >
187
- { ( Number ( cell . getValue ( ) ) * 100 ) . toFixed ( 1 ) } %
198
+ { ( Number ( cell . getValue ( ) ) * 100 ) . toPrecision ( 3 ) } %
188
199
</ Text >
189
200
< Progress
190
201
radius = "lg"
@@ -240,9 +251,10 @@ function TorrentTile({ widget }: TorrentTileProps) {
240
251
columnVisibility : {
241
252
isCompleted : false ,
242
253
dateAdded : false ,
243
- uploadSpeed : width > MIN_WIDTH_MOBILE ,
244
- downloadSpeed : width > MIN_WIDTH_MOBILE ,
245
- eta : width > MIN_WIDTH_MOBILE ,
254
+ uploadSpeed : widget . properties . columns . includes ( 'up' ) && width > MIN_WIDTH_MOBILE ,
255
+ downloadSpeed : widget . properties . columns . includes ( 'down' ) && width > MIN_WIDTH_MOBILE ,
256
+ eta : widget . properties . columns . includes ( 'eta' ) && width > MIN_WIDTH_MOBILE ,
257
+ progress : widget . properties . columns . includes ( 'progress' ) ,
246
258
} ,
247
259
} ,
248
260
} ) ;
@@ -259,21 +271,7 @@ function TorrentTile({ widget }: TorrentTileProps) {
259
271
}
260
272
261
273
if ( isInitialLoading || ! data ) {
262
- return (
263
- < Stack
264
- align = "center"
265
- justify = "center"
266
- style = { {
267
- height : '100%' ,
268
- } }
269
- >
270
- < Loader />
271
- < Stack align = "center" spacing = { 0 } >
272
- < Text > { t ( 'card.loading.title' ) } </ Text >
273
- < Text color = "dimmed" > { t ( 'card.loading.description' ) } </ Text >
274
- </ Stack >
275
- </ Stack >
276
- ) ;
274
+ return < WidgetLoading /> ;
277
275
}
278
276
279
277
if ( data . apps . length === 0 ) {
0 commit comments