Adding more apps

Requirements:

Installing the dependencies

Go to svelte-source, open your terminal there and type:

pnpm install or npm install or yarn install it depends on what package manager you use

Running the source

To start web development mode, simply use pnpm dev --open or npm run dev or yarn run dev it will automatically open a browser and you will see the laptop in your browser

Adding Apps

You can add more app by using the Apps component.

Step 1.

Create new svelte file inside svelte-source/src/components/apps

Step 2.

Import the Apps component inside your new svelte file

The Apps component need to has this data

explanation

You can define the data like below

Step 3.

Go to utils/initDumyData.ts and add your app inside InitDumyAppData function on data variable

And after that you will see your nice looking new app icon there

Step 4.

After that you must register your app on Desktop.svelte

first, you have to import your NewApp Component into Desktop.svelte, simply import that by doing

import NewApp from "@apps/NewApp.svelte"

after that, search for registeredApp variable, and add your app there.

Save it, and after that you should be able to open your app when clicking the icon

Step 5.

Don't forget to add the app on config.lua inside Config.Apps table:

Using fetchNui

To send a POST request to your backend / your lua side, you can use fetchNui function, you can import it from @utils/eventHandler.ts

Example usage:

Build the svelte source

After you satisfy with your new app you can build your app and use it in game

To build the svelte source simply run this command on your terminal

pnpm build or npm run build or yarn run build

Restart your server, and your pretty good looking, badass unique app will be there πŸ€“

Last updated