diff --git a/packages/app/schema/nl/behavior_annotations.json b/packages/app/schema/nl/behavior_annotations.json index b902774649..0b0564efc2 100644 --- a/packages/app/schema/nl/behavior_annotations.json +++ b/packages/app/schema/nl/behavior_annotations.json @@ -17,7 +17,7 @@ "title": "nl_behavior_annotations", "type": "object", "properties": { - "source_type": { + "behavior_indicator": { "enum": [ "wash_hands", "curfew", @@ -34,23 +34,22 @@ "selftest_visit" ] }, - "behaviour_type": { - "enum": [ - "wash_hands", - "curfew", - "keep_distance", - "work_from_home", - "avoid_crowds", - "symptoms_stay_home_if_mandatory", - "symptoms_get_tested", - "wear_mask_public_indoors", - "wear_mask_public_transport", - "sneeze_cough_elbow", - "max_visitors", - "ventilate_home", - "selftest_visit" - ] + "message_title_nl": { + "minLength": 1, + "type": "string" + }, + "message_title_en": { + "minLength": 1, + "type": "string" + }, + "message_desc_nl": { + "minLength": 1, + "type": "string" }, + "message_desc_en": { + "minLength": 1, + "type": "string" + }, "date_start_unix": { "type": "integer" }, @@ -62,8 +61,11 @@ } }, "required": [ - "source_type", - "behaviour_type", + "behavior_indicator", + "message_title_nl", + "message_title_en", + "message_desc_nl", + "message_desc_en", "date_start_unix", "date_end_unix", "date_of_insertion_unix" diff --git a/packages/app/src/pages/landelijk/gedrag.tsx b/packages/app/src/pages/landelijk/gedrag.tsx index d3b6fde740..c62114bfac 100644 --- a/packages/app/src/pages/landelijk/gedrag.tsx +++ b/packages/app/src/pages/landelijk/gedrag.tsx @@ -44,7 +44,6 @@ export const getStaticProps = createGetStaticProps( (siteText) => ({ caterogyTexts: siteText.common.nationaal_layout.headings.gedrag, metadataTexts: siteText.pages.topicalPage.nl.nationaal_metadata, - subjectTexts: siteText.common.behavior.subjects, text: siteText.pages.behaviorPage, }), locale @@ -80,8 +79,8 @@ export default function BehaviorPage( const behaviorLastValue = data.behavior.last_value; const behaviorAnnotationsFeature = useFeature('nlBehaviorAnnotations'); - const { formatNumber, formatDateFromSeconds, formatPercentage } = useIntl(); - const { caterogyTexts, subjectTexts, metadataTexts, text } = pageText; + const { formatNumber, formatDateFromSeconds, formatPercentage, locale } = useIntl(); + const { caterogyTexts, metadataTexts, text } = pageText; const metadata = { ...metadataTexts, @@ -115,17 +114,17 @@ export default function BehaviorPage( const { currentTimelineEvents } = useMemo(() => { // Timeline event from the current selected behaviour const currentTimelineEvents = data.behavior_annotations.values.filter( - (a) => (a.source_type === currentId) + (a) => (a.behavior_indicator === currentId) ).map((event) => ({ - title: subjectTexts[event.behaviour_type], - description: text.shared.annotation_description[event.behaviour_type], + title: event[`message_title_${locale}`], + description: event[`message_desc_${locale}`], start: event.date_start_unix, end: event.date_end_unix }) ); return { currentTimelineEvents }; - }, [currentId, data.behavior_annotations.values, text.shared.annotation_description, subjectTexts]); + }, [currentId, data.behavior_annotations.values, locale]); const timelineProp = behaviorAnnotationsFeature.isEnabled ? { timelineEvents: currentTimelineEvents } diff --git a/packages/common/src/types/data.ts b/packages/common/src/types/data.ts index 530884d00a..a3e26c9631 100644 --- a/packages/common/src/types/data.ts +++ b/packages/common/src/types/data.ts @@ -836,21 +836,7 @@ export interface NlBehaviorAnnotations { values: NlBehaviorAnnotations1[]; } export interface NlBehaviorAnnotations1 { - source_type: - | "wash_hands" - | "curfew" - | "keep_distance" - | "work_from_home" - | "avoid_crowds" - | "symptoms_stay_home_if_mandatory" - | "symptoms_get_tested" - | "wear_mask_public_indoors" - | "wear_mask_public_transport" - | "sneeze_cough_elbow" - | "max_visitors" - | "ventilate_home" - | "selftest_visit"; - behaviour_type: + behavior_indicator: | "wash_hands" | "curfew" | "keep_distance" @@ -864,6 +850,10 @@ export interface NlBehaviorAnnotations1 { | "max_visitors" | "ventilate_home" | "selftest_visit"; + message_title_nl: string; + message_title_en: string; + message_desc_nl: string; + message_desc_en: string; date_start_unix: number; date_end_unix: number; date_of_insertion_unix: number;