Skip to main content
Homepage
Explore
Search or go to…
/
Register
Sign in
Explore
Primary navigation
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Commits
a5d235b0
Commit
a5d235b0
authored
Apr 30, 2024
by
Toufic Batache
Browse files
Options
Downloads
Patches
Plain Diff
Ajout des cas types par dixième
parent
dac43de1
No related branches found
No related tags found
1 merge request
!210
Début du travail sur la nouvelle page d'accueil/d'atterrissage du simulateur
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/components/variables/VariableDetail.svelte
+84
-0
84 additions, 0 deletions
src/lib/components/variables/VariableDetail.svelte
with
84 additions
and
0 deletions
src/lib/components/variables/VariableDetail.svelte
+
84
−
0
View file @
a5d235b0
...
...
@@ -28,9 +28,21 @@
dateStyle
:
"
medium
"
,
}).
format
const
dispatch
=
createEventDispatcher
()
const
formatLongOrdinalSup
=
(
n
:
number
)
=>
{
const
rule
=
ordinalPluralRules
.
select
(
n
)
const
suffix
=
longOrdinalSuffixes
.
get
(
rule
)
return
`
${
n
}
<sup>
${
suffix
}
</sup>`
}
const
longOrdinalSuffixes
=
new
Map
([
[
"
other
"
,
"
ème
"
],
[
"
one
"
,
"
er
"
],
])
const
ordinalPluralRules
=
new
Intl
.
PluralRules
(
"
fr-FR
"
,
{
type
:
"
ordinal
"
})
const
testCases
=
getContext
(
"
testCases
"
)
as
Writable
<
Situation
[]
>
const
year
=
getContext
(
"
year
"
)
as
Writable
<
number
>
let
selectedDixieme
=
"
1
"
// Note: A reform decomposition is always more complete than a decomposition before reform.
// And the children of a reform decomposition always contain the children of the decomposition
// before reform.
...
...
@@ -87,6 +99,23 @@
}
}),
)
$
:
testCaseByDixieme
=
$testCases
.
reduce
(
(
result
:
{
[
dixieme
:
number
]:
[]
},
testCase
,
index
)
=>
{
if
(
testCase
.
dixieme
!==
undefined
)
{
const
dixieme
=
`
${
testCase
.
dixieme
}
`
if
(
result
[
dixieme
]
===
undefined
)
{
result
[
dixieme
]
=
[]
}
result
[
dixieme
].
push
({
...
testCase
,
index
,
})
}
return
result
},
{},
)
</script>
<aside
...
...
@@ -277,6 +306,61 @@
>
{
label
}
</span
>
» avec des cas types représentatifs :
</span>
<div
class=
"flex justify-between gap-1"
>
{
#each
Object
.
keys
(
testCaseByDixieme
)
as
dixieme
}
<button
class=
"px-2 py-1 text-sm bg-neutral-100 border-y-4 border-transparent border-opacity-80 shadow"
class:shrink-0=
{
dixieme
===
"
1
"
||
dixieme
===
"
10
"
}
class:z-20=
{
selectedDixieme
===
dixieme
}
class:bg-white=
{
selectedDixieme
===
dixieme
}
class:border-t-neutral-500=
{
selectedDixieme
===
dixieme
}
class:hover:bg-neutral-50=
{
selectedDixieme
!==
dixieme
}
class:hover:border-t-neutral-300=
{
selectedDixieme
!==
dixieme
}
class:shadow=
{
selectedDixieme
!==
dixieme
}
on:click=
{
()
=>
(
selectedDixieme
=
dixieme
)
}
>
<span
class=
"font-semibold"
>
{
@html
formatLongOrdinalSup
(
dixieme
)
}
dixième
</span
>
{
#if
dixieme
===
"
1
"
}
<br
/>
<span>
Le plus pauvre
</span>
{
:else
if
dixieme
===
"
10
"
}
<br
/>
<span>
Le plus riche
</span>
{
/if
}
</button>
{
/each
}
</div>
<div
class=
"relative z-10 grid grid-cols-3 gap-5 p-3 bg-white shadow-[0_-4px_6px_-1px_rgb(0,0,0,0.1),0_-2px_4px_-2px_rgb(0,0,0,0.1)]"
>
{
#each
testCaseByDixieme
[
selectedDixieme
]
as
testCase
}
<a
class=
"group flex items-center gap-3 p-2 bg-neutral-100 border-b-4 border-b-le-vert-400 shadow-md hover:border-b-le-jaune-very-dark hover:scale-105 hover:shadow-lg transition-all"
href=
{
newSimulationUrl
(
{
parametersVariableName
:
name
,
testCasesIndex
:
[
testCase
.
index
],
tab
:
"
dispositif
"
,
}
)}
>
<div
class=
"shrink-0 grid grid-cols-6"
>
<TestCasePictos
classes=
"[&>svg]:w-7 [&>svg]:h-7 col-span-3 last:odd:col-start-3 justify-center"
situation=
{
testCase
}
year=
{
$year
}
/>
</div>
<span
class=
"text-start text-sm"
>
{
testCase
.
title
}
</span>
<iconify-icon
class=
"text-le-vert-400 text-xl self-end group-hover:text-le-jaune-very-dark"
icon=
"ri-arrow-right-line"
/>
</a>
{
/each
}
</div>
</div>
</AccordionItem>
</Accordion>
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment