diff --git a/ui/v2.5/src/App.tsx b/ui/v2.5/src/App.tsx index ebe714b21..4331adcb4 100755 --- a/ui/v2.5/src/App.tsx +++ b/ui/v2.5/src/App.tsx @@ -15,8 +15,6 @@ import Studios from "./components/Studios/Studios"; import Tags from "./components/Tags/Tags"; import { SceneFilenameParser } from "./components/scenes/SceneFilenameParser"; -import "bootstrap/dist/css/bootstrap.min.css"; - library.add(fas); export const App: React.FC = () => ( diff --git a/ui/v2.5/src/components/Shared/LoadingIndicator.tsx b/ui/v2.5/src/components/Shared/LoadingIndicator.tsx new file mode 100644 index 000000000..5824fb4d7 --- /dev/null +++ b/ui/v2.5/src/components/Shared/LoadingIndicator.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { Spinner } from 'react-bootstrap'; + +interface LoadingProps { + message: string; +} + +const CLASSNAME = 'LoadingIndicator'; +const CLASSNAME_MESSAGE = `${CLASSNAME}-message`; + +const LoadingIndicator: React.FC = ({ message }) => ( +
+ + Loading... + +

+ { message } +

+
+); + +export default LoadingIndicator; diff --git a/ui/v2.5/src/components/Shared/index.ts b/ui/v2.5/src/components/Shared/index.ts index 3a56611f4..ad0beabd0 100644 --- a/ui/v2.5/src/components/Shared/index.ts +++ b/ui/v2.5/src/components/Shared/index.ts @@ -14,3 +14,4 @@ export { DetailsEditNavbar } from "./DetailsEditNavbar"; export { DurationInput } from "./DurationInput"; export { TagLink } from "./TagLink"; export { HoverPopover } from "./HoverPopover"; +export { default as LoadingIndicator } from './LoadingIndicator'; diff --git a/ui/v2.5/src/components/Shared/styles.scss b/ui/v2.5/src/components/Shared/styles.scss new file mode 100644 index 000000000..0c29e1daa --- /dev/null +++ b/ui/v2.5/src/components/Shared/styles.scss @@ -0,0 +1,17 @@ +.LoadingIndicator { + align-items: center; + display: flex; + flex-direction: column; + height: 70vh; + justify-content: center; + width: 100%; + + &-message { + margin-top: 1rem; + } + + .spinner-border { + height: 3rem; + width: 3rem; + } +} diff --git a/ui/v2.5/src/components/Stats.tsx b/ui/v2.5/src/components/Stats.tsx index 7dcfb7d1c..7e20dfd10 100644 --- a/ui/v2.5/src/components/Stats.tsx +++ b/ui/v2.5/src/components/Stats.tsx @@ -1,63 +1,52 @@ -import { Spinner } from "react-bootstrap"; -import React, { FunctionComponent } from "react"; -import { StashService } from "../core/StashService"; +import React from "react"; +import { StashService } from "src/core/StashService"; +import { LoadingIndicator } from "src/components/Shared"; -export const Stats: FunctionComponent = () => { +export const Stats: React.FC = () => { const { data, error, loading } = StashService.useStats(); - function renderStats() { - if (!data || !data.stats) { - return; - } - return ( -