From 80e87ece0177123a6d2e67557d484af26204bf1a Mon Sep 17 00:00:00 2001 From: Ilya Bondar Date: Wed, 5 Feb 2025 21:16:55 +0100 Subject: [PATCH 1/2] fix(chat): fix modal displaying logic (Issue #2878) (#3088) --- .../Chat/ChatInput/ChatInputFooter.tsx | 12 +++++-- ...ModalManager.jsx => ChatModalsManager.jsx} | 6 ++-- .../Chat/Migration/MigrationFailedModal.tsx | 18 +++++----- .../Chat/RenameConversationModal.tsx | 18 ++++------ .../src/components/Chat/ReportIssueDialog.tsx | 5 ++- .../components/Chat/RequestApiKeyDialog.tsx | 5 ++- apps/chat/src/components/Chat/ShareModal.tsx | 22 +++++------- .../Chat/__tests__/FooterMessage.test.tsx | 11 +++--- .../components/Chatbar/ImportExportLoader.tsx | 14 ++++---- .../src/components/Common/FooterMessage.tsx | 23 ++++++------- .../chat/src/components/Common/RenderWhen.tsx | 34 +++++++++++++++++++ .../ReplaceConfirmationModal.tsx | 18 ++++------ .../src/components/Common/ScreenRender.tsx | 22 ++++++++++++ .../src/components/Common/UnshareDialog.tsx | 17 ++++------ .../src/components/Header/User/UserMobile.tsx | 11 ++++-- apps/chat/src/pages/index.tsx | 22 +++--------- apps/chat/src/pages/marketplace/index.tsx | 10 ++---- apps/chat/src/store/share/share.selectors.ts | 4 +-- 18 files changed, 154 insertions(+), 118 deletions(-) rename apps/chat/src/components/Chat/{MainModalManager.jsx => ChatModalsManager.jsx} (78%) create mode 100644 apps/chat/src/components/Common/RenderWhen.tsx create mode 100644 apps/chat/src/components/Common/ScreenRender.tsx diff --git a/apps/chat/src/components/Chat/ChatInput/ChatInputFooter.tsx b/apps/chat/src/components/Chat/ChatInput/ChatInputFooter.tsx index 8373920e40..44bce515de 100644 --- a/apps/chat/src/components/Chat/ChatInput/ChatInputFooter.tsx +++ b/apps/chat/src/components/Chat/ChatInput/ChatInputFooter.tsx @@ -1,9 +1,17 @@ +import { ScreenState } from '@/src/types/common'; + import { FooterMessage } from '../../Common/FooterMessage'; +import { withRenderForScreen } from '../../Common/ScreenRender'; -export const ChatInputFooter = () => { +function ChatInputFooterView() { return ( ); -}; +} + +export const ChatInputFooter = withRenderForScreen([ + ScreenState.TABLET, + ScreenState.DESKTOP, +])(ChatInputFooterView); diff --git a/apps/chat/src/components/Chat/MainModalManager.jsx b/apps/chat/src/components/Chat/ChatModalsManager.jsx similarity index 78% rename from apps/chat/src/components/Chat/MainModalManager.jsx rename to apps/chat/src/components/Chat/ChatModalsManager.jsx index e889897821..dd9640ed25 100644 --- a/apps/chat/src/components/Chat/MainModalManager.jsx +++ b/apps/chat/src/components/Chat/ChatModalsManager.jsx @@ -1,15 +1,17 @@ import { ReplaceConfirmationModal } from '../Common/ReplaceConfirmationModal/ReplaceConfirmationModal'; import { UnshareDialog } from '../Common/UnshareDialog'; +import { UserMobile } from '../Header/User/UserMobile'; import { RenameConversationModal } from './RenameConversationModal'; import { ShareModal } from './ShareModal'; -export const MainModalManager = () => { +export function ChatModalsManager() { return ( <> + > ); -}; +} diff --git a/apps/chat/src/components/Chat/Migration/MigrationFailedModal.tsx b/apps/chat/src/components/Chat/Migration/MigrationFailedModal.tsx index b47e7624a3..5610245718 100644 --- a/apps/chat/src/components/Chat/Migration/MigrationFailedModal.tsx +++ b/apps/chat/src/components/Chat/Migration/MigrationFailedModal.tsx @@ -451,15 +451,15 @@ export const MigrationFailedWindow = ({ {t('contact us.')}
{t('Version')}: