chore: add README.md

fix: added more space to the title, added delete button show up fix
This commit is contained in:
limited_dev 2023-03-11 00:56:51 +01:00
parent 5641bfa6a3
commit 9bdad9e48d
6 changed files with 47 additions and 10 deletions

View file

@ -3,7 +3,6 @@
@namespace ImageBoardServerApp.Pages @namespace ImageBoardServerApp.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<link rel="stylesheet" href="_content/Radzen.Blazor/css/material-dark.css">
<!-- <script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script> --> <!-- <script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script> -->
<!DOCTYPE html> <!DOCTYPE html>
@ -16,6 +15,7 @@
<link href="css/site.css" rel="stylesheet"/> <link href="css/site.css" rel="stylesheet"/>
<link href="ImageBoardServerApp.styles.css" rel="stylesheet"/> <link href="ImageBoardServerApp.styles.css" rel="stylesheet"/>
<link rel="icon" type="image/png" href="/img/static/logo.png"/> <link rel="icon" type="image/png" href="/img/static/logo.png"/>
<!--<link rel="stylesheet" href="_content/Radzen.Blazor/css/material-dark.css"> -->
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered"/> <component type="typeof(HeadOutlet)" render-mode="ServerPrerendered"/>
</head> </head>
<body> <body>

View file

@ -73,6 +73,8 @@
@code { @code {
public bool canDel { get; set; }
private async Task deletePost() private async Task deletePost()
{ {
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider; var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
@ -95,7 +97,21 @@
private ImageData image; private ImageData image;
private string role; private string role;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
if (foundusr != null && (foundusr.Role != "User" || comment.UserID == foundusr.UserID))
{
canDel = true;
}
canDel = false;
}
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
int i; int i;

View file

@ -28,7 +28,7 @@
</div> </div>
<div class="pd centered marg"> <div class="pd centered marg">
<RadzenTextBox Placeholder="Title" MaxLength="40" @bind-Value="@postTitle" Class="w-100"/> <RadzenTextBox Placeholder="Title" MaxLength="128" @bind-Value="@postTitle" Class="w-100"/>
</div> </div>
<div class="pd centered marg"> <div class="pd centered marg">

View file

@ -93,10 +93,12 @@
<span> ]</span> <span> ]</span>
</Authorized> </Authorized>
</AuthorizeView> </AuthorizeView>
@if (canDel)
<span>[</span> {
<a @onclick="@deletePost" href="javascript:void(0)">Delete</a> <span>[</span>
<span>]</span> <a @onclick="@deletePost" href="javascript:void(0)">Delete</a>
<span>]</span>
}
<span>[</span> <span>[</span>
<a class="report" href="/sys/report/op/@post.Board/@post.PostID" target="_blank">Report</a> <a class="report" href="/sys/report/op/@post.Board/@post.PostID" target="_blank">Report</a>
<span>] </span> <span>] </span>
@ -118,6 +120,8 @@
@code { @code {
public bool canDel { get; set; }
private async void lockMe() private async void lockMe()
{ {
@ -137,7 +141,7 @@
dateTime = dateTime.AddMilliseconds( javaTimeStamp ).ToLocalTime(); dateTime = dateTime.AddMilliseconds( javaTimeStamp ).ToLocalTime();
return dateTime; return dateTime;
} }
private async Task deletePost() private async Task deletePost()
{ {
string boardTag = post.Board; string boardTag = post.Board;
@ -165,9 +169,21 @@
toggleText = opened ? "-" : "+"; toggleText = opened ? "-" : "+";
} }
protected override async Task OnInitializedAsync() protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
await base.OnAfterRenderAsync(firstRender);
value = TheManager.getBumpValue(post) + "v"; value = TheManager.getBumpValue(post) + "v";
string boardTag = post.Board;
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
var usr = user.User;
UserData foundusr = await UsersRepository.getUserByEmailAsync(usr.Identity.Name);
if (foundusr != null && (foundusr.Role != "User" || post.UserID == foundusr.UserID))
{
canDel = true;
return;
}
canDel = false;
} }
[Parameter] [Parameter]

View file

@ -5,7 +5,7 @@
<div class="top-row ps-3 navbar navbar-dark"> <div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="">BB v0.1.4</a> <a class="navbar-brand" href="">BB v0.1.9</a>
<AuthorizeView> <AuthorizeView>
<Authorized> <Authorized>
<a class="navbar-brand" @onclick="logout" href="javascript:void(0)" >[Logout]</a> <a class="navbar-brand" @onclick="logout" href="javascript:void(0)" >[Logout]</a>

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# TODO:
- Tags
- Search
- Notify on Topic / Tag
- Send thread to user before deletion