Skip to content

Commit

Permalink
publish: Merge pull request #281 from cozy/feat/add-translate-apps
Browse files Browse the repository at this point in the history
generated from commit 7e07ec9
  • Loading branch information
Travis CI User committed Oct 9, 2024
1 parent 19a6643 commit b333389
Show file tree
Hide file tree
Showing 16 changed files with 658 additions and 500 deletions.
33 changes: 24 additions & 9 deletions en/cozy-client/api/cozy-client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4559,7 +4559,7 @@ <h3 id="dehydrate">dehydrate<a class="headerlink" href="#dehydrate" title="Perma
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/helpers/dehydrateHelper.js#L3">packages/cozy-client/src/helpers/dehydrateHelper.js:3</a></p>
<hr />
<h3 id="dispatchcreate">dispatchCreate<a class="headerlink" href="#dispatchcreate" title="Permanent link">&para;</a></h3>
<p><strong>dispatchCreate</strong>(<code>client</code>, <code>doctype</code>, <code>couchDBDoc</code>): <code>void</code></p>
<p><strong>dispatchCreate</strong>(<code>client</code>, <code>doctype</code>, <code>couchDBDoc</code>, <code>options?</code>): <code>Promise</code>&lt;<code>void</code>&gt;</p>
<p>Dispatches a create action for a document to update CozyClient store from realtime callbacks.</p>
<p><em>Parameters</em></p>
<table>
Expand All @@ -4586,15 +4586,20 @@ <h3 id="dispatchcreate">dispatchCreate<a class="headerlink" href="#dispatchcreat
<td align="left"><code>CouchDBDocument</code></td>
<td align="left">Document to create</td>
</tr>
<tr>
<td align="left"><code>options</code></td>
<td align="left"><code>DispatchOptions</code></td>
<td align="left">-</td>
</tr>
</tbody>
</table>
<p><em>Returns</em></p>
<p><code>void</code></p>
<p><code>Promise</code>&lt;<code>void</code>&gt;</p>
<p><em>Defined in</em></p>
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/store/realtime.js#L58">packages/cozy-client/src/store/realtime.js:58</a></p>
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/store/realtime.js#L76">packages/cozy-client/src/store/realtime.js:76</a></p>
<hr />
<h3 id="dispatchdelete">dispatchDelete<a class="headerlink" href="#dispatchdelete" title="Permanent link">&para;</a></h3>
<p><strong>dispatchDelete</strong>(<code>client</code>, <code>doctype</code>, <code>couchDBDoc</code>): <code>void</code></p>
<p><strong>dispatchDelete</strong>(<code>client</code>, <code>doctype</code>, <code>couchDBDoc</code>, <code>options?</code>): <code>Promise</code>&lt;<code>void</code>&gt;</p>
<p>Dispatches a delete action for a document to update CozyClient store from realtime callbacks.</p>
<p><em>Parameters</em></p>
<table>
Expand All @@ -4621,15 +4626,20 @@ <h3 id="dispatchdelete">dispatchDelete<a class="headerlink" href="#dispatchdelet
<td align="left"><code>CouchDBDocument</code></td>
<td align="left">Document to create</td>
</tr>
<tr>
<td align="left"><code>options</code></td>
<td align="left"><code>DispatchOptions</code></td>
<td align="left">-</td>
</tr>
</tbody>
</table>
<p><em>Returns</em></p>
<p><code>void</code></p>
<p><code>Promise</code>&lt;<code>void</code>&gt;</p>
<p><em>Defined in</em></p>
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/store/realtime.js#L80">packages/cozy-client/src/store/realtime.js:80</a></p>
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/store/realtime.js#L120">packages/cozy-client/src/store/realtime.js:120</a></p>
<hr />
<h3 id="dispatchupdate">dispatchUpdate<a class="headerlink" href="#dispatchupdate" title="Permanent link">&para;</a></h3>
<p><strong>dispatchUpdate</strong>(<code>client</code>, <code>doctype</code>, <code>couchDBDoc</code>): <code>void</code></p>
<p><strong>dispatchUpdate</strong>(<code>client</code>, <code>doctype</code>, <code>couchDBDoc</code>, <code>options?</code>): <code>Promise</code>&lt;<code>void</code>&gt;</p>
<p>Dispatches a update action for a document to update CozyClient store from realtime callbacks.</p>
<p><em>Parameters</em></p>
<table>
Expand All @@ -4656,12 +4666,17 @@ <h3 id="dispatchupdate">dispatchUpdate<a class="headerlink" href="#dispatchupdat
<td align="left"><code>CouchDBDocument</code></td>
<td align="left">Document to create</td>
</tr>
<tr>
<td align="left"><code>options</code></td>
<td align="left"><code>DispatchOptions</code></td>
<td align="left">-</td>
</tr>
</tbody>
</table>
<p><em>Returns</em></p>
<p><code>void</code></p>
<p><code>Promise</code>&lt;<code>void</code>&gt;</p>
<p><em>Defined in</em></p>
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/store/realtime.js#L69">packages/cozy-client/src/store/realtime.js:69</a></p>
<p><a href="https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/store/realtime.js#L98">packages/cozy-client/src/store/realtime.js:98</a></p>
<hr />
<h3 id="ensurefirstslash">ensureFirstSlash<a class="headerlink" href="#ensurefirstslash" title="Permanent link">&para;</a></h3>
<p><strong>ensureFirstSlash</strong>(<code>path</code>): <code>any</code></p>
Expand Down
49 changes: 41 additions & 8 deletions en/cozy-home/src/assistant/AssistantDialog.jsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,62 @@
import React from 'react'

import { FixedActionsDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import { FixedDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'

import Conversation from './Conversations/Conversation'
import ConversationSearchBar from './Conversations/ConversationSearchBar'
import AssistantProvider, { useAssistant } from './AssistantProvider'
import SearchProvider from './SearchProvider'
import ConversationSearchBar from './Conversations/ConversationSearchBar'

import styles from './styles.styl'

const AssistantDialog = ({ onClose }) => {
const { assistantState } = useAssistant()
const { isMobile } = useBreakpoints()

return (
<FixedActionsDialog
<FixedDialog
open
fullScreen
size="full"
className={styles['assistantDialog']}
componentsProps={{
divider: { className: 'u-dn' }
}}
content={<Conversation id={assistantState.conversationId} />}
title=" "
content={
<>
{isMobile && !assistantState.conversationId && (
<div className="u-mb-2">
<ConversationSearchBar
assistantStatus={assistantState.status}
conversationId={assistantState.conversationId}
hasArrowDown
autoFocus
onClose={onClose}
/>
</div>
)}
<Conversation id={assistantState.conversationId} />
</>
}
actions={
<ConversationSearchBar
assistantStatus={assistantState.status}
conversationId={assistantState.conversationId}
/>
isMobile ? (
assistantState.conversationId && (
<ConversationSearchBar
assistantStatus={assistantState.status}
conversationId={assistantState.conversationId}
autoFocus={!isMobile}
onClose={onClose}
/>
)
) : (
<ConversationSearchBar
assistantStatus={assistantState.status}
conversationId={assistantState.conversationId}
autoFocus
/>
)
}
onClose={onClose}
/>
Expand Down
2 changes: 1 addition & 1 deletion en/cozy-home/src/assistant/Conversations/Conversation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Conversation = ({ id, myself }) => {
const givenName = myself.name?.givenName

return (
<div className="u-mt-0 u-mt-2-s u-maw-7 u-mh-auto">
<div className="u-maw-7 u-mh-auto">
<ChatAssistantItem
label={
givenName
Expand Down
25 changes: 18 additions & 7 deletions en/cozy-home/src/assistant/Conversations/ConversationSearchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,25 @@ import SuggestionsPlaceholder from './SuggestionsPlaceholder'

import styles from './styles.styl'

const ConversationSearchBar = ({ assistantStatus, conversationId }) => {
const ConversationSearchBar = ({
assistantStatus,
conversationId,
autoFocus,
hasArrowDown,
onClose
}) => {
const { t } = useI18n()
const resultPaneAnchorRef = useRef()
const { onAssistantExecute } = useAssistant()
const { assistantState, onAssistantExecute } = useAssistant()
const { setSearchValue, delayedSetSearchValue } = useSearch()
const [inputValue, setInputValue] = useState('')
const [showSuggestions, setShowSuggestions] = useState(false)
const inputRef = useRef()

useTimeoutWhen(() => setShowSuggestions(true), 2000)
useTimeoutWhen(
() => setShowSuggestions(true),
2000,
inputValue === '' && !assistantState.conversationId
)

useEventListener(inputRef.current, 'input', () => {
// TODO: hack found on internet, we could try remove the auto assignment to see if it still works without it
Expand All @@ -37,6 +46,7 @@ const ConversationSearchBar = ({ assistantStatus, conversationId }) => {
const handleChange = ev => {
delayedSetSearchValue(ev.target.value)
setInputValue(ev.target.value)
setShowSuggestions(false)
}

const handleStop = () => {
Expand All @@ -53,7 +63,7 @@ const ConversationSearchBar = ({ assistantStatus, conversationId }) => {
})

return (
<div ref={resultPaneAnchorRef} className="u-w-100 u-maw-7 u-mh-auto">
<div className="u-w-100 u-maw-7 u-mh-auto">
<SearchBar
className={styles['conversationSearchBar']}
icon={null}
Expand All @@ -69,7 +79,7 @@ const ConversationSearchBar = ({ assistantStatus, conversationId }) => {
inputProps: {
className: styles['conversationSearchBar-input']
},
autoFocus: true,
autoFocus,
startAdornment: showSuggestions && (
<SuggestionsPlaceholder inputValue={inputValue} />
),
Expand Down Expand Up @@ -98,6 +108,7 @@ const ConversationSearchBar = ({ assistantStatus, conversationId }) => {
>
<Icon
icon={ArrowUpIcon}
rotate={hasArrowDown ? 180 : 0}
size={12}
color={
inputValue
Expand All @@ -119,7 +130,7 @@ const ConversationSearchBar = ({ assistantStatus, conversationId }) => {
onChange={handleChange}
/>
{!conversationId && (
<ResultMenu anchorRef={resultPaneAnchorRef} onClick={handleClick} />
<ResultMenu onClick={handleClick} onClose={onClose} />
)}
</div>
)
Expand Down
29 changes: 16 additions & 13 deletions en/cozy-home/src/assistant/ResultMenu/ResultMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import React from 'react'

import BottomSheet, {
BottomSheetItem
} from 'cozy-ui/transpiled/react/BottomSheet'
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import Paper from 'cozy-ui/transpiled/react/Paper'

import { useSearch } from '../SearchProvider'
import ResultMenuContent from './ResultMenuContent'

import styles from './styles.styl'

const ResultMenu = ({ anchorRef, onClick }) => {
const ResultMenu = ({ onClick, onClose }) => {
const { isMobile } = useBreakpoints()
const { searchValue } = useSearch()

if (!searchValue) return null

if (isMobile)
return (
<BottomSheet
portalProps={{ container: anchorRef?.current }}
settings={{ hasMinHeightOffset: true }}
offset={70}
>
<BottomSheetItem disableGutters>
<ResultMenuContent onClick={onClick} />
</BottomSheetItem>
</BottomSheet>
<Dialog
open
transitionDuration={0}
disablePortal
disableAutoFocus
hideBackdrop
componentsProps={{
dialogTitle: { style: { height: '6.5rem' } },
divider: { className: 'u-dn' }
}}
title={' '}
content={<ResultMenuContent hasArrowDown onClick={onClick} />}
onClose={onClose}
/>
)

return (
Expand Down
8 changes: 6 additions & 2 deletions en/cozy-home/src/assistant/ResultMenu/ResultMenuContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@ const SearchResult = () => {
))
}

const ResultMenuContent = ({ onClick }) => {
const ResultMenuContent = ({ hasArrowDown, onClick }) => {
const { searchValue } = useSearch()

return (
<List>
<ResultMenuItem
icon={
<Circle size="small">
<Icon icon={ArrowUpIcon} size={12} />
<Icon
icon={ArrowUpIcon}
size={12}
rotate={hasArrowDown ? 180 : 0}
/>
</Circle>
}
primaryText={searchValue}
Expand Down
7 changes: 6 additions & 1 deletion en/cozy-home/src/assistant/styles.styl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@
padding-right 4.5rem

&--immersive
padding-bottom calc(1rem + var(--flagship-bottom-height))
padding-bottom calc(1rem + var(--flagship-bottom-height))

// should be in coz-ui for FixedDialog
.assistantDialog
hr
display none
9 changes: 8 additions & 1 deletion en/cozy-home/src/components/BackgroundContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ export const BackgroundContainer = (): JSX.Element => {
<div />
<div />
{!isCustomWallpaper && (
<img className="home-default-background--img" src={DefaultWallpaper} />
<div
className="home-default-background--img"
style={{
backgroundImage: `url(${DefaultWallpaper})`,
backgroundRepeat: 'no-repeat',
backgroundSize: '100%'
}}
/>
)}
</div>
)
Expand Down
18 changes: 17 additions & 1 deletion en/cozy-home/src/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{
"assistant": {
"search": {
"placeholder": "Eine Frage?"
},
"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",
"suggestions": {
"find_file": "Eine Datei suchen",
"reimbursements": "Meine Rückerstattungen überprüfen",
"reorganise_files": "Meine Dateien neu ordnen"
}
},
"app": {
"logo": {
"alt": "%{name} Logo"
Expand Down Expand Up @@ -349,7 +365,7 @@
"reload": "Jetzt aktualisieren"
}
},

"maintenance": {
"icon": "Dieser Connector wird gerade gewartet.",
"service": "Dienst unterbrochen",
Expand Down
16 changes: 16 additions & 0 deletions en/cozy-home/src/locales/es.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{
"assistant": {
"search": {
"placeholder": "¿Tiene alguna pregunta?"
},
"dialog": {
"close": "Cerrar"
},
"hello_name":"Hola %{name}, ¿en qué puedo ayudarle?",
"hello":"Hola, ¿en qué puedo ayudarle?",
"name":"Asistente Cozy",
"suggestions": {
"find_file": "Buscar un fichero",
"reimbursements": "Comprobar mis reembolsos",
"reorganise_files": "Reorganizar mis archivos"
}
},
"app": {
"logo": {
"alt": "%{name} logo"
Expand Down
Loading

0 comments on commit b333389

Please sign in to comment.