mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 14:38:50 +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
+2
-1
@@ -26,6 +26,7 @@
|
||||
"prettier": "^2.8.4",
|
||||
"prettier-plugin-svelte": "^2.9.0",
|
||||
"prettier-plugin-tailwindcss": "^0.2.5",
|
||||
"tailwindcss": "^3.2.7"
|
||||
"tailwindcss": "^3.2.7",
|
||||
"tinro": "^0.6.12"
|
||||
}
|
||||
}
|
||||
Generated
+7
@@ -12,6 +12,7 @@ specifiers:
|
||||
svelte: ^3.55.1
|
||||
svelte-check: ^2.10.3
|
||||
tailwindcss: ^3.2.7
|
||||
tinro: ^0.6.12
|
||||
tslib: ^2.5.0
|
||||
typescript: ^4.9.3
|
||||
vite: ^4.2.0
|
||||
@@ -24,6 +25,7 @@ dependencies:
|
||||
prettier-plugin-svelte: 2.9.0_k23gl6auqwrxgr3e6o2bajswou
|
||||
prettier-plugin-tailwindcss: 0.2.5_yjdjpc7im5hvpskij45owfsns4
|
||||
tailwindcss: 3.2[email protected]
|
||||
tinro: 0.6.12
|
||||
|
||||
devDependencies:
|
||||
'@sveltejs/vite-plugin-svelte': 2.0[email protected][email protected]
|
||||
@@ -1289,6 +1291,11 @@ packages:
|
||||
- ts-node
|
||||
dev: false
|
||||
|
||||
/tinro/0.6.12:
|
||||
resolution:
|
||||
{ integrity: sha512-YYLh0a21GXXpS66ilZbywfXcPTKQQ+bv3tihoqKqSFQP6/F11N7ZmtRbFWcyZXXPFRSzNxmPJBB8ZhP0GkoS0Q== }
|
||||
dev: false
|
||||
|
||||
/to-regex-range/5.0.1:
|
||||
resolution:
|
||||
{ integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== }
|
||||
|
||||
+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