Skip to content

Commit

Permalink
refactor(#653): use string constants for drug interaction indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
tamslo committed Aug 24, 2023
1 parent fb9cea4 commit bb90d1e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/lib/common/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ final cpicMaxCacheTime = Duration(days: 90);
const maxCachedDrugs = 10;
const cpicLookupUrl =
'https://api.cpicpgx.org/v1/diplotype?select=genesymbol,diplotype,generesult,lookupkey';
const indeterminateIcon = Icons.help_outline_rounded;
const indeterminateIcon = Icons.help_outline_rounded;

const drugInteractionIndicator = '*';
const drugInteractionIndicatorName = 'asterisk';
2 changes: 1 addition & 1 deletion app/lib/common/widgets/drug_list/drug_items/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ String formatDrugName(
) {
var drugName = drug.name.capitalize();
if (showDrugInteractionIndicator && isInhibitor(drug)) {
drugName = '$drugName *';
drugName = '$drugName$drugInteractionIndicator';
}
return drugName;
}
5 changes: 4 additions & 1 deletion app/lib/common/widgets/drug_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ class DrugSearch extends HookWidget {
return [
SizedBox(height: PharMeTheme.smallSpace),
Text(
context.l10n.search_page_asterisk_explanation
context.l10n.search_page_indicator_explanation(
drugInteractionIndicatorName,
drugInteractionIndicator
)
),
];
}
Expand Down
15 changes: 14 additions & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@
"search_page_filter_yellow": "Show yellow warning level",
"search_page_filter_red": "Show red warning level",
"search_page_filter_gray": "Show gray warning level",
"search_page_asterisk_explanation": "Taking drugs with an asterisk (*) can influence your results for other drugs",
"search_page_indicator_explanation": "Taking drugs with an {indicatorName} ({indicator}) can influence your results for other drugs",
"@search_page_indicator_explanation": {
"description": "Explanation of drug-drug interaction indicators",
"placeholders": {
"indicatorName": {
"type": "String",
"example": "asterisk"
},
"indicator": {
"type": "String",
"example": "*"
}
}
},
"search_no_drugs": "No drugs found. Try adjusting the search term{amendment}.",
"@search_no_drugs": {
"description": "Disclaimer for when no drug was found in the search",
Expand Down

0 comments on commit bb90d1e

Please sign in to comment.