diff --git a/site/source/pages/gerer/declaration-revenu-independants/declaration.tsx b/site/source/pages/gerer/declaration-revenu-independants/declaration.tsx index f80971b96..163d3e055 100644 --- a/site/source/pages/gerer/declaration-revenu-independants/declaration.tsx +++ b/site/source/pages/gerer/declaration-revenu-independants/declaration.tsx @@ -18,8 +18,8 @@ import { getMeta } from '@/utils' import { Grid } from '@mui/material' import { Item } from '@react-stately/collections' import { Rule, RuleNode } from 'publicodes' -import { useContext, useMemo } from 'react' -import { Trans } from 'react-i18next' +import { useContext, useEffect, useMemo, useState } from 'react' +import { Trans, useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' import { SimpleField } from '../_components/Fields' import { useProgress } from './_components/hooks' @@ -42,6 +42,7 @@ export function useObjectifs(): Array { } export default function Déclaration() { + const { t } = useTranslation() const engine = useEngine() const liasseDottedName = ( [ @@ -50,6 +51,17 @@ export default function Déclaration() { 'DRI . liasse . déclaration contrôlée', ] as const ).find((dottedName) => engine.evaluate(dottedName).nodeValue !== null) + + const [msgCopied, setMsgCopied] = useState(false) + + useEffect(() => { + const handler = setTimeout(() => setMsgCopied(false), 5000) + + return () => { + clearTimeout(handler) + } + }, [msgCopied]) + if (!liasseDottedName) { return null // TODO : micro-fiscal } @@ -150,9 +162,27 @@ export default function Déclaration() { {ModeleMessageComptable} - + {navigator.clipboard && ( + + )}

{liasse.title}

@@ -211,7 +241,7 @@ function LiasseFiscale() { <> {fields.map(([dottedName, rule]) => getMeta(rule.rawNode, {})?.section === 'oui' ? ( - +

) : ( - + )