mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
Add torrent refresh interval selector with slider
This commit is contained in:
@@ -42,6 +42,13 @@ const definition = defineWidget({
|
|||||||
type: 'switch',
|
type: 'switch',
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
|
refreshInterval: {
|
||||||
|
type: 'slider',
|
||||||
|
defaultValue: 1,
|
||||||
|
min: 1,
|
||||||
|
max: 60,
|
||||||
|
step: 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
gridstack: {
|
gridstack: {
|
||||||
minWidth: 4,
|
minWidth: 4,
|
||||||
@@ -71,6 +78,7 @@ function BitTorrentTile({ widget }: BitTorrentTileProps) {
|
|||||||
const [selectedAppId, setSelectedApp] = useState<string | null>(downloadApps[0]?.id);
|
const [selectedAppId, setSelectedApp] = useState<string | null>(downloadApps[0]?.id);
|
||||||
const { data, isError, isInitialLoading, dataUpdatedAt } = useGetTorrentData({
|
const { data, isError, isInitialLoading, dataUpdatedAt } = useGetTorrentData({
|
||||||
appId: selectedAppId!,
|
appId: selectedAppId!,
|
||||||
|
refreshInterval: widget.properties.refreshInterval * 1000,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -103,7 +111,13 @@ function BitTorrentTile({ widget }: BitTorrentTileProps) {
|
|||||||
|
|
||||||
if (isInitialLoading) {
|
if (isInitialLoading) {
|
||||||
return (
|
return (
|
||||||
<Stack align="center">
|
<Stack
|
||||||
|
align="center"
|
||||||
|
justify="center"
|
||||||
|
style={{
|
||||||
|
height: '100%',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Loader />
|
<Loader />
|
||||||
<Stack align="center" spacing={0}>
|
<Stack align="center" spacing={0}>
|
||||||
<Text>{t('card.loading.title')}</Text>
|
<Text>{t('card.loading.title')}</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user