|
| 1 | +import { CustomDataProvider } from '@dhis2/app-runtime' |
| 2 | +import React from 'react' |
| 3 | +import AboutAOUnit from '../components/AboutAOUnit/AboutAOUnit.js' |
| 4 | + |
| 5 | +const verboseData = { |
| 6 | + visualizations: { |
| 7 | + id: 'abc123verbose', |
| 8 | + displayDescription: |
| 9 | + 'This is a comprehensive **visualization** showing district-level aggregate data across all 47 counties for the Expanded Programme on Immunization (EPI) including BCG, OPV, Pentavalent, and Measles-Rubella coverage rates disaggregated by age, sex, and facility ownership for the fiscal year 2024/2025.', |
| 10 | + created: '2023-01-15T08:30:00.000', |
| 11 | + createdBy: { |
| 12 | + displayName: |
| 13 | + 'Dr. Alexandria Konstantinopolous-Whittington III, MD, PhD', |
| 14 | + }, |
| 15 | + lastUpdated: '2024-11-02T14:22:00.000', |
| 16 | + subscribed: true, |
| 17 | + sharing: { |
| 18 | + public: 'r', |
| 19 | + users: { |
| 20 | + u1: { |
| 21 | + displayName: |
| 22 | + 'Maria-Fernanda de los Ángeles Gutiérrez-Montoya', |
| 23 | + access: 'rw', |
| 24 | + }, |
| 25 | + u2: { |
| 26 | + displayName: 'Jean-Pierre Barthélémy Christophersen', |
| 27 | + access: 'r', |
| 28 | + }, |
| 29 | + }, |
| 30 | + userGroups: { |
| 31 | + g1: { |
| 32 | + displayName: |
| 33 | + 'National Immunization Programme Monitoring & Evaluation Team', |
| 34 | + access: 'rw', |
| 35 | + }, |
| 36 | + g2: { |
| 37 | + displayName: |
| 38 | + 'District Health Information System Administrators Group', |
| 39 | + access: 'r', |
| 40 | + }, |
| 41 | + }, |
| 42 | + }, |
| 43 | + }, |
| 44 | + 'dataStatistics/favorites': { |
| 45 | + views: 14873, |
| 46 | + }, |
| 47 | +} |
| 48 | + |
| 49 | +const shortData = { |
| 50 | + visualizations: { |
| 51 | + id: 'xyz789short', |
| 52 | + displayDescription: 'ANC coverage Q3', |
| 53 | + created: '2025-12-01T10:00:00.000', |
| 54 | + createdBy: { displayName: 'Li Wei' }, |
| 55 | + lastUpdated: '2026-04-10T09:00:00.000', |
| 56 | + subscribed: false, |
| 57 | + sharing: { |
| 58 | + public: 'rw', |
| 59 | + users: {}, |
| 60 | + userGroups: { |
| 61 | + g1: { displayName: 'HMIS', access: 'r' }, |
| 62 | + }, |
| 63 | + }, |
| 64 | + }, |
| 65 | + 'dataStatistics/favorites': { |
| 66 | + views: 3, |
| 67 | + }, |
| 68 | +} |
| 69 | + |
| 70 | +const missingFieldsData = { |
| 71 | + visualizations: { |
| 72 | + id: 'missing456', |
| 73 | + displayDescription: null, |
| 74 | + created: '2026-03-20T12:00:00.000', |
| 75 | + createdBy: null, |
| 76 | + lastUpdated: '2026-04-13T06:45:00.000', |
| 77 | + subscribed: false, |
| 78 | + sharing: { |
| 79 | + public: '', |
| 80 | + users: {}, |
| 81 | + userGroups: {}, |
| 82 | + }, |
| 83 | + }, |
| 84 | + 'dataStatistics/favorites': { |
| 85 | + views: 0, |
| 86 | + }, |
| 87 | +} |
| 88 | + |
| 89 | +export default { |
| 90 | + title: 'AboutAOUnit', |
| 91 | +} |
| 92 | + |
| 93 | +export const VerboseData = () => ( |
| 94 | + <CustomDataProvider data={verboseData}> |
| 95 | + <div |
| 96 | + style={{ |
| 97 | + width: 372, |
| 98 | + padding: '16px', |
| 99 | + backgroundColor: 'lightgray', |
| 100 | + }} |
| 101 | + > |
| 102 | + <AboutAOUnit type="visualization" id="abc123verbose" /> |
| 103 | + </div> |
| 104 | + </CustomDataProvider> |
| 105 | +) |
| 106 | + |
| 107 | +VerboseData.story = { |
| 108 | + name: 'Verbose data with long labels', |
| 109 | +} |
| 110 | + |
| 111 | +export const ShortLabels = () => ( |
| 112 | + <CustomDataProvider data={shortData}> |
| 113 | + <div |
| 114 | + style={{ |
| 115 | + width: 372, |
| 116 | + padding: '16px', |
| 117 | + backgroundColor: 'lightgray', |
| 118 | + }} |
| 119 | + > |
| 120 | + <AboutAOUnit type="visualization" id="xyz789short" /> |
| 121 | + </div> |
| 122 | + </CustomDataProvider> |
| 123 | +) |
| 124 | + |
| 125 | +ShortLabels.story = { |
| 126 | + name: 'Short labels', |
| 127 | +} |
| 128 | + |
| 129 | +export const MissingFields = () => ( |
| 130 | + <CustomDataProvider data={missingFieldsData}> |
| 131 | + <div |
| 132 | + style={{ |
| 133 | + width: 372, |
| 134 | + padding: '16px', |
| 135 | + backgroundColor: 'lightgray', |
| 136 | + }} |
| 137 | + > |
| 138 | + <AboutAOUnit type="visualization" id="missing456" /> |
| 139 | + </div> |
| 140 | + </CustomDataProvider> |
| 141 | +) |
| 142 | + |
| 143 | +MissingFields.story = { |
| 144 | + name: 'Missing fields (no description, no author, no sharing)', |
| 145 | +} |
0 commit comments