2023-01-25 22:45:36 +00:00
|
|
|
@using System.ComponentModel.DataAnnotations
|
|
|
|
@using ImageBoardServerApp.Data
|
2023-01-26 12:04:55 +00:00
|
|
|
@using ImageBoardServerApp.Data.Repository
|
2023-01-25 22:45:36 +00:00
|
|
|
|
|
|
|
<div class="threadHeader">
|
|
|
|
<span>[</span>
|
|
|
|
<a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a>
|
|
|
|
<span>]</span>
|
|
|
|
<span class="name">@comment.Username</span>
|
|
|
|
<span class="date">@getTimeFromUnix(comment.CreatedAt)</span>
|
|
|
|
<span class="post-id">No.@comment.CommentID</span>
|
|
|
|
</div>
|
|
|
|
@if (opened)
|
|
|
|
{
|
|
|
|
<div class="threadContent">
|
|
|
|
<div class="threadImage">
|
2023-01-26 12:04:55 +00:00
|
|
|
@if (image != null)
|
2023-01-25 22:45:36 +00:00
|
|
|
{
|
2023-01-26 12:04:55 +00:00
|
|
|
<img src="@($"data:image/jpeg;base64,{Convert.ToBase64String(image.Image)}")" alt="No Image found" />
|
2023-01-25 22:45:36 +00:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div class="threadTextContainer">
|
|
|
|
@foreach (string s in @comment.Content.Split("\n"))
|
|
|
|
{
|
2023-01-26 12:04:55 +00:00
|
|
|
@if (s.StartsWith(">"))
|
|
|
|
{
|
|
|
|
<span class="threadText greenText">@s</span>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<span class='threadText'>@s</span>
|
|
|
|
}
|
2023-01-25 22:45:36 +00:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="threadFooter">
|
|
|
|
<span>[</span>
|
2023-01-26 12:04:55 +00:00
|
|
|
<a class="report" href="/report/@comment.Board/@comment.PostID/comment/@comment.CommentID" target="_blank">Report</a>
|
2023-01-25 22:45:36 +00:00
|
|
|
<span>]</span>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
private static DateTime getTimeFromUnix(double javaTimeStamp)
|
|
|
|
{
|
|
|
|
var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
|
|
|
dateTime = dateTime.AddMilliseconds( javaTimeStamp ).ToLocalTime();
|
|
|
|
return dateTime;
|
|
|
|
}
|
2023-01-26 12:04:55 +00:00
|
|
|
|
|
|
|
private ImageData image;
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
i = (int)comment.ImageID;
|
|
|
|
}
|
|
|
|
catch (InvalidOperationException ioe)
|
|
|
|
{
|
|
|
|
i = -1;
|
|
|
|
}
|
|
|
|
if (i != null)
|
|
|
|
{
|
|
|
|
image = await ImagesRepository.getImageByIdAsync(i);
|
|
|
|
}
|
|
|
|
}
|
2023-01-25 22:45:36 +00:00
|
|
|
|
|
|
|
private bool opened = true;
|
|
|
|
|
|
|
|
private string toggleText = "-";
|
|
|
|
|
|
|
|
private void ToggleOpened()
|
|
|
|
{
|
|
|
|
opened = !opened;
|
|
|
|
toggleText = opened ? "-" : "+";
|
|
|
|
}
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
[Required]
|
|
|
|
public CommentData comment { get; set; }
|
|
|
|
}
|