From f10f6c30e3ecbf14e59c0810fb6a3a749e1b3524 Mon Sep 17 00:00:00 2001 From: "tgstation-ci[bot]" <179393467+tgstation-ci[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:26:06 +0000 Subject: [PATCH 01/80] Automatic changelog compile [ci skip] --- html/changelogs/AutoChangeLog-pr-88789.yml | 7 ------- html/changelogs/AutoChangeLog-pr-89132.yml | 4 ---- html/changelogs/AutoChangeLog-pr-89150.yml | 4 ---- html/changelogs/AutoChangeLog-pr-89153.yml | 4 ---- html/changelogs/AutoChangeLog-pr-89156.yml | 4 ---- html/changelogs/AutoChangeLog-pr-89157.yml | 4 ---- html/changelogs/archive/2025-01.yml | 18 ++++++++++++++++++ 7 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 html/changelogs/AutoChangeLog-pr-88789.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-89132.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-89150.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-89153.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-89156.yml delete mode 100644 html/changelogs/AutoChangeLog-pr-89157.yml diff --git a/html/changelogs/AutoChangeLog-pr-88789.yml b/html/changelogs/AutoChangeLog-pr-88789.yml deleted file mode 100644 index 10f5e68880cc7..0000000000000 --- a/html/changelogs/AutoChangeLog-pr-88789.yml +++ /dev/null @@ -1,7 +0,0 @@ -author: "StrangeWeirdKitten" -delete-after: True -changes: - - balance: "Reduces armor slots to 1 for all station built mechs except the phazon." - - balance: "melee mech armor has been increased to 20 from 15." - - balance: "mech bullet and laser armor has both been increased to 15 from 10." - - balance: "You can no longer stack the repair droid on mechs." \ No newline at end of file diff --git a/html/changelogs/AutoChangeLog-pr-89132.yml b/html/changelogs/AutoChangeLog-pr-89132.yml deleted file mode 100644 index 693684c833982..0000000000000 --- a/html/changelogs/AutoChangeLog-pr-89132.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: "Ghommie" -delete-after: True -changes: - - bugfix: "Chasms are once again incompatible with explosive fishing." \ No newline at end of file diff --git a/html/changelogs/AutoChangeLog-pr-89150.yml b/html/changelogs/AutoChangeLog-pr-89150.yml deleted file mode 100644 index 685f90e5b0f25..0000000000000 --- a/html/changelogs/AutoChangeLog-pr-89150.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: "Vekter" -delete-after: True -changes: - - balance: "The roundstart report will now display a more broad, less specific message about threat levels when between 0 and 80 threat." \ No newline at end of file diff --git a/html/changelogs/AutoChangeLog-pr-89153.yml b/html/changelogs/AutoChangeLog-pr-89153.yml deleted file mode 100644 index acd9df2a8fd46..0000000000000 --- a/html/changelogs/AutoChangeLog-pr-89153.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: "Jacquerel" -delete-after: True -changes: - - refactor: "NPC zombies found in ruins now use the basic mob framework. Please make an issue report if they exhibit any unusual behaviour." \ No newline at end of file diff --git a/html/changelogs/AutoChangeLog-pr-89156.yml b/html/changelogs/AutoChangeLog-pr-89156.yml deleted file mode 100644 index 43ad3a8538258..0000000000000 --- a/html/changelogs/AutoChangeLog-pr-89156.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: "SmArtKar" -delete-after: True -changes: - - bugfix: "Clipboards should no longer retain pens that got removed via Instant Recall" \ No newline at end of file diff --git a/html/changelogs/AutoChangeLog-pr-89157.yml b/html/changelogs/AutoChangeLog-pr-89157.yml deleted file mode 100644 index b4ab02618c6ac..0000000000000 --- a/html/changelogs/AutoChangeLog-pr-89157.yml +++ /dev/null @@ -1,4 +0,0 @@ -author: "Melbert" -delete-after: True -changes: - - bugfix: "Heads with brains no longer look debrained" \ No newline at end of file diff --git a/html/changelogs/archive/2025-01.yml b/html/changelogs/archive/2025-01.yml index 0fca94159883d..684a41a445705 100644 --- a/html/changelogs/archive/2025-01.yml +++ b/html/changelogs/archive/2025-01.yml @@ -583,3 +583,21 @@ the-og-gear: - bugfix: Deluxe Donk Pockets (and their no-carb and vegan variants) are no longer craftable without collecting the recipe. +2025-01-23: + Ghommie: + - bugfix: Chasms are once again incompatible with explosive fishing. + Jacquerel: + - refactor: NPC zombies found in ruins now use the basic mob framework. Please make + an issue report if they exhibit any unusual behaviour. + Melbert: + - bugfix: Heads with brains no longer look debrained + SmArtKar: + - bugfix: Clipboards should no longer retain pens that got removed via Instant Recall + StrangeWeirdKitten: + - balance: Reduces armor slots to 1 for all station built mechs except the phazon. + - balance: melee mech armor has been increased to 20 from 15. + - balance: mech bullet and laser armor has both been increased to 15 from 10. + - balance: You can no longer stack the repair droid on mechs. + Vekter: + - balance: The roundstart report will now display a more broad, less specific message + about threat levels when between 0 and 80 threat. From b53ced4e75701218310f5dd09e83375b622f75a6 Mon Sep 17 00:00:00 2001 From: Lucy Date: Wed, 22 Jan 2025 19:46:14 -0500 Subject: [PATCH 02/80] Add a SS13.check_tick lua function (#89081) ## About The Pull Request This adds a new function for Lua scripts: `SS13.check_tick()` - it acts pretty much exactly like the `CHECK_TICK` macro in DM. It accepts a single argument, a boolean, which if true - it will act like `CHECK_TICK_HIGH_PRIORITY` instead. ## Why It's Good For The Game this function is a repeated code pattern in lua scripts, so having it in the SS13 lua library is useful. ## Changelog :cl: admin: Added a new function in Lua scripting, SS13.check_tick, to avoid causing too much lag during loops and such. /:cl: --- lua/SS13_base.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/SS13_base.lua b/lua/SS13_base.lua index 23f464bf328ab..470288af87e4d 100644 --- a/lua/SS13_base.lua +++ b/lua/SS13_base.lua @@ -39,6 +39,13 @@ function SS13.is_valid(datum) return dm.is_valid_ref(datum) and not datum.gc_destroyed end +function SS13.check_tick(high_priority) + local tick_limit = if high_priority then 95 else dm.global_vars.Master.current_ticklimit + if dm.world.tick_usage > tick_limit then + sleep() + end +end + function SS13.await(thing_to_call, proc_to_call, ...) if not SS13.istype(thing_to_call, "/datum") then thing_to_call = SS13.global_proc From 36d8236998ad410abcac1d83c144a6f00f4d1610 Mon Sep 17 00:00:00 2001 From: "tgstation-ci[bot]" <179393467+tgstation-ci[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:47:45 +0000 Subject: [PATCH 03/80] Automatic changelog for PR #89081 [ci skip] --- html/changelogs/AutoChangeLog-pr-89081.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-89081.yml diff --git a/html/changelogs/AutoChangeLog-pr-89081.yml b/html/changelogs/AutoChangeLog-pr-89081.yml new file mode 100644 index 0000000000000..8c5d863c2f565 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-89081.yml @@ -0,0 +1,4 @@ +author: "Absolucy" +delete-after: True +changes: + - admin: "Added a new function in Lua scripting, SS13.check_tick, to avoid causing too much lag during loops and such." \ No newline at end of file From b71e9c1b28eff98789d477b482d56f7e89ad89a7 Mon Sep 17 00:00:00 2001 From: MichiRecRoom <1008889+LikeLakers2@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:01:00 -0500 Subject: [PATCH 04/80] Allow pAIs to withdraw their candidacy (#89120) ## About The Pull Request This PR adds a "withdraw" button to the pAI candidacy menu, which immediately (or near-immediately, given there's a small delay between tgui refreshes) removes your information from the pAI device's candidate download screen. (The below video was recorded on a local instance of Monkestation, but I've verified that it works exactly the same on tgstation proper too.) https://github.com/user-attachments/assets/8508f17f-db61-4ae9-bdc8-b4214489b8b6 ## Why It's Good For The Game Being able to withdraw your candidacy means that, should you need to go AFK or otherwise leave the game for an extended period of time, your candidate details won't clog up the candidate download screen. Plus, you won't frustrate players who download a pAI, only to find that they're AFK. ## Changelog :cl:MichiRecRoom qol: pAIs can now withdraw their candidacy at any time. /:cl: --- code/controllers/subsystem/pai.dm | 7 +++++++ tgui/packages/tgui/interfaces/PaiSubmit.tsx | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/code/controllers/subsystem/pai.dm b/code/controllers/subsystem/pai.dm index c5754115a6e00..4abc752ea81ae 100644 --- a/code/controllers/subsystem/pai.dm +++ b/code/controllers/subsystem/pai.dm @@ -70,6 +70,13 @@ SUBSYSTEM_DEF(pai) candidate.savefile_load(user) ui.send_full_update() return TRUE + if("withdraw") + if(!candidate.ready) + to_chat(user, span_warning("You need to submit an application before you can withdraw one.")) + return FALSE + candidate.ready = FALSE + to_chat(user, span_notice("Your pAI candidacy has been withdrawn.")) + return TRUE return FALSE /** diff --git a/tgui/packages/tgui/interfaces/PaiSubmit.tsx b/tgui/packages/tgui/interfaces/PaiSubmit.tsx index c27e78d30e364..88643376c9dad 100644 --- a/tgui/packages/tgui/interfaces/PaiSubmit.tsx +++ b/tgui/packages/tgui/interfaces/PaiSubmit.tsx @@ -145,6 +145,14 @@ const ButtonsDisplay = (props) => { SUBMIT + + + ); From 73aae3d4ebd8539ccf9af2cf904773145da51764 Mon Sep 17 00:00:00 2001 From: "tgstation-ci[bot]" <179393467+tgstation-ci[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 01:01:22 +0000 Subject: [PATCH 05/80] Automatic changelog for PR #89120 [ci skip] --- html/changelogs/AutoChangeLog-pr-89120.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-89120.yml diff --git a/html/changelogs/AutoChangeLog-pr-89120.yml b/html/changelogs/AutoChangeLog-pr-89120.yml new file mode 100644 index 0000000000000..7502cfb609e89 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-89120.yml @@ -0,0 +1,4 @@ +author: "MichiRecRoom" +delete-after: True +changes: + - qol: "pAIs can now withdraw their candidacy at any time." \ No newline at end of file From 309eb46d98630860b107064ccf9e905fe21bde44 Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:35:36 -0800 Subject: [PATCH 06/80] Fixes malf ai screen (#89079) ## About The Pull Request 1. Removed an errant :: in objectives list 2. Fixed height of modules selector, this fixes #89071 3. Fixed the categories loop, this fixes #86881 4. Did some stylistic code changes 5. Made a common ui component to reduce code duplication 6. Fixed a typo from a previous pr >[!Note] > This does not address #85999, which seems to be an issue on the DM side.
pics #89071 fixed ![Screenshot 2025-01-14 173954](https://github.com/user-attachments/assets/997ee3ff-4283-4b0c-a9b2-f05b68bb6fd2) #86881 fixed ![Screenshot 2025-01-14 175903](https://github.com/user-attachments/assets/a12f493b-fc58-49aa-b9bf-a8162cc794a6)
## Why It's Good For The Game Better ui, bug fixes ## Changelog :cl: fix: Fixed some bugs in the malf ai screen: one bluescreen, an extra colon, modules view /:cl: --- .../tgui/interfaces/AntagInfoMalf.tsx | 105 ++++++++---------- tgui/packages/tgui/interfaces/ApcControl.tsx | 2 +- .../interfaces/MalfunctionModulePicker.jsx | 39 ------- .../interfaces/MalfunctionModulePicker.tsx | 12 ++ .../tgui/interfaces/common/MalfAiModules.tsx | 49 ++++++++ 5 files changed, 109 insertions(+), 98 deletions(-) delete mode 100644 tgui/packages/tgui/interfaces/MalfunctionModulePicker.jsx create mode 100644 tgui/packages/tgui/interfaces/MalfunctionModulePicker.tsx create mode 100644 tgui/packages/tgui/interfaces/common/MalfAiModules.tsx diff --git a/tgui/packages/tgui/interfaces/AntagInfoMalf.tsx b/tgui/packages/tgui/interfaces/AntagInfoMalf.tsx index 078f3e8026fa8..6ed65e7c41918 100644 --- a/tgui/packages/tgui/interfaces/AntagInfoMalf.tsx +++ b/tgui/packages/tgui/interfaces/AntagInfoMalf.tsx @@ -4,12 +4,13 @@ import { BooleanLike } from 'tgui-core/react'; import { useBackend } from '../backend'; import { Window } from '../layouts'; +import { MalfAiModules } from './common/MalfAiModules'; import { Objective, ObjectivePrintout, ReplaceObjectivesButton, } from './common/Objectives'; -import { GenericUplink, Item } from './Uplink/GenericUplink'; +import { Item } from './Uplink/GenericUplink'; const allystyle = { fontWeight: 'bold', @@ -26,7 +27,12 @@ const goalstyle = { fontWeight: 'bold', }; -type Info = { +type Category = { + name: string; + items: Item[]; +}; + +type Data = { has_codewords: BooleanLike; phrases: string; responses: string; @@ -36,13 +42,14 @@ type Info = { intro: string; processingTime: string; objectives: Objective[]; - categories: any[]; + categories: Category[]; can_change_objective: BooleanLike; }; -const IntroductionSection = (props) => { - const { act, data } = useBackend(); +function IntroductionSection(props) { + const { data } = useBackend(); const { intro, objectives, can_change_objective } = data; + return (
@@ -50,13 +57,13 @@ const IntroductionSection = (props) => { } /> @@ -64,11 +71,12 @@ const IntroductionSection = (props) => {
); -}; +} -const FlavorSection = (props) => { - const { data } = useBackend(); +function FlavorSection(props) { + const { data } = useBackend(); const { allies, goal } = data; + return (
{ mr={-0.8} mt={-0.5} icon="hammer" - tooltip={` + tooltip=" This is a gameplay suggestion for bored ais. You don't have to follow it, unless you want some - ideas for how to spend the round.`} + ideas for how to spend the round." tooltipPosition="bottom-start" > Policy @@ -121,21 +129,22 @@ const FlavorSection = (props) => {
); -}; +} -const CodewordsSection = (props) => { - const { data } = useBackend(); +function CodewordsSection(props) { + const { data } = useBackend(); const { has_codewords, phrases, responses } = data; + return (
- {(!has_codewords && ( + {!has_codewords ? (
You have not been supplied the Syndicate codewords. You will have to use alternative methods to find potential allies. Proceed with caution, however, as everyone is a potential foe.
- )) || ( + ) : ( <>
@@ -167,36 +176,21 @@ const CodewordsSection = (props) => {
); -}; +} + +enum Screen { + Intro, + Modules, +} + +export function AntagInfoMalf(props) { + const [antagInfoTab, setAntagInfoTab] = useState(Screen.Intro); -export const AntagInfoMalf = (props) => { - const { act, data } = useBackend(); - const { processingTime, categories } = data; - const [antagInfoTab, setAntagInfoTab] = useState(0); - const categoriesList: string[] = []; - const items: Item[] = []; - for (let i = 0; i < categories.length; i++) { - const category = categories[i]; - categoriesList.push(category.name); - for (let itemIndex = 0; itemIndex < category.items.length; itemIndex++) { - const item = category.items[itemIndex]; - items.push({ - id: item.name, - name: item.name, - icon: item.icon, - icon_state: item.icon_state, - category: category.name, - cost: `${item.cost} PT`, - desc: item.desc, - disabled: processingTime < item.cost, - }); - } - } return ( @@ -204,21 +198,21 @@ export const AntagInfoMalf = (props) => { setAntagInfoTab(0)} + selected={antagInfoTab === Screen.Intro} + onClick={() => setAntagInfoTab(Screen.Intro)} > Information setAntagInfoTab(1)} + selected={antagInfoTab === Screen.Modules} + onClick={() => setAntagInfoTab(Screen.Modules)} > Malfunction Modules - {(antagInfoTab === 0 && ( + {antagInfoTab === Screen.Intro ? ( <> @@ -234,15 +228,10 @@ export const AntagInfoMalf = (props) => { - )) || ( - -
- act('buy', { name: item.name })} - /> + ) : ( + +
+
)} @@ -250,4 +239,4 @@ export const AntagInfoMalf = (props) => { ); -}; +} diff --git a/tgui/packages/tgui/interfaces/ApcControl.tsx b/tgui/packages/tgui/interfaces/ApcControl.tsx index 7ed1ce31f2d3a..3bc8e9213d095 100644 --- a/tgui/packages/tgui/interfaces/ApcControl.tsx +++ b/tgui/packages/tgui/interfaces/ApcControl.tsx @@ -82,7 +82,7 @@ function ApcLoggedOut(props) { - Nanotrasen or its affiliants do not endorse this product. Risk of + Nanotrasen and its affiliates do not endorse this product. Risk of serious bodily injury or death is inherent in the use of any device that generates electricity. Nanotrasen is not responsible for any damages caused by the use of this product. diff --git a/tgui/packages/tgui/interfaces/MalfunctionModulePicker.jsx b/tgui/packages/tgui/interfaces/MalfunctionModulePicker.jsx deleted file mode 100644 index 7ffc12400b4de..0000000000000 --- a/tgui/packages/tgui/interfaces/MalfunctionModulePicker.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import { useBackend } from '../backend'; -import { Window } from '../layouts'; -import { GenericUplink } from './Uplink/GenericUplink'; - -export const MalfunctionModulePicker = (props) => { - const { act, data } = useBackend(); - const { processingTime, categories } = data; - - const categoriesList = []; - const items = []; - for (let i = 0; i < categories.length; i++) { - const category = categories[i]; - categoriesList.push(category.name); - for (let itemIndex = 0; itemIndex < category.items.length; itemIndex++) { - const item = category.items[itemIndex]; - items.push({ - id: item.name, - name: item.name, - category: category.name, - cost: `${item.cost} PT`, - desc: item.desc, - disabled: processingTime < item.cost, - }); - } - } - - return ( - - - act('buy', { name: item.name })} - /> - - - ); -}; diff --git a/tgui/packages/tgui/interfaces/MalfunctionModulePicker.tsx b/tgui/packages/tgui/interfaces/MalfunctionModulePicker.tsx new file mode 100644 index 0000000000000..199bf69904797 --- /dev/null +++ b/tgui/packages/tgui/interfaces/MalfunctionModulePicker.tsx @@ -0,0 +1,12 @@ +import { Window } from '../layouts'; +import { MalfAiModules } from './common/MalfAiModules'; + +export function MalfunctionModulePicker(props) { + return ( + + + + + + ); +} diff --git a/tgui/packages/tgui/interfaces/common/MalfAiModules.tsx b/tgui/packages/tgui/interfaces/common/MalfAiModules.tsx new file mode 100644 index 0000000000000..971dfc3ef171a --- /dev/null +++ b/tgui/packages/tgui/interfaces/common/MalfAiModules.tsx @@ -0,0 +1,49 @@ +import { useBackend } from '../../backend'; +import { GenericUplink, Item } from '../Uplink/GenericUplink'; + +type Category = { + name: string; + items: Item[]; +}; + +type Data = { + processingTime: string; + categories: Category[]; +}; + +/** Common ui for selecting malf ai modules */ +export function MalfAiModules(props) { + const { act, data } = useBackend(); + const { processingTime, categories = [] } = data; + + const categoriesList: string[] = []; + const items: Item[] = []; + + for (let idx = 0; idx < categories.length; idx++) { + const category = categories[idx]; + categoriesList.push(category.name); + + for (let itemIndex = 0; itemIndex < category.items?.length; itemIndex++) { + const item = category.items[itemIndex]; + items.push({ + category: category.name, + cost: `${item.cost} PT`, + desc: item.desc, + disabled: processingTime < item.cost, + icon_state: item.icon_state, + icon: item.icon, + id: item.name, + name: item.name, + }); + } + } + + return ( + act('buy', { name: item.name })} + /> + ); +} From 5cf2f1c6a59eb75b5babbc867b87b6ca3d1e86bf Mon Sep 17 00:00:00 2001 From: "tgstation-ci[bot]" <179393467+tgstation-ci[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 02:35:54 +0000 Subject: [PATCH 07/80] Automatic changelog for PR #89079 [ci skip] --- html/changelogs/AutoChangeLog-pr-89079.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-89079.yml diff --git a/html/changelogs/AutoChangeLog-pr-89079.yml b/html/changelogs/AutoChangeLog-pr-89079.yml new file mode 100644 index 0000000000000..39d5c4fad3b53 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-89079.yml @@ -0,0 +1,4 @@ +author: "jlsnow301" +delete-after: True +changes: + - bugfix: "Fixed some bugs in the malf ai screen: one bluescreen, an extra colon, modules view" \ No newline at end of file From 08d389d0acb35871ad27977899172d7c72d53eae Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:57:20 -0800 Subject: [PATCH 08/80] Library admin refactor (#89097) ## About The Pull Request Removes uselocalstate from library admin. Did some stylistic changes as per usual, broke the code into multiple files ## Why It's Good For The Game useLocalstate is deprecated, I want it out of the codebase ## Changelog N/A --- .../packages/tgui/interfaces/LibraryAdmin.tsx | 495 ------------------ .../interfaces/LibraryAdmin/BookListing.tsx | 45 ++ .../tgui/interfaces/LibraryAdmin/Modify.tsx | 174 ++++++ .../tgui/interfaces/LibraryAdmin/Search.tsx | 225 ++++++++ .../tgui/interfaces/LibraryAdmin/hooks.ts | 15 + .../tgui/interfaces/LibraryAdmin/index.tsx | 24 + .../tgui/interfaces/LibraryAdmin/types.ts | 52 ++ 7 files changed, 535 insertions(+), 495 deletions(-) delete mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin.tsx create mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin/BookListing.tsx create mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin/Modify.tsx create mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin/Search.tsx create mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin/hooks.ts create mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin/index.tsx create mode 100644 tgui/packages/tgui/interfaces/LibraryAdmin/types.ts diff --git a/tgui/packages/tgui/interfaces/LibraryAdmin.tsx b/tgui/packages/tgui/interfaces/LibraryAdmin.tsx deleted file mode 100644 index 5e9ead80a6054..0000000000000 --- a/tgui/packages/tgui/interfaces/LibraryAdmin.tsx +++ /dev/null @@ -1,495 +0,0 @@ -import { map, sortBy } from 'common/collections'; -import { useState } from 'react'; -import { - Box, - Button, - Dropdown, - Input, - NoticeBox, - Section, - Stack, - Table, - TextArea, -} from 'tgui-core/components'; -import { capitalize } from 'tgui-core/string'; - -import { useBackend, useLocalState } from '../backend'; -import { Window } from '../layouts'; -import { PageSelect } from './LibraryConsole'; - -export const LibraryAdmin = (props) => { - const [modifyMethod, setModifyMethod] = useLocalState('ModifyMethod', null); - return ( - - {modifyMethod ? : } - - ); -}; - -type ListingData = { - can_connect: boolean; - can_db_request: boolean; - our_page: number; - page_count: number; -}; - -const BookListing = (props) => { - const { act, data } = useBackend(); - const { can_connect, can_db_request, our_page, page_count } = data; - if (!can_connect) { - return ( - - Unable to retrieve book listings. Please contact your system - administrator for assistance. - - ); - } - return ( - - - - - - - - - - - act('switch_page', { - page: value, - }) - } - /> - - - ); -}; - -type Book = { - author: string; - category: string; - title: string; - id: number; -}; - -type AdminBook = Book & { - author_ckey: string; - deleted: boolean; -}; - -type DisplayAdminBook = AdminBook & { - key: number; -}; - -type DisplayData = { - can_db_request: boolean; - search_categories: string[]; - book_id: number; - title: string; - category: string; - author: string; - author_ckey: string; - params_changed: boolean; - view_raw: boolean; - show_deleted: boolean; - history: HistoryArray; - pages: Book[]; -}; - -const SearchAndDisplay = (props) => { - const { act, data } = useBackend(); - const [modifyMethod, setModifyMethod] = useLocalState('ModifyMethod', ''); - const [modifyTarget, setModifyTarget] = useLocalState('ModifyTarget', 0); - const { - can_db_request, - search_categories = [], - book_id, - title, - category, - author, - author_ckey, - pages, - params_changed, - view_raw, - show_deleted, - } = data; - const books = sortBy( - map( - pages, - (book, i) => - ({ - ...book, - // Generate a unique id - key: i, - }) as DisplayAdminBook, - ), - (book) => book.key, - ); - return ( -
- - - - - - act('set_search_id', { - id: value, - }) - } - /> - - - - act('set_search_category', { - category: value, - }) - } - /> - - - - act('set_search_title', { - title: value, - }) - } - /> - - - - act('set_search_author', { - author: value, - }) - } - /> - - - - act('set_search_ckey', { - ckey: value, - }) - } - /> - - - - - - - - - - -
- ); -}; - -const ModifyTypes = { - Delete: 'delete', - Restore: 'restore', -}; - -type HistoryEntry = { - // The id of this logged action - id: number; - // The book id this log applies to - book: number; - // The reason this action was enacted - reason: string; - // The admin who performed the action - ckey: string; - // The time of the action being performed - datetime: string; - // The action that ocurred - action: string; - // The ip address of the admin who performed the action - ip_addr: string; -}; - -type HistoryArray = { - [key: string]: HistoryEntry[]; -}; - -type ModalData = { - can_db_request: boolean; - view_raw: boolean; - history: HistoryArray; -}; - -const ModifyPage = (props) => { - const { act, data } = useBackend(); - - const { can_db_request, view_raw, history } = data; - const [modifyMethod, setModifyMethod] = useLocalState('ModifyMethod', ''); - const [modifyTarget, setModifyTarget] = useLocalState('ModifyTarget', 0); - const [reason, setReason] = useState('null'); - - const entries = history[modifyTarget.toString()] - ? history[modifyTarget.toString()].sort((a, b) => b.id - a.id) - : []; - - return ( - - - Heads Up! We do not allow you to fully delete books in game -
- What you're doing here is a "don't show this to - anyone" button -
- If you for whatever reason need to fully wipe a book, please speak to - your database administrator -
- - - Why do you want to {modifyMethod} this book? - - - - - -