From c03426f801a7dd10f58cc04cccebd10a1deab0e8 Mon Sep 17 00:00:00 2001 From: ajnart Date: Thu, 5 Jan 2023 22:45:35 +0900 Subject: [PATCH] Add torrent refresh interval selector with slider --- src/widgets/bitTorrent/BitTorrentTile.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/widgets/bitTorrent/BitTorrentTile.tsx b/src/widgets/bitTorrent/BitTorrentTile.tsx index b9485f021..e6d2368cf 100644 --- a/src/widgets/bitTorrent/BitTorrentTile.tsx +++ b/src/widgets/bitTorrent/BitTorrentTile.tsx @@ -42,6 +42,13 @@ const definition = defineWidget({ type: 'switch', defaultValue: true, }, + refreshInterval: { + type: 'slider', + defaultValue: 1, + min: 1, + max: 60, + step: 1, + }, }, gridstack: { minWidth: 4, @@ -71,6 +78,7 @@ function BitTorrentTile({ widget }: BitTorrentTileProps) { const [selectedAppId, setSelectedApp] = useState(downloadApps[0]?.id); const { data, isError, isInitialLoading, dataUpdatedAt } = useGetTorrentData({ appId: selectedAppId!, + refreshInterval: widget.properties.refreshInterval * 1000, }); useEffect(() => { @@ -103,7 +111,13 @@ function BitTorrentTile({ widget }: BitTorrentTileProps) { if (isInitialLoading) { return ( - + {t('card.loading.title')}