Skip to content

Commit

Permalink
feat(nui): Generate resource list from client data
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Dec 31, 2021
1 parent 110cf81 commit 4529361
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions ui/src/components/NavBars/LeftBar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
import { Box, VStack } from '@chakra-ui/react';
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;
}

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 (
<Box p="1.2vh" fontSize="1.5vh" float="left">
<Box p="1.2vh" fontSize="1.5vh" float="left" maxWidth="13vh">
<VStack align="left">
<Link to="es_extended">es_extended</Link>
<Link to="ox_inventory">ox_inventory</Link>
<Link to="luke_garages">luke_garages</Link>
{initData.resources.map((resource) => (
<Link to={resource}>
<Box _hover={{ transform: 'scale(1.1)' }}>{resource}</Box>
</Link>
))}
</VStack>
</Box>
);
Expand Down

0 comments on commit 4529361

Please sign in to comment.