Skip to content

Commit

Permalink
feat(Assistant): Remove first hello message
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Nov 4, 2024
1 parent 9abcd23 commit c771331
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 37 deletions.
30 changes: 7 additions & 23 deletions src/assistant/Conversations/Conversation.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
import React from 'react'

import { useQuery, isQueryLoading } from 'cozy-client'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import { buildMyselfQuery } from '../queries'
import ChatAssistantItem from './ChatAssistantItem'
import ChatConversation from './ChatConversation'

const Conversation = ({ id, myself }) => {
const { t } = useI18n()
const givenName = myself.name?.givenName

return (
<div className="u-maw-7 u-mh-auto">
<ChatAssistantItem
label={
givenName
? t('assistant.hello_name', { name: givenName })
: t('assistant.hello')
}
/>
{id && <ChatConversation id={id} myself={myself} />}
</div>
)
}

const ConversationWithQuery = ({ id }) => {
const Conversation = ({ id }) => {
const myselfQuery = buildMyselfQuery()
const { data: myselves, ...queryMyselfResult } = useQuery(
myselfQuery.definition,
Expand All @@ -36,7 +16,11 @@ const ConversationWithQuery = ({ id }) => {

if (isLoading) return null

return <Conversation id={id} myself={myselves[0]} />
return (
<div className="u-maw-7 u-mh-auto">
<ChatConversation id={id} myself={myselves[0]} />
</div>
)
}

export default ConversationWithQuery
export default Conversation
2 changes: 0 additions & 2 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "Schließen"
},
"hello_name":"Hallo %{name}, was kann ich für Sie tun?",
"hello":"Hallo, was kann ich für Sie tun?",
"name":"Cozy Assistent",
"sources":"%{smart_count} Quelle |||| %{smart_count} Quellen",
"suggestions": {
Expand Down
2 changes: 0 additions & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "Close"
},
"hello_name":"Hello %{name}, what can I do for you?",
"hello":"Hello, what can I do for you?",
"name":"Cozy Assistant",
"sources":"%{smart_count} source |||| %{smart_count} sources",
"suggestions": {
Expand Down
2 changes: 0 additions & 2 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "Cerrar"
},
"hello_name":"Hola %{name}, ¿en qué puedo ayudarle?",
"hello":"Hola, ¿en qué puedo ayudarle?",
"name":"Asistente Cozy",
"sources":"%{smart_count} fuente |||| %{smart_count} fuentes",
"suggestions": {
Expand Down
2 changes: 0 additions & 2 deletions src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "Fermer"
},
"hello_name":"Bonjour %{name}, que puis-je faire pour vous ?",
"hello":"Bonjour, que puis-je faire pour vous ?",
"name":"Assistant Cozy",
"sources":"%{smart_count} source |||| %{smart_count} sources",
"suggestions": {
Expand Down
2 changes: 0 additions & 2 deletions src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "Chiudere"
},
"hello_name":"Salve %{name}, cosa posso fare per lei?",
"hello":"Salve, cosa posso fare per lei?",
"name":"Assistente Cozy",
"sources":"%{smart_count} fonte |||| %{smart_count} fonti",
"suggestions": {
Expand Down
2 changes: 0 additions & 2 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "閉じる"
},
"hello_name":"${name}さん、こんにちは。",
"hello":"こんにちは、何かご用ですか?",
"name":"アシスタント Cozy",
"sources":"%{smart_count} ソース |||| %{smart_count} ソース",
"suggestions": {
Expand Down
2 changes: 0 additions & 2 deletions src/locales/nl_NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dialog": {
"close": "Sluit"
},
"hello_name":"Hallo %{name}, wat kan ik voor je doen?",
"hello":"Hallo, wat kan ik voor u doen?",
"name":"Cozy Assistent",
"sources":"%{smart_count} bron |||| %{smart_count} bronnen",
"suggestions": {
Expand Down

0 comments on commit c771331

Please sign in to comment.