|
1 | 1 | @using System.Collections.Immutable |
2 | 2 | @using OpenShock.Desktop.Config |
| 3 | +@using OpenShock.Desktop.ModuleBase |
3 | 4 | @using OpenShock.Desktop.ModuleManager |
4 | 5 | @using OpenShock.Desktop.ModuleManager.Repository |
5 | 6 | @using OpenShock.Desktop.Utils |
|
10 | 11 | @inject ISnackbar Snackbar |
11 | 12 |
|
12 | 13 | <MudPaper Class="d-flex module-manager-item-root rounded-lg gap-10" Outlined="true"> |
13 | | - <img src="@_moduleIcon" alt="@_moduleName" class="icon rounded-lg"/> |
| 14 | + @switch (_moduleIcon?.Index) |
| 15 | + { |
| 16 | + case 0: |
| 17 | + <img src="@_moduleIcon.AsT0" alt="Module Icon" class="icon rounded-lg"/> |
| 18 | + break; |
| 19 | + case 1: |
| 20 | + <MudIcon Icon="@_moduleIcon.AsT1"/> |
| 21 | + break; |
| 22 | + } |
14 | 23 |
|
15 | 24 | <div class="d-flex flex-column justify-space-evenly overflow-hidden"> |
16 | 25 | <MudText Typo="Typo.h4">@_moduleName</MudText> |
|
112 | 121 | [Parameter] public required string ModuleId { get; init; } |
113 | 122 |
|
114 | 123 | private string _moduleName = null!; |
115 | | - private string? _moduleIcon; |
| 124 | + private IconOneOf? _moduleIcon; |
116 | 125 |
|
117 | 126 | private SemVersion? LatestVersion => RepoModule?.Versions.Keys.Where(x => x.IsRelease).OrderByDescending(x => x, SemVersion.PrecedenceComparer).FirstOrDefault(); |
118 | 127 | private SemVersion? LatestPreReleaseVersion => RepoModule?.Versions.Keys.Where(x => !x.IsRelease).OrderByDescending(x => x, SemVersion.PrecedenceComparer).FirstOrDefault(); |
|
127 | 136 | } |
128 | 137 |
|
129 | 138 | _moduleName = RepoModule?.Name ?? (LoadedModule?.Name ?? "error"); |
130 | | - _moduleIcon = RepoModule?.IconUrl?.ToString() ?? LoadedModule?.Module.IconPath; |
| 139 | + if (RepoModule?.IconUrl is not null) |
| 140 | + { |
| 141 | + _moduleIcon = IconOneOf.FromPath(RepoModule.IconUrl.ToString()); |
| 142 | + } |
| 143 | + { |
| 144 | + _moduleIcon = LoadedModule?.Module.Icon; |
| 145 | + } |
131 | 146 | _availableVersions = GetAvailableVersions(); |
132 | 147 | } |
133 | 148 |
|
|
0 commit comments