From eb5e57f3e5934fb719e5fd3ed101d905c173df9c Mon Sep 17 00:00:00 2001 From: JF-Cozy Date: Tue, 12 Nov 2024 14:52:24 +0100 Subject: [PATCH] feat(Assistant): Force "normal" variant for searchbar and dialogs To override "inverted" variant when a custom wallpaper is set --- src/assistant/AssistantWrapperDesktop.jsx | 18 ++++++---- src/assistant/AssistantWrapperMobile.jsx | 43 +++++++++++++---------- src/assistant/Views/AssistantDialog.jsx | 9 +++-- src/assistant/Views/SearchDialog.jsx | 13 ++++--- 4 files changed, 49 insertions(+), 34 deletions(-) diff --git a/src/assistant/AssistantWrapperDesktop.jsx b/src/assistant/AssistantWrapperDesktop.jsx index 75af8fd298..7794bc7f11 100644 --- a/src/assistant/AssistantWrapperDesktop.jsx +++ b/src/assistant/AssistantWrapperDesktop.jsx @@ -1,18 +1,22 @@ import React from 'react' +import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme' + import SearchBar from './Search/SearchBar' import SearchProvider from './Search/SearchProvider' import AssistantProvider from './AssistantProvider' const AssistantWrapperDesktop = () => { return ( -
- - - - - -
+ +
+ + + + + +
+
) } diff --git a/src/assistant/AssistantWrapperMobile.jsx b/src/assistant/AssistantWrapperMobile.jsx index 3089cd24a0..ad9407e211 100644 --- a/src/assistant/AssistantWrapperMobile.jsx +++ b/src/assistant/AssistantWrapperMobile.jsx @@ -4,45 +4,50 @@ import flag from 'cozy-flags' import cx from 'classnames' import { getFlagshipMetadata } from 'cozy-device-helper' -import { useCozyTheme } from 'cozy-ui/transpiled/react/providers/CozyTheme' +import CozyTheme, { + useCozyTheme +} from 'cozy-ui/transpiled/react/providers/CozyTheme' import SearchBar from 'cozy-ui/transpiled/react/SearchBar' import Icon from 'cozy-ui/transpiled/react/Icon' import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n' import AssistantIcon from 'assets/images/icon-assistant.png' import { FLAG_FAB_BUTTON_ENABLED } from 'components/AddButton/helpers' +import { useWallpaperContext } from 'hooks/useWallpaperContext' import styles from './styles.styl' export const AssistantWrapperMobile = () => { const { type } = useCozyTheme() + const { + data: { isCustomWallpaper } + } = useWallpaperContext() const { t } = useI18n() const navigate = useNavigate() return ( -
+
- - } - type="button" - label={t('assistant.search.placeholder')} - onClick={() => navigate('connected/search')} - /> -
+ })} + > + + } + type="button" + label={t('assistant.search.placeholder')} + onClick={() => navigate('connected/search')} + /> +
+ ) } diff --git a/src/assistant/Views/AssistantDialog.jsx b/src/assistant/Views/AssistantDialog.jsx index df2d733c23..7d6e0a0694 100644 --- a/src/assistant/Views/AssistantDialog.jsx +++ b/src/assistant/Views/AssistantDialog.jsx @@ -2,6 +2,7 @@ import React from 'react' import { useNavigate, useParams } from 'react-router-dom' import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs' +import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme' import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints' import Conversation from '../Conversations/Conversation' @@ -38,9 +39,11 @@ const AssistantDialog = () => { const AssistantDialogWithProviders = () => { return ( - - - + + + + + ) } diff --git a/src/assistant/Views/SearchDialog.jsx b/src/assistant/Views/SearchDialog.jsx index 4e81f9f5e8..15bac15817 100644 --- a/src/assistant/Views/SearchDialog.jsx +++ b/src/assistant/Views/SearchDialog.jsx @@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom' import flag from 'cozy-flags' import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs' +import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme' import SearchProvider from '../Search/SearchProvider' import AssistantProvider, { useAssistant } from '../AssistantProvider' @@ -54,11 +55,13 @@ const SearchDialog = () => { const SearchDialogWithProviders = () => { return ( - - - - - + + + + + + + ) }