Skip to content

Commit

Permalink
Les fiches action posent les questions qu'il faut
Browse files Browse the repository at this point in the history
  • Loading branch information
laem committed Sep 29, 2020
1 parent 57b23f6 commit 4351e08
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions source/components/Simulation.tsx
Expand Up @@ -25,6 +25,7 @@ export default function Simulation({
showConversation,
noFeedback,
noProgressMessage,
teaseCategories,
}: SimulationProps) {
const firstStepCompleted = useSelector(firstStepCompletedSelector)
const progress = useSelector(simulationProgressSelector)
Expand All @@ -37,6 +38,7 @@ export default function Simulation({
<Animate.fromTop>
<Conversation
customEnd={customEnd}
teaseCategories={teaseCategories}
customEndMessages={customEndMessages}
/>
{progress < 1 && (
Expand Down
6 changes: 4 additions & 2 deletions source/components/conversation/Conversation.tsx
Expand Up @@ -55,6 +55,7 @@ const orderedCurrentQuestionSelector = createSelector(
export default function Conversation({
customEndMessages,
customEnd,
teaseCategories,
}: ConversationProps) {
const [dismissedRespirations, dismissRespiration] = useState([])
const dispatch = useDispatch()
Expand Down Expand Up @@ -89,7 +90,8 @@ export default function Conversation({
(a) => a.split(' . ')[0] === questionCategory.dottedName
) === undefined

return firstCategoryQuestion &&
return teaseCategories &&
firstCategoryQuestion &&
!dismissedRespirations.includes(questionCategory.dottedName) ? (
<CategoryRespiration
questionCategory={questionCategory}
Expand All @@ -109,7 +111,7 @@ export default function Conversation({
>
{currentQuestion && (
<React.Fragment key={currentQuestion}>
{questionCategory && (
{teaseCategories && questionCategory && (
<div>
<span
css={`
Expand Down
12 changes: 11 additions & 1 deletion source/sites/publicodes/Action.js
Expand Up @@ -19,6 +19,7 @@ import {
analysisWithDefaultsSelector,
} from 'Selectors/analyseSelectors'
import { setSimulationConfig } from 'Actions/actions'
import Simulation from 'Components/Simulation'

export const Footprint = ({ value }) => <div>Lala {value}</div>

Expand All @@ -43,14 +44,14 @@ export default ({}) => {
const { nodeValue, description, icons, title } = analysis.targets[0]

const flatActions = rules.find((r) => r.dottedName === 'actions')
console.log(flatActions)
const relatedActions = flatActions.formule.somme
.filter(
(actionDottedName) =>
actionDottedName !== dottedName &&
splitName(dottedName)[0] === splitName(actionDottedName)[0]
)
.map((name) => rules.find(({ dottedName }) => dottedName === name))

return (
<div css="padding: 0 .3rem 1rem; max-width: 600px; margin: 1rem auto;">
<Link to="/actions">
Expand Down Expand Up @@ -85,6 +86,15 @@ export default ({}) => {
<button className="ui__ button simple small">En savoir plus</button>
</div>
</div>
<p>Personnalisez cette estimation</p>
<Simulation
noFeedback
noProgressMessage
showConversation
customEnd={<div />}
targets={<div />}
explanations={null}
/>
<p>Sur le même sujet</p>
<div>
{relatedActions.map((action) => (
Expand Down
1 change: 1 addition & 0 deletions source/sites/publicodes/Simulateur.js
Expand Up @@ -55,6 +55,7 @@ const Simulateur = (props) => {
<SessionBar />
<Simulation
noFeedback
teaseCategories
noProgressMessage
showConversation
customEnd={
Expand Down

0 comments on commit 4351e08

Please sign in to comment.