Skip to content

Commit

Permalink
feat(app): show missing guideline tooltip when no guideline could be …
Browse files Browse the repository at this point in the history
…mapped
  • Loading branch information
tamslo committed Sep 19, 2024
1 parent 775f52f commit c071217
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
35 changes: 19 additions & 16 deletions app/lib/drug/widgets/annotation_cards/guideline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,23 @@ class GuidelineAnnotationCard extends StatelessWidget {
RoundedCard(
innerPadding: const EdgeInsets.all(PharMeTheme.mediumSpace),
child: SingleChildScrollView(
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
if (drug.guidelines.isNotEmpty) ...[
..._buildHeader(context),
SizedBox(height: PharMeTheme.mediumSpace),
_buildCard(context),
SizedBox(height: PharMeTheme.mediumSpace),
_buildSourcesSection(context),
]
else ...[
..._buildHeader(context),
SizedBox(height: PharMeTheme.smallSpace),
_buildCard(context),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (drug.guidelines.isNotEmpty) ...[
..._buildHeader(context),
SizedBox(height: PharMeTheme.mediumSpace),
_buildCard(context),
SizedBox(height: PharMeTheme.mediumSpace),
_buildSourcesSection(context),
]
else ...[
..._buildHeader(context),
SizedBox(height: PharMeTheme.smallSpace),
_buildCard(context),
],
],
]),
),
),
),
],
Expand Down Expand Up @@ -97,11 +100,11 @@ class GuidelineAnnotationCard extends StatelessWidget {
}

String _buildGuidelineTooltipText(BuildContext context) {
return drug.userOrFirstGuideline != null
? context.l10n.drugs_page_tooltip_guidelines_present(
return drug.userGuideline != null
? context.l10n.drugs_page_tooltip_guideline_present(
drug.userOrFirstGuideline!.externalData.first.source
)
: context.l10n.drugs_page_tooltip_guidelines_missing;
: context.l10n.drugs_page_tooltip_guideline_missing;
}

List<Widget> _buildHeader(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
}
}
},
"drugs_page_tooltip_guidelines_present": "{source} guidelines are used to inform the content on this page. These guidelines provide recommendations on which drugs to use based on your DNA.",
"drugs_page_tooltip_guideline_present": "{source} guidelines are used to inform the content on this page. These guidelines provide recommendations on which drugs to use based on your DNA.",
"@drugs_page_tooltip_guideline": {
"placeholders": {
"source": {
Expand All @@ -145,7 +145,7 @@
}
}
},
"drugs_page_tooltip_guidelines_missing": "Guidelines provide recommendations on which medications to use based on your DNA. However, no guideline is present for this medication (yet).",
"drugs_page_tooltip_guideline_missing": "Guidelines provide recommendations on which medications to use based on your DNA. However, no guideline is present in your case (yet).",
"drugs_page_recommendation_description": "What to do: ",

"report_content_explanation": "This is your PGx test report. Tap on a gene name for more details on your results and a list of implicated medications.",
Expand Down

0 comments on commit c071217

Please sign in to comment.