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;
} }
else
{
canDel = false; 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{
@ -77,3 +82,58 @@
.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

@ -42,3 +42,23 @@
.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

@ -42,3 +42,23 @@
.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,7 +7,8 @@
@inject NavigationManager navigationManager; @inject NavigationManager navigationManager;
<div class="threadHeader"> <div class="post">
<div class="threadHeader">
@if (showOpenThread) @if (showOpenThread)
{ {
<span>[</span> <span>[</span>
@ -23,12 +24,6 @@
<span> </span> <span> </span>
<span class="date"> @getTimeFromUnix(post.CreatedAt)</span> <span class="date"> @getTimeFromUnix(post.CreatedAt)</span>
<span class="post-id">No.@post.GET</span> <span class="post-id">No.@post.GET</span>
<AuthorizeView Roles="Admin,Mod">
<Authorized>
<span> </span>
<span>(@value)</span>
</Authorized>
</AuthorizeView>
@if (post.IsSticky) @if (post.IsSticky)
{ {
<img src="img/static/sys/sticky.png" alt="Stickied"/> <img src="img/static/sys/sticky.png" alt="Stickied"/>
@ -37,9 +32,9 @@
{ {
<img src="img/static/sys/locked.png" alt="Locked"/> <img src="img/static/sys/locked.png" alt="Locked"/>
} }
</div> </div>
@if (opened) @if (opened)
{ {
<div class="threadContent"> <div class="threadContent">
<div class="threadImage"> <div class="threadImage">
@if (@post.Image != null) @if (@post.Image != null)
@ -87,65 +82,54 @@
</div> </div>
</div> </div>
<div class="threadFooter"> <div class="threadFooter">
<div class="sticky">
</div>
<AuthorizeView Roles="Admin, Mod"> <AuthorizeView Roles="Admin, Mod">
<Authorized> <Authorized>
<span>[ </span>
@if (post.IsSticky) @if (post.IsSticky)
{ {
<a onclick="@stickyMe" href="javascript:void(0)">Unsticky</a> <button class="statButton" onclick="@stickyMe">Unsticky</button>
} }
else else
{ {
<a onclick="@stickyMe" href="javascript:void(0)">Sticky</a> <button class="statButton" onclick="@stickyMe">Sticky</button>
} }
<span> ]</span>
<span>[ </span>
@if (post.IsLocked) @if (post.IsLocked)
{ {
<a onclick="@lockMe" href="javascript:void(0)">Unlock</a> <button class="statButton" onclick="@lockMe">Unlock</button>
} }
else else
{ {
<a onclick="@lockMe" href="javascript:void(0)">Lock</a> <button class="statButton" onclick="@lockMe">Lock</button>
} }
<span> ]</span>
</Authorized> </Authorized>
</AuthorizeView> </AuthorizeView>
<a class="repButton" href="@reportURL" target="_blank">Report</a>
@if (canDel) @if (canDel)
{ {
<span>[</span> <button class="delButton" onclick="@deletePost">Delete</button>
<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> <a class="opButton" href="@threadURL">@openThreadName</a>
<a class="openThread" href="/@post.Board/thread/@post.PostID">(@post.Comments.Count) View Thread</a>
<span>]</span>
} }
else else
{ {
<span>[</span>
<span class="openThread">@post.Comments.Count Comments</span> <span class="openThread">@post.Comments.Count Comments</span>
<span>]</span>
} }
</div> </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()
{ {
post.IsLocked = !post.IsLocked; post.IsLocked = !post.IsLocked;
@ -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;
} }
@ -75,3 +149,13 @@
.threadMsg { .threadMsg {
display: inline-block; display: inline-block;
} }
.post{
border: 2px solid #2d2a42;
border-radius: 4px;
}
.threadImage{
border: 1px solid #2d2a42;
border-radius: 5px;
}