mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-04 22:21:30 +00:00
feat(nui): Generate resource list from client data
This commit is contained in:
1 parent
110cf81213
commit
4529361e92
1 file changed
+32
-4
@@ -1,13 +1,41 @@
|
|||||||
import { Box, VStack } from '@chakra-ui/react';
|
import { Box, VStack } from '@chakra-ui/react';
|
||||||
|
import { useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { useNuiEvent } from '../../hooks/useNuiEvent';
|
||||||
|
import { debugData } from '../../utils/debugData';
|
||||||
|
|
||||||
|
interface InitData {
|
||||||
|
resources: string[];
|
||||||
|
totalQueries: number;
|
||||||
|
totalTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
const LeftBar: React.FC = () => {
|
const LeftBar: React.FC = () => {
|
||||||
|
debugData([
|
||||||
|
{
|
||||||
|
action: 'init',
|
||||||
|
data: {
|
||||||
|
resources: ['ox_inventory', 'luke_garages', 'es_extended'],
|
||||||
|
totalQueries: 732,
|
||||||
|
totalTime: 258,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const [initData, setInitData] = useState<InitData>({ resources: [''], totalQueries: 0, totalTime: 0 });
|
||||||
|
|
||||||
|
useNuiEvent<InitData>('init', (data) => {
|
||||||
|
setInitData(data);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box p="1.2vh" fontSize="1.5vh" float="left">
|
<Box p="1.2vh" fontSize="1.5vh" float="left" maxWidth="13vh">
|
||||||
<VStack align="left">
|
<VStack align="left">
|
||||||
<Link to="es_extended">es_extended</Link>
|
{initData.resources.map((resource) => (
|
||||||
<Link to="ox_inventory">ox_inventory</Link>
|
<Link to={resource}>
|
||||||
<Link to="luke_garages">luke_garages</Link>
|
<Box _hover={{ transform: 'scale(1.1)' }}>{resource}</Box>
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
</VStack>
|
</VStack>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user