From 9d2203a447a6b7677635e414906123db06630ea7 Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:20:50 -0700 Subject: [PATCH] [MIRROR] Tgui ui fix (#7815) Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> --- code/game/machinery/air_alarm.dm | 2 +- code/game/machinery/biogenerator.dm | 26 +- .../machinery/casino_prize_dispenser_ch.dm | 2 +- .../eventkit/gm_interfaces/mob_spawner.dm | 55 +- code/modules/nifsoft/nif_tgui.dm | 1 + .../tgui-panel/settings/SettingsPanel.jsx | 2 + .../tgui/interfaces/AccountsTerminal.jsx | 18 +- tgui/packages/tgui/interfaces/AirAlarm.jsx | 33 +- tgui/packages/tgui/interfaces/Autolathe.jsx | 1 + .../packages/tgui/interfaces/Biogenerator.jsx | 68 +- .../tgui/interfaces/CameraConsole.jsx | 32 +- .../tgui/interfaces/CasinoPrizeDispenser.jsx | 75 +- .../packages/tgui/interfaces/Communicator.tsx | 1600 ++++++++--------- tgui/packages/tgui/interfaces/CrewMonitor.jsx | 43 +- tgui/packages/tgui/interfaces/DNAModifier.jsx | 28 +- .../tgui/interfaces/ExosuitFabricator.jsx | 1 + .../tgui/interfaces/MessageMonitor.jsx | 2 +- .../packages/tgui/interfaces/MiningVendor.jsx | 65 +- tgui/packages/tgui/interfaces/MobSpawner.tsx | 224 ++- tgui/packages/tgui/interfaces/NIF.jsx | 68 +- .../tgui/interfaces/NtosNetDownloader.jsx | 4 +- tgui/packages/tgui/interfaces/OvermapFull.tsx | 5 +- tgui/packages/tgui/interfaces/Pda.jsx | 18 +- .../tgui/interfaces/PipeDispenser.jsx | 6 +- .../tgui/interfaces/RapidPipeDispenser.jsx | 5 +- .../tgui/interfaces/ResearchConsole.jsx | 141 +- tgui/packages/tgui/interfaces/SecureSafe.jsx | 10 +- tgui/packages/tgui/interfaces/SuitCycler.jsx | 43 +- tgui/packages/tgui/interfaces/Uplink.jsx | 4 +- tgui/packages/tgui/interfaces/VorePanel.jsx | 7 +- .../common/InterfaceLockNoticeBox.jsx | 21 +- 31 files changed, 1411 insertions(+), 1199 deletions(-) diff --git a/code/game/machinery/air_alarm.dm b/code/game/machinery/air_alarm.dm index ce718c9c81..5c38eace6f 100644 --- a/code/game/machinery/air_alarm.dm +++ b/code/game/machinery/air_alarm.dm @@ -748,7 +748,7 @@ var/env = params["env"] var/name = params["var"] - var/value = tgui_input_number(usr, "New [name] for [env]:", name, TLV[env][name], round_value = FALSE) + var/value = tgui_input_number(usr, "New [name] for [env]:", name, TLV[env][name], min_value=-1, round_value = FALSE) if(!isnull(value) && !..()) if(value < 0) TLV[env][name] = -1 diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm index 763564fcf9..215b2051fa 100644 --- a/code/game/machinery/biogenerator.dm +++ b/code/game/machinery/biogenerator.dm @@ -64,26 +64,26 @@ item_list = list() item_list["Food Items"] = list( - BIOGEN_REAGENT("10 milk", "milk", 10, 20), - BIOGEN_REAGENT("50 milk", "milk", 50, 95), - BIOGEN_REAGENT("10 Cream", "cream", 10, 30), - BIOGEN_REAGENT("50 Cream", "cream", 50, 120), + BIOGEN_REAGENT("Milk x10", "milk", 10, 20), + BIOGEN_REAGENT("Milk x50", "milk", 50, 95), + BIOGEN_REAGENT("Cream x10", "cream", 10, 30), + BIOGEN_REAGENT("Cream x50", "cream", 50, 120), BIOGEN_ITEM("Slab of meat", /obj/item/weapon/reagent_containers/food/snacks/meat, 1, 50), - BIOGEN_ITEM("5 slabs of meat", /obj/item/weapon/reagent_containers/food/snacks/meat, 5, 250), + BIOGEN_ITEM("Slabs of meat x5", /obj/item/weapon/reagent_containers/food/snacks/meat, 5, 250), ) item_list["Cooking Ingredients"] = list( - BIOGEN_REAGENT("10 Universal Enzyme", "enzyme", 10, 30), - BIOGEN_REAGENT("50 Universal Enzyme", "enzyme", 50, 120), + BIOGEN_REAGENT("Universal Enzyme x10", "enzyme", 10, 30), + BIOGEN_REAGENT("Universal Enzyme x50", "enzyme", 50, 120), BIOGEN_ITEM("Nutri-spread", /obj/item/weapon/reagent_containers/food/snacks/spreads, 1, 30), - BIOGEN_ITEM("5 nutri-spread", /obj/item/weapon/reagent_containers/food/snacks/spreads, 5, 120), + BIOGEN_ITEM("Nutri-spread x5", /obj/item/weapon/reagent_containers/food/snacks/spreads, 5, 120), ) item_list["Gardening Nutrients"] = list( BIOGEN_ITEM("E-Z-Nutrient", /obj/item/weapon/reagent_containers/glass/bottle/eznutrient, 1, 60), - BIOGEN_ITEM("5 E-Z-Nutrient", /obj/item/weapon/reagent_containers/glass/bottle/eznutrient, 5, 300), + BIOGEN_ITEM("E-Z-Nutrient x5", /obj/item/weapon/reagent_containers/glass/bottle/eznutrient, 5, 300), BIOGEN_ITEM("Left 4 Zed", /obj/item/weapon/reagent_containers/glass/bottle/left4zed, 1, 120), - BIOGEN_ITEM("5 Left 4 Zed", /obj/item/weapon/reagent_containers/glass/bottle/left4zed, 5, 600), + BIOGEN_ITEM("Left 4 Zed x5", /obj/item/weapon/reagent_containers/glass/bottle/left4zed, 5, 600), BIOGEN_ITEM("Robust Harvest", /obj/item/weapon/reagent_containers/glass/bottle/robustharvest, 1, 150), - BIOGEN_ITEM("5 Robust Harvest", /obj/item/weapon/reagent_containers/glass/bottle/robustharvest, 5, 750), + BIOGEN_ITEM("Robust Harvest x5", /obj/item/weapon/reagent_containers/glass/bottle/robustharvest, 5, 750), ) item_list["Leather Products"] = list( BIOGEN_ITEM("Wallet", /obj/item/weapon/storage/wallet, 1, 100), @@ -100,8 +100,8 @@ BIOGEN_ITEM("Leather Jacket", /obj/item/clothing/suit/storage/toggle/brown_jacket, 1, 500), BIOGEN_ITEM("Winter Coat", /obj/item/clothing/suit/storage/hooded/wintercoat, 1, 500), //VOREStation Edit - Algae for oxygen generator - BIOGEN_ITEM("4 Algae Sheets", /obj/item/stack/material/algae, 4, 400), - BIOGEN_ITEM("50 Algae Sheets", /obj/item/stack/material/algae, 50, 5000), + BIOGEN_ITEM("Algae Sheets x4", /obj/item/stack/material/algae, 4, 400), + BIOGEN_ITEM("Algae Sheets x50", /obj/item/stack/material/algae, 50, 5000), ) /obj/machinery/biogenerator/tgui_static_data(mob/user) diff --git a/code/game/machinery/casino_prize_dispenser_ch.dm b/code/game/machinery/casino_prize_dispenser_ch.dm index 2cb7cb66ca..b4cbf39690 100644 --- a/code/game/machinery/casino_prize_dispenser_ch.dm +++ b/code/game/machinery/casino_prize_dispenser_ch.dm @@ -292,7 +292,7 @@ // Open the window ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "CasinoPrizeDispenserCh", name) + ui = new(user, src, "CasinoPrizeDispenser", name) ui.open() /obj/machinery/casino_prize_dispenser/tgui_act(action, params) diff --git a/code/modules/eventkit/gm_interfaces/mob_spawner.dm b/code/modules/eventkit/gm_interfaces/mob_spawner.dm index a829cc3221..19efc7ccfc 100644 --- a/code/modules/eventkit/gm_interfaces/mob_spawner.dm +++ b/code/modules/eventkit/gm_interfaces/mob_spawner.dm @@ -47,37 +47,36 @@ data["loc_y"] = usr.y data["loc_z"] = usr.z - data["path"] = path; data["use_custom_ai"] = use_custom_ai + if(new_path) + data["path"] = path; + if(path) + var/mob/M = new path() + if(M) + data["path_name"] = M.name + data["desc"] = M.desc + data["flavor_text"] = M.flavor_text + if(istype(M, /mob/living)) + var/mob/living/L = M + // AI Stuff + ai_type = (L.ai_holder_type ? L.ai_holder_type : /datum/ai_holder/simple_mob/inert) + faction = (L.faction ? L.faction : "neutral") + intent = (L.a_intent ? L.a_intent : I_HELP) + new_path = FALSE - if(path) - var/mob/M = new path() - if(M) - data["default_path_name"] = M.name - data["default_desc"] = M.desc - data["default_flavor_text"] = M.flavor_text - if(new_path && istype(M, /mob/living)) - var/mob/living/L = M - - // AI Stuff - ai_type = (L.ai_holder_type ? L.ai_holder_type : /datum/ai_holder/simple_mob/inert) - faction = (L.faction ? L.faction : "neutral") - intent = (L.a_intent ? L.a_intent : I_HELP) - new_path = FALSE - - data["max_health"] = L.maxHealth - data["health"] = L.health - if(istype(L, /mob/living/simple_mob)) - var/mob/living/simple_mob/S = L - data["melee_damage_lower"] = S.melee_damage_lower ? S.melee_damage_lower : 0 - data["melee_damage_upper"] = S.melee_damage_upper ? S.melee_damage_upper : 0 - qdel(S) - qdel(L) - qdel(M) - data["ai_type"] = ai_type - data["faction"] = faction - data["intent"] = intent + data["max_health"] = L.maxHealth + data["health"] = L.health + if(istype(L, /mob/living/simple_mob)) + var/mob/living/simple_mob/S = L + data["melee_damage_lower"] = S.melee_damage_lower ? S.melee_damage_lower : 0 + data["melee_damage_upper"] = S.melee_damage_upper ? S.melee_damage_upper : 0 + qdel(S) + qdel(L) + qdel(M) + data["ai_type"] = ai_type + data["faction"] = faction + data["intent"] = intent return data diff --git a/code/modules/nifsoft/nif_tgui.dm b/code/modules/nifsoft/nif_tgui.dm index 7699e9929e..fecf50fe87 100644 --- a/code/modules/nifsoft/nif_tgui.dm +++ b/code/modules/nifsoft/nif_tgui.dm @@ -112,6 +112,7 @@ /obj/item/device/nif/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state) var/list/data = ..() + data["valid_themes"] = valid_ui_themes data["theme"] = save_data["ui_theme"] data["last_notification"] = last_notification diff --git a/tgui/packages/tgui-panel/settings/SettingsPanel.jsx b/tgui/packages/tgui-panel/settings/SettingsPanel.jsx index a445cc7375..8d9d8ea616 100644 --- a/tgui/packages/tgui-panel/settings/SettingsPanel.jsx +++ b/tgui/packages/tgui-panel/settings/SettingsPanel.jsx @@ -102,6 +102,7 @@ export const SettingsGeneral = (props) => { @@ -118,6 +119,7 @@ export const SettingsGeneral = (props) => { {(!freeFont && ( diff --git a/tgui/packages/tgui/interfaces/AccountsTerminal.jsx b/tgui/packages/tgui/interfaces/AccountsTerminal.jsx index b00126bf54..998fb72569 100644 --- a/tgui/packages/tgui/interfaces/AccountsTerminal.jsx +++ b/tgui/packages/tgui/interfaces/AccountsTerminal.jsx @@ -61,13 +61,17 @@ const AccountTerminalContent = (props) => { > New Account - act('print')} - > - Print - + {!creating_new_account ? ( + act('print')} + > + Print + + ) : ( + '' + )} {(creating_new_account && ) || (detailed_account_view && ) || } diff --git a/tgui/packages/tgui/interfaces/AirAlarm.jsx b/tgui/packages/tgui/interfaces/AirAlarm.jsx index 7c2931e8b3..a2cf9f8fee 100644 --- a/tgui/packages/tgui/interfaces/AirAlarm.jsx +++ b/tgui/packages/tgui/interfaces/AirAlarm.jsx @@ -1,7 +1,7 @@ import { toFixed } from 'common/math'; -import { Fragment } from 'react'; +import { Fragment, useState } from 'react'; -import { useBackend, useLocalState } from '../backend'; +import { useBackend } from '../backend'; import { Box, Button, LabeledList, Section } from '../components'; import { getGasColor, getGasLabel } from '../constants'; import { Window } from '../layouts'; @@ -10,6 +10,13 @@ import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox'; export const AirAlarm = (props) => { const { act, data } = useBackend(); + + const [screen, setScreen] = useState(''); + + function handleSetScreen(value) { + setScreen(value); + } + const locked = data.locked && !data.siliconUser && !data.remoteUser; return ( @@ -17,7 +24,9 @@ export const AirAlarm = (props) => { - {!locked && } + {!locked && ( + + )} ); @@ -146,23 +155,22 @@ const AIR_ALARM_ROUTES = { }; const AirAlarmControl = (props) => { - const [screen, setScreen] = useLocalState('screen'); - const route = AIR_ALARM_ROUTES[screen] || AIR_ALARM_ROUTES.home; + const route = AIR_ALARM_ROUTES[props.screen] || AIR_ALARM_ROUTES.home; const Component = route.component(); return (
setScreen()} + onClick={() => props.onScreen()} /> ) } > - +
); }; @@ -172,7 +180,6 @@ const AirAlarmControl = (props) => { const AirAlarmControlHome = (props) => { const { act, data } = useBackend(); - const [screen, setScreen] = useLocalState('screen'); const { mode, atmos_alarm } = data; return ( <> @@ -197,25 +204,25 @@ const AirAlarmControlHome = (props) => { - - + + )} @@ -56,10 +87,7 @@ const BiogeneratorItems = (props) => { const { act, data } = useBackend(); const { points, items } = data; // Search thingies - const [searchText, _setSearchText] = useLocalState('search', ''); - const [sortOrder, _setSortOrder] = useLocalState('sort', 'Alphabetical'); - const [descending, _setDescending] = useLocalState('descending', false); - const searcher = createSearch(searchText, (item) => { + const searcher = createSearch(props.searchText, (item) => { return item[0]; }); @@ -71,11 +99,11 @@ const BiogeneratorItems = (props) => { kv2[1].affordable = points >= kv2[1].price / data.build_eff; return kv2[1]; }) - .sort(sortTypes[sortOrder]); + .sort(sortTypes[props.sortOrder]); if (items_in_cat.length === 0) { return; } - if (descending) { + if (props.descending) { items_in_cat = items_in_cat.reverse(); } @@ -102,36 +130,34 @@ const BiogeneratorItems = (props) => { }; const BiogeneratorSearch = (props) => { - const [_searchText, setSearchText] = useLocalState('search', ''); - const [_sortOrder, setSortOrder] = useLocalState('sort', ''); - const [descending, setDescending] = useLocalState('descending', false); return ( setSearchText(value)} + onInput={(_e, value) => props.onSearchText(value)} /> setSortOrder(v)} + onSelected={(v) => props.onSortOrder(v)} /> + {app.module} + + ))} + + )) || + (currentTab === PHONTAB && ( +
+ + + + + + act('write_target_address', { val: val }) + } + /> + + + + Dial + + {/* Message */} + + + Message + + {/* Hang Up */} + + + Hang Up + + + + +
+ + +
+
+ {(!!communicating.length && ( + + {communicating.map((comm) => ( + + + {decodeHtmlEntities(comm.name)} + + +
+ )) || No connections} +
+
+ {(!!requestsReceived.length && ( + + {requestsReceived.map((request) => ( + + {decodeHtmlEntities(request.address)} + +
+
+ {(!!invitesSent.length && ( + + {invitesSent.map((invite) => ( + + {decodeHtmlEntities(invite.address)} + +
+
+ + )) || + (currentTab === CONTTAB && ) || + (currentTab === MESSTAB && ( +
+ {(imContacts.length && ( + + {imContacts.map((device) => ( + + + {decodeHtmlEntities(device.name)}: + + + {device.address} + +
+ )) || ( + + You haven't sent any messages yet. +
+ )) || + (currentTab === MESSSUBTAB && + (clipboardMode ? ( +
+ {enforceLengthLimit( + 'Conversation with ', + decodeHtmlEntities(targetAddressName), + 30, + )} + + } + buttons={ +
+ ) : ( +
+ {enforceLengthLimit( + 'Conversation with ', + decodeHtmlEntities(targetAddressName), + 30, + )} + + } + buttons={ +
+ ))) || + (currentTab === NEWSTAB && ( +
+ {(!feeds.length && ( + + Error: No newsfeeds available. Please try again later. + + )) || + (target_feed && ( +
+ act('newsfeed', { newsfeed: null }) + } + /> + } + > + {target_feed.messages.map((message) => ( +
+ - {decodeHtmlEntities(message.body)} + {!!message.img && ( + + + {decodeHtmlEntities(message.caption) || null} + + )} + + [{message.message_type} by{' '} + {decodeHtmlEntities(message.author)} -{' '} + {message.time_stamp}] + +
+ ))} +
+ )) || ( + <> +
+
+ {latest_news.map((news) => ( + +
+ {decodeHtmlEntities(news.channel)} +
+ - {decodeHtmlEntities(news.body)} + {!!news.img && ( + + [image omitted, view story for more + details] + {news.caption || null} + + )} + + [{news.message_type} by{' '} + + {news.author} + {' '} + - {news.time_stamp}] + +
+ ))} +
+
+
+ {feeds.map((feed) => ( +
+ + )} +
+ )) || + (currentTab === NOTETAB && ( +
act('edit')} + content="Edit Notes" + /> + } + > +
+ {note} +
+
+ )) || + (currentTab === WTHRTAB && ) || + (currentTab === MANITAB && ) || + (currentTab === SETTTAB && ( +
+ + +
+ )) || + (notFound(currentTab) && )}
{ return false; }; -/* Tabs Below this point */ - -type HomeTabData = { - homeScreen: { number: number; module: string; icon: string }[]; -}; - -/* Home tab, provides access to all other tabs. */ -const HomeTab = (props) => { - const { act, data } = useBackend(); - - const { homeScreen } = data; - - return ( - - {homeScreen.map((app) => ( - - - {app.module} - - ))} - - ); -}; - -TabToTemplate[HOMETAB] = ; - -type PhoneTabData = { - targetAddress: string; - voice_mobs: { name: string; true_name: string; ref: string }[]; - communicating: { - address: string; - name: string; - true_name: string; - ref: string; - }[]; - requestsReceived: { address: string; name: string; ref: string }[]; - invitesSent: { address: string; name: string }[]; - video_comm: string; - selfie_mode: BooleanLike; -}; - -/* Phone tab, provides a phone interface! */ -const PhoneTab = (props) => { - const { act, data } = useBackend(); - - const { - targetAddress, - voice_mobs, - communicating, - requestsReceived, - invitesSent, - video_comm, - selfie_mode, - } = data; - - return ( -
- - - - - act('write_target_address', { val: val })} - /> - - -
-
- {(!!communicating.length && ( - - {communicating.map((comm) => ( - - - {decodeHtmlEntities(comm.name)} - - -
- )) || No connections} -
-
- {(!!requestsReceived.length && ( - - {requestsReceived.map((request) => ( - - {decodeHtmlEntities(request.address)} - -
-
- {(!!invitesSent.length && ( - - {invitesSent.map((invite) => ( - - {decodeHtmlEntities(invite.address)} - -
- - - ); -}; - -// Subtemplate -const NumberPad = (props) => { - const { act, data } = useBackend(); - - const { targetAddress } = data; - - const validCharacters = [ - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', - ]; - - let buttonArray = validCharacters.map((char) => ( - - Dial - - {/* Message */} - - - Message - - {/* Hang Up */} - - - Hang Up - - - - - ); -}; - -TabToTemplate[PHONTAB] = ; - type ContactsTabData = { knownDevices: { address: string; name: string }[]; }; @@ -730,73 +1159,6 @@ const ContactsTab = (props) => { ); }; - -TabToTemplate[CONTTAB] = ; - -type MessagingTabData = { - // TAB - imContacts: { address: string; name: string }[]; - - // THREAD - targetAddressName: string; - targetAddress: string; - imList: { address: string; to_address: string; im: string }[]; -}; - -/* Messaging */ -const MessagingTab = (props) => { - const { act, data } = useBackend(); - - const { imContacts } = data; - - return ( -
- {(imContacts.length && ( - - {imContacts.map((device) => ( - - - {decodeHtmlEntities(device.name)}: - - - {device.address} - -
- )) || ( - - You haven't sent any messages yet. -
- ); -}; - -TabToTemplate[MESSTAB] = ; - /* Actual messaging conversation */ const IsIMOurs = (im, targetAddress) => { return im.address !== targetAddress; @@ -829,315 +1191,6 @@ const findClassMessage = (im, targetAddress, lastIndex, filterArray) => { return thisSent ? 'TinderMessage_First_Sent' : 'TinderMessage_First_Received'; }; -const MessagingThreadTab = (props) => { - const { act, data } = useBackend(); - - const { targetAddressName, targetAddress, imList } = data; - - const [clipboardMode, setClipboardMode] = useState(false); - - if (clipboardMode) { - return ( -
- {enforceLengthLimit( - 'Conversation with ', - decodeHtmlEntities(targetAddressName), - 30, - )} - - } - buttons={ -
- ); - } - - return ( -
- {enforceLengthLimit( - 'Conversation with ', - decodeHtmlEntities(targetAddressName), - 30, - )} - - } - buttons={ -
- ); -}; - -TabToTemplate[MESSSUBTAB] = ; - -type NewsTabData = { - feeds: { index: number; name: string }[]; - target_feed: { name: string; author: string; messages: NewsMessage[] }; - latest_news: NewsMessage[]; -}; - -type NewsMessage = { - ref: string; - body: string; - img: string; - caption: string; - message_type: string; - author: string; - time_stamp: string; - - index: number; - channel: string; -}; - -/* News */ -const NewsTab = (props) => { - const { act, data } = useBackend(); - - const { feeds, target_feed } = data; - - return ( -
- {(!feeds.length && ( - - Error: No newsfeeds available. Please try again later. - - )) || - (target_feed && ) || } -
- ); -}; - -const NewsTargetFeed = (props) => { - const { act, data } = useBackend(); - - const { target_feed } = data; - - return ( -
act('newsfeed', { newsfeed: null })} - /> - } - > - {target_feed.messages.map((message) => ( -
- - {decodeHtmlEntities(message.body)} - {!!message.img && ( - - - {decodeHtmlEntities(message.caption) || null} - - )} - - [{message.message_type} by {decodeHtmlEntities(message.author)} -{' '} - {message.time_stamp}] - -
- ))} -
- ); -}; - -const NewsFeed = (props) => { - const { act, data } = useBackend(); - - const { feeds, latest_news } = data; - - return ( - <> -
-
- {latest_news.map((news) => ( - -
- {decodeHtmlEntities(news.channel)} -
- - {decodeHtmlEntities(news.body)} - {!!news.img && ( - - [image omitted, view story for more details] - {news.caption || null} - - )} - - [{news.message_type} by{' '} - - {news.author} - {' '} - - {news.time_stamp}] - -
- ))} -
-
-
- {feeds.map((feed) => ( -
- - ); -}; - -TabToTemplate[NEWSTAB] = ; - -type NoteTabData = { - note: string; -}; - -/* Note Keeper */ -const NoteTab = (props) => { - const { act, data } = useBackend(); - - const { note } = data; - - return ( -
act('edit')} content="Edit Notes" /> - } - > -
- {note} -
-
- ); -}; - -TabToTemplate[NOTETAB] = ; - /* Weather App */ const getItemColor = (value, min2, min1, max1, max2) => { if (value < min2) { @@ -1249,98 +1302,3 @@ const WeatherTab = (props) => { ); }; - -TabToTemplate[WTHRTAB] = ; - -/* Crew Manifest */ -// Lol just steal it from the existing template -TabToTemplate[MANITAB] = ; - -type SettingsTabData = { - owner: string; - occupation: string; - connectionStatus: BooleanLike; - address: string; - visible: BooleanLike; - ring: BooleanLike; - selfie_mode: BooleanLike; -}; - -/* Settings */ -const SettingsTab = (props) => { - const { act, data } = useBackend(); - - const { - owner, - occupation, - connectionStatus, - address, - visible, - ring, - selfie_mode, - } = data; - - return ( -
- - -
- ); -}; - -TabToTemplate[SETTTAB] = ; diff --git a/tgui/packages/tgui/interfaces/CrewMonitor.jsx b/tgui/packages/tgui/interfaces/CrewMonitor.jsx index 74418f60b6..3038834999 100644 --- a/tgui/packages/tgui/interfaces/CrewMonitor.jsx +++ b/tgui/packages/tgui/interfaces/CrewMonitor.jsx @@ -1,7 +1,8 @@ import { sortBy } from 'common/collections'; import { flow } from 'common/fp'; +import { useState } from 'react'; -import { useBackend, useLocalState } from '../backend'; +import { useBackend } from '../backend'; import { Box, Button, Icon, NanoMap, Table, Tabs } from '../components'; import { Window } from '../layouts'; @@ -28,10 +29,26 @@ const getStatColor = (cm) => { }; export const CrewMonitor = () => { + const [tabIndex, setTabIndex] = useState(0); + const [zoom, setZoom] = useState(1); + + function handleTabIndex(value) { + setTabIndex(value); + } + + function handleZoom(value) { + setZoom(value); + } + return ( - + ); @@ -39,7 +56,6 @@ export const CrewMonitor = () => { export const CrewMonitorContent = (props) => { const { act, data, config } = useBackend(); - const [tabIndex, setTabIndex] = useLocalState('tabIndex', 0); const crew = flow([ sortBy((cm) => cm.name), @@ -48,11 +64,9 @@ export const CrewMonitorContent = (props) => { sortBy((cm) => cm?.realZ), ])(data.crewmembers || []); - const [zoom, setZoom] = useLocalState('zoom', 1); - let body; // Data view - if (tabIndex === 0) { + if (props.tabIndex === 0) { body = ( @@ -115,11 +129,11 @@ export const CrewMonitorContent = (props) => { ))}
); - } else if (tabIndex === 1) { + } else if (props.tabIndex === 1) { // Please note, if you ever change the zoom values, // you MUST update styles/components/Tooltip.scss // and change the @for scss to match. - body = ; + body = ; } else { body = 'ERROR'; } @@ -129,15 +143,15 @@ export const CrewMonitorContent = (props) => { setTabIndex(0)} + selected={0 === props.tabIndex} + onClick={() => props.onTabIndex(0)} > Data View setTabIndex(1)} + selected={1 === props.tabIndex} + onClick={() => props.onTabIndex(1)} > Map View @@ -149,10 +163,9 @@ export const CrewMonitorContent = (props) => { const CrewMonitorMapView = (props) => { const { act, config, data } = useBackend(); - const [zoom, setZoom] = useLocalState('zoom', 1); return ( - setZoom(v)}> + props.onZoom(v)}> {data.crewmembers .filter( (x) => x.sensor_type === 3 && ~~x.realZ === ~~config.mapZLevel, @@ -162,7 +175,7 @@ const CrewMonitorMapView = (props) => { key={cm.ref} x={cm.x} y={cm.y} - zoom={zoom} + zoom={props.zoom} icon="circle" tooltip={cm.name + ' (' + cm.assignment + ')'} color={getStatColor(cm)} diff --git a/tgui/packages/tgui/interfaces/DNAModifier.jsx b/tgui/packages/tgui/interfaces/DNAModifier.jsx index e7ec460a03..7a0eafe047 100644 --- a/tgui/packages/tgui/interfaces/DNAModifier.jsx +++ b/tgui/packages/tgui/interfaces/DNAModifier.jsx @@ -32,8 +32,7 @@ const rejuvenatorsDoses = [5, 10, 20, 30, 50]; export const DNAModifier = (props) => { const { act, data } = useBackend(); const { irradiating, dnaBlockSize, occupant } = data; - context.dnaBlockSize = dnaBlockSize; - context.isDNAInvalid = + const isDNAInvalid = !occupant.isViableSubject || !occupant.uniqueIdentity || !occupant.structuralEnzymes; @@ -42,12 +41,12 @@ export const DNAModifier = (props) => { radiatingModal = ; } return ( - + {radiatingModal} - - + + ); @@ -103,7 +102,7 @@ const DNAModifierOccupant = (props) => {
- {context.isDNAInvalid ? ( + {props.isDNAInvalid ? (   The occupant's DNA structure is ruined beyond @@ -154,7 +153,7 @@ const DNAModifierMain = (props) => { ); - } else if (context.isDNAInvalid) { + } else if (props.isDNAInvalid) { return (
@@ -208,15 +207,20 @@ const DNAModifierMain = (props) => { const DNAModifierMainUI = (props) => { const { act, data } = useBackend(); - const { selectedUIBlock, selectedUISubBlock, selectedUITarget, occupant } = - data; + const { + selectedUIBlock, + selectedUISubBlock, + selectedUITarget, + dnaBlockSize, + occupant, + } = data; return (
@@ -244,14 +248,14 @@ const DNAModifierMainUI = (props) => { const DNAModifierMainSE = (props) => { const { act, data } = useBackend(); - const { selectedSEBlock, selectedSESubBlock, occupant } = data; + const { selectedSEBlock, selectedSESubBlock, dnaBlockSize, occupant } = data; return (
- {(maxHealth && ( + {(data.max_health && ( <> setMaxHealth(val)} + value={data.max_health} + onChange={(e, val) => props.onMaxHealth(val)} /> setHealth(val)} + value={data.health} + onChange={(e, val) => props.onHealth(val)} />
)) || "Note: Only available for '/mob/living'"} - {(meleeDamageLower && ( + {(data.melee_damage_lower && ( <> setMeleeDamageLower(val)} + value={data.melee_damage_lower} + onChange={(e, val) => props.onMeleeDamageLower(val)} /> setMeleeDamageUpper(val)} + value={data.melee_damage_upper} + onChange={(e, val) => props.onMeleeDamageUpper(val)} /> @@ -267,8 +329,8 @@ const GeneralMobSettings = (props) => {