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
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"devDependencies": {
"@babel/eslint-parser": "^7.19.1",
"@babel/polyfill": "7.12.1",
"@cozy/codemods": "^1.33.1",
"@rsbuild/core": "^1.5.4",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.4.0",
Expand All @@ -60,6 +61,7 @@
"identity-obj-proxy": "3.0.0",
"jest": "29.4.2",
"jest-environment-jsdom": "29.4.2",
"jscodeshift": "^17.3.0",
"mockdate": "3.0.5",
"node-polyglot": "2.5.0",
"prettier": "^2.8.4",
Expand All @@ -77,8 +79,8 @@
"@sentry/integrations": "7.88.0",
"@sentry/react": "7.88.0",
"classnames": "2.3.1",
"cozy-bar": "^27.0.0",
"cozy-client": "^60.14.0",
"cozy-bar": "^29.2.0",
"cozy-client": "^60.21.1",
"cozy-dataproxy-lib": "^4.11.0",
"cozy-device-helper": "^3.8.0",
"cozy-devtools": "^1.3.0",
Expand All @@ -91,12 +93,12 @@
"cozy-minilog": "^3.10.0",
"cozy-pouch-link": "^54.0.0",
"cozy-realtime": "^5.0.0",
"cozy-search": "^0.13.0",
"cozy-sharing": "^25.4.0",
"cozy-search": "^0.16.2",
"cozy-sharing": "^28.3.3",
"cozy-stack-client": "^60.1.0",
"cozy-tsconfig": "^1.8.1",
"cozy-ui": "^133.0.0",
"cozy-ui-plus": "^2.1.0",
"cozy-ui": "^136.0.0",
"cozy-ui-plus": "^4.5.1",
"cozy-vcard": "^0.2.18",
"final-form": "4.20.9",
"final-form-arrays": "3.1.0",
Expand All @@ -114,6 +116,7 @@
"redux-logger": "3.0.6",
"redux-thunk": "2.4.1",
"remove-accents": "0.4.2",
"twake-i18n": "^0.3.1",
"yarn-run-all": "3.1.1"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppProviders.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import { Provider } from 'react-redux'
import { I18n } from 'twake-i18n'

import { BarProvider } from 'cozy-bar'
import { CozyProvider } from 'cozy-client'
import { DataProxyProvider } from 'cozy-dataproxy-lib'
import { WebviewIntentProvider } from 'cozy-intent'
import AlertProvider from 'cozy-ui/transpiled/react/providers/Alert'
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { I18n } from 'cozy-ui/transpiled/react/providers/I18n'
import {
StylesProvider,
createGenerateClassName
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/ConfirmDeleteActions.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PropTypes from 'prop-types'
import React from 'react'
import { useI18n } from 'twake-i18n'

import Button from 'cozy-ui/transpiled/react/Buttons'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

const ConfirmDeleteActions = ({ onCancel, onDelete, isBusy }) => {
const { t } = useI18n()
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/StoreButton.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { useI18n } from 'twake-i18n'

import { useClient } from 'cozy-client'
import Button from 'cozy-ui/transpiled/react/Buttons'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import AppIcon from 'cozy-ui-plus/dist/AppIcon'

import { getFilteredStoreUrl } from '../../helpers/store'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContactCard/ContactAccounts.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types'
import React from 'react'
import { translate } from 'twake-i18n'

import Icon from 'cozy-ui/transpiled/react/Icon'
import Typography from 'cozy-ui/transpiled/react/Typography'
import { translate } from 'cozy-ui/transpiled/react/providers/I18n'

import Fieldset from '../Common/Fieldset'
import FieldsetTitle from '../Common/FieldsetTitle'
Expand Down
3 changes: 1 addition & 2 deletions src/components/ContactCard/ContactFields/FieldByType.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import PropTypes from 'prop-types'
import React from 'react'

import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import { useI18n } from 'twake-i18n'

import {
Birthday,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types'
import React from 'react'
import { useI18n } from 'twake-i18n'

import Typography from 'cozy-ui/transpiled/react/Typography'
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import FieldByType from './FieldByType'
import { makeTLabel } from './helpers'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PropTypes from 'prop-types'
import React from 'react'
import { translate } from 'twake-i18n'

import Button from 'cozy-ui/transpiled/react/Buttons'
import { translate } from 'cozy-ui/transpiled/react/providers/I18n'

import Importation from '../../importation'
import Status from '../../importation/status'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import cx from 'classnames'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
import { useI18n } from 'twake-i18n'

import Icon from 'cozy-ui/transpiled/react/Icon'
import UploadIcon from 'cozy-ui/transpiled/react/Icons/Upload'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import Importation from '../../../importation'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import PropTypes from 'prop-types'
import React from 'react'

import { translate } from 'cozy-ui/transpiled/react/providers/I18n'
import { translate } from 'twake-i18n'

import ContactImportationCardWrapper from './ContactImportationCardWrapper'
import ContactImportationFile from './ContactImportationFile'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'

import { translate } from 'cozy-ui/transpiled/react/providers/I18n'
import { translate } from 'twake-i18n'

const ExportStepsExplanation = ({ t }) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContactImportationModal/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useI18n } from 'twake-i18n'

import { useClient } from 'cozy-client'
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs'
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import ContactImportationActions from './ContactImportationActions'
import ContactImportationCard from './ContactImportationCard'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContactsList/CategorizedList.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import PropTypes from 'prop-types'
import React from 'react'
import { useI18n } from 'twake-i18n'

import List from 'cozy-ui/transpiled/react/List'
import ListSubheader from 'cozy-ui/transpiled/react/ListSubheader'
import { Table } from 'cozy-ui/transpiled/react/deprecated/Table'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import ContactsSubList from './ContactsSubList'
import { categorizeContacts } from '../../helpers/contactList'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContactsList/ContactsEmptyList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import { useNavigate } from 'react-router-dom'
import { useI18n } from 'twake-i18n'

import Button from 'cozy-ui/transpiled/react/Buttons'
import Empty from 'cozy-ui/transpiled/react/Empty'
Expand All @@ -10,7 +11,6 @@ import TeamIcon from 'cozy-ui/transpiled/react/Icons/Team'
import Stack from 'cozy-ui/transpiled/react/Stack'
import Infos from 'cozy-ui/transpiled/react/deprecated/Infos'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import { useSelectedGroup } from 'cozy-ui-plus/dist/Contacts/GroupsSelect/GroupsSelectProvider'

import EmptyIcon from '../../assets/icons/empty-contact-list.svg'
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContactsList/Virtualized/Cell.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useRef, useState } from 'react'
import { useI18n } from 'twake-i18n'

import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'
import Icon from 'cozy-ui/transpiled/react/Icon'
import IconButton from 'cozy-ui/transpiled/react/IconButton'
import DotsIcon from 'cozy-ui/transpiled/react/Icons/Dots'
import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
import ContactIdentity from 'cozy-ui-plus/dist/ContactsList/Contacts/ContactIdentity'

const Cell = ({ row, column, cell, actions }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import flow from 'lodash/flow'
import PropTypes from 'prop-types'
import React from 'react'
import { useNavigate } from 'react-router-dom'
import { useI18n } from 'twake-i18n'

import { useClient } from 'cozy-client'
import { splitFilename } from 'cozy-client/dist/models/file'
Expand All @@ -10,7 +11,6 @@ import { addToFavorites } from 'cozy-ui/transpiled/react/ActionsMenu/Actions/add
import { removeFromFavorites } from 'cozy-ui/transpiled/react/ActionsMenu/Actions/removeFromFavorites'
import VirtualizedTable from 'cozy-ui/transpiled/react/Table/Virtualized'
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

import { edit } from '@/components/Actions/edit'
import { trash } from '@/components/Actions/trash'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@ exports[`ContactListItem should match the contact snapshot 1`] = `
className="MuiTypography-root u-ml-1 MuiTypography-body1 MuiTypography-colorTextPrimary MuiTypography-noWrap MuiTypography-displayInline"
data-testid="ContactName"
>
<span
className=""
>
John

</span>
John

<span
className="u-fw-bold"
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Intents/CreateContact.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import flow from 'lodash/flow'
import PropTypes from 'prop-types'
import React from 'react'
import { translate } from 'twake-i18n'

import { withClient } from 'cozy-client'
import IntentHeader from 'cozy-ui/transpiled/react/IntentHeader'
import { translate } from 'cozy-ui/transpiled/react/providers/I18n'
import ContactForm from 'cozy-ui-plus/dist/Contacts/AddModal/ContactForm'

import IntentMain from './IntentMain'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Intents/IntentHandler.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import PropTypes from 'prop-types'
import React, { Children, Component } from 'react'
import { translate } from 'twake-i18n'

import Empty from 'cozy-ui/transpiled/react/Empty'
import CozyIcon from 'cozy-ui/transpiled/react/Icons/Cozy'
import Spinner from 'cozy-ui/transpiled/react/Spinner'
import { translate } from 'cozy-ui/transpiled/react/providers/I18n'

import contactsStyles from '@/styles/contacts.styl'
import intentStyles from '@/styles/intent.styl'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Intents/PickContacts.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types'
import React from 'react'
import { translate } from 'twake-i18n'

import Button from 'cozy-ui/transpiled/react/Buttons'
import IntentHeader from 'cozy-ui/transpiled/react/IntentHeader'
import { translate } from 'cozy-ui/transpiled/react/providers/I18n'

import IntentMain from './IntentMain'
import ContactsList from '../ContactsList/ContactsList'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modals/ConfirmDeleteModal.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from 'react'
import { useEffect } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
import { useI18n } from 'twake-i18n'

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

import { getConnectedAccounts } from '../../helpers/contacts'
import { buildContactsQueryById } from '../../queries/queries'
Expand Down
34 changes: 0 additions & 34 deletions src/components/Modals/ContactFormModal.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,6 @@ describe('ContactFormModal component', () => {
})
})

it('should not call the create function if any of the required fields are missing', async () => {
Comment thread
rezk2ll marked this conversation as resolved.
const formData = {
company: 'Cozy Cloud'
}
useQuery.mockReturnValue({
data: undefined
})
useQueryAll.mockReturnValue({
data: []
})
useParams.mockReturnValue({
contactId: 'ID'
})

render(
<AppLike>
<ContactFormModal />
</AppLike>
)

act(() => {
fireEvent.change(screen.getByLabelText('Company'), {
target: { value: formData.company }
})
})
expect(screen.getByLabelText('Company').value).toBe('Cozy Cloud')

act(() => {
fireEvent.click(screen.getByText('Save'))
})

expect(createOrUpdateContact).not.toBeCalled()
})

it('should pass a new contact to the creation function', async () => {
const formData = {
firstname: 'bob'
Expand Down
36 changes: 1 addition & 35 deletions src/components/Modals/ContactFormModal/CreateModal.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, fireEvent, act } from '@testing-library/react'
import { render, screen, fireEvent } from '@testing-library/react'
import React from 'react'
import { useParams } from 'react-router-dom'

Expand All @@ -23,40 +23,6 @@ jest.mock('react-router-dom', () => ({
}))

describe('CreateModal component', () => {
it('should not call the create function if any of the required fields are missing', async () => {
const formData = {
company: 'Cozy Cloud'
}
useQuery.mockReturnValue({
data: undefined
})
useQueryAll.mockReturnValue({
data: []
})
useParams.mockReturnValue({
contactId: 'ID'
})

render(
<AppLike>
<CreateModal />
</AppLike>
)

act(() => {
fireEvent.change(screen.getByLabelText('Company'), {
target: { value: formData.company }
})
})
expect(screen.getByLabelText('Company').value).toBe('Cozy Cloud')

act(() => {
fireEvent.click(screen.getByText('Save'))
})

expect(createOrUpdateContact).not.toBeCalled()
})

it('should pass a new contact to the creation function', async () => {
const formData = {
firstname: 'bob'
Expand Down
Loading