blob: 822894a65cc2d9b9c9d8b42df557c43277466030 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<MxcImage Homeserver="@Homeserver" Uri="@MxcUri" style="@StyleString"/>
@code {
private string _style;
[Parameter]
public string? MxcUri {
get;
set {
if(field == value) return;
field = value;
// UriHasChanged(value);
StateHasChanged();
}
}
[Parameter]
public bool Circular { get; set; }
[Parameter]
public int Size { get; set; } = 48;
[Parameter]
public string SizeUnit { get; set; } = "px";
[Parameter]
public required AuthenticatedHomeserverGeneric Homeserver { get; set; }
private string StyleString => $"{(Circular ? "border-radius: 50%;" : "")} width: {Size}{SizeUnit}; height: {Size}{SizeUnit}; object-fit: cover;";
private static readonly string Prefix = "mxc://";
private static readonly int PrefixLength = Prefix.Length;
// private async Task UriHasChanged(string? value) {
// if (string.IsNullOrWhiteSpace(value) || !value.StartsWith(Prefix)) {
// Console.WriteLine($"[MxcAvatar] UriHasChanged: {value} does not start with {Prefix}!");
// return;
// }
//
// if (Homeserver is null) {
// Console.WriteLine($"[MxcAvatar] Homeserver is required for MxcAvatar! URI: {MxcUri}, Homeserver: {Homeserver?.ToString() ?? "null"}");
// return;
// }
//
// Console.WriteLine($"[MxcAvatar] Homeserver: {Homeserver}");
// StateHasChanged();
// }
}
|