From 79bfc6863bff2e8d4b79303dc66f07d4bd272740 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Thu, 25 Jul 2024 01:58:46 -0400 Subject: [PATCH] Update SoundPanel.tsx convert to the new version --- tgui/packages/tgui/interfaces/SoundPanel.tsx | 99 ++++++++++++-------- 1 file changed, 58 insertions(+), 41 deletions(-) diff --git a/tgui/packages/tgui/interfaces/SoundPanel.tsx b/tgui/packages/tgui/interfaces/SoundPanel.tsx index cee18b9630..899a4be58a 100644 --- a/tgui/packages/tgui/interfaces/SoundPanel.tsx +++ b/tgui/packages/tgui/interfaces/SoundPanel.tsx @@ -1,8 +1,17 @@ -import { useBackend, useLocalState } from 'tgui/backend'; -import { Box, Button, Dropdown, Input, Section, Slider, Stack, Tabs } from 'tgui/components'; -import { Window } from 'tgui/layouts'; -import { Component } from 'react'; import { debounce } from 'common/timer'; +import { Component, useState } from 'react'; +import { useBackend } from 'tgui/backend'; +import { + Box, + Button, + Dropdown, + Input, + Section, + Slider, + Stack, + Tabs, +} from 'tgui/components'; +import { Window } from 'tgui/layouts'; interface SoundPanelData { sound_list: string[]; @@ -10,7 +19,7 @@ interface SoundPanelData { zlevel_list: string[]; group_list: string[]; sound_path: string; - sound_category: number; + sound_category: string; sound_volume: number; sound_pitch: number; sound_duration: number; @@ -44,9 +53,8 @@ export const SoundPanel = () => { component: , }, ]; - const [tabIndex, setTabIndex] = useLocalState( - 'tabIndex', - PAGES.findIndex((page) => page.title === 'Local') + const [tabIndex, setTabIndex] = useState( + PAGES.findIndex((page) => page.title === 'Local'), ); return ( @@ -77,7 +85,8 @@ export const SoundPanel = () => { setTabIndex(i)}> + onClick={() => setTabIndex(i)} + > {page.title} ); @@ -170,7 +179,6 @@ class ListSearchBox extends Component { return ( @@ -229,12 +240,13 @@ const SoundOptions = () => { Category act('set_sound_category', { sound_category: value }) } options={category_list} selected={sound_category} + menuWidth="100px" + width="100px" /> @@ -294,16 +306,15 @@ const SoundOptions = () => { - @@ -319,7 +330,7 @@ const ClientPage = () => { return ( - {target_player_desc || 'N/A'} @@ -328,9 +339,10 @@ const ClientPage = () => { ); @@ -347,17 +359,19 @@ const LocalPage = () => { act('toggle_loc_click_play')} - /> + > + Play on Click + @@ -368,9 +382,10 @@ const LocalPage = () => { ); @@ -389,8 +404,8 @@ const ZLevelPage = () => { onSelected={(value) => act('set_target_zlevel', { target_zlevel: value }) } + menuWidth="180px" width="180px" - noscroll over /> @@ -398,9 +413,10 @@ const ZLevelPage = () => { ); @@ -419,8 +435,8 @@ const ServerPage = () => { onSelected={(value) => act('set_target_group', { target_group: value }) } + menuWidth="80px" width="80px" - noscroll over /> @@ -428,9 +444,10 @@ const ServerPage = () => { );