Development
Development Guide
Project Structure
b2-sleeknotify/
βββ client/
β βββ main.lua
β βββ config.lua
βββ server/
β βββ main.lua
βββ ui/
β βββ src/
β β βββ components/
β β β βββ NotificationSystem.jsx
β β βββ App.jsx
β β βββ main.jsx
β βββ public/
β βββ package.json
β βββ vite.config.js
β βββ tailwind.config.js
βββ fxmanifest.luaDevelopment Environment Setup
Prerequisites
Node.js 18 or higher
npm or yarn
Git
Code editor (VS Code recommended)
Initial Setup
Clone the repository:
Install UI dependencies:
Development Server
Start the development server with hot reload:
Building for Production
Create a production build:
UI Development
Tech Stack
React 18
Tailwind CSS
Vite
Lucide Icons
Key Components
NotificationSystem.jsx
The main component handling notifications. Key sections:
Styling Guide
Tailwind Configuration
The project uses Tailwind CSS for styling. Customize tailwind.config.js:
Color System
We use a consistent color system across notification types:
NUI Communication
Sending Messages to Lua
Receiving Messages from Lua
Building Custom Styles
Creating a New Style
Add style option in
config.lua:
Create style component:
Add to style renderer:
Production Build Process
1. Development and Testing
Test changes using the development server.
2. Production Build
This creates optimized files in ui/dist/.
3. Testing the Production Build
Copy the contents of
ui/dist/to your FiveM serverEnsure paths in
fxmanifest.luamatch your build output
4. Debugging
Enable development tools in FiveM:
Use browser dev tools to:
Monitor network requests
Debug React components
Check for console errors
Best Practices
Performance
Use React.memo for pure components
Implement proper cleanup in useEffect
Optimize re-renders with proper state management
Styling
Use Tailwind utility classes
Maintain consistent color schemes
Follow the established naming conventions
Testing
Test all notification types
Verify position handling
Check animation performance
Test with different screen resolutions
Error Handling
Implement proper error boundaries
Handle missing or invalid data gracefully
Provide fallback styles
Common Issues and Solutions
Issue: Notifications not showing
Issue: Styles not applying correctly
Last updated