mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
Superadmin nav fixes
This commit is contained in:
parent
0527fd6972
commit
fc7e3d363a
@ -6,8 +6,6 @@
|
|||||||
<div class="flex items-center justify-center gap-4">
|
<div class="flex items-center justify-center gap-4">
|
||||||
<img
|
<img
|
||||||
src="/images/pockethost-cloud-logo.jpg"
|
src="/images/pockethost-cloud-logo.jpg"
|
||||||
width="450"
|
|
||||||
height="450"
|
|
||||||
class="mix-blend-lighten {logoWidth}"
|
class="mix-blend-lighten {logoWidth}"
|
||||||
alt="PocketHost Logo"
|
alt="PocketHost Logo"
|
||||||
/>
|
/>
|
||||||
|
@ -1,11 +1,24 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { page } from '$app/stores'
|
||||||
|
import Logo from '$components/Logo.svelte'
|
||||||
import MediaQuery from '$components/MediaQuery.svelte'
|
import MediaQuery from '$components/MediaQuery.svelte'
|
||||||
import MobileNavDrawer from '$components/MobileNavDrawer.svelte'
|
import MobileNavDrawer from '$components/MobileNavDrawer.svelte'
|
||||||
import Navbar from '$components/Navbar.svelte'
|
import Navbar from '$components/Navbar.svelte'
|
||||||
import AuthStateGuard from '$components/helpers/AuthStateGuard.svelte'
|
import AuthStateGuard from '$components/helpers/AuthStateGuard.svelte'
|
||||||
import Meta from '$components/helpers/Meta.svelte'
|
import Meta from '$components/helpers/Meta.svelte'
|
||||||
import UserLoggedIn from '$components/helpers/UserLoggedIn.svelte'
|
import UserLoggedIn from '$components/helpers/UserLoggedIn.svelte'
|
||||||
|
import { client } from '$src/pocketbase-client'
|
||||||
import '../app.css'
|
import '../app.css'
|
||||||
|
|
||||||
|
const handleLogoutAndRedirect = async () => {
|
||||||
|
const { logOut } = client()
|
||||||
|
|
||||||
|
// Clear out the pocketbase information about the current user
|
||||||
|
logOut()
|
||||||
|
|
||||||
|
// Hard refresh to make sure any remaining data is cleared
|
||||||
|
window.location.href = '/'
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Meta />
|
<Meta />
|
||||||
@ -16,7 +29,11 @@
|
|||||||
<MediaQuery query="(min-width: 1280px)" let:matches>
|
<MediaQuery query="(min-width: 1280px)" let:matches>
|
||||||
{#if matches}
|
{#if matches}
|
||||||
<Navbar />
|
<Navbar />
|
||||||
{:else}
|
{/if}
|
||||||
|
</MediaQuery>
|
||||||
|
|
||||||
|
<MediaQuery query="(max-width: 700px)" let:matches>
|
||||||
|
{#if matches}
|
||||||
<MobileNavDrawer>
|
<MobileNavDrawer>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</MobileNavDrawer>
|
</MobileNavDrawer>
|
||||||
@ -24,8 +41,47 @@
|
|||||||
</MediaQuery>
|
</MediaQuery>
|
||||||
</UserLoggedIn>
|
</UserLoggedIn>
|
||||||
|
|
||||||
<div class="lg:p-4 lg:pt-0 xl:pt-4 min-h-screen grow">
|
<div class="p-0 lg:p-4 min-h-screen grow">
|
||||||
<div class="bg-base-300 border-base-300 border-[16px] lg:p-4 rounded-2xl">
|
<div
|
||||||
|
class="bg-base-300 border-base-300 border-[16px] m-0 md:p-4 rounded-2xl"
|
||||||
|
>
|
||||||
|
<MediaQuery
|
||||||
|
query="(min-width: 701px) and (max-width: 1279px)"
|
||||||
|
let:matches
|
||||||
|
>
|
||||||
|
{#if matches}
|
||||||
|
<UserLoggedIn>
|
||||||
|
<div role="tablist" class="tabs tabs-boxed">
|
||||||
|
<a href="/" role="tab" class="tab">
|
||||||
|
<Logo hideLogoText={true} logoWidth="h-8" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
role="tab"
|
||||||
|
class="tab {$page.url.pathname === '/stats'
|
||||||
|
? `tab-active`
|
||||||
|
: ``}"
|
||||||
|
href="/stats">Stats</a
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
role="tab"
|
||||||
|
class="tab {$page.url.pathname === '/plugins'
|
||||||
|
? `tab-active`
|
||||||
|
: ``}"
|
||||||
|
href="/plugins">Plugins</a
|
||||||
|
>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="tab"
|
||||||
|
on:click={handleLogoutAndRedirect}
|
||||||
|
><i class="fa-regular fa-arrow-up-left-from-circle mr-2"></i> Logout</button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</UserLoggedIn>
|
||||||
|
{/if}
|
||||||
|
</MediaQuery>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import UserLoggedIn from '$components/helpers/UserLoggedIn.svelte'
|
import UserLoggedIn from '$components/helpers/UserLoggedIn.svelte'
|
||||||
import UserLoggedOut from '$components/helpers/UserLoggedOut.svelte'
|
import UserLoggedOut from '$components/helpers/UserLoggedOut.svelte'
|
||||||
import LoginForm from '$components/login-register/LoginForm.svelte'
|
import LoginForm from '$components/login-register/LoginForm.svelte'
|
||||||
import Dashboard from './dashboard/Dashboard.svelte'
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
@ -11,9 +10,7 @@
|
|||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<UserLoggedIn>
|
<UserLoggedIn>Welcome</UserLoggedIn>
|
||||||
<Dashboard />
|
|
||||||
</UserLoggedIn>
|
|
||||||
|
|
||||||
<UserLoggedOut>
|
<UserLoggedOut>
|
||||||
<div class="min-h-screen flex items-center justify-center">
|
<div class="min-h-screen flex items-center justify-center">
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
<script>
|
|
||||||
import UserLoggedIn from '$components/helpers/UserLoggedIn.svelte'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<UserLoggedIn redirect>
|
|
||||||
<slot />
|
|
||||||
</UserLoggedIn>
|
|
@ -1,42 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import AuthStateGuard from '$components/helpers/AuthStateGuard.svelte'
|
|
||||||
import { client } from '$src/pocketbase-client'
|
|
||||||
import { onMount } from 'svelte'
|
|
||||||
import { writable } from 'svelte/store'
|
|
||||||
|
|
||||||
type Plugin = {
|
|
||||||
slug: string
|
|
||||||
name: string
|
|
||||||
version: string
|
|
||||||
migration: number
|
|
||||||
enabled: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const plugins = writable<Plugin[]>([])
|
|
||||||
const stats = writable({})
|
|
||||||
|
|
||||||
onMount(async () => {
|
|
||||||
plugins.set(await client().client.collection('plugins').getFullList())
|
|
||||||
stats.set(
|
|
||||||
((await client().client.collection('stats').getFullList()) || []).pop() ||
|
|
||||||
{},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<svelte:head>
|
|
||||||
<title>Dashboard - PocketHost</title>
|
|
||||||
</svelte:head>
|
|
||||||
|
|
||||||
<AuthStateGuard>
|
|
||||||
<div>
|
|
||||||
{#each Object.entries($stats) as [key, idx]}
|
|
||||||
<div>{key}: {idx}</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
{#each $plugins as plugin}
|
|
||||||
<div>{plugin.name}</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</AuthStateGuard>
|
|
33
frontends/superadmin/src/routes/plugins/+page.svelte
Normal file
33
frontends/superadmin/src/routes/plugins/+page.svelte
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { client } from '$src/pocketbase-client'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
|
type Plugin = {
|
||||||
|
slug: string
|
||||||
|
name: string
|
||||||
|
version: string
|
||||||
|
migration: number
|
||||||
|
enabled: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const plugins = writable<Plugin[]>([])
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
plugins.set(await client().client.collection('plugins').getFullList())
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Stats - PocketHost</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{#each $plugins as plugin}
|
||||||
|
<div>{plugin.name}</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
29
frontends/superadmin/src/routes/stats/+page.svelte
Normal file
29
frontends/superadmin/src/routes/stats/+page.svelte
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { client } from '$src/pocketbase-client'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
|
const stats = writable({})
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
stats.set(
|
||||||
|
(
|
||||||
|
(await client().client.collection('stats').getFullList()) || []
|
||||||
|
).pop() || {},
|
||||||
|
)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>Stats - PocketHost</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{#each Object.entries($stats) as [key, idx]}
|
||||||
|
<div>{key}: {idx}</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user