diff --git a/src/script/components/calling/FullscreenVideoCall.tsx b/src/script/components/calling/FullscreenVideoCall.tsx index 20948a7f9f1..c9be651c963 100644 --- a/src/script/components/calling/FullscreenVideoCall.tsx +++ b/src/script/components/calling/FullscreenVideoCall.tsx @@ -74,7 +74,6 @@ import {CallingViewMode, CallState, MuteState} from '../../calling/CallState'; import {Participant} from '../../calling/Participant'; import type {Grid} from '../../calling/videoGridHandler'; import type {Conversation} from '../../entity/Conversation'; -import {useWarnings} from '../../guards/useWarnings'; import {ElectronDesktopCapturerSource, MediaDevicesHandler} from '../../media/MediaDevicesHandler'; import {TeamState} from '../../team/TeamState'; import {CallViewTab} from '../../view_model/CallingViewModel'; @@ -148,9 +147,6 @@ const FullscreenVideoCall: React.FC = ({ const [isConfirmCloseModalOpen, setIsConfirmCloseModalOpen] = useState(false); const [showEmojisBar, setShowEmojisBar] = useState(false); const [disabledEmojis, setDisabledEmojis] = useState([]); - - const {showSmallOffset, showLargeOffset} = useWarnings(); - const selfParticipant = call.getSelfParticipant(); const {sharesScreen: selfSharesScreen, sharesCamera: selfSharesCamera} = useKoSubscribableChildren(selfParticipant, [ 'sharesScreen', @@ -429,12 +425,7 @@ const FullscreenVideoCall: React.FC = ({ const isModerator = selfUser && roles[selfUser.id] === DefaultConversationRoleName.WIRE_ADMIN; return ( -
+
diff --git a/src/script/guards/useWarnings.ts b/src/script/guards/useWarnings.ts deleted file mode 100644 index 6e47e0e49e3..00000000000 --- a/src/script/guards/useWarnings.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Wire - * Copyright (C) 2024 Wire Swiss GmbH - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/. - * - */ - -import {useWarningsState} from '../view_model/WarningsContainer/WarningsState'; -import {CONFIG, TYPE as type} from '../view_model/WarningsContainer/WarningsTypes'; - -export const useWarnings = () => { - const warnings = useWarningsState(state => state.warnings); - const visibleWarning = warnings[warnings.length - 1]; - const isConnectivityRecovery = visibleWarning === type.CONNECTIVITY_RECOVERY; - const hasOffset = warnings.length > 0 && !isConnectivityRecovery; - const isMiniMode = CONFIG.MINI_MODES.includes(visibleWarning); - - return { - showSmallOffset: hasOffset && isMiniMode, - showLargeOffset: hasOffset && !isMiniMode, - }; -}; diff --git a/src/script/page/AppMain.tsx b/src/script/page/AppMain.tsx index 7364a319026..3dd17a82a60 100644 --- a/src/script/page/AppMain.tsx +++ b/src/script/page/AppMain.tsx @@ -20,7 +20,6 @@ import {FC, useEffect, useLayoutEffect} from 'react'; import {amplify} from 'amplify'; -import cx from 'classnames'; import {ErrorBoundary} from 'react-error-boundary'; import {container} from 'tsyringe'; @@ -52,7 +51,6 @@ import {useAppState, ContentState} from './useAppState'; import {CallingViewMode, CallState, DesktopScreenShareMenu} from '../calling/CallState'; import {ConversationState} from '../conversation/ConversationState'; import {User} from '../entity/User'; -import {useWarnings} from '../guards/useWarnings'; import {useActiveWindow} from '../hooks/useActiveWindow'; import {useInitializeRootFontSize} from '../hooks/useRootFontSize'; import {App} from '../main/app'; @@ -95,8 +93,6 @@ export const AppMain: FC = ({ useInitializeRootFontSize(); - const {showSmallOffset, showLargeOffset} = useWarnings(); - if (!apiContext) { throw new Error('API Context has not been set'); } @@ -253,13 +249,7 @@ export const AppMain: FC = ({ {Config.getConfig().FEATURE.ENABLE_DEBUG && } {!locked && ( -
+
{showLeftSidebar && ( void; } -export const WarningsContainer = ({onRefresh}: WarningProps) => { +const WarningsContainer: React.FC = ({onRefresh}) => { const name = useWarningsState(state => state.name); const warnings = useWarningsState(state => state.warnings); + const type = TYPE; const visibleWarning = warnings[warnings.length - 1]; + const warningDimmed = warnings.some(warning => CONFIG.DIMMED_MODES.includes(warning)); - if (warnings.length === 0) { - return null; - } + useEffect(() => { + const visibleWarning = warnings[warnings.length - 1]; + const isConnectivityRecovery = visibleWarning === TYPE.CONNECTIVITY_RECOVERY; + const hasOffset = warnings.length > 0 && !isConnectivityRecovery; + const isMiniMode = CONFIG.MINI_MODES.includes(visibleWarning); - const warningDimmed = warnings.some(warning => CONFIG.DIMMED_MODES.includes(warning)); + const app = document.querySelector('#app'); + if (app) { + app.classList.toggle('app--small-offset', hasOffset && isMiniMode); + app.classList.toggle('app--large-offset', hasOffset && !isMiniMode); + } - const {BRAND_NAME: brandName, URL} = Config.getConfig(); + afterRender(() => window.dispatchEvent(new Event('resize'))); + }, [warnings]); + + const brandName = Config.getConfig().BRAND_NAME; + const URL = Config.getConfig().URL; const closeButton = (