mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-26 21:49:11 +01:00
Merge pull request #12858 from ItsSelis/selis-stocks-quality1
(Stocks) UI Migration & Bugfix
This commit is contained in:
@@ -5,21 +5,36 @@
|
||||
icon_state = "stockmarket"
|
||||
icon_screen = "stocks"
|
||||
icon_keyboard = "stockmarket_key"
|
||||
circuit = /obj/item/weapon/circuitboard/stockexchange
|
||||
var/logged_in = "Cargo Department"
|
||||
var/vmode = 1
|
||||
|
||||
var/screen = "stocks"
|
||||
var/datum/stock/current_stock = null
|
||||
|
||||
light_color = LIGHT_COLOR_GREEN
|
||||
|
||||
/obj/machinery/computer/stockexchange/Initialize()
|
||||
. = ..()
|
||||
logged_in = "Cargo Department"
|
||||
|
||||
/obj/machinery/computer/stockexchange/Destroy()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/stockexchange/attackby(obj/item/W, mob/user, params)
|
||||
..()
|
||||
SStgui.update_uis(src)
|
||||
return
|
||||
|
||||
/obj/machinery/computer/stockexchange/attack_ai(mob/user)
|
||||
src.attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/stockexchange/attack_hand(mob/user)
|
||||
if(..(user))
|
||||
return
|
||||
|
||||
//if(!ai_control && issilicon(user))
|
||||
// to_chat(user, "<span class='warning'>Access Denied.</span>")
|
||||
// return TRUE
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
tgui_interact(user)
|
||||
|
||||
@@ -51,56 +66,28 @@
|
||||
sell_some_shares(S, usr)
|
||||
|
||||
if("stocks_check")
|
||||
var/dat = "<html><head><title>Stock Transaction Logs</title></head><body><h2>Stock Transaction Logs</h2><div><a href='?src=[REF(src)];show_logs=1'>Refresh</a></div></br>"
|
||||
for(var/D in GLOB.stockExchange.logs)
|
||||
var/datum/stock_log/L = D
|
||||
if(istype(L, /datum/stock_log/buy))
|
||||
dat += "[L.time] | <b>[L.user_name]</b> bought <b>[L.stocks]</b> stocks at [L.shareprice] a share for <b>[L.money]</b> total credits in <b>[L.company_name]</b>.</br>"
|
||||
continue
|
||||
if(istype(L, /datum/stock_log/sell))
|
||||
dat += "[L.time] | <b>[L.user_name]</b> sold <b>[L.stocks]</b> stocks at [L.shareprice] a share for <b>[L.money]</b> total credits from <b>[L.company_name]</b>.</br>"
|
||||
continue
|
||||
if(istype(L, /datum/stock_log/borrow))
|
||||
dat += "[L.time] | <b>[L.user_name]</b> borrowed <b>[L.stocks]</b> stocks with a deposit of <b>[L.money]</b> credits in <b>[L.company_name]</b>.</br>"
|
||||
continue
|
||||
var/datum/browser/popup = new(usr, "stock_logs", "Stock Transaction Logs", 600, 400)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
screen = "logs"
|
||||
|
||||
if("stocks_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
|
||||
var/dat = "<html><head><title>News feed for [S.name]</title></head><body><h2>News feed for [S.name]</h2><div><a href='?src=[REF(src)];archive=[REF(S)]'>Refresh</a></div>"
|
||||
dat += "<div><h3>Events</h3>"
|
||||
var/p = 0
|
||||
for (var/datum/stockEvent/E in S.events)
|
||||
if (E.hidden)
|
||||
continue
|
||||
if (p > 0)
|
||||
dat += "<hr>"
|
||||
dat += "<div><b>[E.current_title]</b></br>[E.current_desc]</div>"
|
||||
p++
|
||||
dat += "</div><hr><div><h3>Articles</h3>"
|
||||
p = 0
|
||||
for (var/datum/article/A in S.articles)
|
||||
if (p > 0)
|
||||
dat += "<hr>"
|
||||
dat += "<div><b>[A.headline]</b><br><i>[A.subtitle]</i><br><br>[A.article]<br>- [A.author], [A.spacetime] (via <i>[A.outlet]</i>)</div>"
|
||||
p++
|
||||
dat += "</div></body></html>"
|
||||
var/datum/browser/popup = new(usr, "archive_[S.name]", "Stock News", 600, 400)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
if(S)
|
||||
current_stock = S
|
||||
//if (logged_in && logged_in != "")
|
||||
// var/list/LR = GLOB.stockExchange.last_read[S]
|
||||
// LR[logged_in] = world.time
|
||||
screen = "archive"
|
||||
|
||||
if("stocks_history")
|
||||
var/datum/stock/S = locate(params["share"]) in GLOB.stockExchange.stocks
|
||||
if (S)
|
||||
//current_stock = S
|
||||
//screen = "graph"
|
||||
S.displayValues(usr)
|
||||
|
||||
if("stocks_backbutton")
|
||||
current_stock = null
|
||||
screen = "stocks"
|
||||
|
||||
if("stocks_cycle_view")
|
||||
vmode++
|
||||
if (vmode > 1)
|
||||
@@ -111,87 +98,158 @@
|
||||
|
||||
data["stationName"] = using_map.station_name
|
||||
data["balance"] = balance()
|
||||
data["screen"] = screen
|
||||
|
||||
switch(screen)
|
||||
// Main Stocks List
|
||||
if("stocks")
|
||||
if (vmode)
|
||||
data["viewMode"] = "Full"
|
||||
else
|
||||
data["viewMode"] = "Compressed"
|
||||
|
||||
if (vmode)
|
||||
data["viewMode"] = "Full"
|
||||
else
|
||||
data["viewMode"] = "Compressed"
|
||||
|
||||
for (var/datum/stock/S in GLOB.stockExchange.last_read)
|
||||
var/list/LR = GLOB.stockExchange.last_read[S]
|
||||
if (!(logged_in in LR))
|
||||
LR[logged_in] = 0
|
||||
|
||||
data["stocks"] = list()
|
||||
|
||||
if (vmode)
|
||||
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]
|
||||
|
||||
var/value = 0
|
||||
if (!S.bankrupt)
|
||||
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
|
||||
if (logged_in)
|
||||
for (var/datum/stock/S in GLOB.stockExchange.last_read)
|
||||
var/list/LR = GLOB.stockExchange.last_read[S]
|
||||
var/lrt = LR[logged_in]
|
||||
for (var/datum/article/A in S.articles)
|
||||
if (A.ticks > lrt)
|
||||
news = 1
|
||||
break
|
||||
if (!news)
|
||||
for (var/datum/stockEvent/E in S.events)
|
||||
if (E.last_change > lrt && !E.hidden)
|
||||
news = 1
|
||||
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]
|
||||
if (!(logged_in in LR))
|
||||
LR[logged_in] = 0
|
||||
|
||||
var/unification = 0
|
||||
if (S.last_unification)
|
||||
unification = DisplayTimeText(world.time - S.last_unification)
|
||||
data["stocks"] = list()
|
||||
|
||||
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,
|
||||
))
|
||||
if (vmode)
|
||||
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]
|
||||
|
||||
var/news = 0
|
||||
if (logged_in)
|
||||
var/list/LR = GLOB.stockExchange.last_read[S]
|
||||
var/lrt = LR[logged_in]
|
||||
for (var/datum/article/A in S.articles)
|
||||
if (A.ticks > lrt)
|
||||
news = 1
|
||||
break
|
||||
if (!news)
|
||||
for (var/datum/stockEvent/E in S.events)
|
||||
if (E.last_change > lrt && !E.hidden)
|
||||
news = 1
|
||||
break
|
||||
var/value = 0
|
||||
if (!S.bankrupt)
|
||||
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
|
||||
if (logged_in)
|
||||
var/list/LR = GLOB.stockExchange.last_read[S]
|
||||
var/lrt = LR[logged_in]
|
||||
for (var/datum/article/A in S.articles)
|
||||
if (A.ticks > lrt)
|
||||
news = 1
|
||||
break
|
||||
if (!news)
|
||||
for (var/datum/stockEvent/E in S.events)
|
||||
if (E.last_change > lrt && !E.hidden)
|
||||
news = 1
|
||||
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]
|
||||
|
||||
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]
|
||||
var/lrt = LR[logged_in]
|
||||
for (var/datum/article/A in S.articles)
|
||||
if (A.ticks > lrt)
|
||||
news = 1
|
||||
break
|
||||
if (!news)
|
||||
for (var/datum/stockEvent/E in S.events)
|
||||
if (E.last_change > lrt && !E.hidden)
|
||||
news = 1
|
||||
break
|
||||
|
||||
// Stocks Logs Screen
|
||||
if("logs")
|
||||
data["logs"] = list()
|
||||
|
||||
for(var/D in GLOB.stockExchange.logs)
|
||||
var/datum/stock_log/L = D
|
||||
|
||||
if (istype(L, /datum/stock_log/buy))
|
||||
data["logs"] += list(list(
|
||||
"type" = "transaction_bought",
|
||||
"time" = L.time,
|
||||
"user_name" = L.user_name,
|
||||
"stocks" = L.stocks,
|
||||
"shareprice" = L.shareprice,
|
||||
"money" = L.money,
|
||||
"company_name" = L.company_name,
|
||||
))
|
||||
else if (istype(L, /datum/stock_log/sell))
|
||||
data["logs"] += list(list(
|
||||
"type" = "transaction_sold",
|
||||
"time" = L.time,
|
||||
"user_name" = L.user_name,
|
||||
"stocks" = L.stocks,
|
||||
"shareprice" = L.shareprice,
|
||||
"money" = L.money,
|
||||
"company_name" = L.company_name,
|
||||
))
|
||||
else if (istype(L, /datum/stock_log/borrow))
|
||||
data["logs"] += list(list(
|
||||
"type" = "borrow",
|
||||
"time" = L.time,
|
||||
"user_name" = L.user_name,
|
||||
"stocks" = L.stocks,
|
||||
"money" = L.money,
|
||||
"company_name" = L.company_name,
|
||||
))
|
||||
|
||||
// Archive Screen
|
||||
if("archive")
|
||||
data["name"] = current_stock.name
|
||||
data["events"] = list()
|
||||
data["articles"] = list()
|
||||
|
||||
for (var/datum/stockEvent/E in current_stock.events)
|
||||
if (E.hidden)
|
||||
continue
|
||||
data["events"] += list(list(
|
||||
"current_title" = E.current_title,
|
||||
"current_desc" = E.current_desc,
|
||||
))
|
||||
|
||||
for (var/datum/article/A in current_stock.articles)
|
||||
data["articles"] += list(list(
|
||||
"headline" = A.headline,
|
||||
"subtitle" = A.subtitle,
|
||||
"article" = A.article,
|
||||
"author" = A.author,
|
||||
"spacetime" = A.spacetime,
|
||||
"outlet" = A.outlet,
|
||||
))
|
||||
|
||||
// Stock Graph
|
||||
if("graph")
|
||||
data["name"] = current_stock.name
|
||||
data["maxValue"] = 100
|
||||
data["values"] = current_stock.values
|
||||
|
||||
return data
|
||||
|
||||
@@ -201,52 +259,6 @@
|
||||
ui = new(user, src, "StockExchange")
|
||||
ui.open()
|
||||
|
||||
///// HISTORY SCREEN /////
|
||||
|
||||
/obj/machinery/computer/stockexchange/history/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "StockExchangeHistory")
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/stockexchange/history/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
//data["var"] = var
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/stockexchange/history/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("copypasta")
|
||||
//var/newvar = params["var"]
|
||||
// A demo of proper input sanitation.
|
||||
//var = CLAMP(newvar, min_val, max_val)
|
||||
. = TRUE
|
||||
|
||||
///// ARCHIVE SCREEN /////
|
||||
|
||||
/obj/machinery/computer/stockexchange/archive/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "StockExchangeArchive")
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/stockexchange/archive/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
//data["var"] = var
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/stockexchange/archive/tgui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("copypasta")
|
||||
//var/newvar = params["var"]
|
||||
// A demo of proper input sanitation.
|
||||
//var = CLAMP(newvar, min_val, max_val)
|
||||
. = TRUE
|
||||
|
||||
///// PROCS /////
|
||||
|
||||
/obj/machinery/computer/stockexchange/proc/sell_some_shares(var/datum/stock/S, var/mob/user)
|
||||
|
||||
@@ -1,15 +1,47 @@
|
||||
import { useBackend } from "../backend";
|
||||
import { Box, Button, Divider, Section, Table } from "../components";
|
||||
import { Box, Button, Chart, Divider, Section, Table } from "../components";
|
||||
import { Window } from "../layouts";
|
||||
|
||||
export const StockExchange = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
screen,
|
||||
stationName,
|
||||
} = data;
|
||||
|
||||
let body;
|
||||
if (screen === "stocks") {
|
||||
body = <StockExchangeStockList />;
|
||||
} else if (screen === "logs") {
|
||||
body = <StockExchangeLogs />;
|
||||
} else if (screen === "archive") {
|
||||
body = <StockExchangeArchive />;
|
||||
} else if (screen === "graph") {
|
||||
body = <StockExchangeGraph />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Window
|
||||
width={600}
|
||||
height={600}
|
||||
resizable>
|
||||
<Window.Content scrollable>
|
||||
<Section title={`${stationName} Stock Exchange`}>
|
||||
{body}
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
const StockExchangeStockList = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
balance,
|
||||
stationName,
|
||||
viewMode,
|
||||
stocks = [],
|
||||
} = data;
|
||||
|
||||
let subTemplate = <StockExchangeFullView />;
|
||||
@@ -21,29 +53,23 @@ export const StockExchange = (props, context) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Window
|
||||
width={600}
|
||||
height={600}
|
||||
resizable>
|
||||
<Window.Content scrollable>
|
||||
<Section title={`${stationName} Stock Exchange`}>
|
||||
<span>Welcome, <b>{stationName} Cargo Department</b> | </span>
|
||||
<span><b>Credits:</b> {balance}</span><br />
|
||||
<b>View mode: </b>
|
||||
<Button content={viewMode}
|
||||
onClick={() => act("stocks_cycle_view")} /><br />
|
||||
<Box>
|
||||
<span>Welcome, <b>{stationName} Cargo Department</b> | </span>
|
||||
<span><b>Credits:</b> {balance}</span><br />
|
||||
<b>View mode: </b>
|
||||
<Button content={viewMode}
|
||||
onClick={() => act("stocks_cycle_view")} /><br />
|
||||
|
||||
<b>Stock Transaction Log: </b>
|
||||
<Button icon="list"
|
||||
content="Check"
|
||||
onClick={() => act("stocks_check")} /><br />
|
||||
<b>This is a work in progress. Certain features may not be available.</b>
|
||||
</Section>
|
||||
<Section title="Listed Stocks">
|
||||
{subTemplate}
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
<b>Stock Transaction Log: </b>
|
||||
<Button icon="list"
|
||||
content="Check"
|
||||
onClick={() => act("stocks_check")} /><br />
|
||||
<b>This is a work in progress. Certain features may not be available.</b>
|
||||
|
||||
<Section title="Listed Stocks">
|
||||
{subTemplate}
|
||||
</Section>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -152,32 +178,36 @@ const StockExchangeCompactView = (props, context) => {
|
||||
);
|
||||
};
|
||||
|
||||
const StockExchangeHistory = (props, context) => {
|
||||
// "<div><a href='?src=[REF(src)];show_logs=1'>Refresh</a></div></br>"
|
||||
const StockExchangeLogs = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
stocks = [],
|
||||
logs = [],
|
||||
} = data;
|
||||
|
||||
return (
|
||||
<Box>
|
||||
{stocks.map(stock => (
|
||||
<Box key={stock.ID}>
|
||||
<span>{stock.name}</span> <span>{stock.ID}</span>{stock.bankrupt === 1 && <b color="red">BANKRUPT</b> }<br />
|
||||
<b>Unified shares</b> {stock.Unification} ago.<br />
|
||||
<b>Current value per share:</b> {stock.Value} | <Button content="View history" onClick={() => act("stocks_history", { share: stock.REF })} /><br />
|
||||
You currently own <b>{stock.Owned}</b> shares in this company.<br />
|
||||
There are {stock.Avail} purchasable shares on the market currently.<br />
|
||||
|
||||
{stock.bankrupt === 1 ? <span>You cannot buy or sell shares in a bankrupt company!</span>
|
||||
: <span><Button content="Buy shares" onClick={() => act("stocks_buy", { share: stock.REF })} /> | <Button content="Sell shares" onClick={() => act("stocks_sell", { share: stock.REF })} /></span> }
|
||||
<br />
|
||||
<b>Prominent products:</b><br />
|
||||
<i>{stock.Products}</i><br />
|
||||
<Button content="View news archives" onClick={() => act("stocks_archive", { share: stock.REF })} /> { /* [news ? " <span style='color:red'>(updated)</span>" : null] */ }
|
||||
<Divider />
|
||||
</Box>
|
||||
))}
|
||||
<h2>Stock Transaction Logs</h2><br />
|
||||
<Button content="Go back" onClick={() => act("stocks_backbutton")} />
|
||||
<Divider />
|
||||
<div>
|
||||
{logs.map(log => (
|
||||
<Box key={log.time}>
|
||||
{log.type !== "borrow" ? (
|
||||
<div>
|
||||
{log.time} | <b>{log.user_name}</b> {log.type === "transaction_bought" ? <span>bought</span> : <span>sold</span> } <b>{log.stocks}</b> stocks at {log.shareprice} a share for <b>{log.money}</b> total credits {log.type === "transaction_bought" ? <span>in</span> : <span>from</span> } <b>{log.company_name}</b>.<br />
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
{log.time} | <b>{log.user_name}</b> borrowed <b>{log.stocks}</b> stocks with
|
||||
a deposit of <b>{log.money}</b> credits in <b>{log.company_name}</b>.<br />
|
||||
</div>
|
||||
)}
|
||||
<Divider />
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
@@ -186,28 +216,71 @@ const StockExchangeArchive = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
stocks = [],
|
||||
name,
|
||||
events = [],
|
||||
articles = [],
|
||||
} = data;
|
||||
|
||||
return (
|
||||
<Box>
|
||||
{stocks.map(stock => (
|
||||
<Box key={stock.ID}>
|
||||
<span>{stock.name}</span> <span>{stock.ID}</span>{stock.bankrupt === 1 && <b color="red">BANKRUPT</b> }<br />
|
||||
<b>Unified shares</b> {stock.Unification} ago.<br />
|
||||
<b>Current value per share:</b> {stock.Value} | <Button content="View history" onClick={() => act("stocks_history", { share: stock.REF })} /><br />
|
||||
You currently own <b>{stock.Owned}</b> shares in this company.<br />
|
||||
There are {stock.Avail} purchasable shares on the market currently.<br />
|
||||
|
||||
{stock.bankrupt === 1 ? <span>You cannot buy or sell shares in a bankrupt company!</span>
|
||||
: <span><Button content="Buy shares" onClick={() => act("stocks_buy", { share: stock.REF })} /> | <Button content="Sell shares" onClick={() => act("stocks_sell", { share: stock.REF })} /></span> }
|
||||
<br />
|
||||
<b>Prominent products:</b><br />
|
||||
<i>{stock.Products}</i><br />
|
||||
<Button content="View news archives" onClick={() => act("stocks_archive", { share: stock.REF })} /> { /* [news ? " <span style='color:red'>(updated)</span>" : null] */ }
|
||||
<Divider />
|
||||
</Box>
|
||||
))}
|
||||
<h2>News feed for {name}</h2>
|
||||
<Button content="Go back" onClick={() => act("stocks_backbutton")} />
|
||||
<h3>Events</h3>
|
||||
<Divider />
|
||||
<div>
|
||||
{events.map(event => (
|
||||
<Box key={event.current_title}>
|
||||
<div>
|
||||
<b>{event.current_title}</b><br />
|
||||
{event.current_desc}
|
||||
</div>
|
||||
<Divider />
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
<br />
|
||||
<h3>Articles</h3>
|
||||
<Divider />
|
||||
<div>
|
||||
{articles.map(article => (
|
||||
<Box key={article.headline}>
|
||||
<div>
|
||||
<b>{article.headline}</b>
|
||||
<i>{article.subtitle}</i><br />
|
||||
{article.article}<br />- {article.author}, {article.spacetime} (via <i>{article.outlet}</i>)
|
||||
</div>
|
||||
<Divider />
|
||||
</Box>
|
||||
))}
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
const StockExchangeGraph = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
|
||||
const {
|
||||
name,
|
||||
maxValue,
|
||||
values = [],
|
||||
} = data;
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Button content="Go back" onClick={() => act("stocks_backbutton")} />
|
||||
<Divider />
|
||||
<Section position="relative" height="100%">
|
||||
<Chart.Line
|
||||
fillPositionedParent
|
||||
data={values}
|
||||
rangeX={[0, values.length - 1]}
|
||||
rangeY={[0, maxValue]}
|
||||
strokeColor="rgba(0, 181, 173, 1)"
|
||||
fillColor="rgba(0, 181, 173, 0.25)" />
|
||||
</Section>
|
||||
<Divider />
|
||||
<p>{name} share value per share</p>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -551,12 +551,12 @@ o8o `8 "888" `Y8bood8P' 8""88888P'
|
||||
A fatal exception has occurred at 002B:C562F1B7 in TGUI.
|
||||
The current application will be terminated.
|
||||
Send the copy of the following stack trace to an authorized
|
||||
Nanotrasen incident handler at https://github.com/tgstation/tgstation.
|
||||
Nanotrasen incident handler at https://github.com/VOREStation/VOREStation.
|
||||
Thank you for your cooperation.
|
||||
</marquee>
|
||||
<div id="FatalError__stack" class="FatalError__stack"></div>
|
||||
<div class="FatalError__footer">
|
||||
Nanotrasen (c) 2525-2561
|
||||
Nanotrasen (c) 2225-2322
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user