Skip to content

Commit

Permalink
refactor: Converted the PerformanceHome to function component. (#7799)
Browse files Browse the repository at this point in the history
* refactor: Converted the PerformanceHome to function component.

* refactor: refactored the LoadingIndicatorComp component to functional.

* refactor: refactored the UserReviewFormComponent component to functional.

* fix: Added missing prop

---------

Co-authored-by: Riku Rouvila <[email protected]>
  • Loading branch information
Eezi and rikukissa authored Nov 4, 2024
1 parent 06fd407 commit 375df64
Show file tree
Hide file tree
Showing 3 changed files with 561 additions and 593 deletions.
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

0 comments on commit 375df64

Please sign in to comment.