Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream #209

Merged
merged 48 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ca2ff33
Rocky DLXIII: Fitness to Athletics, Athletics skill influences Boxing…
necromanceranne Apr 22, 2024
bb74bd4
Automatic changelog for PR #82611 [ci skip]
comfyorange Apr 22, 2024
9135b0c
Cargo ui refactor -> TS (#82745)
jlsnow301 Apr 22, 2024
9506120
Automatic changelog for PR #82745 [ci skip]
comfyorange Apr 22, 2024
c165c05
Makes lavaland stone tiles prevent immersion (#82807)
FlufflesTheDog Apr 22, 2024
8ca3064
Automatic changelog for PR #82807 [ci skip]
comfyorange Apr 22, 2024
72ba08c
Getting up from prone, z movement, and mod de/activation don't do cog…
MrMelbert Apr 22, 2024
88813ff
Automatic changelog for PR #82794 [ci skip]
comfyorange Apr 22, 2024
2569062
[NO GBP]Inversely scale mechanical favor with STANDARD_CELL_CHARGE. (…
Pickle-Coding Apr 22, 2024
474d870
Automatic changelog for PR #82801 [ci skip]
comfyorange Apr 22, 2024
176253c
Automatic changelog compile [ci skip]
actions-user Apr 23, 2024
b218130
Converts ListInputModal to actually be a Modal | Adds ListInputWindow…
ZephyrTFA Apr 23, 2024
15fe19c
Fix all types of damage to the head causing brain damage (#82763)
MrMelbert Apr 23, 2024
80493d2
Automatic changelog for PR #82763 [ci skip]
comfyorange Apr 23, 2024
af8d69f
Higher capacity SMES variant for low maintenance areas; miners can ac…
necromanceranne Apr 23, 2024
da0bd77
Automatic changelog for PR #82713 [ci skip]
comfyorange Apr 23, 2024
630fb72
New views for mc controller ui (#82769)
jlsnow301 Apr 23, 2024
c845546
Automatic changelog for PR #82769 [ci skip]
comfyorange Apr 23, 2024
9acf5bd
Revert "Converts ListInputModal to actually be a Modal | Adds ListInp…
MrsTonedOne Apr 23, 2024
02d949b
[no gbp] Fixes cargo express console (#82843)
jlsnow301 Apr 23, 2024
2262054
Automatic changelog for PR #82843 [ci skip]
comfyorange Apr 23, 2024
7d02f4b
Plumbing & chem reaction chamber patches (#82781)
SyncIt21 Apr 23, 2024
1f862ae
Automatic changelog for PR #82781 [ci skip]
comfyorange Apr 23, 2024
f27d660
fixes brimdemon AI (and some other mobs) (#82831)
Ben10Omintrix Apr 23, 2024
2a4ab67
Automatic changelog for PR #82831 [ci skip]
comfyorange Apr 23, 2024
98153ad
Adds an achievement for pushing a boulder up a hill (#82813)
Jacquerel Apr 23, 2024
c1a775e
Implements data systems (#82816)
jlsnow301 Apr 23, 2024
76d3329
Automatic changelog for PR #82813 [ci skip]
comfyorange Apr 23, 2024
9e7aeca
[no gbp] express console: Bluescreen on cart (#82844)
jlsnow301 Apr 23, 2024
b5fa92d
Adds Medieval Pirates (and small assault_pod change) (#82392)
uaioy Apr 23, 2024
d4f5cba
Automatic changelog for PR #82392 [ci skip]
comfyorange Apr 23, 2024
373557f
Fix playing card memory (#82834)
MrMelbert Apr 23, 2024
0a4f57f
Automatic changelog for PR #82834 [ci skip]
comfyorange Apr 23, 2024
c80622a
Fixes all emotes being "audible", adds support for runechat only emot…
MrMelbert Apr 23, 2024
b1e691c
Automatic changelog for PR #82832 [ci skip]
comfyorange Apr 23, 2024
aab7771
Tuberculosis makes you cough more, Nicotine Withdrawal makes you coug…
MrMelbert Apr 23, 2024
b4d41e1
Automatic changelog for PR #82827 [ci skip]
comfyorange Apr 23, 2024
e97e7bf
Fake handcuffs no longer apply click cooldown on resist (#82828)
Rhials Apr 23, 2024
1d7e389
Automatic changelog for PR #82828 [ci skip]
comfyorange Apr 23, 2024
b6fce8f
Automatic changelog compile [ci skip]
actions-user Apr 24, 2024
6b018aa
Removes the stun from longfall modules activating. (#82824)
necromanceranne Apr 24, 2024
93e62dc
Automatic changelog for PR #82824 [ci skip]
comfyorange Apr 24, 2024
43c85ee
Adds sorting options and a search bar to the crew monitor (#82732)
Momo8289 Apr 24, 2024
696b795
Automatic changelog for PR #82732 [ci skip]
comfyorange Apr 24, 2024
0cb9aa8
Accessing Datasystem Manager from MC controller panel (#82848)
EvilDragonfiend Apr 24, 2024
59a20eb
Fixes some rando failures off the ignore list of projectiles (#82855)
LemonInTheDark Apr 24, 2024
2e11db2
[NO GBP] fixes issues with human rendering fixes (#82852)
Fikou Apr 24, 2024
c7ea5cd
Automatic changelog for PR #82852 [ci skip]
comfyorange Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Converts ListInputModal to actually be a Modal | Adds ListInp…
…utWindow which uses it" (tgstation#82841)

Reverts tgstation#82792
MrsTonedOne authored Apr 23, 2024
commit 9acf5bd821b37e4d8dad1c850497eeef79c0e7d8
2 changes: 1 addition & 1 deletion code/modules/tgui_input/list.dm
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@
/datum/tgui_list_input/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "ListInputWindow")
ui = new(user, src, "ListInputModal")
ui.open()

/datum/tgui_list_input/ui_close(mob/user)
Original file line number Diff line number Diff line change
@@ -7,26 +7,35 @@ import {
KEY_ESCAPE,
KEY_UP,
KEY_Z,
} from '../../../common/keycodes';
import { useBackend } from '../../backend';
import { Autofocus, Button, Input, Section, Stack } from '../../components';
import { InputButtons } from '../common/InputButtons';
} from '../../common/keycodes';
import { useBackend } from '../backend';
import { Autofocus, Button, Input, Section, Stack } from '../components';
import { Window } from '../layouts';
import { InputButtons } from './common/InputButtons';
import { Loader } from './common/Loader';

type ListInputModalProps = {
type ListInputData = {
init_value: string;
items: string[];
default_item: string;
large_buttons: boolean;
message: string;
on_selected: (entry: string) => void;
on_cancel: () => void;
timeout: number;
title: string;
};

export const ListInputModal = (props: ListInputModalProps) => {
const { items = [], default_item, message, on_selected, on_cancel } = props;

const [selected, setSelected] = useState(items.indexOf(default_item));
export const ListInputModal = (props) => {
const { act, data } = useBackend<ListInputData>();
const {
items = [],
message = '',
init_value,
large_buttons,
timeout,
title,
} = data;
const [selected, setSelected] = useState(items.indexOf(init_value));
const [searchBarVisible, setSearchBarVisible] = useState(items.length > 9);
const [searchQuery, setSearchQuery] = useState('');

// User presses up or down on keyboard
// Simulates clicking an item
const onArrowKey = (key: number) => {
@@ -90,77 +99,82 @@ export const ListInputModal = (props: ListInputModalProps) => {
const filteredItems = items.filter((item) =>
item?.toLowerCase().includes(searchQuery.toLowerCase()),
);
// Dynamically changes the window height based on the message.
const windowHeight =
325 + Math.ceil(message.length / 3) + (large_buttons ? 5 : 0);
// Grabs the cursor when no search bar is visible.
if (!searchBarVisible) {
setTimeout(() => document!.getElementById(selected.toString())?.focus(), 1);
}

return (
<Section
onKeyDown={(event) => {
const keyCode = window.event ? event.which : event.keyCode;
if (keyCode === KEY_DOWN || keyCode === KEY_UP) {
event.preventDefault();
onArrowKey(keyCode);
}
if (keyCode === KEY_ENTER) {
event.preventDefault();
on_selected(filteredItems[selected]);
}
if (!searchBarVisible && keyCode >= KEY_A && keyCode <= KEY_Z) {
event.preventDefault();
onLetterSearch(keyCode);
}
if (keyCode === KEY_ESCAPE) {
event.preventDefault();
on_cancel();
}
}}
buttons={
<Button
compact
icon={searchBarVisible ? 'search' : 'font'}
selected
tooltip={
searchBarVisible
? 'Search Mode. Type to search or use arrow keys to select manually.'
: 'Hotkey Mode. Type a letter to jump to the first match. Enter to select.'
<Window title={title} width={325} height={windowHeight}>
{timeout && <Loader value={timeout} />}
<Window.Content
onKeyDown={(event) => {
const keyCode = window.event ? event.which : event.keyCode;
if (keyCode === KEY_DOWN || keyCode === KEY_UP) {
event.preventDefault();
onArrowKey(keyCode);
}
tooltipPosition="left"
onClick={() => onSearchBarToggle()}
/>
}
className="ListInput__Section"
fill
title={message}
>
<Stack fill vertical>
<Stack.Item grow>
<ListDisplay
filteredItems={filteredItems}
onClick={onClick}
onFocusSearch={onFocusSearch}
searchBarVisible={searchBarVisible}
selected={selected}
/>
</Stack.Item>
{searchBarVisible && (
<SearchBar
filteredItems={filteredItems}
onSearch={onSearch}
searchQuery={searchQuery}
selected={selected}
/>
)}
<Stack.Item>
<InputButtons
input={filteredItems[selected]}
on_submit={() => on_selected(filteredItems[selected])}
on_cancel={on_cancel}
/>
</Stack.Item>
</Stack>
</Section>
if (keyCode === KEY_ENTER) {
event.preventDefault();
act('submit', { entry: filteredItems[selected] });
}
if (!searchBarVisible && keyCode >= KEY_A && keyCode <= KEY_Z) {
event.preventDefault();
onLetterSearch(keyCode);
}
if (keyCode === KEY_ESCAPE) {
event.preventDefault();
act('cancel');
}
}}
>
<Section
buttons={
<Button
compact
icon={searchBarVisible ? 'search' : 'font'}
selected
tooltip={
searchBarVisible
? 'Search Mode. Type to search or use arrow keys to select manually.'
: 'Hotkey Mode. Type a letter to jump to the first match. Enter to select.'
}
tooltipPosition="left"
onClick={() => onSearchBarToggle()}
/>
}
className="ListInput__Section"
fill
title={message}
>
<Stack fill vertical>
<Stack.Item grow>
<ListDisplay
filteredItems={filteredItems}
onClick={onClick}
onFocusSearch={onFocusSearch}
searchBarVisible={searchBarVisible}
selected={selected}
/>
</Stack.Item>
{searchBarVisible && (
<SearchBar
filteredItems={filteredItems}
onSearch={onSearch}
searchQuery={searchQuery}
selected={selected}
/>
)}
<Stack.Item>
<InputButtons input={filteredItems[selected]} />
</Stack.Item>
</Stack>
</Section>
</Window.Content>
</Window>
);
};

@@ -169,7 +183,7 @@ export const ListInputModal = (props: ListInputModalProps) => {
* If a search query is provided, filters the items.
*/
const ListDisplay = (props) => {
const { act } = useBackend();
const { act } = useBackend<ListInputData>();
const { filteredItems, onClick, onFocusSearch, searchBarVisible, selected } =
props;

@@ -213,7 +227,7 @@ const ListDisplay = (props) => {
* Closing the bar defaults input to an empty string.
*/
const SearchBar = (props) => {
const { act } = useBackend();
const { act } = useBackend<ListInputData>();
const { filteredItems, onSearch, searchQuery, selected } = props;

return (
44 changes: 0 additions & 44 deletions tgui/packages/tgui/interfaces/ListInputWindow/index.tsx

This file was deleted.

23 changes: 3 additions & 20 deletions tgui/packages/tgui/interfaces/common/InputButtons.tsx
Original file line number Diff line number Diff line change
@@ -8,36 +8,19 @@ type InputButtonsData = {

type InputButtonsProps = {
input: string | number | string[];
on_submit?: () => void;
on_cancel?: () => void;
message?: string;
};

export const InputButtons = (props: InputButtonsProps) => {
const { act, data } = useBackend<InputButtonsData>();
const { large_buttons, swapped_buttons } = data;
const { input, message, on_submit, on_cancel } = props;

let on_submit_actual = on_submit;
if (!on_submit_actual) {
on_submit_actual = () => {
act('submit', { entry: input });
};
}

let on_cancel_actual = on_cancel;
if (!on_cancel_actual) {
on_cancel_actual = () => {
act('cancel');
};
}

const { input, message } = props;
const submitButton = (
<Button
color="good"
fluid={!!large_buttons}
height={!!large_buttons && 2}
onClick={on_submit_actual}
onClick={() => act('submit', { entry: input })}
m={0.5}
pl={2}
pr={2}
@@ -54,7 +37,7 @@ export const InputButtons = (props: InputButtonsProps) => {
color="bad"
fluid={!!large_buttons}
height={!!large_buttons && 2}
onClick={on_cancel_actual}
onClick={() => act('cancel')}
m={0.5}
pl={2}
pr={2}