From ff94c324b3db6ce8afb15c4038d19bffe6a28fed Mon Sep 17 00:00:00 2001 From: MerlinScheurer Date: Fri, 13 Jun 2025 20:10:57 +0200 Subject: [PATCH 01/10] Refac extract loading indicator into its own component --- frontend/src/components/InputConfig.tsx | 9 ++------- frontend/src/components/LoadingIndicator.tsx | 9 +++++++++ frontend/src/components/WatchedCheckBox.tsx | 5 ++--- frontend/src/pages/Login.tsx | 6 ++---- 4 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 frontend/src/components/LoadingIndicator.tsx diff --git a/frontend/src/components/InputConfig.tsx b/frontend/src/components/InputConfig.tsx index a378a5fb..cf1bfa13 100644 --- a/frontend/src/components/InputConfig.tsx +++ b/frontend/src/components/InputConfig.tsx @@ -1,4 +1,5 @@ import { useState } from 'react'; +import LoadingIndicator from './LoadingIndicator'; type InputTextProps = { type: 'text' | 'number'; @@ -51,13 +52,7 @@ const InputConfig = ({ type, name, value, setValue, oldValue, updateCallback }: > )} {oldValue !== null && handleUpdate(name, null)}>reset} - {loading && ( - <> - - - - > - )} + {loading && } {success && ✅} diff --git a/frontend/src/components/LoadingIndicator.tsx b/frontend/src/components/LoadingIndicator.tsx new file mode 100644 index 00000000..0eaeaeb4 --- /dev/null +++ b/frontend/src/components/LoadingIndicator.tsx @@ -0,0 +1,9 @@ +const LoadingIndicator = () => { + return ( + + + + ); +}; + +export default LoadingIndicator; diff --git a/frontend/src/components/WatchedCheckBox.tsx b/frontend/src/components/WatchedCheckBox.tsx index 490bb3c3..0585ec1a 100644 --- a/frontend/src/components/WatchedCheckBox.tsx +++ b/frontend/src/components/WatchedCheckBox.tsx @@ -1,6 +1,7 @@ import iconUnseen from '/img/icon-unseen.svg'; import iconSeen from '/img/icon-seen.svg'; import { useEffect, useState } from 'react'; +import LoadingIndicator from './LoadingIndicator'; type WatchedCheckBoxProps = { watched: boolean; @@ -32,9 +33,7 @@ const WatchedCheckBox = ({ watched, onClick, onDone }: WatchedCheckBoxProps) => <> {loading && ( <> - - - + > )} {!loading && watched && ( diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index da8a0385..d07c392e 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -5,6 +5,7 @@ import Colours from '../configuration/colours/Colours'; import Button from '../components/Button'; import signIn from '../api/actions/signIn'; import loadAuth from '../api/loader/loadAuth'; +import LoadingIndicator from '../components/LoadingIndicator'; const Login = () => { const navigate = useNavigate(); @@ -134,10 +135,7 @@ const Login = () => { {waitingForBackend && ( <> - Waiting for backend{' '} - - - + Waiting for backend
- Waiting for backend{' '} -
- {videoAggs.total_items.value} videos |{' '} - {videoAggs.total_duration.value_str} playback{' '} - | Total size{' '} - {humanFileSize(videoAggs.total_size.value, useSiUnits)} -
+ {videoAggs.total_items.value} videos |{' '} + {videoAggs.total_duration.value_str} playback{' '} + | Total size{' '} + {humanFileSize(videoAggs.total_size.value, useSiUnits)} +
- Try going to the downloads page to start the scan - and download tasks. -
+ Try going to the downloads page to start the + scan and download tasks. +
Youtube:{' '} - + Active
Overwrite{' '} - + SponsorBlock
Enable{' '} - + returnyoutubedislike
Enable{' '} - + Sponsorblock