diff --git a/src/pages/components/libraryOverview.jsx b/src/pages/components/libraryOverview.jsx index 4a37f62..708afc8 100644 --- a/src/pages/components/libraryOverview.jsx +++ b/src/pages/components/libraryOverview.jsx @@ -5,7 +5,6 @@ import Loading from "./general/loading"; import LibraryStatComponent from "./libraryStatCard/library-stat-component"; - import TvLineIcon from "remixicon-react/TvLineIcon"; import FilmLineIcon from "remixicon-react/FilmLineIcon"; import FileMusicLineIcon from "remixicon-react/FileMusicLineIcon"; @@ -14,14 +13,13 @@ import { Trans } from "react-i18next"; import i18next from "i18next"; export default function LibraryOverView() { - const token = localStorage.getItem('token'); - const SeriesIcon= ; - const MovieIcon= ; - const MusicIcon= ; - const MixedIcon= ; + const token = localStorage.getItem("token"); + const SeriesIcon = ; + const MovieIcon = ; + const MusicIcon = ; + const MixedIcon = ; const [data, setData] = useState(); - useEffect(() => { const fetchData = () => { const url = `/stats/getLibraryOverview`; @@ -36,10 +34,10 @@ export default function LibraryOverView() { .catch((error) => console.log(error)); }; - if (!data || data.length === 0) { + if (!data) { fetchData(); } - }, [data,token]); + }, [data, token]); if (!data) { return ; @@ -47,15 +45,35 @@ export default function LibraryOverView() { return (
-

+

+ +

- - stat.CollectionType === "movies")} heading={} units={} icon={MovieIcon}/> - stat.CollectionType === "tvshows")} heading={} units={`${i18next.t("SERIES")} / ${i18next.t("SEASONS")} / ${i18next.t("EPISODES")}`} icon={SeriesIcon}/> - stat.CollectionType === "music")} heading={} units={} icon={MusicIcon}/> - stat.CollectionType === "mixed")} heading={} units={} icon={MixedIcon}/> - -
+ stat.CollectionType === "movies")} + heading={} + units={} + icon={MovieIcon} + /> + stat.CollectionType === "tvshows")} + heading={} + units={`${i18next.t("SERIES")} / ${i18next.t("SEASONS")} / ${i18next.t("EPISODES")}`} + icon={SeriesIcon} + /> + stat.CollectionType === "music")} + heading={} + units={} + icon={MusicIcon} + /> + stat.CollectionType === "mixed")} + heading={} + units={} + icon={MixedIcon} + /> +
); } diff --git a/src/pages/components/settings/apiKeys.jsx b/src/pages/components/settings/apiKeys.jsx index 799e3d7..3b54299 100644 --- a/src/pages/components/settings/apiKeys.jsx +++ b/src/pages/components/settings/apiKeys.jsx @@ -191,7 +191,7 @@ async function handleFormSubmit(event) { .map((apikey,index) => ( ))} - {keys.length===0 ? :''} + {keys.length===0 ? :''} diff --git a/src/pages/components/settings/backupfiles.jsx b/src/pages/components/settings/backupfiles.jsx index c109e3b..125744c 100644 --- a/src/pages/components/settings/backupfiles.jsx +++ b/src/pages/components/settings/backupfiles.jsx @@ -179,25 +179,33 @@ export default function BackupFiles() { if (event.target.files[0]) { uploadFile(event.target.files[0], (progressEvent) => { setProgress(Math.round((progressEvent.loaded / progressEvent.total) * 100)); + }) + .then(() => { + setshowAlert({ visible: true, title: "Success", type: "success", message: "Upload complete!" }); + fetchData(); // Refresh the file list after upload + setProgress(0); + }) + .catch((error) => { + setshowAlert({ visible: true, title: "Error", type: "danger", message: error.response.data }); + }); + } + }; + + const fetchData = async () => { + try { + const backupFiles = await axios.get(`/backup/files`, { + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "application/json", + }, }); + setFiles(backupFiles.data); + } catch (error) { + console.log(error); } }; useEffect(() => { - const fetchData = async () => { - try { - const backupFiles = await axios.get(`/backup/files`, { - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "application/json", - }, - }); - setFiles(backupFiles.data); - } catch (error) { - console.log(error); - } - }; - fetchData(); const intervalId = setInterval(fetchData, 60000 * 5); @@ -213,7 +221,9 @@ export default function BackupFiles() { }; const handleRowActionMessage = (alertState) => { - setshowAlert({ visible: alertState.visible, title: alertState.title, type: alertState.type, message: alertState.message }); + fetchData().then(() => { + setshowAlert({ visible: alertState.visible, title: alertState.title, type: alertState.type, message: alertState.message }); + }); }; return ( @@ -228,7 +238,7 @@ export default function BackupFiles() { )} - + @@ -252,7 +262,11 @@ export default function BackupFiles() { .map((file, index) => )} {files.length === 0 ? ( - diff --git a/src/pages/components/statistics/daily-play-count.jsx b/src/pages/components/statistics/daily-play-count.jsx index d4ea99e..3e896fc 100644 --- a/src/pages/components/statistics/daily-play-count.jsx +++ b/src/pages/components/statistics/daily-play-count.jsx @@ -60,7 +60,7 @@ function DailyPlayStats(props) {

- {days} 1 ? 'S':''}`}/>

-

+
); } diff --git a/src/pages/components/statistics/play-stats-by-day.jsx b/src/pages/components/statistics/play-stats-by-day.jsx index 8380060..d04843c 100644 --- a/src/pages/components/statistics/play-stats-by-day.jsx +++ b/src/pages/components/statistics/play-stats-by-day.jsx @@ -56,7 +56,7 @@ function PlayStatsByDay(props) {

- {days} 1 ? 'S':''}`}/>

-

+
); } diff --git a/src/pages/components/statistics/play-stats-by-hour.jsx b/src/pages/components/statistics/play-stats-by-hour.jsx index b80b922..4403400 100644 --- a/src/pages/components/statistics/play-stats-by-hour.jsx +++ b/src/pages/components/statistics/play-stats-by-hour.jsx @@ -55,7 +55,7 @@ function PlayStatsByHour(props) {

- {days} 1 ? 'S':''}`}/>

-

No Stats to display

+
); } diff --git a/src/pages/components/statistics/playbackMethodStats.jsx b/src/pages/components/statistics/playbackMethodStats.jsx index 63046be..cd3457a 100644 --- a/src/pages/components/statistics/playbackMethodStats.jsx +++ b/src/pages/components/statistics/playbackMethodStats.jsx @@ -61,9 +61,9 @@ function PlayMethodStats(props) { - {hours} 1 ? "S" : ""}`} /> -

+

-
+ ); } diff --git a/src/pages/users.jsx b/src/pages/users.jsx index c17b8b5..b5eefe6 100644 --- a/src/pages/users.jsx +++ b/src/pages/users.jsx @@ -295,7 +295,7 @@ function Users() { return () => clearInterval(intervalId); }, [config]); - if (!data || data.length === 0) { + if (!data) { return ; } @@ -419,7 +419,7 @@ function Users() { -
+
@@ -454,11 +454,16 @@ function Users() { {filteredData.map((row) => ( - + ))} {data.length === 0 ? (
-
+
+ No Users Found