refactor(web): visibility handling

This commit is contained in:
Luke committed 2023-03-24 20:56:53 +01:00
1 parent e06c61d292
commit fb78adec43
6 files changed
+24 -10

No files matched your search

+2 -2
View File
@@ -31,12 +31,12 @@ jobs:
- name: Bundle files
run: |
mkdir -p ./temp/oxmysql
mkdir -p ./temp/oxmysql/ui/
mkdir -p ./temp/oxmysql/web/
mkdir -p ./temp/oxmysql/lib/
cp ./{LICENSE,README.md,fxmanifest.lua,ui.lua} ./temp/oxmysql
cp ./lib/{MySQL.lua,define.lua} ./temp/oxmysql/lib
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
- name: Create Release
+2 -2
View File
@@ -66,12 +66,12 @@ jobs:
- name: Bundle files
run: |
mkdir -p ./temp/oxmysql
mkdir -p ./temp/oxmysql/ui/
mkdir -p ./temp/oxmysql/web/
mkdir -p ./temp/oxmysql/lib/
cp ./{LICENSE,README.md,fxmanifest.lua,ui.lua} ./temp/oxmysql
cp ./lib/{MySQL.lua,define.lua} ./temp/oxmysql/lib
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
- name: Create Release
+3 -3
View File
@@ -15,11 +15,11 @@ client_script 'ui.lua'
server_script 'dist/build.js'
files {
'ui/build/index.html',
'ui/build/**/*'
'web/build/index.html',
'web/build/**/*'
}
ui_page 'ui/build/index.html'
ui_page 'web/build/index.html'
provide 'mysql-async'
provide 'ghmattimysql'
+1 -1
View File
@@ -1,5 +1,5 @@
{
"packages": ["ui"],
"packages": ["web"],
"npmClient": "pnpm",
"version": "0.0.0"
}
+14 -2
View File
@@ -5,6 +5,8 @@
import { useNuiEvent } from './utils/useNuiEvent';
import { resources, generalData } from './store';
import { debugData } from './utils/debugData';
import { visible } from './store';
import { scale } from 'svelte/transition';
interface OpenData {
resources: string[];
@@ -22,6 +24,7 @@
router.goto('/');
useNuiEvent('openUI', (data: OpenData) => {
$visible = true;
$resources = data.resources;
$generalData = {
queries: data.totalQueries,
@@ -46,9 +49,17 @@
},
},
]);
const handleESC = (e: KeyboardEvent) => e.key === 'Escape' && ($visible = false);
$: $visible ? window.addEventListener('keydown', handleESC) : window.removeEventListener('keydown', handleESC);
</script>
<main class="w-full h-full flex justify-center items-center font-main">
{#if $visible}
<main
transition:scale={{ start: 0.95, duration: 150 }}
class="w-full h-full flex justify-center items-center font-main"
>
<div class="bg-dark-800 text-white w-[1000px] h-[600px] flex rounded-md">
<Route path="/">
<Root />
@@ -57,4 +68,5 @@
<Resource />
</Route>
</div>
</main>
</main>
{/if}
+2
View File
@@ -1,5 +1,7 @@
import { derived, writable } from 'svelte/store';
export const visible = writable(false)
export const search = writable('');
let timeout: NodeJS.Timeout;
export const debouncedSearch = derived(search, (value, set: (value: string) => void) => {