|
|
|
@ -176,8 +176,18 @@
|
|
|
|
|
@{/* Embeds */}
|
|
|
|
|
@foreach (var embed in message.Embeds)
|
|
|
|
|
{
|
|
|
|
|
var youTubeVideo = embed.TryGetYouTubeVideo();
|
|
|
|
|
|
|
|
|
|
// Spotify embed
|
|
|
|
|
if (embed.TryGetSpotifyTrack() is { } spotifyTrackEmbed)
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed">
|
|
|
|
|
<div class="chatlog__embed-spotify-container">
|
|
|
|
|
<iframe class="chatlog__embed-spotify" src="@spotifyTrackEmbed.Url" width="400" height="80" allowtransparency="true" allow="encrypted-media"></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
// YouTube embed
|
|
|
|
|
else if (embed.TryGetYouTubeVideo() is { } youTubeVideoEmbed)
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed">
|
|
|
|
|
@{/* Color pill */}
|
|
|
|
|
@if (embed.Color is not null)
|
|
|
|
@ -234,14 +244,76 @@
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@{/* Embed description (with special casing for YouTube videos) */}
|
|
|
|
|
@if (youTubeVideo is not null)
|
|
|
|
|
{
|
|
|
|
|
@{/* Video player */}
|
|
|
|
|
<div class="chatlog__embed-youtube-container">
|
|
|
|
|
<iframe class="chatlog__embed-youtube" src="@youTubeVideo.Url" width="400" height="225"></iframe>
|
|
|
|
|
<iframe class="chatlog__embed-youtube" src="@youTubeVideoEmbed.Url" width="400" height="225"></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
// Generic embed
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed">
|
|
|
|
|
@{/* Color pill */}
|
|
|
|
|
@if (embed.Color is not null)
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-color-pill" style="background-color: rgba(@embed.Color?.R,@embed.Color?.G,@embed.Color?.B,@embed.Color?.A)"></div>
|
|
|
|
|
}
|
|
|
|
|
else if (!string.IsNullOrWhiteSpace(embed.Description))
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-color-pill chatlog__embed-color-pill--default"></div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<div class="chatlog__embed-content-container">
|
|
|
|
|
<div class="chatlog__embed-content">
|
|
|
|
|
<div class="chatlog__embed-text">
|
|
|
|
|
@{/* Embed author */}
|
|
|
|
|
@if (embed.Author is not null)
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-author">
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.IconUrl))
|
|
|
|
|
{
|
|
|
|
|
<img class="chatlog__embed-author-icon" src="@await ResolveUrlAsync(embed.Author.IconProxyUrl ?? embed.Author.IconUrl)" alt="Author icon" loading="lazy" onerror="this.style.visibility='hidden'">
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Name))
|
|
|
|
|
{
|
|
|
|
|
<span class="chatlog__embed-author-name">
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Author.Url))
|
|
|
|
|
{
|
|
|
|
|
<a class="chatlog__embed-author-name-link" href="@embed.Author.Url">@embed.Author.Name</a>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@embed.Author.Name
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@{/* Embed title */}
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Title))
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-title">
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Url))
|
|
|
|
|
{
|
|
|
|
|
<a class="chatlog__embed-title-link" href="@embed.Url">
|
|
|
|
|
<div class="markdown preserve-whitespace">@Raw(FormatEmbedMarkdown(embed.Title))</div>
|
|
|
|
|
</a>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="markdown preserve-whitespace">@Raw(FormatEmbedMarkdown(embed.Title))</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@{/* Embed description */}
|
|
|
|
|
@if (!string.IsNullOrWhiteSpace(embed.Description))
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-description">
|
|
|
|
|
<div class="markdown preserve-whitespace">@Raw(FormatEmbedMarkdown(embed.Description))</div>
|
|
|
|
@ -274,8 +346,8 @@
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@{/* Embed content (not shown for YouTube videos) */}
|
|
|
|
|
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url) && youTubeVideo is null)
|
|
|
|
|
@{/* Embed content */}
|
|
|
|
|
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
|
|
|
|
|
{
|
|
|
|
|
<div class="chatlog__embed-thumbnail-container">
|
|
|
|
|
<a class="chatlog__embed-thumbnail-link" href="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
|
|
|
|
@ -328,6 +400,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@{/* Message reactions */}
|
|
|
|
|
@if (message.Reactions.Any())
|
|
|
|
|