diff --git a/code/modules/stockmarket/computer.dm b/code/modules/stockmarket/computer.dm index 414a64cc91..e33931ec2a 100644 --- a/code/modules/stockmarket/computer.dm +++ b/code/modules/stockmarket/computer.dm @@ -22,7 +22,7 @@ //if(!ai_control && issilicon(user)) // to_chat(user, "Access Denied.") // return TRUE - + tgui_interact(user) /obj/machinery/computer/stockexchange/proc/balance() @@ -37,6 +37,9 @@ add_fingerprint(usr) switch(action) + if ("logout") + logged_in = null + if("stocks_buy") var/datum/stock/S = locate(params["share"]) in GLOB.stockExchange.stocks if (S) @@ -66,7 +69,7 @@ popup.open() if("stocks_archive") - var/datum/stock/S = locate(params["archive"]) + var/datum/stock/S = locate(params["share"]) if (logged_in && logged_in != "") var/list/LR = GLOB.stockExchange.last_read[S] LR[logged_in] = world.time @@ -94,7 +97,7 @@ popup.open() if("stocks_history") - var/datum/stock/S = locate("history") in GLOB.stockExchange.stocks + var/datum/stock/S = locate(params["share"]) in GLOB.stockExchange.stocks if (S) S.displayValues(usr) @@ -132,12 +135,15 @@ value = S.current_value data["stocks"] += list(list( + "REF" = REF(S), + "valueChange" = S.disp_value_change, // > 0 is +, < 0 is -, else its = "bankrupt" = S.bankrupt, "ID" = S.short_name, "Name" = S.name, "Value" = value, "Owned" = mystocks, "Avail" = S.available_shares, + "Products" = S.products, )) var/news = 0 @@ -152,41 +158,27 @@ for (var/datum/stockEvent/E in S.events) if (E.last_change > lrt && !E.hidden) news = 1 - - /* - if(S.disp_value_change > 0) - dat += "+" - else if(S.disp_value_change < 0) - dat += "-" - else - dat += "=" - - - - if(mystocks) - dat += "[]" - else - dat += "0 - */ - - else for (var/datum/stock/S in GLOB.stockExchange.stocks) var/mystocks = 0 if (logged_in && (logged_in in S.shareholders)) mystocks = S.shareholders[logged_in] - //dat += "
[S.name] ([S.short_name])[S.bankrupt ? " BANKRUPT" : null]
" - //if (S.last_unification) - // dat += "Unified shares [DisplayTimeText(world.time - S.last_unification)] ago.
" - //dat += "Current value per share: [S.current_value] | View history

" - //dat += "You currently own [mystocks] shares in this company. There are [S.available_shares] purchasable shares on the market currently.
" - //if (S.bankrupt) - // dat += "You cannot buy or sell shares in a bankrupt company!

" - //else - // dat += "Buy shares | Sell shares

" - //dat += "Prominent products:
" - for (var/prod in S.products) - dat += "[prod]
" + + var/unification = 0 + if (S.last_unification) + unification = DisplayTimeText(world.time - S.last_unification) + + data["stocks"] += list(list( + "REF" = REF(S), + "bankrupt" = S.bankrupt, + "ID" = S.short_name, + "Name" = S.name, + "Owned" = mystocks, + "Avail" = S.available_shares, + "Unification" = unification, + "Products" = S.products, + )) + var/news = 0 if (logged_in) var/list/LR = GLOB.stockExchange.last_read[S] @@ -200,40 +192,6 @@ if (E.last_change > lrt && !E.hidden) news = 1 break - //dat += "View news archives[news ? " (updated)" : null]
" - - /* - - .change { - font-weight: bold; - font-family: monospace; -} -.up { - background: #00a000; -} -.down { - background: #a00000; -} -.stable { - width: 100% - border-collapse: collapse; - border: 1px solid #305260; - border-spacing: 4px 4px; -} -.stable td, .stable th { - border: 1px solid #305260; - padding: 0px 3px; -} -.bankrupt { - border: 1px solid #a00000; - background: #a00000; -} - -a.updated { - color: red; -} - - */ return data @@ -326,8 +284,5 @@ a.updated { if (!usr || (!(usr in range(1, src)) && iscarbon(usr))) usr.machine = src - if (href_list["logout"]) - logged_in = null - src.add_fingerprint(usr) src.updateUsrDialog() \ No newline at end of file diff --git a/maps/virgo_minitest/virgo_minitest-1.dmm b/maps/virgo_minitest/virgo_minitest-1.dmm index fd81e96920..4dbf470b92 100644 --- a/maps/virgo_minitest/virgo_minitest-1.dmm +++ b/maps/virgo_minitest/virgo_minitest-1.dmm @@ -168,8 +168,8 @@ pixel_x = 24 }, /obj/structure/cable{ - icon_state = "0-2"; - d2 = 2 + d2 = 2; + icon_state = "0-2" }, /turf/simulated/floor/tiled, /area/tcommsat/computer) @@ -179,8 +179,8 @@ /area/space) "aA" = ( /obj/machinery/atmospherics/pipe/manifold/visible/cyan{ - icon_state = "map"; - dir = 4 + dir = 4; + icon_state = "map" }, /turf/simulated/floor/plating, /area/engineering/engine_room) @@ -353,8 +353,8 @@ dir = 8 }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/machinery/atmospherics/pipe/simple/hidden/black{ dir = 6 @@ -368,8 +368,8 @@ dir = 1 }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/structure/cable{ d2 = 8; @@ -386,8 +386,8 @@ }, /obj/structure/cable, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/structure/cable{ d2 = 8; @@ -405,8 +405,8 @@ dir = 1 }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/structure/cable{ d2 = 8; @@ -468,8 +468,8 @@ /area/engineering/engine_room) "aY" = ( /obj/machinery/atmospherics/pipe/simple/visible/cyan{ - icon_state = "intact"; - dir = 5 + dir = 5; + icon_state = "intact" }, /obj/structure/cable{ d1 = 1; @@ -495,8 +495,8 @@ dir = 4 }, /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 9 + dir = 9; + icon_state = "camera" }, /turf/simulated/floor/plating, /area/engineering/engine_room) @@ -541,8 +541,8 @@ /area/tcommsat/chamber) "bg" = ( /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/machinery/power/apc{ dir = 1; @@ -709,8 +709,8 @@ pixel_y = 0 }, /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 4 + dir = 4; + icon_state = "camera" }, /turf/simulated/floor/plating, /area/engineering/engine_room) @@ -747,8 +747,8 @@ /area/tcommsat/chamber) "bw" = ( /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/machinery/power/apc{ dir = 2; @@ -798,8 +798,8 @@ name_tag = "MiniTest" }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /obj/structure/cable{ d2 = 8; @@ -933,8 +933,8 @@ pixel_y = 0 }, /obj/machinery/light{ - icon_state = "tube1"; - dir = 8 + dir = 8; + icon_state = "tube1" }, /turf/simulated/floor/bluegrid{ name = "Mainframe Base"; @@ -1115,8 +1115,8 @@ pixel_x = -32 }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /turf/simulated/floor/tiled, /area/hallway/secondary/engineering_hallway) @@ -1227,9 +1227,9 @@ external_pressure_bound = 140; external_pressure_bound_default = 140; icon_state = "map_vent_out"; - use_power = 1; pressure_checks = 0; - pressure_checks_default = 0 + pressure_checks_default = 0; + use_power = 1 }, /turf/simulated/floor/bluegrid{ name = "Mainframe Base"; @@ -1260,10 +1260,10 @@ initialize_directions = 1; internal_pressure_bound = 4000; internal_pressure_bound_default = 4000; - use_power = 1; pressure_checks = 2; pressure_checks_default = 2; - pump_direction = 0 + pump_direction = 0; + use_power = 1 }, /turf/simulated/floor/bluegrid{ name = "Mainframe Base"; @@ -2299,8 +2299,8 @@ icon_state = "0-8" }, /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 10 + dir = 10; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/crew_quarters/bar) @@ -2682,8 +2682,8 @@ pixel_y = 32 }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /turf/simulated/floor/tiled, /area/crew_quarters/cafeteria) @@ -2874,8 +2874,8 @@ pixel_y = 32 }, /obj/structure/cable{ - icon_state = "0-4"; - d2 = 4 + d2 = 4; + icon_state = "0-4" }, /turf/simulated/floor/tiled, /area/bridge) @@ -3312,17 +3312,21 @@ /obj/structure/shuttle, /turf/simulated/shuttle/wall/voidcraft/green, /area/shuttle/overmapdemo) +"lU" = ( +/obj/machinery/computer/stockexchange, +/turf/simulated/floor/tiled, +/area/bridge) "mj" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 10 + dir = 10; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/crew_quarters/bar) "nM" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 9 + dir = 9; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/crew_quarters/cafeteria) @@ -3332,8 +3336,8 @@ /area/bridge) "pG" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 9 + dir = 9; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/bridge) @@ -3363,8 +3367,8 @@ /area/bridge) "rK" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 10 + dir = 10; + icon_state = "camera" }, /turf/simulated/floor/bluegrid{ name = "Mainframe Base"; @@ -3399,15 +3403,15 @@ /area/shuttle/overmapdemo) "xM" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 5 + dir = 5; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/crew_quarters/cafeteria) "xX" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 4 + dir = 4; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/medical/medbay) @@ -3439,8 +3443,8 @@ icon_state = "1-2" }, /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 9 + dir = 9; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/hallway/primary/fore) @@ -3466,8 +3470,8 @@ /area/shuttle/overmapdemo) "OA" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 10 + dir = 10; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/medical/medbay) @@ -3487,8 +3491,8 @@ /area/bridge) "Ug" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 4 + dir = 4; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/medical/medbay2) @@ -3500,8 +3504,8 @@ /area/shuttle/overmapdemo) "Vf" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 9 + dir = 9; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/crew_quarters/bar) @@ -3521,8 +3525,8 @@ /area/shuttle/overmapdemo) "Yb" = ( /obj/machinery/camera/network/civilian{ - icon_state = "camera"; - dir = 9 + dir = 9; + icon_state = "camera" }, /turf/simulated/floor/tiled, /area/medical/medbay2) @@ -5545,7 +5549,7 @@ fY GC gf gr -gf +lU gf gz gf diff --git a/tgui/packages/tgui/interfaces/StockExchange.js b/tgui/packages/tgui/interfaces/StockExchange.js index d41f772a98..5d283129ca 100644 --- a/tgui/packages/tgui/interfaces/StockExchange.js +++ b/tgui/packages/tgui/interfaces/StockExchange.js @@ -1,5 +1,5 @@ import { useBackend } from "../backend"; -import { Button, Divider, Section, Table } from "../components"; +import { Box, Button, Divider, Section, Table } from "../components"; import { Window } from "../layouts"; export const StockExchange = (props, context) => { @@ -12,8 +12,19 @@ export const StockExchange = (props, context) => { stocks = [], } = data; + let subTemplate = ; + + if (viewMode === "Full") { + subTemplate = ; + } else if (viewMode === "Compressed") { + subTemplate = ; + } + return ( - +
Welcome, {stationName} Cargo Department | @@ -29,70 +40,114 @@ export const StockExchange = (props, context) => { This is a work in progress. Certain features may not be available.
- Actions: + Buy, - Sell, (A)rchives, (H)istory - - - - -   - - - ID - - - Name - - - Value - - - Owned - - - Avail - - - Actions - - - - {stocks.map(stock => ( - - -   - - - {stock.ID} - - - {stock.Name} - - - {stock.Value} - - - {stock.Owned} - - - {stock.Avail} - - -
+ {subTemplate}
); }; + +const StockExchangeFullView = (props, context) => { + const { act, data } = useBackend(context); + + const { + stocks = [], + } = data; + + return ( + + Actions: + Buy, - Sell, (A)rchives, (H)istory + + + + +   + + + ID + + + Name + + + Value + + + Owned + + + Avail + + + Actions + + + + {stocks.map(stock => ( + + +   + + + {stock.ID} + + + {stock.Name} + + + {stock.Value} + + + {stock.Owned} + + + {stock.Avail} + + +
+
+ ); +}; + +const StockExchangeCompactView = (props, context) => { + const { act, data } = useBackend(context); + + const { + stocks = [], + } = data; + + return ( + + {stocks.map(stock => ( + + {stock.name} {stock.ID}{stock.bankrupt === 1 && BANKRUPT }
+ Unified shares {stock.Unification} ago.
+ Current value per share: {stock.Value} |