From aebdbbc39fc2b99e680e496d6dbdfaf9737412ae Mon Sep 17 00:00:00 2001 From: meemofcourse <75212565+meemofcourse@users.noreply.github.com> Date: Thu, 31 Aug 2023 21:55:02 -0400 Subject: [PATCH] tgui stuff --- code/modules/paperwork/fax.dm | 6 ++ tgui/packages/tgui/interfaces/AdminFax.js | 97 +++++++++++++++---- tgui/packages/tgui/interfaces/Fax.tsx | 12 +-- .../tgui/interfaces/RequestManager.js | 27 ++++-- .../styles/interfaces/RequestManager.scss | 5 - 5 files changed, 109 insertions(+), 38 deletions(-) diff --git a/code/modules/paperwork/fax.dm b/code/modules/paperwork/fax.dm index 0c9e3928cf7a..8ad0711ad0a1 100644 --- a/code/modules/paperwork/fax.dm +++ b/code/modules/paperwork/fax.dm @@ -310,6 +310,7 @@ loaded_item_ref = null update_icon() return TRUE + if("send") var/obj/item/loaded = loaded_item_ref?.resolve() if(!loaded) @@ -320,13 +321,16 @@ loaded_item_ref = null update_icon() return TRUE + if("send_special") var/obj/item/paper/fax_paper = loaded_item_ref?.resolve() if(!istype(fax_paper)) to_chat(usr, icon2html(src.icon, usr) + "ERROR: Failed to send fax.") return + fax_paper.request_state = TRUE fax_paper.loc = null + INVOKE_ASYNC(src, PROC_REF(animate_object_travel), fax_paper, "fax_receive", find_overlay_state(fax_paper, "send")) history_add("Send", params["name"]) @@ -340,10 +344,12 @@ fax.receive(fax_paper, fax_name) break update_appearance() + if("history_clear") history_clear() return TRUE + /** * Records logs of bureacratic action * Arguments: diff --git a/tgui/packages/tgui/interfaces/AdminFax.js b/tgui/packages/tgui/interfaces/AdminFax.js index 89870f45451d..6b6b4f64bec4 100644 --- a/tgui/packages/tgui/interfaces/AdminFax.js +++ b/tgui/packages/tgui/interfaces/AdminFax.js @@ -1,5 +1,16 @@ import { useBackend, useLocalState } from '../backend'; -import { Section, Box, Dropdown, Button, Input, TextArea, Divider, NumberInput, Tooltip, Knob } from '../components'; +import { + Section, + Box, + Dropdown, + Button, + Input, + TextArea, + Divider, + NumberInput, + Tooltip, + Knob, +} from '../components'; import { Window } from '../layouts'; export const AdminFax = (props, context) => { @@ -21,8 +32,16 @@ export const FaxMainPanel = (props, context) => { const [fromWho, setFromWho] = useLocalState(context, 'fromWho', ''); const [rawText, setRawText] = useLocalState(context, 'rawText', ''); const [stamp, setStamp] = useLocalState(context, 'stampType', ''); - const [stampCoordX, setStampCoordX] = useLocalState(context, 'stampCoordX', 0); - const [stampCoordY, setStampCoordY] = useLocalState(context, 'stampCoordY', 0); + const [stampCoordX, setStampCoordX] = useLocalState( + context, + 'stampCoordX', + 0 + ); + const [stampCoordY, setStampCoordY] = useLocalState( + context, + 'stampCoordY', + 0 + ); const [stampAngle, setStampAngle] = useLocalState(context, 'stampAngle', 0); if (stamp && data.stamps[0] !== 'None') { data.stamps.unshift('None'); @@ -40,11 +59,13 @@ export const FaxMainPanel = (props, context) => { act('follow', { faxName: fax, }) - }> + } + > Follow - }> + } + > { act('preview', { faxName: fax, }) - }> + } + > Preview - }> + } + > - setPaperName(v)} /> - - - setFromWho(v)} /> + setFromWho(v)} + /> - - @@ -133,7 +188,12 @@ export const FaxMainPanel = (props, context) => {

Y Coordinate:{' '} - setStampCoordY(v)} /> + setStampCoordY(v)} + />

@@ -161,7 +221,8 @@ export const FaxMainPanel = (props, context) => { act('send', { faxName: fax, }) - }> + } + > Send Fax diff --git a/tgui/packages/tgui/interfaces/Fax.tsx b/tgui/packages/tgui/interfaces/Fax.tsx index 015e88270596..34e798749d0b 100644 --- a/tgui/packages/tgui/interfaces/Fax.tsx +++ b/tgui/packages/tgui/interfaces/Fax.tsx @@ -9,7 +9,7 @@ type FaxData = { fax_name: string; visible: boolean; has_paper: string; - frontier_network: boolean; + syndicate_network: boolean; fax_history: FaxHistory[]; special_faxes: FaxSpecial[]; }; @@ -19,7 +19,7 @@ type FaxInfo = { fax_id: string; visible: boolean; has_paper: boolean; - syndicate_network: boolean; + frontier_network: boolean; }; type FaxHistory = { @@ -40,11 +40,11 @@ export const Fax = (props, context) => { const { data } = useBackend(context); const faxes = data.faxes ? sortBy((sortFax: FaxInfo) => sortFax.fax_name)( - data.frontier_network + data.syndicate_network ? data.faxes.filter((filterFax: FaxInfo) => filterFax.visible) : data.faxes.filter( (filterFax: FaxInfo) => - filterFax.visible && !filterFax.syndicate_network + filterFax.visible && !filterFax.frontier_network ) ) : []; @@ -82,7 +82,7 @@ export const Fax = (props, context) => {
{faxes.length !== 0 ? ( - {(data.frontier_network + {(data.syndicate_network ? data.special_faxes : data.special_faxes.filter( (fax: FaxSpecial) => !fax.emag_needed @@ -108,7 +108,7 @@ export const Fax = (props, context) => { key={fax.fax_id} title={fax.fax_name} disabled={!data.has_paper} - color={fax.syndicate_network ? 'red' : 'blue'} + color={fax.frontier_network ? 'red' : 'blue'} onClick={() => act('send', { id: fax.fax_id, diff --git a/tgui/packages/tgui/interfaces/RequestManager.js b/tgui/packages/tgui/interfaces/RequestManager.js index 2dc8c2ae2ce1..5d8d2c468a53 100644 --- a/tgui/packages/tgui/interfaces/RequestManager.js +++ b/tgui/packages/tgui/interfaces/RequestManager.js @@ -1,8 +1,8 @@ /** -* @file -* @copyright 2021 bobbahbrown (https://github.com/bobbahbrown) -* @license MIT -*/ + * @file + * @copyright 2021 bobbahbrown (https://github.com/bobbahbrown) + * @license MIT + */ import { decodeHtmlEntities } from 'common/string'; import { useBackend, useLocalState } from '../backend'; @@ -32,8 +32,8 @@ export const RequestManager = (props, context) => { (request) => decodeHtmlEntities(request.message) .toLowerCase() - .includes(filterText) - || request.owner_name.toLowerCase().includes(filterText) + .includes(filterText) || + request.owner_name.toLowerCase().includes(filterText) ); } @@ -52,7 +52,8 @@ export const RequestManager = (props, context) => { /> - }> + } + > {displayedRequests.map((request) => (
@@ -84,6 +85,7 @@ const displayTypeMap = { 'request_centcom': 'CENTCOM', 'request_syndicate': 'SYNDICATE', 'request_nuke': 'NUKE CODE', + 'request_fax': 'FAX', }; const RequestType = (props) => { @@ -117,6 +119,9 @@ const RequestControls = (props, context) => { SETCODE )} + {request.req_type === 'request_fax' && ( + + )}
); }; @@ -145,7 +150,8 @@ const FilterPanel = (_, context) => { className="RequestManager__filterPanel" style={{ display: filterVisible ? 'block' : 'none', - }}> + }} + > {Object.keys(displayTypeMap).map((type) => { return ( @@ -168,10 +174,11 @@ const FilterPanel = (_, context) => { })}
- }> + } + > ); -}; \ No newline at end of file +}; diff --git a/tgui/packages/tgui/styles/interfaces/RequestManager.scss b/tgui/packages/tgui/styles/interfaces/RequestManager.scss index 1003440243a4..f560918ed3d5 100644 --- a/tgui/packages/tgui/styles/interfaces/RequestManager.scss +++ b/tgui/packages/tgui/styles/interfaces/RequestManager.scss @@ -12,7 +12,6 @@ $color-centcom: colors.bg(colors.$yellow) !default; $color-syndicate: colors.bg(colors.$red) !default; $color-nuke: colors.bg(colors.$yellow) !default; $color-fax: colors.bg(colors.$green) !default; -$color-music: colors.bg(colors.$teal) !default; $color-muted: colors.bg(colors.$label) !default; $color-header: colors.bg(colors.$label) !default; $background-color: base.$color-bg-section !default; @@ -45,10 +44,6 @@ $text-color: base.$color-fg !default; color: $color-fax; } -.RequestManager__request_internet_sound { - color: $color-music; -} - .RequestManager__header { line-height: 1.375rem; min-height: 1.375rem;