Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
remove leftover comments and logging
  • Loading branch information
Doubleumc committed Jun 8, 2024
1 parent a4ddcb8 commit 28f50c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 52 deletions.
28 changes: 1 addition & 27 deletions code/modules/admin/game_master/sound_panel.dm
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//GLOBAL_DATUM_INIT(sound_panel, /datum/sound_panel_tgui, new)

/client/proc/open_sound_panel()
set name = "Sound Panel"
//set category = "Admin.Events"
set category = "Game Master"
set category = "Admin.Panels"

if(!check_rights(R_SOUNDS))
return
Expand Down Expand Up @@ -31,7 +28,6 @@
var/target_group

/datum/sound_panel/New(user)
//. = ..()
if(isnull(sound_list)) //first run, init statics
sound_list = get_sounds()

Expand Down Expand Up @@ -67,8 +63,6 @@
var/list/file_paths = list()
for(var/i = 1, i <= length(dirs), i++)
var/path = dirs[i]
//while(length(dirs))
//var/path = popleft(dirs)

var/list/filenames = flist(path)
for(var/filename as anything in filenames)
Expand All @@ -81,14 +75,7 @@

return file_paths

/*
/datum/sound_panel/Destroy(force, ...)
. = ..()
*/

/datum/sound_panel/ui_static_data(mob/user)
//. = ..()

var/list/data = list()

data["sound_list"] = sound_list
Expand Down Expand Up @@ -136,7 +123,6 @@
ui.open()

/datum/sound_panel/proc/InterceptClickOn(mob/user, params, atom/object)
//var/list/modifiers = params2list(params)
if(loc_click_intercept)
var/turf/chosen_loc = get_turf(object)
if(QDELETED(chosen_loc))
Expand All @@ -157,12 +143,6 @@

return TRUE

/*
#define IS_VALID_SOUND(sound) ((sound) in sound_list)
#define IS_VALID_CATEGORY(category) ((category) in category_list)
#define IS_VALID_VOLUME(volume) (ISINRANGE((volume), 0, 100))
*/

/datum/sound_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
Expand Down Expand Up @@ -290,9 +270,3 @@
for(var/mob/target as anything in targets)
playsound_client(target.client, sound_datum, vol = sound_volume, vol_cat = category_lookup[sound_category])
return TRUE

/*
#undef IS_VALID_SOUND
#undef IS_VALID_CATEGORY
#undef IS_VALID_VOLUME
*/
26 changes: 1 addition & 25 deletions tgui/packages/tgui/interfaces/SoundPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Box, Button, Dropdown, Input, Section, Slider, Stack, Tabs } from 'tgui
import { Window } from 'tgui/layouts';
import { Component, Fragment } from 'inferno';
import { debounce } from 'common/timer';
import { logger } from '../logging';

interface SoundPanelData {
sound_list: string[];
Expand Down Expand Up @@ -117,7 +116,6 @@ interface ListSearchBoxEntry {
class ListSearchBox extends Component<ListSearchBoxProps, ListSearchBoxState> {
state: ListSearchBoxState = {
query: '',
// selection: '',
};
handleQueryChange(value: string) {
if (value === this.state.query) {
Expand All @@ -126,12 +124,6 @@ class ListSearchBox extends Component<ListSearchBoxProps, ListSearchBoxState> {
this.setState({
query: value,
});

/*
if (this.state.selection.toLowerCase().includes(value.toLowerCase())) {
return;
}
*/
this.handleSelectionChange('');
}
handleSelectionChange(value: string) {
Expand All @@ -142,18 +134,8 @@ class ListSearchBox extends Component<ListSearchBoxProps, ListSearchBoxState> {
this.handleQueryChange(value);
}, 250);

/*
shouldComponentUpdate(nextState) {
return (
nextState.selection !== this.state.selection ||
nextState.query !== this.state.query
);
}
*/

parsedItems = this.props.items
.map<ListSearchBoxEntry>((item, index) => {
if (index === 0) logger.log('parsing items');
const dirIndex = item.lastIndexOf('/');
const dirName = item.slice(6, dirIndex);
const extIndex = item.lastIndexOf('.');
Expand All @@ -175,14 +157,12 @@ class ListSearchBox extends Component<ListSearchBoxProps, ListSearchBoxState> {
});

render() {
logger.log('in render');
return (
<Fragment>
<Stack.Item grow>
<Section fill scrollable title="File">
{this.parsedItems
.filter((item, index) => {
if (index === 0) logger.log('filtering items');
return item.fileName
.toLowerCase()
.includes(this.state.query.toLowerCase());
Expand All @@ -193,17 +173,14 @@ class ListSearchBox extends Component<ListSearchBoxProps, ListSearchBoxState> {
color="transparent"
content={item.fileName}
fluid
// id={item.id}
key={item.id}
my={0}
onClick={() => this.handleSelectionChange(item.fullPath)}
selected={item.fullPath === this.props.selection}
style={{
animation: 'none',
transition: 'none',
}}
// tabIndex={undefined}
>
}}>
<div
style={{
'font-size': '0.75rem',
Expand Down Expand Up @@ -259,7 +236,6 @@ const SoundOptions = (props, context) => {
}
options={category_list}
selected={sound_category}
// minWidth="90px"
/>
</Stack.Item>
<Stack.Item grow>
Expand Down

0 comments on commit 28f50c8

Please sign in to comment.