Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Converted the PerformanceHome to function component. #7799

Merged
merged 8 commits into from
Nov 4, 2024
60 changes: 30 additions & 30 deletions packages/client/src/views/OfficeHome/LoadingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,36 @@ type IBaseLoadingProps = {

type IProps = IBaseLoadingProps & IntlShapeProps & IOnlineStatusProps

class LoadingIndicatorComp extends React.Component<IProps> {
render() {
const { loading, noDeclaration, hasError, intl } = this.props

return (
<Wrapper>
{this.props.isOnline && loading && (
<LoadingContainer>
<Spinner id="Spinner" size={24} baseColor="#4C68C1" />
</LoadingContainer>
)}
<MobileViewContainer noDeclaration={noDeclaration}>
{this.props.isOnline && hasError && (
<ErrorText id="search-result-error-text-count">
{intl.formatMessage(errorMessages.queryError)}
</ErrorText>
)}
{!this.props.isOnline && (
<ConnectivityContainer>
<NoConnectivity />
<Text id="wait-connection-text">
{intl.formatMessage(constantsMessages.noConnection)}
</Text>
</ConnectivityContainer>
)}
</MobileViewContainer>
</Wrapper>
)
}
}
const LoadingIndicatorComp = ({
loading,
noDeclaration,
hasError,
intl,
isOnline
}: IProps) => (
<Wrapper>
{isOnline && loading && (
<LoadingContainer>
<Spinner id="Spinner" size={24} baseColor="#4C68C1" />
</LoadingContainer>
)}
<MobileViewContainer noDeclaration={noDeclaration}>
{isOnline && hasError && (
<ErrorText id="search-result-error-text-count">
{intl.formatMessage(errorMessages.queryError)}
</ErrorText>
)}
{!isOnline && (
<ConnectivityContainer>
<NoConnectivity />
<Text id="wait-connection-text">
{intl.formatMessage(constantsMessages.noConnection)}
</Text>
</ConnectivityContainer>
)}
</MobileViewContainer>
</Wrapper>
)

export function withOnlineStatus<T>(
WrappedComponent: React.ComponentType<T & IOnlineStatusProps>
Expand Down
Loading
Loading