-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Update to use new assistant ✨ #2351
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| import React, { useState } from 'react' | ||
| import { Navigate, Route } from 'react-router-dom' | ||
| import { Navigate, Outlet, Route, useLocation } from 'react-router-dom' | ||
| import { BarComponent } from 'cozy-bar' | ||
| import cx from 'classnames' | ||
|
|
||
| import flag from 'cozy-flags' | ||
| import minilog from 'cozy-minilog' | ||
|
|
@@ -14,7 +15,7 @@ import { Layout } from 'cozy-ui/transpiled/react/Layout' | |
| import { useCozyTheme } from 'cozy-ui-plus/dist/providers/CozyTheme' | ||
|
|
||
| import { AssistantMobileWrapper } from '@/components/Assistant/AssistantMobileWrapper' | ||
| import { AssistantDialog, SearchDialog } from 'cozy-search' | ||
| import { AssistantDialog, AssistantView, SearchDialog } from 'cozy-search' | ||
| import Failure from '@/components/Failure' | ||
| import HeroHeader from '@/components/HeroHeader' | ||
| import Home from '@/components/Home' | ||
|
|
@@ -40,11 +41,13 @@ import { useFetchInitialData } from '@/hooks/useFetchInitialData' | |
| import SectionDialog from '@/components/Sections/SectionDialog' | ||
| import { SentryRoutes } from '@/lib/sentry' | ||
| import '../flags' | ||
| import styles from '../styles/app.styl' | ||
|
|
||
| window.flag = window.flag || flag | ||
| window.minilog = minilog | ||
|
|
||
| const App = () => { | ||
| const { pathname } = useLocation() | ||
| const { isMobile } = useBreakpoints() | ||
| const [contentWrapper, setContentWrapper] = useState(undefined) | ||
|
|
||
|
|
@@ -104,25 +107,42 @@ const App = () => { | |
| setDidInit(true) | ||
| } | ||
|
|
||
| const isNewAssistantView = | ||
| pathname.startsWith('/connected/assistant/') && | ||
| flag('cozy.top-bar-in-assistant.enabled') | ||
|
|
||
| return ( | ||
| // u-bg-white avoids mix-blend-mode from home-custom-background to be linked to the background color of the body. Must not be responsive to the theme. | ||
| <Layout monoColumn className="u-bg-white"> | ||
| <Layout monoColumn className={`${isNewAssistantView ? '' : 'u-bg-white'}`}> | ||
| <BarComponent | ||
| searchOptions={{ enabled: false }} | ||
| searchOptions={{ enabled: isNewAssistantView }} | ||
| appSlug={isNewAssistantView ? 'assistant' : undefined} | ||
| componentsProps={{ | ||
| Wrapper: { className: 'u-bg-transparent u-elevation-0' } | ||
| Wrapper: { | ||
| className: cx('u-elevation-0', { | ||
| 'u-border-bottom': isNewAssistantView, | ||
| 'u-bg-transparent': !isNewAssistantView, | ||
| [styles['topbar-border']]: isNewAssistantView | ||
| }) | ||
| } | ||
| }} | ||
| /> | ||
| <BackgroundContainer /> | ||
| {!isNewAssistantView && <BackgroundContainer />} | ||
| <ReloadFocus /> | ||
| <MainView> | ||
| <MainView isFullHeight={isNewAssistantView}> | ||
| <BackupNotification /> | ||
| <div | ||
| className="u-flex u-flex-column u-flex-content-start u-flex-content-stretch u-w-100 u-m-auto u-pos-relative" | ||
| className={cx( | ||
| 'u-flex u-flex-column u-flex-content-start u-flex-content-stretch u-w-100 u-pos-relative', | ||
| { | ||
| 'u-m-auto': !isNewAssistantView, | ||
| 'u-h-100': isNewAssistantView | ||
| } | ||
| )} | ||
| ref={didInit ? div => setContentWrapper(div) : null} | ||
| > | ||
| <MoveModal /> | ||
| <HeroHeader /> | ||
| {!isNewAssistantView && <HeroHeader />} | ||
| {hasError && ( | ||
| <main className="u-flex u-flex-items-center u-flex-justify-center"> | ||
| <Failure errorType="initial" /> | ||
|
|
@@ -139,15 +159,25 @@ const App = () => { | |
| <Route | ||
| path="/connected" | ||
| element={ | ||
| <Home | ||
| wrapper={contentWrapper} | ||
| shortcutsDirectories={shortcutsDirectories} | ||
| /> | ||
| isNewAssistantView ? ( | ||
| <Outlet /> | ||
| ) : ( | ||
| <Home | ||
| wrapper={contentWrapper} | ||
| shortcutsDirectories={shortcutsDirectories} | ||
| /> | ||
| ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to hide this?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| > | ||
| <Route | ||
| path="assistant/:conversationId" | ||
| element={<AssistantDialog />} | ||
| element={ | ||
| flag('cozy.top-bar-in-assistant.enabled') ? ( | ||
| <AssistantView /> | ||
| ) : ( | ||
| <AssistantDialog /> | ||
| ) | ||
| } | ||
| /> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| <Route path="search" element={<SearchDialog />} /> | ||
|
|
||
|
|
@@ -170,7 +200,9 @@ const App = () => { | |
| )} | ||
| <IconSprite /> | ||
| </div> | ||
| <FooterLogo /> | ||
| {((!isMobile && isNewAssistantView) || !isNewAssistantView) && ( | ||
| <FooterLogo /> | ||
| )} | ||
| </MainView> | ||
| {showAssistantForMobile && <AssistantMobileWrapper />} | ||
| {flag('home.wallpaper-personalization.enabled') && ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep false here. I think we will never want the search bar in home top bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I saw the search bar display in the figma, should we need a confirmation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok right keep it like this