├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── ci.yml │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── client ├── enums.lua ├── hud.lua ├── main.lua ├── progress.lua ├── prompt.lua ├── settings.lua ├── test.lua ├── toast.lua └── utils.lua ├── config.json ├── fxmanifest.lua ├── package.json ├── update └── main.js ├── web ├── .gitignore ├── .prettierrc ├── README.md ├── craco.config.js ├── package.json ├── public │ ├── assets │ │ └── img │ │ │ └── p.png │ └── index.html ├── src │ ├── components │ │ ├── MainWrapper.tsx │ │ ├── crosshair │ │ │ └── CrosshairManager.tsx │ │ ├── misc │ │ │ ├── CinematicBars.tsx │ │ │ ├── ScreenshotModeManager.tsx │ │ │ └── TextPrompt.tsx │ │ ├── player │ │ │ ├── ArmorCircle.tsx │ │ │ ├── CircleHudWrapper.tsx │ │ │ ├── CircleItem.tsx │ │ │ ├── GenericCircleItem.tsx │ │ │ ├── HealthCircle.tsx │ │ │ └── VoiceCircle.tsx │ │ └── progress │ │ │ └── ProgressBarWrapper.tsx │ ├── config │ │ └── defaultSettings.ts │ ├── features │ │ └── settings │ │ │ ├── components │ │ │ ├── SettingButton.tsx │ │ │ ├── SettingColorPicker.tsx │ │ │ ├── SettingDropdown.tsx │ │ │ ├── SettingInput.tsx │ │ │ ├── SettingSwitch.tsx │ │ │ ├── SettingsModal.tsx │ │ │ └── SettingsSlider.tsx │ │ │ └── pages │ │ │ ├── AdditionalSettings.tsx │ │ │ ├── PerformanceSettings.tsx │ │ │ └── VisualSettings.tsx │ ├── hooks │ │ ├── useExitListener.ts │ │ ├── useHudListener.ts │ │ ├── useHudReady.ts │ │ ├── useKey.ts │ │ └── useNuiEvent.ts │ ├── index.css │ ├── index.tsx │ ├── providers │ │ ├── AlertDialogProvider.tsx │ │ ├── TextPromptProvider.tsx │ │ └── ToastProvider.tsx │ ├── react-app-env.d.ts │ ├── setupTests.ts │ ├── state │ │ ├── base.state.ts │ │ ├── hud.state.ts │ │ └── settings.state.ts │ ├── styles │ │ └── theme.ts │ ├── types │ │ ├── prompt.types.ts │ │ └── settings.types.ts │ └── utils │ │ ├── DebugObserver.ts │ │ ├── debugData.ts │ │ ├── fetchNui.ts │ │ ├── misc.ts │ │ ├── registerBrowserFuncs.ts │ │ └── setClipboard.ts ├── tsconfig.json └── yarn.lock └── yarn.lock /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a bug report to help solve an issue 4 | title: 'Bug: TITLE' 5 | labels: New Issue 6 | assignees: '' 7 | --- 8 | 9 | **Describe the issue** 10 | 11 | A clear and concise description of what the bug is. 12 | 13 | **Expected behavior** 14 | 15 | A clear and concise description of what you expected to happen. 16 | 17 | **To Reproduce** 18 | 19 | Steps to reproduce the behavior: 20 | 1. Go to '...' 21 | 2. Click on '....' 22 | 3. Scroll down to '....' 23 | 4. See error 24 | 25 | 26 | **Media** 27 | 28 | If applicable, add a screenshot or a video to help explain your problem. 29 | 30 | **Needed information (please complete the following information):** 31 | - **Client Version:**: [e.g. Canary or Release] 32 | - **Template Version**: [e.g. 3486] Don't know?~~Check the version in your package.json~~ 33 | 34 | **Additional context** 35 | Add any other context about the issue here. 36 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Main CI 2 | on: [push, pull_request] 3 | jobs: 4 | build: 5 | name: Build Test 6 | runs-on: ubuntu-latest 7 | defaults: 8 | run: 9 | working-directory: web 10 | 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v2 14 | - name: Setup node environment 15 | uses: actions/setup-node@v2 16 | with: 17 | node-version: 14.x 18 | - name: Get yarn cache directory path 19 | id: yarn-cache-dir-path 20 | run: echo "::set-output name=dir::$(yarn config get cacheFolder)" 21 | - uses: actions/cache@v2 22 | id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) 23 | with: 24 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} 25 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 26 | restore-keys: | 27 | ${{ runner.os }}-yarn- 28 | - name: Install deps 29 | run: yarn --frozen-lockfile 30 | - name: Try build 31 | run: yarn build 32 | 33 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Tagged Release 2 | on: 3 | push: 4 | tags: 5 | - "v*" 6 | jobs: 7 | create-tagged-release: 8 | name: Create Release 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout source 12 | uses: actions/checkout@v2 13 | with: 14 | fetch-depth: 0 15 | ref: ${{ github.ref }} 16 | - name: Get tag 17 | run: echo ::set-output name=VERSION_TAG::${GITHUB_REF/refs\/tags\//} 18 | id: get_tag 19 | - name: 'Setup Node.js' 20 | uses: 'actions/setup-node@v1' 21 | with: 22 | node-version: 14.x 23 | - name: Create release 24 | uses: marvinpinto/action-automatic-releases@latest 25 | with: 26 | title: React/Lua Boilerplate - ${{ steps.get_tag.outputs.VERSION_TAG }} 27 | repo_token: ${{ secrets.GITHUB_TOKEN }} 28 | prerelease: false 29 | id: auto_release 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | .yarn.installed 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 Project Error 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 18 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 19 | OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
{state}
124 |(events: DebugEvent
[], timer = 500): void => {
16 | if (process.env.NODE_ENV === 'development' && isEnvBrowser()) {
17 | for (const event of events) {
18 | setTimeout(() => {
19 | window.dispatchEvent(
20 | new MessageEvent('message', {
21 | data: {
22 | action: event.action,
23 | data: event.data,
24 | },
25 | })
26 | );
27 | }, timer);
28 | }
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/web/src/utils/fetchNui.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Simple wrapper around fetch API tailored for CEF/NUI use. This abstraction
3 | * can be extended to include AbortController if needed or if the response isn't
4 | * JSON. Tailor it to your needs.
5 | *
6 | * @param eventName - The endpoint eventname to target
7 | * @param data - Data you wish to send in the NUI Callback
8 | *
9 | * @return returnData - A promise for the data sent back by the NuiCallbacks CB argument
10 | */
11 | import { isEnvBrowser } from './misc';
12 |
13 | export async function fetchNui