Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Assistant): Force "normal" variant for searchbar and dialogs #2244

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/assistant/AssistantWrapperDesktop.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="app-list-wrapper u-mb-3 u-mh-auto u-w-100">
<AssistantProvider>
<SearchProvider>
<SearchBar />
</SearchProvider>
</AssistantProvider>
</div>
<CozyTheme variant="normal">
<div className="app-list-wrapper u-mb-3 u-mh-auto u-w-100">
<AssistantProvider>
<SearchProvider>
<SearchBar />
</SearchProvider>
</AssistantProvider>
</div>
</CozyTheme>
)
}

Expand Down
43 changes: 24 additions & 19 deletions src/assistant/AssistantWrapperMobile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
className={cx(
styles['assistantWrapper-mobile'],
styles[`assistantWrapper-mobile--${type}`],
{
<CozyTheme variant="normal">
<div
className={cx(styles['assistantWrapper-mobile'], {
[styles[`assistantWrapper-mobile--${type}`]]: !isCustomWallpaper,
[styles['assistantWrapper-mobile--offset']]: flag(
FLAG_FAB_BUTTON_ENABLED
),
[styles['assistantWrapper-mobile--immersive']]:
getFlagshipMetadata().immersive
}
)}
>
<SearchBar
size="medium"
icon={
<Icon className="u-ml-1 u-mr-half" icon={AssistantIcon} size={24} />
}
type="button"
label={t('assistant.search.placeholder')}
onClick={() => navigate('connected/search')}
/>
</div>
})}
>
<SearchBar
size="medium"
icon={
<Icon className="u-ml-1 u-mr-half" icon={AssistantIcon} size={24} />
}
type="button"
label={t('assistant.search.placeholder')}
onClick={() => navigate('connected/search')}
/>
</div>
</CozyTheme>
)
}

Expand Down
9 changes: 6 additions & 3 deletions src/assistant/Views/AssistantDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -38,9 +39,11 @@ const AssistantDialog = () => {

const AssistantDialogWithProviders = () => {
return (
<AssistantProvider>
<AssistantDialog />
</AssistantProvider>
<CozyTheme variant="normal">
<AssistantProvider>
<AssistantDialog />
</AssistantProvider>
</CozyTheme>
)
}

Expand Down
13 changes: 8 additions & 5 deletions src/assistant/Views/SearchDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -54,11 +55,13 @@ const SearchDialog = () => {

const SearchDialogWithProviders = () => {
return (
<AssistantProvider>
<SearchProvider>
<SearchDialog />
</SearchProvider>
</AssistantProvider>
<CozyTheme variant="normal">
<AssistantProvider>
<SearchProvider>
<SearchDialog />
</SearchProvider>
</AssistantProvider>
</CozyTheme>
)
}

Expand Down
Loading