mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-01 22:21:51 +00:00
feat(nui): RightBar data fetching
This commit is contained in:
1 parent
ae121fd01c
commit
1ecb93801a
3 files changed
+17
-10
No files matched your search
@@ -3,12 +3,7 @@ import { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
||||
import { debugData } from '../../utils/debugData';
|
||||
|
||||
interface InitData {
|
||||
resources: string[];
|
||||
totalQueries: number;
|
||||
totalTime: number;
|
||||
}
|
||||
import type { InitData } from '../../types';
|
||||
|
||||
const LeftBar: React.FC = () => {
|
||||
debugData([
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
import React from 'react';
|
||||
import { useState } from 'react';
|
||||
import { Box, VStack, Center } from '@chakra-ui/react';
|
||||
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
||||
import type { InitData } from '../../types';
|
||||
|
||||
const RightBar: React.FC = () => {
|
||||
const [initData, setInitData] = useState<InitData>({ totalQueries: 0, totalTime: 0, resources: [''] });
|
||||
|
||||
// Debug data defined in LeftBar.tsx
|
||||
|
||||
useNuiEvent<InitData>('init', (data) => setInitData(data));
|
||||
|
||||
return (
|
||||
<Box float="right" w="20%" h="max" p="1.2vh">
|
||||
<Center>
|
||||
<VStack align="left">
|
||||
<Box>Number of slow queries: 3</Box>
|
||||
<Box>Most active resource: essentialmode</Box>
|
||||
<Box>Total number of queries: 732</Box>
|
||||
<Box>Total number of queries: {initData.totalQueries}</Box>
|
||||
<Box>Total amount of time querying: {initData.totalTime}</Box>
|
||||
</VStack>
|
||||
</Center>
|
||||
</Box>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export type InitData = {
|
||||
resources: string[];
|
||||
totalQueries: number;
|
||||
totalTime: number;
|
||||
}
|
||||
Reference in new issue
Block a user