diff --git a/source/components/ui/index.css b/source/components/ui/index.css index e21bc7045..6ec4a4dbd 100644 --- a/source/components/ui/index.css +++ b/source/components/ui/index.css @@ -9,6 +9,13 @@ --darkColor: rgb(24, 69, 123); --textColor: rgb(24, 69, 123); } + +html, +body, +#js { + height: 100%; +} + html:fullscreen { background-color: white; overflow: auto !important; diff --git a/source/components/utils/colors.tsx b/source/components/utils/colors.tsx index fbd46b3a6..8ba5f32b0 100644 --- a/source/components/utils/colors.tsx +++ b/source/components/utils/colors.tsx @@ -110,7 +110,16 @@ export function ThemeColorsProvider({ color, children }: ProviderProps) { }, [colors]) return ( -
{children}
+ {/* This div is only used to set the CSS variables */} +
+ {children} +
) } diff --git a/source/sites/mon-entreprise.fr/App.css b/source/sites/mon-entreprise.fr/App.css index c9f4f5f1a..3ded3e927 100644 --- a/source/sites/mon-entreprise.fr/App.css +++ b/source/sites/mon-entreprise.fr/App.css @@ -1,9 +1,3 @@ -html, -body, -#js { - min-height: 100%; -} - .app-container { position: relative; width: 100%; diff --git a/source/sites/publi.codes/Studio.tsx b/source/sites/publi.codes/Studio.tsx index 43f6ee65a..f42445698 100644 --- a/source/sites/publi.codes/Studio.tsx +++ b/source/sites/publi.codes/Studio.tsx @@ -1,13 +1,14 @@ import baremeIr from '!!raw-loader!./exemples/bareme-ir.yaml' import douche from '!!raw-loader!./exemples/douche.yaml' import { ControlledEditor } from '@monaco-editor/react' +import { formatValue } from 'Engine/format' import Engine from 'Engine/index' import { buildFlatRules } from 'Engine/rules' -import { serializeUnit } from 'Engine/units' import { safeLoad } from 'js-yaml' import React, { useRef, useState } from 'react' import emoji from 'react-easy-emoji' import { useLocation } from 'react-router' +import styled from 'styled-components' import { Header } from './Header' let examples = { @@ -16,13 +17,13 @@ let examples = { } let initialInput = `a: - formule: 10 + formule: 10€ b: - formule: a + 18 + formule: a + 18€ c: formule: multiplication: - assiette: 2000 + assiette: 2000€ taux: 3% d: formule: a + b + c @@ -30,11 +31,25 @@ d: export default function SafeStudio() { return ( -
-
- - - +
+
+
+
+
+ + + +
) } @@ -65,51 +80,92 @@ export function Studio() { } return ( -
- Construisez votre modèle ici : - setEditorValue(newValue ?? '')} - options={{ minimap: { enabled: false } }} - /> -
- - -
- - -
+
+ + +
+ +
+ + + ) } + +const Layout = styled.div` + display: flex; + height: 100%; + + section { + width: 50%; + } + + @media (max-width: 960px) { + flex-direction: column; + padding: 20px; + + section { + width: 100%; + } + } +` + export const Results = ({ analysis }) => { return analysis ? (

Résultats

-
    -
  • Valeur : {analysis.nodeValue}
  • -
  • - Unité : {analysis.unit ? serializeUnit(analysis.unit) : 'Sans unité'} -
  • -
  • Applicable : {analysis.isApplicable ? '✅' : '❌'}
  • -
+ {analysis.isApplicable === false ? ( + <>❌ Cette règle n'est pas applicable + ) : ( + formatValue({ + language: 'fr', + value: analysis.nodeValue, + unit: analysis.unit + }) + )}
) : null } diff --git a/source/sites/publi.codes/exemples/bareme-ir.yaml b/source/sites/publi.codes/exemples/bareme-ir.yaml index 8b497cd4d..75ae4bc44 100644 --- a/source/sites/publi.codes/exemples/bareme-ir.yaml +++ b/source/sites/publi.codes/exemples/bareme-ir.yaml @@ -1,5 +1,5 @@ revenu imposable: - formule: 30000 € + formule: 18000 € revenu abattu: formule: @@ -21,11 +21,3 @@ impôt sur le revenu: - taux: 41% plafond: 153783€ - taux: 45% - -impôt final: - formule: - allègement: - assiette: impôt sur le revenu - décote: - taux: 75% - plafond: 1177€