mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 06:28:54 +00:00
refactor(web): change routing libraries and app design
This commit is contained in:
1 parent
e04a43a86c
commit
2a11ded518
11 files changed
+74
-52
No files matched your search
+13
-6
@@ -1,12 +1,19 @@
|
||||
<script lang="ts">
|
||||
import Router from 'svelte-spa-router';
|
||||
import Navbar from './components/Navbar.svelte';
|
||||
import { routes } from './routes';
|
||||
import { Route, router } from 'tinro';
|
||||
import Resource from './pages/resource/Resource.svelte';
|
||||
import Root from './pages/root/Root.svelte';
|
||||
|
||||
router.mode.hash();
|
||||
</script>
|
||||
|
||||
<main class="w-full h-full flex justify-center items-center font-main">
|
||||
<div class="bg-slate-900 text-white w-[1200px] h-[650px] flex rounded-md">
|
||||
<Navbar />
|
||||
<Router {routes} />
|
||||
<div class="bg-slate-900 text-white w-[1000px] h-[600px] flex rounded-md">
|
||||
<!-- <Navbar /> -->
|
||||
<Route path="/">
|
||||
<Root />
|
||||
</Route>
|
||||
<Route path="/:resource">
|
||||
<Resource />
|
||||
</Route>
|
||||
</div>
|
||||
</main>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
export let icon: ConstructorOfATypedSvelteComponent;
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="p-2 flex items-center outline-none focus-within:outline-1 focus-within:outline-cyan-600 rounded-md bg-slate-600"
|
||||
>
|
||||
<div class="pr-2">
|
||||
<svelte:component this={icon} />
|
||||
</div>
|
||||
<input type="text" class="bg-transparent outline-none w-full" />
|
||||
</div>
|
||||
@@ -1,14 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { push, location } from 'svelte-spa-router';
|
||||
|
||||
export let route: string;
|
||||
</script>
|
||||
|
||||
<button
|
||||
on:click={() => push(route)}
|
||||
class="flex flex-col hover:bg-slate-600 w-[50px] h-[50px] justify-center items-center p-3 {$location === route
|
||||
? 'bg-slate-600'
|
||||
: 'bg-slate-700'} rounded-md"
|
||||
>
|
||||
<slot />
|
||||
</button>
|
||||
@@ -1,20 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { IconLayoutDashboard, IconLogout, IconSourceCode } from '@tabler/icons-svelte';
|
||||
import NavLink from './NavLink.svelte';
|
||||
</script>
|
||||
|
||||
<div class="bg-slate-800 w-[80px] h-full rounded-tl-md rounded-bl-md p-4 flex flex-col justify-between items-center">
|
||||
<div class="flex flex-col gap-2">
|
||||
<NavLink route="/">
|
||||
<IconLayoutDashboard />
|
||||
</NavLink>
|
||||
<NavLink route="/resources">
|
||||
<IconSourceCode />
|
||||
</NavLink>
|
||||
</div>
|
||||
<div
|
||||
class="bg-red-500 bg-opacity-30 text-red-500 hover:bg-opacity-40 rounded-md w-[50px] h-[50px] flex justify-center items-center"
|
||||
>
|
||||
<IconLogout />
|
||||
</div>
|
||||
</div>
|
||||
@@ -1 +0,0 @@
|
||||
<h2>Dashboard</h2>
|
||||
@@ -0,0 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { meta } from 'tinro';
|
||||
|
||||
const route = meta();
|
||||
</script>
|
||||
|
||||
<h2>{route.params.resource}</h2>
|
||||
@@ -1 +0,0 @@
|
||||
<h2>Resources</h2>
|
||||
@@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import Input from '../../components/Input.svelte';
|
||||
import { IconSearch } from '@tabler/icons-svelte';
|
||||
import { router } from 'tinro';
|
||||
|
||||
const resources = ['ox_core', 'oxmysql', 'ox_inventory', 'ox_doorlock', 'ox_lib', 'ox_vehicleshop', 'ox_target'];
|
||||
</script>
|
||||
|
||||
<div class="p-4 w-full h-full flex justify-between gap-4">
|
||||
<div class="bg-slate-800 p-4 flex flex-col w-2/3 rounded-md">
|
||||
<p class="text-2xl mb-4">Resources</p>
|
||||
<Input icon={IconSearch} />
|
||||
<div class="flex flex-col gap-3 mt-6">
|
||||
{#each resources as resource}
|
||||
<button
|
||||
on:click={() => router.goto(`/${resource}`)}
|
||||
class="bg-slate-700 p-3 text-left hover:bg-slate-600 rounded-md"
|
||||
>
|
||||
{resource}
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-slate-800 p-4 flex flex-col w-1/3 rounded-md">
|
||||
<p class="text-2xl mb-4">General data</p>
|
||||
<div class="flex flex-col">
|
||||
<p>Queries: 360</p>
|
||||
<p>Time querying: 332 ms</p>
|
||||
<p>Slow queries: 6</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +0,0 @@
|
||||
import Dashboard from './pages/dashboard/Dashboard.svelte';
|
||||
import Resources from './pages/resources/Resources.svelte';
|
||||
import type { RouteDefinition } from 'svelte-spa-router';
|
||||
|
||||
export const routes: RouteDefinition = {
|
||||
'/': Dashboard,
|
||||
|
||||
'/resources': Resources,
|
||||
};
|
||||
Reference in new issue
Block a user