From f815f8b8e542666d2d5d5397e371c0b43cc5396e Mon Sep 17 00:00:00 2001 From: DreamXZE Date: Tue, 14 Mar 2023 01:13:33 +0100 Subject: [PATCH] Apply link --- .../FightForStyleShowRoomMenu.tsx | 79 +++++++++++-------- .../src/nui/components/Menu/MenuApp.tsx | 5 +- .../server/job/ffs/ffs.showroom.provider.ts | 4 +- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/resources/[soz]/soz-core/src/nui/components/FightForStyle/FightForStyleShowRoomMenu.tsx b/resources/[soz]/soz-core/src/nui/components/FightForStyle/FightForStyleShowRoomMenu.tsx index 8da1c3f5e4..c8dd5205ea 100755 --- a/resources/[soz]/soz-core/src/nui/components/FightForStyle/FightForStyleShowRoomMenu.tsx +++ b/resources/[soz]/soz-core/src/nui/components/FightForStyle/FightForStyleShowRoomMenu.tsx @@ -1,19 +1,20 @@ -import { FunctionComponent, useState, useEffect } from 'react'; -import { MenuType } from '../../../shared/nui/menu'; +import { FunctionComponent, useEffect, useState } from 'react'; + import { FfsComponent, Outfit, Prop } from '../../../shared/cloth'; -import { useNuiEvent } from '../../hook/nui'; import { NuiEvent } from '../../../shared/event'; -import { fetchNui } from '../../fetch'; +import { MenuType } from '../../../shared/nui/menu'; import { isOk, Result } from '../../../shared/result'; +import { fetchNui } from '../../fetch'; +import { useNuiEvent } from '../../hook/nui'; import { MainMenu, Menu, MenuContent, - MenuItemSubMenuLink, + MenuItemButton, MenuItemCheckbox, MenuItemSelect, MenuItemSelectOption, - MenuItemButton, + MenuItemSubMenuLink, MenuTitle, SubMenu, } from '../Styleguide/Menu'; @@ -50,7 +51,7 @@ type FightForStyleShowRoomComponent = { }[]; }; can_craft: boolean; - } + }; }; export interface NuiFFSSubMenuMethodMap { @@ -74,18 +75,20 @@ export interface NuiFFSSubMenuMethodMap { export const FightForStyleShowRoomMenu: FunctionComponent = ({ data }) => { const banner = 'https://nui-img/soz/menu_job_ffs'; const [currentDrawable, setCurrentDrawable] = useState(0); - const [currentCraft, setcurrentCraft] = useState<{ drawables: object, props: object}>(); - const [shouldCraft, setshouldCraft] = useState<{ drawables: object, props: object}>(); + const [currentCraft, setcurrentCraft] = useState<{ drawables: object; props: object }>(); + const [shouldCraft, setshouldCraft] = useState<{ drawables: object; props: object }>(); const [description, setDescription] = useState(); const state = data.state; const can_craft = data.can_craft; useEffect(() => { - fetchNui>(NuiEvent.FfsMenuCraftingPanel).then(result => { - if (isOk(result)) { - setcurrentCraft(result.ok); + fetchNui>(NuiEvent.FfsMenuCraftingPanel).then( + result => { + if (isOk(result)) { + setcurrentCraft(result.ok); + } } - }); + ); }, [currentDrawable]); useNuiEvent( @@ -100,13 +103,9 @@ export const FightForStyleShowRoomMenu: FunctionComponent { - setDescription(data.description) - } - ); + useNuiEvent('ffs_skin_submenu', 'SetClotheDescription', async (data: { description: string }) => { + setDescription(data.description); + }); useNuiEvent('menu', 'Backspace', () => { setCurrentDrawable(0); @@ -186,7 +185,9 @@ export const FightForStyleShowRoomMenu: FunctionComponent 🎩 Autres accessoires - Selection et Confection des tenues + + Selection et Confection des tenues + @@ -215,13 +216,15 @@ export const FightForStyleShowRoomMenu: FunctionComponent ( { + onChange={async value => { await fetchNui(NuiEvent.FfsShowRoomSelectToCraft, { type: 'drawables', index: componentIndex, - value: value - }) - await fetchNui>(NuiEvent.FfsMenuShouldCraftPanel).then(result => { + value: value, + }); + await fetchNui>( + NuiEvent.FfsMenuShouldCraftPanel + ).then(result => { if (isOk(result)) { setshouldCraft(result.ok); } @@ -234,13 +237,15 @@ export const FightForStyleShowRoomMenu: FunctionComponent ( { + onChange={async value => { await fetchNui(NuiEvent.FfsShowRoomSelectToCraft, { type: 'props', index: propIndex, - value: value - }) - await fetchNui>(NuiEvent.FfsMenuShouldCraftPanel).then(result => { + value: value, + }); + await fetchNui>( + NuiEvent.FfsMenuShouldCraftPanel + ).then(result => { if (isOk(result)) { setshouldCraft(result.ok); } @@ -259,7 +264,9 @@ export const FightForStyleShowRoomMenu: FunctionComponent { await fetchNui(NuiEvent.FfsMenuCraftOutfit); }} - >Confectionner la tenue + > + Confectionner la tenue + @@ -300,8 +307,10 @@ export const FightForStyleShowRoomMenu: FunctionComponent - {Array(state.maxOptions.find(option => option.componentIndex === Number(componentIndex)) - ?.maxTextures || 0) + {Array( + state.maxOptions.find(option => option.componentIndex === Number(componentIndex)) + ?.maxTextures || 0 + ) .fill(0) .map((_, index) => ( @@ -349,8 +358,10 @@ export const FightForStyleShowRoomMenu: FunctionComponent - {Array(state.maxOptions.find(option => option.propIndex === Number(propIndex)) - ?.maxTextures || 0) + {Array( + state.maxOptions.find(option => option.propIndex === Number(propIndex))?.maxTextures || + 0 + ) .fill(0) .map((_, index) => ( diff --git a/resources/[soz]/soz-core/src/nui/components/Menu/MenuApp.tsx b/resources/[soz]/soz-core/src/nui/components/Menu/MenuApp.tsx index caf697d2b2..d63f0af2f7 100644 --- a/resources/[soz]/soz-core/src/nui/components/Menu/MenuApp.tsx +++ b/resources/[soz]/soz-core/src/nui/components/Menu/MenuApp.tsx @@ -138,7 +138,10 @@ const MenuRouter: FunctionComponent = () => { } /> } /> } /> - } /> + } + /> } /> } /> } /> diff --git a/resources/[soz]/soz-core/src/server/job/ffs/ffs.showroom.provider.ts b/resources/[soz]/soz-core/src/server/job/ffs/ffs.showroom.provider.ts index 17481eae09..c8bdddb547 100755 --- a/resources/[soz]/soz-core/src/server/job/ffs/ffs.showroom.provider.ts +++ b/resources/[soz]/soz-core/src/server/job/ffs/ffs.showroom.provider.ts @@ -24,10 +24,10 @@ export class FightForStylShowRoomProvider { const player = this.qbcore.getPlayer(source); let cost_mult = 0; - Object.keys(outfit['Components']).forEach(_ => { + Object.keys(outfit['Components']).forEach(() => { cost_mult++; }); - Object.keys(outfit['Props']).forEach(_ => { + Object.keys(outfit['Props']).forEach(() => { cost_mult++; });