HUUUGE dump of code, toast system in a svelte module, new reworked tailwing color palette, WIP cms, WIP API and probably much more that i forgot about.
This commit is contained in:
Executable → Regular
+42
-20
@@ -1,49 +1,71 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
import { BookA, ChartLine, ChartNoAxesColumn, FolderArchive, Plus } from '@lucide/svelte';
|
||||
import { type Snippet } from 'svelte';
|
||||
import { fetchAllData } from '$lib/stores/panel-state.svelte';
|
||||
import { FileSystem } from '$lib/termos/filesystem/filesystem';
|
||||
import {
|
||||
BookA,
|
||||
ChartLine,
|
||||
ChartNoAxesColumn,
|
||||
FolderArchive,
|
||||
Plus,
|
||||
Settings2,
|
||||
UserRoundCog
|
||||
} from '@lucide/svelte';
|
||||
import { onMount, type Snippet } from 'svelte';
|
||||
import '../../app.css';
|
||||
import SidebarButton from '../../modules/panel/SidebarButton.svelte';
|
||||
import ToastsModule from '../../modules/ToastsModule.svelte';
|
||||
import { capitalize } from '../admin/util';
|
||||
let { children, data }: { children: Snippet; data: any } = $props();
|
||||
|
||||
// Get last word of pathname (full url) filter if no empty array indexes exist and capitalize it
|
||||
let site: string = $derived(capitalize(page.url.pathname.split('/').filter(Boolean).pop() ?? ''));
|
||||
|
||||
onMount(async () => {
|
||||
await FileSystem.init();
|
||||
await fetchAllData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex h-dvh w-full flex-row text-text-dark light:text-text-light">
|
||||
<div class="flex h-full w-fit flex-col items-center bg-bg-dark light:bg-bg-light">
|
||||
<ToastsModule></ToastsModule>
|
||||
<div class="flex h-dvh w-full flex-row text-text-primary">
|
||||
<div class="flex h-full w-fit flex-col items-center bg-surface-1">
|
||||
<img class="m-3 mb-8" alt="Logo" src={favicon} height="32" width="32" />
|
||||
<form class="flex h-full w-fit flex-col items-center gap-3">
|
||||
<label
|
||||
class="m-0 mb-4 flex size-12 items-center justify-center rounded-xl bg-bg-lighter-dark shadow-subtle hover:text-primary-hover-dark has-checked:text-primary-dark has-checked:hover:text-primary-hover-dark light:bg-bg-light-light light:hover:text-primary-hover-light light:has-checked:text-primary-light light:has-checked:hover:text-primary-hover-light"
|
||||
class="m-0 mb-4 flex size-12 items-center justify-center rounded-xl bg-surface-2 shadow-subtle duration-100 transition-standard hover:text-primary has-checked:text-primary has-checked:hover:text-primary-variant has-active:button-click"
|
||||
>
|
||||
<input name="langs" type="radio" class="hidden" id="pl" autocomplete="off" />
|
||||
<Plus strokeWidth={1} />
|
||||
<Plus strokeWidth={1.25} />
|
||||
</label>
|
||||
<SidebarButton checked path="/panel/projects">
|
||||
<FolderArchive strokeWidth={1} />
|
||||
<!-- prettier-ignore -->
|
||||
<SidebarButton /*checked*/ path="/panel/projects">
|
||||
<FolderArchive strokeWidth={1.25} />
|
||||
</SidebarButton>
|
||||
<SidebarButton path="/panel/users">
|
||||
<UserRoundCog strokeWidth={1.25} />
|
||||
</SidebarButton>
|
||||
<SidebarButton path="/panel/langs">
|
||||
<BookA strokeWidth={1} />
|
||||
<BookA strokeWidth={1.25} />
|
||||
</SidebarButton>
|
||||
<SidebarButton path="/panel/metrics">
|
||||
<ChartLine strokeWidth={1} />
|
||||
<ChartLine strokeWidth={1.25} />
|
||||
</SidebarButton>
|
||||
<SidebarButton path="/panel/stats">
|
||||
<ChartNoAxesColumn strokeWidth={1} />
|
||||
<ChartNoAxesColumn strokeWidth={1.25} />
|
||||
</SidebarButton>
|
||||
<SidebarButton path="/panel/global">
|
||||
<Settings2 strokeWidth={1.25} />
|
||||
</SidebarButton>
|
||||
</form>
|
||||
</div>
|
||||
<div class=" w-full">
|
||||
<div class=" m-8 w-full">
|
||||
<h2 class=" m-8 ml-0 font-primary text-3xl font-black text-primary">{site}</h2>
|
||||
{@render children()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
main {
|
||||
transition:
|
||||
--dots-bg-2 0.2s ease-in,
|
||||
--dots-bg-1 0.2s ease-in;
|
||||
}
|
||||
</style>
|
||||
|
||||
Executable → Regular
Executable → Regular
Executable → Regular
@@ -1,25 +1,14 @@
|
||||
import fsData from '$lib/assets/fs/fs.json';
|
||||
import { db } from '$lib/server/db';
|
||||
import { projects, settings } from '$lib/server/db/schema';
|
||||
import { FileSystem } from '$lib/termos/filesystem/filesystem';
|
||||
import { Sort, SortNodeBy } from '$lib/termos/util/sort';
|
||||
import { config, projects } from '$lib/server/db/schema';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
FileSystem.Init(fsData as any);
|
||||
|
||||
const fs = FileSystem.instance;
|
||||
|
||||
const node = fs.getNodeByInode(13); //Gordonox home dir
|
||||
let nodes = node.children.map((child) => fs.getNodeByInode(child));
|
||||
nodes = Sort.nodeArraySort(nodes, false, SortNodeBy.NAME);
|
||||
|
||||
return {
|
||||
settings: await db
|
||||
.select({ setting: settings.state })
|
||||
.from(settings)
|
||||
.where(eq(settings.var, 'maintenance'))
|
||||
.select({ value: config.value })
|
||||
.from(config)
|
||||
.where(eq(config.key, 'maintenance'))
|
||||
.limit(1),
|
||||
projects: await db
|
||||
.select({
|
||||
@@ -28,7 +17,6 @@ export const load: PageServerLoad = async () => {
|
||||
data: projects.data,
|
||||
enabled: projects.enabled
|
||||
})
|
||||
.from(projects),
|
||||
nodes: nodes
|
||||
.from(projects)
|
||||
};
|
||||
};
|
||||
|
||||
Executable → Regular
+30
-27
@@ -2,6 +2,7 @@
|
||||
import { Construction, Eye, EyeOff } from '@lucide/svelte';
|
||||
import NodeModule from '../../../modules/panel/NodeModule.svelte';
|
||||
import ProjectModule from '../../../modules/panel/ProjectModule.svelte';
|
||||
import ToggleSwitchModule from '../../../modules/panel/ToggleSwitchModule.svelte';
|
||||
import { setMaintenanceState } from '../settings.remote';
|
||||
|
||||
let { data }: { data: any } = $props();
|
||||
@@ -11,6 +12,10 @@
|
||||
|
||||
console.log(data.projects[0].name);
|
||||
|
||||
function testModule() {
|
||||
console.log('it works!');
|
||||
}
|
||||
|
||||
function handleToggle() {
|
||||
console.log(maintenance);
|
||||
maintenance = !maintenance;
|
||||
@@ -24,6 +29,17 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class=" flex items-start">
|
||||
<ToggleSwitchModule
|
||||
callback={async () => await setMaintenanceState(Number(!maintenance))}
|
||||
id="maintenence"
|
||||
sync={maintenance}
|
||||
>
|
||||
{#snippet icon()}
|
||||
<Construction strokeWidth={1} />
|
||||
{/snippet}
|
||||
</ToggleSwitchModule>
|
||||
</div>
|
||||
<div
|
||||
class=" grid-cols-[1.5fr, 1fr] grid w-full"
|
||||
style="grid-template-areas:
|
||||
@@ -46,33 +62,20 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class=" flex flex-col gap-1">
|
||||
{#each data.nodes as node}
|
||||
{#if showHidden}
|
||||
<NodeModule nodeName={node.name} nodeType={node.type} isProject={false} />
|
||||
{/if}
|
||||
{#if !node.name.startsWith('.') && !showHidden}
|
||||
<NodeModule nodeName={node.name} nodeType={node.type} isProject={false} />
|
||||
{/if}
|
||||
{/each}
|
||||
<form>
|
||||
{#each data.nodes as node}
|
||||
{#if showHidden}
|
||||
<label>
|
||||
<NodeModule nodeName={node.name} nodeType={node.type} isProject={false} />
|
||||
</label>
|
||||
{/if}
|
||||
{#if !node.name.startsWith('.') && !showHidden}
|
||||
<label>
|
||||
<NodeModule nodeName={node.name} nodeType={node.type} isProject={false} />
|
||||
</label>
|
||||
{/if}
|
||||
{/each}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" mt-4">
|
||||
<Construction strokeWidth={1} />
|
||||
<label
|
||||
for="maintenence"
|
||||
class="relative m-2 ml-auto block h-5 w-10 cursor-pointer rounded-full bg-bg-lighter-dark shadow-subtle"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={maintenance}
|
||||
onclick={async () => await setMaintenanceState(Number(!maintenance))}
|
||||
id="maintenence"
|
||||
class=" peer sr-only"
|
||||
/>
|
||||
<span
|
||||
class=" absolute top-0.5 left-0.5 h-4/5 w-2/5 rounded-full bg-bg-dark peer-checked:left-5.5 peer-checked:bg-primary-dark"
|
||||
>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Executable → Regular
@@ -0,0 +1,54 @@
|
||||
<script lang="ts">
|
||||
import { Plus, Search, SquarePen } from '@lucide/svelte';
|
||||
import Button from '../../../modules/Button.svelte';
|
||||
import UsersTable from '../../../modules/panel/users/UsersTable.svelte';
|
||||
|
||||
function log2() {
|
||||
console.log('test');
|
||||
}
|
||||
|
||||
let searchPrompt = $state();
|
||||
|
||||
$inspect(searchPrompt);
|
||||
|
||||
function log(newValue: any) {
|
||||
console.log(newValue);
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- <ContextMenu items={[{ label: 'test123', action: log2 }]} onClose={() => {}}></ContextMenu> -->
|
||||
<div class="mb-4 flex flex-row justify-between">
|
||||
<div
|
||||
class="
|
||||
flex flex-row items-center justify-between
|
||||
overflow-clip rounded-md border border-border
|
||||
bg-surface-1 has-focus:border-focus-ring
|
||||
"
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
class=" w-full px-3 py-2 outline-none placeholder:text-muted"
|
||||
placeholder="Search..."
|
||||
bind:value={searchPrompt}
|
||||
/>
|
||||
<Search strokeWidth={2} size={20} class="mx-3"></Search>
|
||||
</div>
|
||||
<Button class="flex flex-row items-center bg-primary text-text-on-primary">
|
||||
<Plus class="ml-1" size={20}></Plus>
|
||||
<span class="mx-2">Add User</span>
|
||||
</Button>
|
||||
</div>
|
||||
<div style="grid-template-areas: 'a b';" class=" grid-cols-[2fr 1fr] grid size-full shadow-subtle">
|
||||
<div style="grid-area: a;" class=" size-full">
|
||||
<UsersTable></UsersTable>
|
||||
</div>
|
||||
<div style="grid-area: b;" class=" p-4">
|
||||
<div class="bg-bg-dark rounded-2xl">
|
||||
<div class="flex h-full flex-col items-center justify-center">
|
||||
<SquarePen size={128} strokeWidth={1} class="text-gray-800" />
|
||||
<p class="text-2xl font-bold text-gray-800">Nothing here but us chickens...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-full"></div>
|
||||
Reference in New Issue
Block a user