mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-22 22:15:17 -04:00
ac33b15048
(cherry picked from commit 60529f0bacf2398838ef8d7843490a35046a1093)
38 lines
802 B
TypeScript
38 lines
802 B
TypeScript
import React from 'react';
|
|
import { Error } from 'App/State/AppSectionState';
|
|
import Alert from 'Components/Alert';
|
|
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
|
import { kinds } from 'Helpers/Props';
|
|
|
|
interface PageSectionContentProps {
|
|
isFetching: boolean;
|
|
isPopulated: boolean;
|
|
error?: Error;
|
|
errorMessage: string;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
function PageSectionContent({
|
|
isFetching,
|
|
isPopulated,
|
|
error,
|
|
errorMessage,
|
|
children,
|
|
}: PageSectionContentProps) {
|
|
if (isFetching && !isPopulated) {
|
|
return <LoadingIndicator />;
|
|
}
|
|
|
|
if (!isFetching && !!error) {
|
|
return <Alert kind={kinds.DANGER}>{errorMessage}</Alert>;
|
|
}
|
|
|
|
if (isPopulated && !error) {
|
|
return <div>{children}</div>;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
export default PageSectionContent;
|