feat: started working on thread view

This commit is contained in:
limited_dev 2023-01-25 17:26:21 +01:00
parent 6b919e0b7b
commit 585440d10f
5 changed files with 12 additions and 6 deletions

View file

@ -31,7 +31,7 @@ public class PostData
[Required] [Required]
public string Content { get; set; } public string Content { get; set; }
public string Interactions { get; set; } public int Interactions { get; set; }
[Required] [Required]
public long CreatedAt { get; set; } public long CreatedAt { get; set; }

View file

@ -16,6 +16,7 @@ public static class PostsRepository
return await db.Posts return await db.Posts
.Where(post => post.Board.Equals(board)) .Where(post => post.Board.Equals(board))
.Include(post => post.Image) .Include(post => post.Image)
.Include(post => post.Comments)
.ToListAsync(); .ToListAsync();
} }

View file

@ -0,0 +1,8 @@
@page "/{board}/thread/{threadId}"
<h3>Thread #xx on /x/</h3>
@RouteData.Values["title"]
@code {
}

View file

@ -37,7 +37,7 @@
<a class="report" href="/report/@post.Board/@post.PostID" target="_blank">Report</a> <a class="report" href="/report/@post.Board/@post.PostID" target="_blank">Report</a>
<span>]</span> <span>]</span>
<span>[</span> <span>[</span>
<a class="openThread" href="/@post.Board/@post.PostID" target="_blank">(@post.Interactions) Open Thread</a> <a class="openThread" href="/@post.Board/thread/@post.PostID" target="_blank">(@post.Comments.Count) Open Thread</a>
<span>]</span> <span>]</span>
</div> </div>
} }
@ -45,9 +45,6 @@
@code { @code {
private static DateTime getTimeFromUnix(double javaTimeStamp) private static DateTime getTimeFromUnix(double javaTimeStamp)
{ {
var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); var dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

View file

@ -118,7 +118,7 @@
Username = postUsername, Username = postUsername,
Title = postTitle, Title = postTitle,
Content = postContent, Content = postContent,
Interactions = "", Interactions = 0,
CreatedAt = DateTimeOffset.Now.ToUnixTimeMilliseconds(), CreatedAt = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
Board = board.Tag Board = board.Tag
}; };