Skip to content
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
12 changes: 6 additions & 6 deletions manifest.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@
"chatConversations": {
"description": "Required by the cozy Assistant",
"type": "io.cozy.ai.chat.conversations",
"verbs": ["GET", "POST"]
"verbs": ["ALL"]
},
"chatEvents": {
"description": "Required by the cozy Assistant",
"type": "io.cozy.ai.chat.events",
"verbs": ["GET"]
},
"assistants": {
"type": "io.cozy.ai.chat.assistants",
"verbs": ["ALL"],
"description": "Required to fetch, create and update AI assistant"
},
"settings": {
"description": "Required by the cozy-bar display Claudy, to know which applications are coming soon and to manage default redirection update",
"type": "io.cozy.settings",
Expand Down Expand Up @@ -129,11 +134,6 @@
"type": "cc.cozycloud.announcements.uploads",
"verbs": ["GET"],
"description": "Remote-doctype required to get announcements images"
},
"assistants": {
"type": "io.cozy.ai.chat.assistants",
"verbs": ["ALL"],
"description": "Remote-doctype required to fetch, create and update assistant data"
}
},
"routes": {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@sentry/react": "7.119.0",
"cozy": "^0.5.0",
"cozy-bar": "^29.3.0",
"cozy-client": "^60.21.0",
"cozy-client": "^60.22.1",
"cozy-dataproxy-lib": "^4.11.0",
"cozy-device-helper": "^3.8.0",
"cozy-devtools": "^1.3.0",
Expand All @@ -48,11 +48,11 @@
"cozy-minilog": "^3.10.0",
"cozy-pouch-link": "^60.14.0",
"cozy-realtime": "^5.6.4",
"cozy-search": "^0.16.0",
"cozy-search": "^0.23.0",
"cozy-sharing": "^28.0.2",
"cozy-stack-client": "^60.6.0",
"cozy-tsconfig": "^1.8.1",
"cozy-ui": "^135.6.0",
"cozy-ui": "^137.0.1",
"cozy-ui-plus": "^4.0.0",
"cozy-viewer": "^26.2.0",
"date-fns": "2.30.0",
Expand Down
1 change: 1 addition & 0 deletions src/components/AppWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const Inner = ({ children, lang, context }) => (
<SectionsProvider>
{children}
<RealTimeQueries doctype="io.cozy.ai.chat.conversations" />
<RealTimeQueries doctype="io.cozy.ai.chat.assistant" />
<RealTimeQueries doctype="io.cozy.apps" />
<RealTimeQueries doctype="io.cozy.files" />
<RealTimeQueries doctype="io.cozy.jobs" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Assistant/AssistantMobileWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const AssistantMobileWrapper = () => {
return (
<CozyTheme variant="normal">
<div
className={cx('home-mobile-assistant', {
className={cx('home-mobile-assistant u-dn', {
['home-mobile-assistant--immersive']: getFlagshipMetadata().immersive
})}
>
Expand Down
8 changes: 6 additions & 2 deletions src/components/MainView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import React from 'react'
import cx from 'classnames'

import { getFlagshipMetadata } from 'cozy-device-helper'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'

export const MainView = ({ children }) => {
export const MainView = ({ children, isFullHeight }) => {
const isImmersive = getFlagshipMetadata().immersive
const { isMobile } = useBreakpoints()

return (
<main
className={cx(
'main-view u-flex u-flex-column u-flex-content-start u-flex-content-stretch u-w-100 u-pos-relative',
isImmersive && 'main-view--immersive'
isImmersive && 'main-view--immersive',
isFullHeight && 'main-view--full-height',
isFullHeight && isMobile && 'main-view--full-height-mobile'
)}
>
{children}
Expand Down
62 changes: 47 additions & 15 deletions src/containers/App.jsx
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'
Expand All @@ -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'
Expand All @@ -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)

Expand Down Expand Up @@ -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 }}
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Author

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?

Copy link
Copy Markdown
Member

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

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" />
Expand All @@ -139,15 +159,25 @@ const App = () => {
<Route
path="/connected"
element={
<Home
wrapper={contentWrapper}
shortcutsDirectories={shortcutsDirectories}
/>
isNewAssistantView ? (
<Outlet />
) : (
<Home
wrapper={contentWrapper}
shortcutsDirectories={shortcutsDirectories}
/>
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to hide this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the Home did not hide, the assistant view will look like this

image

}
>
<Route
path="assistant/:conversationId"
element={<AssistantDialog />}
element={
flag('cozy.top-bar-in-assistant.enabled') ? (
<AssistantView />
) : (
<AssistantDialog />
)
}
/>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<Route path="search" element={<SearchDialog />} />

Expand All @@ -170,7 +200,9 @@ const App = () => {
)}
<IconSprite />
</div>
<FooterLogo />
{((!isMobile && isNewAssistantView) || !isNewAssistantView) && (
<FooterLogo />
)}
</MainView>
{showAssistantForMobile && <AssistantMobileWrapper />}
{flag('home.wallpaper-personalization.enabled') && (
Expand Down
9 changes: 7 additions & 2 deletions src/containers/App.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { isFlagshipApp } from 'cozy-device-helper'
import { HashRouter } from 'react-router-dom'
import { render } from '@testing-library/react'
import App from '../components/AnimatedWrapper'
import AppLike from '@/test/AppLike'
Expand Down Expand Up @@ -57,7 +58,9 @@ describe('App', () => {
<AppLike>
<CozyTheme>
<WallPaperProvider>
<App />
<HashRouter>
<App />
</HashRouter>
</WallPaperProvider>
</CozyTheme>
</AppLike>
Expand All @@ -82,7 +85,9 @@ describe('App', () => {
<AppLike>
<CozyTheme>
<WallPaperProvider>
<App />
<HashRouter>
<App />
</HashRouter>
</WallPaperProvider>
</CozyTheme>
</AppLike>
Expand Down
10 changes: 10 additions & 0 deletions src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ const schema = {
doctype: 'io.cozy.accounts'
}
}
},
conversations: {
doctype: 'io.cozy.ai.chat.conversations',
attributes: {},
relationships: {
assistant: {
type: 'has-one',
doctype: 'io.cozy.ai.chat.assistants'
}
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/styles/app.styl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ body
&--immersive
min-height calc(100vh - var(--flagship-bottom-height) - var(--flagship-top-height))

&--full-height
padding 0
min-height calc(100vh - 3rem - 1px) // 3rem is topbar height, 1px is divider height

&--full-height-mobile
margin-top 3rem

+small-screen()
.main-view, .home-custom-background
transition transform 200ms ease-out
Expand All @@ -60,3 +67,6 @@ body

#coz-bar
top var(--flagship-top-height)

.topbar-border
border-bottom 1px solid var(--dividerColor)
Loading
Loading