🐛 Corrige les erreurs dans la console

pull/2023/head
Maxime Quandalle 2022-02-16 14:03:34 +01:00 committed by Maxime Quandalle
parent 454fbe4c80
commit 13523f45a3
11 changed files with 154 additions and 152 deletions

View File

@ -108,7 +108,6 @@ function getSerializedUnit(
}
const formatUnit = getFormatUnit(unit)
console.log(unit, locale, formatUnit)
if (!formatUnit) {
return (

View File

@ -1,4 +1,5 @@
import { setSimulationConfig } from 'Actions/actions'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { useHistory } from 'react-router'
import { Company } from 'Reducers/inFranceAppReducer'
@ -24,9 +25,11 @@ export default function useSimulationConfig(
: undefined
const lastConfig = useSelector(configSelector)
if (config && lastConfig !== config) {
dispatch(setSimulationConfig(config ?? {}, url, initialSituation))
}
useEffect(() => {
if (config && lastConfig !== config) {
dispatch(setSimulationConfig(config ?? {}, url, initialSituation))
}
}, [config, dispatch, lastConfig, initialSituation, url])
}
export function getCompanySituation(company: Company | null): Situation {

View File

@ -32,7 +32,7 @@ export const Button = forwardRef(function Button(
{...buttonOrLinkProps}
className={className}
size={size}
light={light}
$light={light}
color={color}
/>
)
@ -41,7 +41,7 @@ export const Button = forwardRef(function Button(
type StyledButtonProps = {
color: Color
size: Size
light: boolean
$light: boolean
isDisabled?: boolean
}
@ -93,8 +93,8 @@ export const StyledButton = styled.button<StyledButtonProps>`
`}
/* Primary, secondary & tertiary light colors */
${({ light, color, theme }) =>
light &&
${({ $light, color, theme }) =>
$light &&
!theme.darkMode &&
css`
color: ${theme.colors.bases[color][color === 'primary' ? 700 : 700]};
@ -111,9 +111,9 @@ export const StyledButton = styled.button<StyledButtonProps>`
`}
/* White color and light mode (dark background mode) */
${({ light, theme }) =>
${({ $light, theme }) =>
theme.darkMode &&
light &&
$light &&
css`
background-color: transparent;
border-color: ${theme.colors.extended.grey[100]};
@ -122,11 +122,11 @@ export const StyledButton = styled.button<StyledButtonProps>`
}
/* HOVER STYLE */
:hover {
${({ theme, color, isDisabled, light }) =>
${({ theme, color, isDisabled, $light }) =>
isDisabled || theme.darkMode
? ''
: /* Primary, secondary & tertiary light colors */
light
$light
? css`
background-color: ${theme.colors.bases[color][
color === 'primary' ? 200 : color === 'secondary' ? 100 : 100
@ -143,11 +143,11 @@ export const StyledButton = styled.button<StyledButtonProps>`
/* Dark mode */
@media not print {
:hover {
${({ light, theme, isDisabled }) =>
${({ $light, theme, isDisabled }) =>
isDisabled || !theme.darkMode
? ''
: /* White color and light mode (dark background mode) */
light
$light
? css`
color: rgba(255, 255, 255, 25%);
opacity: 1;

View File

@ -20,7 +20,7 @@ export default function ButtonHelp({
return (
<PopoverWithTrigger
trigger={(buttonProps) => (
<StyledButton light={light ?? false} {...buttonProps}>
<StyledButton $light={light} {...buttonProps}>
<CircleIcon
aria-hidden="true"
width="24"
@ -61,7 +61,7 @@ const CircleIcon = styled.svg`
margin-right: ${({ theme }) => theme.spacings.xxs};
`
const StyledButton = styled(Button)<{ light: boolean }>`
const StyledButton = styled(Button)<{ $light?: boolean }>`
--padding: 2px;
&& {
height: calc(${({ theme }) => theme.spacings.md} + 2 * var(--padding));
@ -80,8 +80,8 @@ const StyledButton = styled(Button)<{ light: boolean }>`
align-items: center;
color: ${({ theme }) => theme.colors.bases.primary[600]} !important;
border: 1px solid ${({ theme }) => theme.colors.bases.primary[600]};
background-color: ${({ theme, light }) =>
light
background-color: ${({ theme, $light }) =>
$light
? theme.colors.extended.grey[100]
: theme.colors.bases.primary[100]};
border-radius: calc(
@ -89,8 +89,7 @@ const StyledButton = styled(Button)<{ light: boolean }>`
);
:hover {
background-color: ${({ theme, light }) =>
theme.colors.bases.primary[200]};
background-color: ${({ theme }) => theme.colors.bases.primary[200]};
}
}
`

View File

@ -39,7 +39,7 @@ export function Card({
return (
<ThemeProvider theme={(theme) => ({ ...theme, darkMode: false })}>
<CardContainer compact={compact} {...buttonOrLinkProps} tabIndex={0}>
<CardContainer $compact={compact} {...buttonOrLinkProps} tabIndex={0}>
{icon && <IconContainer>{icon}</IconContainer>}
{title && <StyledHeader {...titleProps} />}
<div
@ -53,7 +53,7 @@ export function Card({
</div>
{ctaLabel && (
// The button is not selectable with keyboard navigation because the whole card already is
<CardButton tabIndex={-1} size="XS" light color="primary">
<CardButton tabIndex={-1} size="XS" $light color="primary">
{ctaLabel}
{linkProps.external && <NewWindowLinkIcon />}
</CardButton>
@ -100,7 +100,7 @@ const IconContainer = styled.div`
margin-top: ${({ theme }) => theme.spacings.md};
`
export const CardContainer = styled.div<{ compact?: boolean }>`
export const CardContainer = styled.div<{ $compact?: boolean }>`
display: flex;
width: 100%;
height: 100%;
@ -119,8 +119,8 @@ export const CardContainer = styled.div<{ compact?: boolean }>`
&:focus-visible {
${FocusStyle}
}
padding: ${({ theme: { spacings }, compact = false }) =>
compact
padding: ${({ theme: { spacings }, $compact = false }) =>
$compact
? css`
${spacings.sm} ${spacings.md}
`

View File

@ -75,7 +75,6 @@ export default function SearchField(
{props.isSearchStalled ? <Loader /> : <SearchIcon />}
</IconContainer>
<SearchInput
{...(props as InputHTMLAttributes<HTMLInputElement>)}
{...inputProps}
placeholder={inputProps.placeholder ?? ''}
ref={ref}

View File

@ -71,7 +71,7 @@ const Value = styled.span`
margin-top: 1rem;
`
const StyledIcon = styled(CarretDown)<{ isOpen: boolean }>`
const StyledIcon = styled(CarretDown)`
margin: 0 4px;
`
export const Wrapper = styled.div<{
@ -218,7 +218,7 @@ export function Select<T extends Record<string, unknown>>(
? state.selectedItem.rendered
: t('select.value.default', 'Choisissez une option')}
</Value>
<StyledIcon isOpen={state.isOpen} />
<StyledIcon />
</Button>
{state.isOpen && (
<Popover isOpen={state.isOpen} onClose={() => state.close()}>

View File

@ -1206,32 +1206,32 @@ pages:
ogTitle: "Auto-entrepreneur: quickly calculate your net income from sales and
vice versa"
titre: "Auto-entrepreneurs: income simulator"
seo explanation: "<0>How do you calculate the net income for an
auto-entrepreneur?</0><1>An auto-entrepreneur has to pay social
security contributions to the administration (also known as
\"social charge\"). These social contributions are used to finance
social security, and give rights for retirement or health insurance.
They are also used to finance vocational training.</1><2><0></0> <2>See
details of how the contributions are calculated</2></2><3>But this is
not the only expense: to calculate net income, one must also take into
account all expenses incurred in the course of the professional activity
(assets, raw materials, premises, transport). Although they are not
useful for the calculation of contributions and taxes, they must be
taken into account to estimate the viability of one''s
activity.</3><4>The complete calculation formula is therefore:<1><0>Net
income = Turnover - Social contributions - Professional
expenses</0></1></4><5>How to calculate income tax for an
auto-entrepreneur ?</5><6>If you opted for the flat-rate payment when
you set up your business, income tax is paid at the same time as social
security contributions.</6><7><0></0> <2>See how the amount of the
flat-rate tax is calculated</2></7><8>Otherwise, you will be taxed
according to the standard income tax schedule. The taxable income is
then calculated as a percentage of turnover. This is called the lump-sum
allowance. This percentage varies according to the type of activity
carried out. It is said to be lump-sum because it does not take into
account the actual expenses incurred in the activity.</8><9><0></0>
<2>See details of the calculation of the income allowance for an
auto-entrepreneur</2></9><10>Useful resources</10><11><0></0></11>'"
seo explanation: <0>How to calculate the net income of an
auto-entrepreneur?</0><1>An auto-entrepreneur must pay social
contributions to the administration. These contributions are used to
finance the social security system, and open up rights, notably for
retirement and health insurance. They are also used to finance
professional training. Their amount varies according to the type of
activity.</1><2><0></0> <2>See the details of the calculation of the
contributions</2></2><3>Do not forget to subtract all expenses incurred
in the course of the business (equipment, raw materials, premises,
transport). Although they are not used for the calculation of
contributions and taxes, they must be taken into account to check
whether the activity is economically viable.</3><4>The complete
calculation formula is therefore</4><5><0>Net income = Sales - Social
security contributions - Business expenses</0></5><6>How to calculate
the income tax for an auto-entrepreneur ?</6><7>If you have opted for
the payment in full discharge when creating your auto-entrepreneur, the
income tax is paid at the same time as the social
contributions.</7><8><0></0> <2>See how the amount of the payment in
full discharge is calculated</2></8><9>Otherwise, you will be taxed
according to the standard income tax scale. The taxable income is then
calculated as a percentage of the turnover. This is called the standard
deduction. This percentage varies according to the type of activity
carried out. It is said to be flat rate because it does not take into
account the real expenses incurred in the course of the
activity.</9><10><0></0> <2>See the details of the calculation of the
abatement income for an auto-entrepreneur</2></10>
shortname: Auto-entrepreneur
title: Self-entrepreneur Income Simulator
titre: Auto-entrepreneur income simulator
@ -1396,30 +1396,31 @@ pages:
ogTitle: "Sole proprietorship: quickly calculate your net income from your
turnover and vice versa"
titre: "Sole proprietorship (EI): income simulator"
seo explanation: <0>How to calculate the net income of a sole trader?</0><1>A
sole trader must pay social security contributions to the authorities.
These contributions are used to finance social security, and open up
rights, particularly for retirement and health insurance. They are also
used to finance professional training.</1><2><0></0> <2>See the details
of the calculation of contributions</2></2><3>Do not forget to deduct
all expenses incurred in the course of the business (equipment, raw
materials, premises, transport). These are deductible from the company's
income, which means that you will not pay tax or contributions on their
amount (unless you have opted for the micro-tax option).</3><4>The
complete calculation formula is therefore :<1><0>Net income = Turnover -
Professional expenses - Social contributions</0></1></4><5>How do you
calculate the social security contributions of a sole
proprietorship?</5><6>The manager of a sole proprietorship pays social
security contributions in proportion to the company's <2>taxable
income</2>. Their amount also varies according to the type of activity
(liberal profession, craftsman, tradesman, etc.), or any exemptions
granted (ACRE, ZFU, RSA, etc.).</6><7> As a company's result is only
known at the end of the accounting period, the manager pays provisional
contributions which will then be adjusted once the actual income has
been declared, the following year.</7><8>This simulator allows you to
calculate the exact amount of social security contributions based on a
desired turnover or net income. You can specify your situation by
answering the questions displayed below the simulation.</8>
seo explanation: <0>How to calculate the net income of a sole proprietorship
manager (EI)?</0><1>A sole trader must pay social contributions to the
administration. These contributions are used to finance the social
security system, and open up rights, particularly for retirement and
health insurance. They are also used to finance professional
training.</1><2><0></0> <2>See the details of the calculation of the
contributions</2></2><3>Do not forget to deduct all expenses incurred in
the course of the business (equipment, raw materials, premises,
transport). These are deductible from the company's income, which means
that you will not pay taxes or contributions on their amount (unless you
have opted for the micro-tax option).</3><4>The complete calculation
formula is therefore :</4><5><0>Net income = Turnover - Professional
expenses - Social contributions</0></5><6>How to calculate the social
contributions of a sole proprietorship ?</6><7>The manager of a sole
proprietorship pays social contributions, proportional to the company's
<2>taxable income</2>. Their amount also varies according to the type of
activity (liberal profession, craftsman, tradesman, etc.), or the
possible exemptions granted (ACRE, ZFU, RSA, etc.).</7><8> As the result
of a company is only known at the end of the accounting year, the
manager pays provisional contributions which will then be adjusted once
the real income is declared, the following year.</8><9>This simulator
allows you to calculate the exact amount of social security
contributions based on a desired turnover or net income. You can specify
your situation by answering the questions displayed below the
simulation.</9>
shortname: Individual company
title: Simulator for sole proprietorship (EI)
eirl:

View File

@ -937,20 +937,20 @@ pages:
soient pas utilisées pour le calcul des cotisations et de l'impôt, elles
doivent être prises en compte pour vérifier si l'activité est viable
économiquement.</3><4>La formule de calcul complète est donc
:<1><0>Revenu net = Chiffres d'affaires Cotisations sociales
Dépenses professionnelles</0></1></4><5>Comment calculer l'impôt sur le
revenu pour un auto-entrepreneur ?</5><6>Si vous avez opté pour le
:</4><5><0>Revenu net = Chiffres d'affaires Cotisations sociales
Dépenses professionnelles</0></5><6>Comment calculer l'impôt sur le
revenu pour un auto-entrepreneur ?</6><7>Si vous avez opté pour le
versement libératoire lors de la création de votre auto-entreprise,
l'impôt sur le revenu est payé en même temps que les cotisations
sociales.</6><7><0></0> <2>Voir comment est calculé le montant du
versement libératoire</2></7><8>Sinon, vous serez imposé selon le barème
sociales.</7><8><0></0> <2>Voir comment est calculé le montant du
versement libératoire</2></8><9>Sinon, vous serez imposé selon le barème
standard de l'impôt sur le revenu. Le revenu imposable est alors calculé
comme un pourcentage du chiffre d'affaires. C'est qu'on appel
l'abattement forfaitaire. Ce pourcentage varie en fonction du type
d'activité excercé. On dit qu'il est forfaitaire car il ne prends pas en
compte les dépenses réelles effectuées dans le cadre de
l'activité.</8><9><0></0> <2>Voir le détail du calcul du revenu abattu
pour un auto-entrepreneur</2></9>
l'activité.</9><10><0></0> <2>Voir le détail du calcul du revenu abattu
pour un auto-entrepreneur</2></10>
shortname: Auto-entrepreneur
title: Simulateur de revenus auto-entrepreneur
auxiliaire:
@ -1074,21 +1074,21 @@ pages:
déductibles du résultat de l'entreprise, cela veut dire que vous ne
payerez pas d'impôt ou de cotisations sur leur montant (sauf si vous
avez opté pour l'option micro-fiscal).</3><4>La formule de calcul
complète est donc :<1><0>Revenu net = Chiffres d'affaires Dépenses
professionnelles - Cotisations sociales</0></1></4><5>Comment calculer
les cotisations sociales d'une entreprise individuelle ?</5><6>Le
dirigeant d'une entreprise individuelle paye des cotisations sociales,
complète est donc :</4><5><0>Revenu net = Chiffres d'affaires Dépenses
professionnelles - Cotisations sociales</0></5><6>Comment calculer les
cotisations sociales d'une entreprise individuelle ?</6><7>Le dirigeant
d'une entreprise individuelle paye des cotisations sociales,
proportionnelle au <2>résultat fiscal</2> de l'entreprise. Leur montant
varie également en fonction du type d'activité (profession libérale,
artisan, commerçants, etc), où des éventuelles exonérations accordées
(ACRE, ZFU, RSA, etc.).</6><7> Comme le résultat d'une entreprise n'est
(ACRE, ZFU, RSA, etc.).</7><8> Comme le résultat d'une entreprise n'est
connu qu'à la fin de l'exercice comptable, le dirigeant paye des
cotisations provisionnelles qui seront ensuite régularisée une fois le
revenu réel déclaré, l'année suivante.</7><8>Ce simulateur permet de
revenu réel déclaré, l'année suivante.</8><9>Ce simulateur permet de
calculer le montant exact des cotisations sociale en partant d'un
chiffre d'affaires ou d'un revenu net souhaité. Vous pourrez préciser
votre situation en répondant aux questions s'affichant en dessous de la
simulation.</8>
simulation.</9>
shortname: Entreprise Individuelle
title: Simulateur pour entreprise individuelle (EI)
eirl:

View File

@ -168,22 +168,25 @@ function ComparaisonTable({ rows: [head, ...body] }: ComparaisonTableProps) {
return (
<>
<ResultTable className="ui__ mobile-version">
<tr>
<th></th>
<th>
<select
onChange={(evt) =>
setCurrentColumnIndex(Number(evt.target.value))
}
>
{columns.map((name, i) => (
<option value={i} selected={i === currentColumnIndex} key={i}>
{name}
</option>
))}
</select>
</th>
</tr>
<thead>
<tr>
<th></th>
<th>
<select
onChange={(evt) =>
setCurrentColumnIndex(Number(evt.target.value))
}
value={currentColumnIndex}
>
{columns.map((name, i) => (
<option value={i} key={i}>
{name}
</option>
))}
</select>
</th>
</tr>
</thead>
<tbody>
{body.map(([label, ...line], i) => (
<tr key={i}>
@ -198,34 +201,36 @@ function ComparaisonTable({ rows: [head, ...body] }: ComparaisonTableProps) {
</tbody>
</ResultTable>
<ResultTable>
<tr>
{head.map((label, i) => (
<th key={i}>{label}</th>
))}
</tr>
{body.map(([label, ...line], i) => (
<tr key={i}>
<td>
<RowLabel {...label} />
</td>
{line.map((cell, j) => (
<td key={j}>
{' '}
<ValueWithLink {...cell} />
{cell.additionalText && (
<p
className="ui__ notice"
css={`
text-align: right;
`}
>
{cell.additionalText}
</p>
)}
</td>
<tbody>
<tr>
{head.map((label, i) => (
<th key={i}>{label}</th>
))}
</tr>
))}
{body.map(([label, ...line], i) => (
<tr key={i}>
<td>
<RowLabel {...label} />
</td>
{line.map((cell, j) => (
<td key={j}>
{' '}
<ValueWithLink {...cell} />
{cell.additionalText && (
<p
className="ui__ notice"
css={`
text-align: right;
`}
>
{cell.additionalText}
</p>
)}
</td>
))}
</tr>
))}
</tbody>
</ResultTable>
</>
)

View File

@ -244,15 +244,13 @@ export function getSimulatorsData({
d'impôt ou de cotisations sur leur montant (sauf si vous avez opté
pour l'option micro-fiscal).
</Body>
<Body>
La formule de calcul complète est donc :
<blockquote>
<strong>
Revenu net = Chiffres d'affaires Dépenses professionnelles -
Cotisations sociales
</strong>
</blockquote>
</Body>
<Body>La formule de calcul complète est donc :</Body>
<blockquote>
<strong>
Revenu net = Chiffres d'affaires Dépenses professionnelles -
Cotisations sociales
</strong>
</blockquote>
<H2>
Comment calculer les cotisations sociales d'une entreprise
individuelle ?
@ -391,15 +389,13 @@ export function getSimulatorsData({
prises en compte pour vérifier si l'activité est viable
économiquement.
</Body>
<Body>
La formule de calcul complète est donc :
<blockquote>
<strong>
Revenu net = Chiffres d'affaires Cotisations sociales
Dépenses professionnelles
</strong>
</blockquote>
</Body>
<Body>La formule de calcul complète est donc :</Body>
<blockquote>
<strong>
Revenu net = Chiffres d'affaires Cotisations sociales Dépenses
professionnelles
</strong>
</blockquote>
<H2>
Comment calculer l'impôt sur le revenu pour un auto-entrepreneur ?
</H2>