diff --git a/src/components/BanksLink.jsx b/src/components/BanksLink.jsx deleted file mode 100644 index 2455ae27be..0000000000 --- a/src/components/BanksLink.jsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react' - -import AppLinker from 'cozy-ui/transpiled/react/AppLinker' -import Icon from 'cozy-ui/transpiled/react/Icon' -import styles from 'styles/konnectorSuccess.styl' -import OpenwithIcon from 'cozy-ui/transpiled/react/Icons/Openwith' - -import { useI18n } from 'cozy-ui/transpiled/react' -import { useClient } from 'cozy-client' -import Intents from 'cozy-interapp' - -const BanksLink = ({ banksUrl }) => { - const { t } = useI18n() - const client = useClient() - const intents = new Intents({ client }) - return banksUrl ? ( - - {({ href, onClick, name }) => ( - - - {t('account.success.banksLinkText', { - appName: name - })} - - )} - - ) : ( - - intents.redirect('io.cozy.apps', { slug: 'banks' }, url => { - window.top.location.href = url - }) - } - > - - {t('account.success.banksLinkText')} - - ) -} - -export default BanksLink diff --git a/src/components/KonnectorErrors.jsx b/src/components/KonnectorErrors.jsx deleted file mode 100644 index 2d7afcc9f9..0000000000 --- a/src/components/KonnectorErrors.jsx +++ /dev/null @@ -1,209 +0,0 @@ -import PropTypes from 'prop-types' -import React from 'react' -import flow from 'lodash/flow' -import keyBy from 'lodash/keyBy' -import { connect } from 'react-redux' -import { useClient, models } from 'cozy-client' -import { useNavigate } from 'react-router-dom' - -import AppIcon from 'cozy-ui/transpiled/react/AppIcon' -import Button from 'cozy-ui/transpiled/react/deprecated/Button' -import CrossButton from 'cozy-ui/transpiled/react/Icons/Cross' -import Divider from 'cozy-ui/transpiled/react/Divider' -import Icon from 'cozy-ui/transpiled/react/Icon' -import IconButton from 'cozy-ui/transpiled/react/IconButton' -import Infos from 'cozy-ui/transpiled/react/deprecated/Infos' -import InfosCarrousel from 'cozy-ui/transpiled/react/deprecated/InfosCarrousel' -import Typography from 'cozy-ui/transpiled/react/Typography' -import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints' -import { Media, Bd } from 'cozy-ui/transpiled/react/deprecated/Media' -import { getErrorLocaleBound, KonnectorJobError } from 'cozy-harvest-lib' -import { useI18n } from 'cozy-ui/transpiled/react/I18n' - -import { - getAccountsWithErrors, - getInstalledKonnectors, - getTriggersInError -} from 'reducers/index' -import ReactMarkdownWrapper from 'components/ReactMarkdownWrapper' -import homeConfig from 'config/home.json' - -const { - triggers: { triggers: triggersModel, triggerStates: triggerStatesModel }, - accounts: accountsModel -} = models - -const muteTrigger = async (client, trigger, accountsById) => { - const accountId = triggersModel.getAccountId(trigger) - const initialAccount = accountsById[accountId] - const errorType = triggerStatesModel.getLastErrorType(trigger) - const account = accountsModel.muteError(initialAccount, errorType) - - await client.save(account) -} - -const getKonnectorSlug = konnector => konnector.slug - -// TODO, use directly Infos prop dismissAction when -// https://github.com/cozy/cozy-ui/pull/1724 is merged -// Here we need the aria-label for tests, and IconButton for style -const InfosDismissButton = ({ onClick }) => { - const { t } = useI18n() - return ( - - - - ) -} - -const dismissButtonStyle = { - position: 'absolute', - top: '0.5rem', - right: '0.5rem' -} - -const KonnectorError = ({ - trigger, - triggerErrors, - index, - konnectorsBySlug, - accountsById -}) => { - const client = useClient() - const { t, lang } = useI18n() - const { isMobile } = useBreakpoints() - const errorType = triggerStatesModel.getLastErrorType(trigger) - const konnError = new KonnectorJobError(errorType) - const konnectorSlug = triggersModel.getKonnector(trigger) - const konnectorAccount = triggersModel.getAccountId(trigger) - const konnector = konnectorsBySlug[konnectorSlug] - const navigate = useNavigate() - - const errorTitle = getErrorLocaleBound(konnError, konnector, lang, 'title') - - const errorDescription = getErrorLocaleBound( - konnError, - konnector, - lang, - 'description' - ) - - const handleDismiss = () => { - muteTrigger(client, trigger, accountsById) - } - - return ( - - - - - - - {konnector.name} - - - {triggerErrors.length > 1 - ? `(${index + 1}/${triggerErrors.length}) ` - : null} - {errorTitle} - - - -
- - - -
- - } - action={ -