import React, { FC, ComponentType } from 'react'; import { Progress, Alert } from 'reactstrap'; import { useFetchReadyInterval } from '../hooks/useFetch'; import { WALReplayData } from '../types/types'; import { usePathPrefix } from '../contexts/PathPrefixContext'; interface StartingContentProps { isUnexpected: boolean; status?: WALReplayData; } export const StartingContent: FC = ({ status, isUnexpected }) => { if (isUnexpected) { return ( Error: Server is not responding ); } return (

Starting up...

{status?.max! > 0 ? (

Replaying WAL ({status?.current}/{status?.max})

) : null}
); }; export const withStartingIndicator = (Page: ComponentType): FC => ({ ...rest }) => { const pathPrefix = usePathPrefix(); const { ready, walReplayStatus, isUnexpected } = useFetchReadyInterval(pathPrefix); if (ready || isUnexpected) { return ; } return ; };