show recommendation only there is reason

This commit is contained in:
Sandeep Somavarapu
2021-07-26 17:11:59 +02:00
parent 713c5745f1
commit 8eccbfc301
2 changed files with 6 additions and 3 deletions
@@ -494,8 +494,11 @@ export class ExtensionEditor extends EditorPane {
reset(template.recommendation);
const extRecommendations = this.extensionRecommendationsService.getAllRecommendationsWithReason();
if (extRecommendations[extension.identifier.id.toLowerCase()]) {
append(template.recommendation, $(`div${ThemeIcon.asCSSSelector(starEmptyIcon)}`));
append(template.recommendation, $(`div.recommendation-text`, undefined, extRecommendations[extension.identifier.id.toLowerCase()].reasonText));
const reasonText = extRecommendations[extension.identifier.id.toLowerCase()].reasonText;
if (reasonText) {
append(template.recommendation, $(`div${ThemeIcon.asCSSSelector(starEmptyIcon)}`));
append(template.recommendation, $(`div.recommendation-text`, undefined, reasonText));
}
} else if (this.extensionIgnoredRecommendationsService.globalIgnoredRecommendations.indexOf(extension.identifier.id.toLowerCase()) !== -1) {
append(template.recommendation, $(`div.recommendation-text`, undefined, localize('recommendationHasBeenIgnored', "You have chosen not to receive recommendations for this extension.")));
}
@@ -480,7 +480,7 @@ export class ExtensionHoverWidget extends ExtensionWidget {
private getRecommendationMessage(extension: IExtension): string | undefined {
const recommendation = this.extensionRecommendationsService.getAllRecommendationsWithReason()[extension.identifier.id.toLowerCase()];
if (recommendation) {
if (recommendation?.reasonText) {
const bgColor = this.themeService.getColorTheme().getColor(extensionButtonProminentBackground);
return `<span style="color:${bgColor ? Color.Format.CSS.formatHex(bgColor) : '#ffffff'};">$(${starEmptyIcon.id})</span>&nbsp;${recommendation.reasonText}`;
}