oliverbooth.dev/OliverBooth/Pages/Shared/Partials/_MastodonStatus.cshtml

43 lines
1.4 KiB
Plaintext
Raw Normal View History

@using Humanizer
@using OliverBooth.Common.Data.Mastodon
@using OliverBooth.Common.Services
@inject IMastodonService MastodonService
@{
IMastodonStatus latestStatus = MastodonService.GetLatestStatus();
}
<div class="card text-center mastodon-update-card">
<div class="card-body">
@Html.Raw(latestStatus.Content)
@foreach (MediaAttachment attachment in latestStatus.MediaAttachments)
{
switch (attachment.Type)
{
case AttachmentType.Audio:
<p>
<audio controls="controls" src="@attachment.Url"></audio>
</p>
break;
case AttachmentType.Video:
<p>
<video controls="controls" class="figure-img img-fluid" src="@attachment.Url"></video>
</p>
break;
case AttachmentType.Image:
case AttachmentType.GifV:
<p>
<img class="figure-img img-fluid" src="@attachment.Url">
</p>
break;
}
}
</div>
<div class="card-footer text-muted">
<abbr title="@latestStatus.CreatedAt.ToString("F")">@latestStatus.CreatedAt.Humanize()</abbr>
&bull;
<a href="@latestStatus.OriginalUri" target="_blank">View on Mastodon</a>
</div>
</div>