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'; import { useReady } from '../contexts/ReadyContext'; interface StartingContentProps { isUnexpected: boolean; status?: WALReplayData; } export const StartingContent: FC = ({ status, isUnexpected }) => { if (isUnexpected) { return ( Error: Server is not responding ); } return (

Starting up...

{status && 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); const staticReady = useReady(); if (staticReady || ready) { return ; } return ; };