mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 14:38:50 +00:00
refactor(web): visibility handling
This commit is contained in:
1 parent
e06c61d292
commit
fb78adec43
6 files changed
+32
-18
No files matched your search
@@ -31,12 +31,12 @@ jobs:
|
|||||||
- name: Bundle files
|
- name: Bundle files
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ./temp/oxmysql
|
mkdir -p ./temp/oxmysql
|
||||||
mkdir -p ./temp/oxmysql/ui/
|
mkdir -p ./temp/oxmysql/web/
|
||||||
mkdir -p ./temp/oxmysql/lib/
|
mkdir -p ./temp/oxmysql/lib/
|
||||||
cp ./{LICENSE,README.md,fxmanifest.lua,ui.lua} ./temp/oxmysql
|
cp ./{LICENSE,README.md,fxmanifest.lua,ui.lua} ./temp/oxmysql
|
||||||
cp ./lib/{MySQL.lua,define.lua} ./temp/oxmysql/lib
|
cp ./lib/{MySQL.lua,define.lua} ./temp/oxmysql/lib
|
||||||
cp -r ./dist ./temp/oxmysql
|
cp -r ./dist ./temp/oxmysql
|
||||||
cp -r ./ui/build ./temp/oxmysql/ui/
|
cp -r ./web/build ./temp/oxmysql/web/
|
||||||
cd ./temp && zip -r ../oxmysql.zip ./oxmysql
|
cd ./temp && zip -r ../oxmysql.zip ./oxmysql
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ jobs:
|
|||||||
- name: Bundle files
|
- name: Bundle files
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ./temp/oxmysql
|
mkdir -p ./temp/oxmysql
|
||||||
mkdir -p ./temp/oxmysql/ui/
|
mkdir -p ./temp/oxmysql/web/
|
||||||
mkdir -p ./temp/oxmysql/lib/
|
mkdir -p ./temp/oxmysql/lib/
|
||||||
cp ./{LICENSE,README.md,fxmanifest.lua,ui.lua} ./temp/oxmysql
|
cp ./{LICENSE,README.md,fxmanifest.lua,ui.lua} ./temp/oxmysql
|
||||||
cp ./lib/{MySQL.lua,define.lua} ./temp/oxmysql/lib
|
cp ./lib/{MySQL.lua,define.lua} ./temp/oxmysql/lib
|
||||||
cp -r ./dist ./temp/oxmysql
|
cp -r ./dist ./temp/oxmysql
|
||||||
cp -r ./ui/build ./temp/oxmysql/ui/
|
cp -r ./web/build ./temp/oxmysql/web/
|
||||||
cd ./temp && zip -r ../oxmysql.zip ./oxmysql
|
cd ./temp && zip -r ../oxmysql.zip ./oxmysql
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
|
|||||||
+3
-3
@@ -15,11 +15,11 @@ client_script 'ui.lua'
|
|||||||
server_script 'dist/build.js'
|
server_script 'dist/build.js'
|
||||||
|
|
||||||
files {
|
files {
|
||||||
'ui/build/index.html',
|
'web/build/index.html',
|
||||||
'ui/build/**/*'
|
'web/build/**/*'
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_page 'ui/build/index.html'
|
ui_page 'web/build/index.html'
|
||||||
|
|
||||||
provide 'mysql-async'
|
provide 'mysql-async'
|
||||||
provide 'ghmattimysql'
|
provide 'ghmattimysql'
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"packages": ["ui"],
|
"packages": ["web"],
|
||||||
"npmClient": "pnpm",
|
"npmClient": "pnpm",
|
||||||
"version": "0.0.0"
|
"version": "0.0.0"
|
||||||
}
|
}
|
||||||
+22
-10
@@ -5,6 +5,8 @@
|
|||||||
import { useNuiEvent } from './utils/useNuiEvent';
|
import { useNuiEvent } from './utils/useNuiEvent';
|
||||||
import { resources, generalData } from './store';
|
import { resources, generalData } from './store';
|
||||||
import { debugData } from './utils/debugData';
|
import { debugData } from './utils/debugData';
|
||||||
|
import { visible } from './store';
|
||||||
|
import { scale } from 'svelte/transition';
|
||||||
|
|
||||||
interface OpenData {
|
interface OpenData {
|
||||||
resources: string[];
|
resources: string[];
|
||||||
@@ -22,6 +24,7 @@
|
|||||||
router.goto('/');
|
router.goto('/');
|
||||||
|
|
||||||
useNuiEvent('openUI', (data: OpenData) => {
|
useNuiEvent('openUI', (data: OpenData) => {
|
||||||
|
$visible = true;
|
||||||
$resources = data.resources;
|
$resources = data.resources;
|
||||||
$generalData = {
|
$generalData = {
|
||||||
queries: data.totalQueries,
|
queries: data.totalQueries,
|
||||||
@@ -46,15 +49,24 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const handleESC = (e: KeyboardEvent) => e.key === 'Escape' && ($visible = false);
|
||||||
|
|
||||||
|
$: $visible ? window.addEventListener('keydown', handleESC) : window.removeEventListener('keydown', handleESC);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main class="w-full h-full flex justify-center items-center font-main">
|
{#if $visible}
|
||||||
<div class="bg-dark-800 text-white w-[1000px] h-[600px] flex rounded-md">
|
<main
|
||||||
<Route path="/">
|
transition:scale={{ start: 0.95, duration: 150 }}
|
||||||
<Root />
|
class="w-full h-full flex justify-center items-center font-main"
|
||||||
</Route>
|
>
|
||||||
<Route path="/:resource">
|
<div class="bg-dark-800 text-white w-[1000px] h-[600px] flex rounded-md">
|
||||||
<Resource />
|
<Route path="/">
|
||||||
</Route>
|
<Root />
|
||||||
</div>
|
</Route>
|
||||||
</main>
|
<Route path="/:resource">
|
||||||
|
<Resource />
|
||||||
|
</Route>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
{/if}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import { derived, writable } from 'svelte/store';
|
import { derived, writable } from 'svelte/store';
|
||||||
|
|
||||||
|
export const visible = writable(false)
|
||||||
|
|
||||||
export const search = writable('');
|
export const search = writable('');
|
||||||
let timeout: NodeJS.Timeout;
|
let timeout: NodeJS.Timeout;
|
||||||
export const debouncedSearch = derived(search, (value, set: (value: string) => void) => {
|
export const debouncedSearch = derived(search, (value, set: (value: string) => void) => {
|
||||||
|
|||||||
Reference in new issue
Block a user