From 56759cb95b82cceec1b152c895b1d6a4a758b545 Mon Sep 17 00:00:00 2001 From: CHOMPStation2StaffMirrorBot <94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com> Date: Mon, 3 Feb 2025 03:15:50 -0700 Subject: [PATCH] [MIRROR] Work on phasing out tgui collections.ts (#10059) Co-authored-by: ShadowLarkens Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> --- code/game/objects/items/stacks/stack.dm | 2 +- tgui/packages/tgui-panel/chat/selectors.ts | 4 +- .../interfaces/AdminShuttleController.tsx | 17 +++-- .../AppearanceChangerBody.tsx | 62 +++++++++++-------- .../packages/tgui/interfaces/AtmosControl.tsx | 10 ++- .../tgui/interfaces/CameraConsole.tsx | 33 ++++------ .../Communicator/CommunicatorWeatherTab.tsx | 46 +++++++------- .../CrewMonitor/CrewMonitorContent.tsx | 13 +--- .../tgui/interfaces/CrewMonitor/functions.ts | 42 +++++-------- tgui/packages/tgui/interfaces/FileCabinet.tsx | 5 +- .../interfaces/GeneralRecords/functions.ts | 3 +- tgui/packages/tgui/interfaces/Gps.tsx | 25 ++++---- tgui/packages/tgui/interfaces/GuestPass.tsx | 5 +- tgui/packages/tgui/interfaces/ICPrinter.tsx | 16 ++--- .../interfaces/IdentificationComputer.tsx | 13 +++- tgui/packages/tgui/interfaces/LawManager.tsx | 3 +- .../{Stack.tsx => MaterialStack.tsx} | 48 +++++++++++--- .../tgui/interfaces/ModifyRobot/functions.ts | 3 +- .../tgui/interfaces/NtosDigitalWarrant.tsx | 4 +- .../Pda/pda_screens/pda_atmos_scan.tsx | 46 +++++++------- .../Pda/pda_screens/pda_messenger.tsx | 9 ++- .../tgui/interfaces/PersonalCrafting.tsx | 5 +- .../PowerMonitor/PowerMonitorFocus.tsx | 29 ++++----- .../PreferencesMenu/GamePreferencesPage.tsx | 9 ++- .../preferences/features/base.tsx | 10 ++- .../interfaces/ResearchServerController.tsx | 9 ++- .../tgui/interfaces/RobotChoose/functions.ts | 5 +- tgui/packages/tgui/interfaces/SeedStorage.tsx | 7 ++- .../SupplyConsole/SupplyConsoleMenuOrder.tsx | 24 +++---- .../tgui/interfaces/TelesciConsole.tsx | 7 ++- tgui/packages/tgui/interfaces/Vending.tsx | 3 +- tgui/packages/tgui/interfaces/pAIAtmos.tsx | 46 +++++++------- 32 files changed, 296 insertions(+), 267 deletions(-) rename tgui/packages/tgui/interfaces/{Stack.tsx => MaterialStack.tsx} (76%) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 415ec8c202..262cdc9865 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -82,7 +82,7 @@ /obj/item/stack/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "Stack", name) + ui = new(user, src, "MaterialStack", name) ui.open() /obj/item/stack/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state) diff --git a/tgui/packages/tgui-panel/chat/selectors.ts b/tgui/packages/tgui-panel/chat/selectors.ts index 64269833f6..ec0496bb8f 100644 --- a/tgui/packages/tgui-panel/chat/selectors.ts +++ b/tgui/packages/tgui-panel/chat/selectors.ts @@ -4,12 +4,10 @@ * @license MIT */ -import { map } from 'common/collections'; - export const selectChat = (state) => state.chat; export const selectChatPages = (state) => - map(state.chat.pages, (id: string) => state.chat.pageById[id]); + state.chat.pages.map((id: string) => state.chat.pageById[id]); export const selectCurrentChatPage = (state) => state.chat.pageById[state.chat.currentPageId]; diff --git a/tgui/packages/tgui/interfaces/AdminShuttleController.tsx b/tgui/packages/tgui/interfaces/AdminShuttleController.tsx index 014f35398d..c4f890011b 100644 --- a/tgui/packages/tgui/interfaces/AdminShuttleController.tsx +++ b/tgui/packages/tgui/interfaces/AdminShuttleController.tsx @@ -1,4 +1,3 @@ -import { sortBy } from 'common/collections'; import { useBackend } from 'tgui/backend'; import { Window } from 'tgui/layouts'; import { Button, Section, Table } from 'tgui-core/components'; @@ -35,11 +34,20 @@ export const ShuttleList = (props) => { const { shuttles, overmap_ships } = data; + shuttles.sort((a, b) => a.name.localeCompare(b.name)); + + overmap_ships.sort((a, b) => { + let a_cmp = a.name?.toLowerCase() || a.name || a.ref; + let b_cmp = a.name?.toLowerCase() || a.name || a.ref; + + return a_cmp.localeCompare(b_cmp); + }); + return (
- {sortBy(shuttles, (f: Shuttle) => f.name).map((shuttle) => ( + {shuttles.map((shuttle) => (
- {sortBy( - overmap_ships, - (f: OvermapShip) => f.name?.toLowerCase() || f.name || f.ref, - ).map((ship) => ( + {overmap_ships.map((ship) => ( - {sortBy(ear_styles, (e: styles) => e.name.toLowerCase()).map( - (ear) => ( - - ), - )} + {ear_styles.map((ear) => ( + + ))} @@ -96,17 +99,15 @@ export const AppearanceChangerEars = (props) => { > -- Not Set -- - {sortBy(ear_styles, (e: styles) => e.name.toLowerCase()).map( - (ear) => ( - - ), - )} + {ear_styles.map((ear) => ( + + ))} @@ -118,6 +119,10 @@ export const AppearanceChangerTails = (props) => { const { tail_style, tail_styles } = data; + tail_styles.sort((a, b) => + a.name.toLowerCase().localeCompare(b.name.toLowerCase()), + ); + return (
- {sortBy(tail_styles, (e: styles) => e.name.toLowerCase()).map((tail) => ( + {tail_styles.map((tail) => ( - {sortBy(wing_styles, (e: styles) => e.name.toLowerCase()).map((wing) => ( + {wing_styles.map((wing) => (