Skip to content

Commit

Permalink
MOBILE-4456 activitymodules: Get branded from icons
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Mar 11, 2024
1 parent 732a211 commit 9c28b32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
const archetypes: Record<string, number> = {};
const modIcons: Record<string, string> = {};
let modFullNames: Record<string, string> = {};
const brandedIcons: Record<string, boolean|undefined> = {};

sections.forEach((section) => {
if (!section.modules) {
return;
Expand Down Expand Up @@ -93,6 +95,8 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
modFullNames[mod.modname] = mod.modplural;
}

brandedIcons[mod.modname] = mod.branded;

// If this is not a theme image, leave it undefined to avoid having specific activity icons.
if (CoreUrlUtils.isThemeImageUrl(mod.modicon)) {
modIcons[mod.modname] = mod.modicon;
Expand All @@ -111,6 +115,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
iconModName,
name: modFullNames[modName],
modName,
branded: brandedIcons[iconModName],
});
}
}
Expand Down Expand Up @@ -149,4 +154,5 @@ type AddonBlockActivityModuleEntry = {
name: string;
modName: string;
iconModName: string;
branded?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ <h2>{{ 'addon.block_activitymodules.pluginname' | translate }}</h2>
</ion-item-divider>
<core-loading [hideUntil]="loaded">
<ion-item class="ion-text-wrap" *ngFor="let entry of entries" [detail]="true" button (click)="gotoCoureListModType(entry)">
<core-mod-icon slot="start" [modicon]="entry.icon" [modname]="entry.iconModName" [showAlt]="false" [colorize]="false" />
<core-mod-icon slot="start" [modicon]="entry.icon" [modname]="entry.iconModName" [showAlt]="false" [colorize]="false"
[isBranded]="entry.branded" />
<ion-label>{{ entry.name }}</ion-label>
</ion-item>
</core-loading>

0 comments on commit 9c28b32

Please sign in to comment.