feat: improved visuals

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-07 14:46:39 +02:00
parent 94a705b840
commit 1524d12647
8 changed files with 318 additions and 175 deletions

View file

@ -4,8 +4,8 @@
@using System.Text.RegularExpressions @using System.Text.RegularExpressions
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@inject AuthenticationStateProvider authStateProvider @inject AuthenticationStateProvider authStateProvider
<div class="comment">
<div class="threadHeader"> <div class="threadHeader">
<span>[</span> <span>[</span>
<a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a> <a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a>
<span>]</span> <span>]</span>
@ -84,55 +84,20 @@
</div> </div>
</div> </div>
<div class="threadFooter"> <div class="threadFooter">
<span>[</span> <a class="repButton" href="@reportURL" target="_blank">Report</a>
<a @onclick="@deletePost" href="javascript:void(0)">Delete</a> @if (canDel)
<!-- {
<button class="button-31" role="button">Button 31</button> <button class="delButton" onclick="@deletePost">Delete</button>
}
/* CSS */
.button-31 {
background-color: #222;
border-radius: 4px;
border-style: none;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: inline-block;
font-family: "Farfetch Basis","Helvetica Neue",Arial,sans-serif;
font-size: 16px;
font-weight: 700;
line-height: 1.5;
margin: 0;
max-width: none;
min-height: 44px;
min-width: 10px;
outline: none;
overflow: hidden;
padding: 9px 20px 8px;
position: relative;
text-align: center;
text-transform: none;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
width: 100%;
}
.button-31:hover,
.button-31:focus {
opacity: .75;
}
!-->
<span>]</span>
<span>[</span>
<a class="report" href="/sys/report/comment/@comment.Board/@comment.CommentID" target="_blank">Report</a>
<span>]</span>
</div> </div>
} }
</div>
@code { @code {
private string reportURL { get; set; }
private bool isActive { get; set; } = false; private bool isActive { get; set; } = false;
@ -187,7 +152,11 @@ opacity: .75;
{ {
canDel = true; canDel = true;
} }
canDel = false; else
{
canDel = false;
}
hoverComment = new Dictionary<int, CommentData>(); hoverComment = new Dictionary<int, CommentData>();
hoverPost = new Dictionary<int, PostData>(); hoverPost = new Dictionary<int, PostData>();
@ -223,6 +192,7 @@ opacity: .75;
} }
} }
} }
reportURL = $"/sys/report/comment/{comment.Board}/{comment.CommentID}";
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()

View file

@ -27,6 +27,9 @@
.threadHeader{ .threadHeader{
text-align: left; text-align: left;
background-color: #241938;
border-bottom: 2px solid #2d2a42;
margin-inside: 2px;
} }
.threadFooter{ .threadFooter{
@ -48,6 +51,8 @@
max-width: 500px; max-width: 500px;
max-height: 500px; max-height: 500px;
padding: 5px; padding: 5px;
border: 1px solid #2d2a42;
border-radius: 5px;
} }
.threadImage img{ .threadImage img{
@ -76,4 +81,59 @@
.Mod{ .Mod{
color: #bd93f9; color: #bd93f9;
}
.comment{
border: 2px solid #2d2a42;
border-radius: 4px;
}
.threadFooter button{
border: none;
color: white;
padding: 4px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 3px;
}
.threadFooter a{
border: none;
color: white;
padding: 4px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 3px;
}
.delButton{
background-color: #433F6B;
color: white;
border: 2px solid #ff5555;
}
.delButton:hover{
background-color: #ff5555;
color: white;
}
.repButton{
background-color: #433F6B;
color: white;
border: 2px solid #ffa255;
}
.repButton:hover{
background-color: #ffa255;
color: white;
} }

View file

@ -5,9 +5,9 @@
@inject IWebHostEnvironment env @inject IWebHostEnvironment env
@inject AuthenticationStateProvider authStateProvider @inject AuthenticationStateProvider authStateProvider
<div> <div class="toggler">
<span>[</span> <span>[</span>
<a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a> <button onclick="@ToggleOpened">@toggleText</button>
<span>]</span> <span>]</span>
</div> </div>
@if (opened) @if (opened)

View file

@ -41,4 +41,24 @@
.postError{ .postError{
color: #ff191c; color: #ff191c;
}
.toggler button{
color: white;
padding: 4px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 3px;
background-color: #433F6B;
border: none;
}
.toggler button:hover{
background-color: #0de873;
color: black;
} }

View file

@ -6,9 +6,9 @@
@inject IWebHostEnvironment env @inject IWebHostEnvironment env
@inject AuthenticationStateProvider authStateProvider @inject AuthenticationStateProvider authStateProvider
<div> <div class="toggler">
<span>[</span> <span>[</span>
<a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a> <button onclick="@ToggleOpened">@toggleText</button>
<span>]</span> <span>]</span>
</div> </div>
@if (opened) @if (opened)

View file

@ -41,4 +41,24 @@
.postError{ .postError{
color: #ff191c; color: #ff191c;
}
.toggler button{
color: white;
padding: 4px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 3px;
background-color: #433F6B;
border: none;
}
.toggler button:hover{
background-color: #0de873;
color: black;
} }

View file

@ -7,144 +7,128 @@
@inject NavigationManager navigationManager; @inject NavigationManager navigationManager;
<div class="threadHeader"> <div class="post">
@if (showOpenThread) <div class="threadHeader">
{
<span>[</span>
<a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a>
<span>] </span>
}
<span class="title">@post.Title</span>
<span class="name">@post.Username </span>
@if (post.User.Role != "User")
{
<span class="@post.User.Role">##@post.User.Role </span>
}
<span> </span>
<span class="date"> @getTimeFromUnix(post.CreatedAt)</span>
<span class="post-id">No.@post.GET</span>
<AuthorizeView Roles="Admin,Mod">
<Authorized>
<span> </span>
<span>(@value)</span>
</Authorized>
</AuthorizeView>
@if (post.IsSticky)
{
<img src="img/static/sys/sticky.png" alt="Stickied"/>
}
@if (post.IsLocked)
{
<img src="img/static/sys/locked.png" alt="Locked"/>
}
</div>
@if (opened)
{
<div class="threadContent">
<div class="threadImage">
@if (@post.Image != null)
{
string isActiveClass = isActive ? "active" : "";
<img @onclick="() => isActive = !isActive" class="@isActiveClass" src="@($"{@post.Image.ImageLocation}?size=258x258")" alt="No Image found" />
}
else
{
<span>[No Image]</span>
}
</div>
<div class="threadTextContainer">
@if (showOpenThread)
{
@foreach (string s in post.Content.Split("\n").ToList().Take(6))
{
var className = "";
@if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}"))
{
className = "greenText";
}
<span class='threadText @className'>@s&nbsp;</span>
}
@if (post.Content.Split("\n").Length > 6)
{
<br/>
<span class="greenText">[Open Thread to read more...]</span>
}
}
else
{
@foreach (string s in post.Content.Split("\n"))
{
var className = "";
@if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}"))
{
className = "greenText";
}
<span class='threadText @className'>@s&nbsp;</span>
}
}
</div>
</div>
<div class="threadFooter">
<div class="sticky">
</div>
<AuthorizeView Roles="Admin, Mod">
<Authorized>
<span>[ </span>
@if (post.IsSticky)
{
<a onclick="@stickyMe" href="javascript:void(0)">Unsticky</a>
}
else
{
<a onclick="@stickyMe" href="javascript:void(0)">Sticky</a>
}
<span> ]</span>
<span>[ </span>
@if (post.IsLocked)
{
<a onclick="@lockMe" href="javascript:void(0)">Unlock</a>
}
else
{
<a onclick="@lockMe" href="javascript:void(0)">Lock</a>
}
<span> ]</span>
</Authorized>
</AuthorizeView>
@if (canDel)
{
<span>[</span>
<a @onclick="@deletePost" href="javascript:void(0)">Delete</a>
<span>]</span>
}
<span>[</span>
<a class="report" href="/sys/report/op/@post.Board/@post.PostID" target="_blank">Report</a>
<span>] </span>
@if (showOpenThread) @if (showOpenThread)
{ {
<span>[</span> <span>[</span>
<a class="openThread" href="/@post.Board/thread/@post.PostID">(@post.Comments.Count) View Thread</a> <a class="toggleOpened" onclick="@ToggleOpened">@toggleText</a>
<span>]</span> <span>] </span>
} }
else <span class="title">@post.Title</span>
<span class="name">@post.Username </span>
@if (post.User.Role != "User")
{
<span class="@post.User.Role">##@post.User.Role </span>
}
<span> </span>
<span class="date"> @getTimeFromUnix(post.CreatedAt)</span>
<span class="post-id">No.@post.GET</span>
@if (post.IsSticky)
{ {
<span>[</span> <img src="img/static/sys/sticky.png" alt="Stickied"/>
<span class="openThread">@post.Comments.Count Comments</span> }
<span>]</span> @if (post.IsLocked)
{
<img src="img/static/sys/locked.png" alt="Locked"/>
} }
</div> </div>
} @if (opened)
{
<div class="threadContent">
<div class="threadImage">
@if (@post.Image != null)
{
string isActiveClass = isActive ? "active" : "";
<img @onclick="() => isActive = !isActive" class="@isActiveClass" src="@($"{@post.Image.ImageLocation}?size=258x258")" alt="No Image found" />
}
else
{
<span>[No Image]</span>
}
</div>
<div class="threadTextContainer">
@if (showOpenThread)
{
@foreach (string s in post.Content.Split("\n").ToList().Take(6))
{
var className = "";
@if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}"))
{
className = "greenText";
}
<span class='threadText @className'>@s&nbsp;</span>
}
@if (post.Content.Split("\n").Length > 6)
{
<br/>
<span class="greenText">[Open Thread to read more...]</span>
}
}
else
{
@foreach (string s in post.Content.Split("\n"))
{
var className = "";
@if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}"))
{
className = "greenText";
}
<span class='threadText @className'>@s&nbsp;</span>
}
}
</div>
</div>
<div class="threadFooter">
<AuthorizeView Roles="Admin, Mod">
<Authorized>
@if (post.IsSticky)
{
<button class="statButton" onclick="@stickyMe">Unsticky</button>
}
else
{
<button class="statButton" onclick="@stickyMe">Sticky</button>
}
@if (post.IsLocked)
{
<button class="statButton" onclick="@lockMe">Unlock</button>
}
else
{
<button class="statButton" onclick="@lockMe">Lock</button>
}
</Authorized>
</AuthorizeView>
<a class="repButton" href="@reportURL" target="_blank">Report</a>
@if (canDel)
{
<button class="delButton" onclick="@deletePost">Delete</button>
}
@if (showOpenThread)
{
<a class="opButton" href="@threadURL">@openThreadName</a>
}
else
{
<span class="openThread">@post.Comments.Count Comments</span>
}
</div>
}
</div>
@code { @code {
private string reportURL { get; set; }
private string threadURL { get; set; }
private string openThreadName { get; set; }
public bool canDel { get; set; } public bool canDel { get; set; }
public bool isActive { get; set; } = false; public bool isActive { get; set; } = false;
private int linecnt = 0; private int linecnt = 0;
private async void lockMe() private async void lockMe()
{ {
@ -202,6 +186,11 @@
var user = await cauthStateProvder.GetAuthenticationStateAsync(); var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User; var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name); UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
reportURL = $"/sys/report/op/{post.Board}/{post.PostID}";
threadURL = $"/{post.Board}/thread/{post.PostID}";
openThreadName = $"({post.Comments.Count}) View Thread";
if (foundusr != null && (foundusr.Role != "User" || post.UserID == foundusr.UserID)) if (foundusr != null && (foundusr.Role != "User" || post.UserID == foundusr.UserID))
{ {
canDel = true; canDel = true;

View file

@ -23,9 +23,11 @@
.Mod{ .Mod{
color: #bd93f9; color: #bd93f9;
} }
.threadHeader{ .threadHeader{
text-align: left; text-align: left;
background-color: #241938;
border-bottom: 2px solid #2d2a42;
margin-inside: 2px;
} }
.threadFooter{ .threadFooter{
@ -33,6 +35,78 @@
align-self: end; !important; align-self: end; !important;
} }
.threadFooter button{
border: none;
color: white;
padding: 4px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 3px;
}
.threadFooter a{
border: none;
color: white;
padding: 4px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 3px;
}
.delButton{
background-color: #433F6B;
color: white;
border: 2px solid #ff5555;
}
.delButton:hover{
background-color: #ff5555;
color: white;
}
.repButton{
background-color: #433F6B;
color: white;
border: 2px solid #ffa255;
}
.repButton:hover{
background-color: #ffa255;
color: white;
}
.opButton{
background-color: #433F6B;
color: white;
border: 2px solid #55ff77;
}
.opButton:hover{
background-color: #55ff77;
color: white;
}
.statButton{
background-color: #433F6B;
color: white;
border: 2px solid #008CBA;
}
.statButton:hover{
background-color: #008CBA;
color: white;
}
.threadFooter.a{ .threadFooter.a{
color: #6272a4; color: #6272a4;
} }
@ -74,4 +148,14 @@
.threadMsg { .threadMsg {
display: inline-block; display: inline-block;
}
.post{
border: 2px solid #2d2a42;
border-radius: 4px;
}
.threadImage{
border: 1px solid #2d2a42;
border-radius: 5px;
} }