Files
fnx_web/svelte/src/admin_panel/Router.svelte

95 lines
2.6 KiB
Svelte
Raw Normal View History

2021-05-25 22:15:29 +02:00
<script>
import AbuseReporters from "./AbuseReporters.svelte"
import AbuseReports from "./AbuseReports.svelte"
import IpBans from "./IPBans.svelte"
import Home from "./Home.svelte"
import { onMount } from "svelte";
2021-09-23 22:16:53 +02:00
import BlockFiles from "./BlockFiles.svelte";
import Subscriptions from "./Subscriptions.svelte";
2021-05-25 22:15:29 +02:00
let page = ""
let navigate = (path, title) => {
page = path
window.document.title = title+" ~ pixeldrain"
window.history.pushState(
{}, window.document.title, "/admin/"+path
)
}
onMount(() => {
let newpage = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1)
if (newpage === "admin") {
2021-06-14 14:55:34 +02:00
newpage = "status"
2021-05-25 22:15:29 +02:00
}
page = newpage
})
</script>
2022-01-11 13:28:22 +01:00
<header>
2022-01-03 14:02:50 +01:00
<h1>Admin Panel</h1>
2021-09-21 21:39:28 +02:00
<div class="tab_bar">
2021-09-23 20:38:17 +02:00
<a class="button"
2021-09-21 21:39:28 +02:00
href="/admin"
class:button_highlight={page === "status"}
on:click|preventDefault={() => {navigate("status", "Status")}}>
2022-03-29 21:41:46 +02:00
<i class="icon">home</i><br/>
2021-09-21 21:39:28 +02:00
Status
</a>
2021-09-23 22:16:53 +02:00
<a class="button"
href="/admin/block_files"
class:button_highlight={page === "block_files"}
on:click|preventDefault={() => {navigate("block_files", "Block files")}}>
2022-03-29 21:41:46 +02:00
<i class="icon">block</i><br/>
2021-09-21 21:39:28 +02:00
Block files
</a>
2021-09-23 20:38:17 +02:00
<a class="button"
2021-09-21 21:39:28 +02:00
href="/admin/abuse_reports"
class:button_highlight={page === "abuse_reports"}
on:click|preventDefault={() => {navigate("abuse_reports", "Abuse reports")}}>
2022-03-29 21:41:46 +02:00
<i class="icon">flag</i><br/>
2022-01-17 15:46:36 +01:00
User reports
2021-09-21 21:39:28 +02:00
</a>
2021-09-23 20:38:17 +02:00
<a class="button"
2021-09-21 21:39:28 +02:00
href="/admin/abuse_reporters"
class:button_highlight={page === "abuse_reporters"}
on:click|preventDefault={() => {navigate("abuse_reporters", "Abuse reporters")}}>
2022-03-29 21:41:46 +02:00
<i class="icon">email</i><br/>
2022-01-17 15:46:36 +01:00
E-mail reporters
2021-09-21 21:39:28 +02:00
</a>
2021-09-23 20:38:17 +02:00
<a class="button"
2021-09-21 21:39:28 +02:00
href="/admin/ip_bans"
class:button_highlight={page === "ip_bans"}
on:click|preventDefault={() => {navigate("ip_bans", "IP bans")}}>
2022-03-29 21:41:46 +02:00
<i class="icon">remove_circle</i><br/>
2021-09-21 21:39:28 +02:00
IP bans
</a>
<a class="button"
href="/admin/subscriptions"
class:button_highlight={page === "subscriptions"}
on:click|preventDefault={() => {navigate("subscriptions", "Subscriptions")}}>
2022-03-29 21:41:46 +02:00
<i class="icon">receipt_long</i><br/>
Subscriptions
</a>
2021-09-23 20:38:17 +02:00
<a class="button" href="/admin/globals">
2022-03-29 21:41:46 +02:00
<i class="icon">edit</i><br/>
2022-01-17 15:46:36 +01:00
Global settings
2021-09-21 21:39:28 +02:00
</a>
</div>
2022-01-11 13:28:22 +01:00
</header>
2022-01-03 14:02:50 +01:00
{#if page === "status"}
<Home></Home>
{:else if page === "block_files"}
<BlockFiles></BlockFiles>
{:else if page === "abuse_reports"}
<AbuseReports></AbuseReports>
{:else if page === "abuse_reporters"}
<AbuseReporters></AbuseReporters>
{:else if page === "ip_bans"}
<IpBans></IpBans>
{:else if page === "subscriptions"}
<Subscriptions></Subscriptions>
{/if}