Add date picker and different report types

This commit is contained in:
2021-05-11 20:29:56 +02:00
parent 9be306a427
commit 5be98caadc
4 changed files with 58 additions and 29 deletions

View File

@@ -7,17 +7,11 @@ let dispatch = createEventDispatcher()
export let report
let expandable
let grant = () => {
set_status("grant")
}
let reject = () => {
set_status("reject")
}
let set_status = async (action) => {
let set_status = async (action, report_type) => {
const form = new FormData()
form.append("action", action)
if (action === "grant") {
form.append("type", report.type)
form.append("type", report_type)
}
try {
@@ -44,7 +38,9 @@ let set_status = async (action) => {
</div>
<div class="title">{report.file.name}</div>
<div class="stats">Type<br/>{report.type}</div>
<div class="stats">Type<br/>
{report.file.abuse_type === "" ? report.type : report.file.abuse_type}
</div>
{#if report.status !== "pending"}
<div class="stats">Status<br/>{report.status}</div>
{/if}
@@ -53,12 +49,24 @@ let set_status = async (action) => {
<div class="stats">DL<br/>{Math.round(report.file.bandwidth_used / report.file.size)}</div>
</div>
<div class="details">
<div style="text-align: center;">
<a class="button" target="_blank" href={"/u/"+report.file.id}>
<i class="icon">open_in_new</i> Open file
</a>
<button on:click={grant}><i class="icon">done</i> Grant (block file)</button>
<button on:click={reject}><i class="icon">delete</i> Ignore reports</button>
<div class="toolbar">
<div style="flex: 1 1 auto">
<a class="button" target="_blank" href={"/u/"+report.file.id}>
<i class="icon">open_in_new</i> Open file
</a>
<button class="button_highlight" on:click={() => {set_status("grant", report.type)}}>
<i class="icon">done</i> Block ({report.type})
</button>
<button class="button_red" on:click={() => {set_status("reject", "")}}>
<i class="icon">delete</i> Ignore
</button>
</div>
<div style="flex: 0 1 auto">
<button on:click={() => {set_status("grant", "terrorism")}}>terrorism</button>
<button on:click={() => {set_status("grant", "gore")}}>gore</button>
<button on:click={() => {set_status("grant", "child_abuse")}}>child_abuse</button>
<button on:click={() => {set_status("grant", "malware")}}>malware</button>
</div>
</div>
<table>
<tr>
@@ -83,6 +91,7 @@ let set_status = async (action) => {
.header {
display: flex;
flex-direction: row;
line-height: 1.2em;
}
.icon_cell {
flex: 0 0 auto;
@@ -96,13 +105,16 @@ let set_status = async (action) => {
.stats {
flex: 0 0 auto;
padding: 3px 4px;
line-height: 1.2em;
border-left: 1px solid var(--layer_3_color_border);
text-align: center;
}
.details {
flex: 1 1 auto;
}
.toolbar {
display: flex;
flex-direction: row;
}
.file_icon {
width:48px;
height:48px;