Skip to content

Commit

Permalink
refactor: remove loading steps text (bigbluebutton#21709)
Browse files Browse the repository at this point in the history
* remove loading steps text

* remove loading screen children
  • Loading branch information
ramonlsouza authored Nov 21, 2024
1 parent c70e978 commit 46fda48
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 53 deletions.
2 changes: 1 addition & 1 deletion bigbluebutton-html5/client/meetingClient.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import PLUGIN_CONFIGURATION_QUERY from '/imports/ui/components/plugins-engine/qu
const Startup = () => {
const loadingContextInfo = useContext(LoadingContext);
useEffect(() => {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
}, []);
// Logs all uncaught exceptions to the client logger
window.addEventListener('error', (e) => {
Expand Down
8 changes: 4 additions & 4 deletions bigbluebutton-html5/imports/startup/client/intlLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const IntlLoader: React.FC<IntlLoaderProps> = ({
const foundLocales = typedResp.filter((locale) => locale instanceof Object) as LocaleJson[];
if (foundLocales.length === 0) {
const error = `${{ logCode: 'intl_fetch_locale_error' }},Could not fetch any locale file for ${languageSets.join(', ')}`;
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
logger.error(error);
throw new Error(error);
}
Expand All @@ -137,15 +137,15 @@ const IntlLoader: React.FC<IntlLoaderProps> = ({
setCurrentLocale(replacedLocale);
setMessages(mergedLocale);
if (!init) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
}
}).catch((error) => {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error(error);
});
})
.catch(() => {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('unable to fetch localized messages');
});
}, []);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from 'react';
import Styled from './styles';

const LoadingScreen = ({ children }) => (
const LoadingScreen = () => (
<Styled.Background>
<Styled.Spinner animations>
<Styled.Bounce1 animations />
<Styled.Bounce2 animations />
<div />
</Styled.Spinner>
<Styled.Message>
{children}
</Styled.Message>
</Styled.Background>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import LoadingScreen from '../component';

interface LoadingContent {
isLoading: boolean;
loadingMessage: string;
}

interface LoadingContextContent extends LoadingContent {
setLoading: (isLoading: boolean, loadingMessage: string) => void;
setLoading: (isLoading: boolean) => void;
}

export const LoadingContext = React.createContext<LoadingContextContent>({
isLoading: false,
loadingMessage: '',
setLoading: () => { },
});

Expand All @@ -25,27 +23,22 @@ const LoadingScreenHOC: React.FC<LoadingScreenHOCProps> = ({
}) => {
const [loading, setLoading] = React.useState<LoadingContent>({
isLoading: false,
loadingMessage: '',
});

return (
<LoadingContext.Provider value={{
loadingMessage: loading.loadingMessage,
isLoading: loading.isLoading,
setLoading: (isLoading: boolean, loadingMessage: string = '') => {
setLoading: (isLoading: boolean) => {
setLoading({
isLoading,
loadingMessage,
});
},
}}
>
{
loading.isLoading
? (
<LoadingScreen>
<h1>{loading.loadingMessage}</h1>
</LoadingScreen>
<LoadingScreen />
)
: null
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import styled, { css, keyframes } from 'styled-components';
import { mdPaddingX } from '/imports/ui/stylesheets/styled-components/general';
import { loaderBg, loaderBullet, colorWhite } from '/imports/ui/stylesheets/styled-components/palette';
import { fontSizeLarge } from '/imports/ui/stylesheets/styled-components/typography';
import { loaderBg, loaderBullet } from '/imports/ui/stylesheets/styled-components/palette';

const Background = styled.div`
position: fixed;
Expand Down Expand Up @@ -57,16 +56,9 @@ const Bounce2 = styled.div`
`}
`;

const Message = styled.div`
font-size: ${fontSizeLarge};
color: ${colorWhite};
text-align: center;
`;

export default {
Background,
Spinner,
Bounce1,
Bounce2,
Message,
};
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac
BBBWeb.index().then(({ data }) => {
setGraphqlUrl(data.graphqlWebsocketUrl);
}).catch((error) => {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('Error fetching GraphQL URL: '.concat(error.message || ''));
});
logger.info('Fetching GraphQL URL');
loadingContextInfo.setLoading(true, '1/2');
loadingContextInfo.setLoading(true);
}, []);

useEffect(() => {
Expand Down Expand Up @@ -155,12 +155,12 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac

useEffect(() => {
logger.info('Connecting to GraphQL server');
loadingContextInfo.setLoading(true, '2/2');
loadingContextInfo.setLoading(true);
if (graphqlUrl) {
const urlParams = new URLSearchParams(window.location.search);
const sessionToken = urlParams.get('sessionToken');
if (!sessionToken) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('Missing session token');
}
sessionStorage.setItem('sessionToken', sessionToken);
Expand Down Expand Up @@ -215,7 +215,7 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac
}

if (error && typeof error === 'object' && 'code' in error && error.code === 4403) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
setTerminalError('Server refused the connection');
return false;
}
Expand All @@ -233,7 +233,7 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac
on: {
error: (error) => {
logger.error('Graphql Client Error:', error);
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
connectionStatus.setConnectedStatus(false);
setErrorCounts((prev: number) => prev + 1);
},
Expand All @@ -259,7 +259,7 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac
// message ID -1 as a signal to terminate the session
// it contains a prop message.messageId which can be used to show a proper error to the user
logger.error({ logCode: 'graphql_server_closed_connection', extraInfo: message }, 'Graphql Server closed the connection');
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
const payload = message.payload as ErrorPayload[];
if (payload[0].messageId) {
setTerminalError(new Error(payload[0].message, { cause: payload[0].messageId }));
Expand All @@ -277,12 +277,12 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac
);
wsLink = ApolloLink.from([payloadSizeCheckLink, errorLink, graphWsLink]);
wsLink.setOnError((error) => {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('Error: on apollo connection'.concat(JSON.stringify(error) || ''));
});
apolloContextHolder.setLink(subscription);
} catch (error) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('Error creating WebSocketLink: '.concat(JSON.stringify(error) || ''));
}
let client;
Expand All @@ -295,7 +295,7 @@ const ConnectionManager: React.FC<ConnectionManagerProps> = ({ children }): Reac
setApolloClient(client);
apolloContextHolder.setClient(client);
} catch (error) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('Error creating Apollo Client: '.concat(JSON.stringify(error) || ''));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ const CustomUsersSettings: React.FC<CustomUsersSettingsProps> = ({
/>
) : null}
{loading ? (
<LoadingScreen>
<div className="sr-only">
Loading...
</div>
</LoadingScreen>
<LoadingScreen />
) : null}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const GuestWait: React.FC<GuestWaitProps> = (props) => {
const sessionToken = getSearchParam('sessionToken');

if (loadingContextInfo.isLoading) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
}

if (!sessionToken) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const PresenceManager: React.FC<PresenceManagerProps> = ({
useEffect(() => {
if (isGuestAllowed) {
timeoutRef.current = setTimeout(() => {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
throw new Error('Authentication timeout');
}, connectionTimeout);
}
Expand Down Expand Up @@ -155,7 +155,7 @@ const PresenceManager: React.FC<PresenceManagerProps> = ({

useEffect(() => {
if (joinErrorCode) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
}
},
[joinErrorCode, joinErrorMessage]);
Expand Down Expand Up @@ -204,7 +204,7 @@ const PresenceManagerContainer: React.FC<PresenceManagerContainerProps> = ({ chi
const loadingContextInfo = useContext(LoadingContext);
if (loading || userInfoLoading) return null;
if (error || userInfoError) {
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
logger.debug(`Error on user authentication: ${error}`);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ const MeetingEnded: React.FC<MeetingEndedProps> = ({

useEffect(() => {
// Sets Loading to falsed and removes loading splash screen
loadingContextInfo.setLoading(false, '');
loadingContextInfo.setLoading(false);
// Stops all media tracks
window.dispatchEvent(new Event('StopAudioTracks'));
// get the media tag from the session storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ const SettingsLoader: React.FC<SettingsLoaderProps> = (props) => {
/>
) : null}
{loading ? (
<LoadingScreen>
<div style={{ display: 'none' }}>
Loading...
</div>
</LoadingScreen>
<LoadingScreen />
) : null}
</>
);
Expand Down

0 comments on commit 46fda48

Please sign in to comment.