diff --git a/.eslintrc.js b/.eslintrc.js
index cc4da5ace..d6c323f4a 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -63,7 +63,6 @@ module.exports = {
"id-blacklist": ["error"],
"id-length": ["off"],
"id-match": ["error"],
- "implicit-arrow-linebreak": ["error", "beside"],
indent: ["off"],
"indent-legacy": ["off"],
"init-declarations": ["off"],
diff --git a/css/companymanagement.scss b/css/companymanagement.scss
index 13e2ccdcc..6919c1bb4 100644
--- a/css/companymanagement.scss
+++ b/css/companymanagement.scss
@@ -133,6 +133,7 @@
}
.cmpy-mgmt-upgrade-div {
+ text-align: left;
display: inline-block;
border: 1px solid #fff;
margin: 2px;
diff --git a/src/Corporation/ui/LevelableUpgrade.tsx b/src/Corporation/ui/LevelableUpgrade.tsx
index 3fa536788..3d4ef2df0 100644
--- a/src/Corporation/ui/LevelableUpgrade.tsx
+++ b/src/Corporation/ui/LevelableUpgrade.tsx
@@ -40,9 +40,9 @@ export function LevelableUpgrade(props: IProps): React.ReactElement {
}
return (
-
+
+
);
}
diff --git a/src/Corporation/ui/Overview.tsx b/src/Corporation/ui/Overview.tsx
index 570e47dbe..2807c42be 100644
--- a/src/Corporation/ui/Overview.tsx
+++ b/src/Corporation/ui/Overview.tsx
@@ -27,330 +27,52 @@ interface IProps {
player: IPlayer;
rerender: () => void;
}
-
-export function Overview(props: IProps): React.ReactElement {
- // Generic Function for Creating a button
- interface ICreateButtonProps {
- text: string;
- class?: string;
- className?: string;
- display?: string;
- tooltip?: string;
- onClick?: (event: React.MouseEvent) => void;
- }
-
- function Button(props: ICreateButtonProps): React.ReactElement {
- let className = props.className ? props.className : "std-button";
- const hasTooltip = props.tooltip != null;
- if (hasTooltip) className += " tooltip";
- return (
-
- {props.text}
- {hasTooltip && {props.tooltip}}
-
- );
- }
-
- function openBribeFactionPopup(): void {
- const popupId = "corp-bribe-popup";
- createPopup(popupId, BribeFactionPopup, {
- player: props.player,
- popupId: popupId,
- corp: props.corp,
- });
- }
-
- const profit: number = props.corp.revenue.minus(props.corp.expenses).toNumber();
-
- function DividendsStats(): React.ReactElement {
- if (props.corp.dividendPercentage <= 0 || profit <= 0) return <>>;
- const totalDividends = (props.corp.dividendPercentage / 100) * profit;
- const retainedEarnings = profit - totalDividends;
- const dividendsPerShare = totalDividends / props.corp.totalShares;
- const playerEarnings = props.corp.numShares * dividendsPerShare;
- return (
- <>
- Retained Profits (after dividends): / s
-
- Dividend Percentage: {numeralWrapper.format(props.corp.dividendPercentage / 100, "0%")}
-
- Dividends per share: / s
- Your earnings as a shareholder (Pre-Tax): / s
- Dividend Tax Rate: {props.corp.dividendTaxPercentage}%
- Your earnings as a shareholder (Post-Tax):{" "}
- / s
-
- >
- );
- }
-
- function Mult(props: { name: string; mult: number }): React.ReactElement {
- if (props.mult <= 1) return <>>;
- return (
-
- {props.name}
- {numeralWrapper.format(props.mult, "0.000")}
-
-
- );
- }
-
- // Returns a string with general information about Corporation
- function BonusTime(): React.ReactElement {
- const storedTime = props.corp.storedCycles * CONSTANTS.MilliPerCycle;
- if (storedTime <= 15000) return <>>;
- return (
-
- Bonus time: {convertTimeMsToTimeElapsedString(storedTime)}
-
-
-
- );
- }
-
- function BribeButton(): React.ReactElement {
- const canBribe = props.corp.determineValuation() >= CorporationConstants.BribeThreshold || true;
- const bribeFactionsClass = canBribe ? "a-link-button" : "a-link-button-inactive";
- return (
-
- );
- }
-
- function openFindInvestorsPopup(): void {
- const popupId = "cmpy-mgmt-find-investors-popup";
- createPopup(popupId, FindInvestorsPopup, {
- rerender: props.rerender,
- player: props.player,
- popupId: popupId,
- corp: props.corp,
- });
- }
-
- function openGoPublicPopup(): void {
- const popupId = "cmpy-mgmt-go-public-popup";
- createPopup(popupId, GoPublicPopup, {
- rerender: props.rerender,
- player: props.player,
- popupId: popupId,
- corp: props.corp,
- });
- }
-
- // Render the buttons for when your Corporation is still private
- function PrivateButtons(): React.ReactElement {
- const fundingAvailable = props.corp.fundingRound < 4;
- const findInvestorsClassName = fundingAvailable ? "std-button" : "a-link-button-inactive";
- const findInvestorsTooltip = fundingAvailable
- ? "Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company"
- : undefined;
-
- return (
- <>
-
-
-
- >
- );
- }
-
- function openSellSharesPopup(): void {
- const popupId = "cmpy-mgmt-sell-shares-popup";
- createPopup(popupId, SellSharesPopup, {
- corp: props.corp,
- player: props.player,
- popupId: popupId,
- rerender: props.rerender,
- });
- }
-
- function openBuybackSharesPopup(): void {
- const popupId = "corp-buyback-shares-popup";
- createPopup(popupId, BuybackSharesPopup, {
- rerender: props.rerender,
- player: props.player,
- popupId: popupId,
- corp: props.corp,
- });
- }
-
- function openIssueNewSharesPopup(): void {
- const popupId = "cmpy-mgmt-issue-new-shares-popup";
- createPopup(popupId, IssueNewSharesPopup, {
- popupId: popupId,
- corp: props.corp,
- });
- }
-
- function openIssueDividendsPopup(): void {
- const popupId = "cmpy-mgmt-issue-dividends-popup";
- createPopup(popupId, IssueDividendsPopup, {
- popupId: popupId,
- corp: props.corp,
- });
- }
-
- // Render the buttons for when your Corporation has gone public
- function PublicButtons(): React.ReactElement {
- const corp = props.corp;
-
- const sellSharesOnCd = corp.shareSaleCooldown > 0;
- const sellSharesClass = sellSharesOnCd ? "a-link-button-inactive" : "std-button";
- const sellSharesTooltip = sellSharesOnCd
- ? "Cannot sell shares for " + corp.convertCooldownToString(corp.shareSaleCooldown)
- : "Sell your shares in the company. The money earned from selling your " +
- "shares goes into your personal account, not the Corporation's. " +
- "This is one of the only ways to profit from your business venture.";
-
- const issueNewSharesOnCd = corp.issueNewSharesCooldown > 0;
- const issueNewSharesClass = issueNewSharesOnCd ? "a-link-button-inactive" : "std-button";
- const issueNewSharesTooltip = issueNewSharesOnCd
- ? "Cannot issue new shares for " + corp.convertCooldownToString(corp.issueNewSharesCooldown)
- : "Issue new equity shares to raise capital.";
-
- return (
- <>
-
-
-
-
-
-
- >
- );
- }
-
- // Render the UI for Corporation upgrades
- function Upgrades(): React.ReactElement {
- // Don't show upgrades
- if (props.corp.divisions.length <= 0) {
- return Unlock upgrades after creating your first division
;
- }
-
- return (
-
-
Unlocks
- {Object.values(CorporationUnlockUpgrades)
- .filter((upgrade: CorporationUnlockUpgrade) => props.corp.unlockUpgrades[upgrade[0]] === 0)
- .map((upgrade: CorporationUnlockUpgrade) => (
-
- ))}
-
- Upgrades
- {props.corp.upgrades
- .map((level: number, i: number) => CorporationUpgrades[i])
- .map((upgrade: CorporationUpgrade) => (
-
- ))}
-
- );
- }
+export function Overview({ corp, player, rerender }: IProps): React.ReactElement {
+ const profit: number = corp.revenue.minus(corp.expenses).toNumber();
return (
- Total Funds:
+ Total Funds:
- Total Revenue: / s
- Total Expenses: / s
+ Total Revenue: / s
+ Total Expenses: / s
Total Profits: / s
-
- Publicly Traded: {props.corp.public ? "Yes" : "No"}
+
+ Publicly Traded: {corp.public ? "Yes" : "No"}
- Owned Stock Shares: {numeralWrapper.format(props.corp.numShares, "0.000a")}
+ Owned Stock Shares: {numeralWrapper.format(corp.numShares, "0.000a")}
- Stock Price: {props.corp.public ? : "N/A"}
+ Stock Price: {corp.public ? : "N/A"}
- Total Stock Shares: {numeralWrapper.format(props.corp.totalShares, "0.000a")}
+ Total Stock Shares: {numeralWrapper.format(corp.totalShares, "0.000a")}
- Outstanding Shares: {numeralWrapper.format(props.corp.issuedShares, "0.000a")}
+ Outstanding Shares: {numeralWrapper.format(corp.issuedShares, "0.000a")}
- Private Shares:{" "}
- {numeralWrapper.format(props.corp.totalShares - props.corp.issuedShares - props.corp.numShares, "0.000a")}
+ Private Shares: {numeralWrapper.format(corp.totalShares - corp.issuedShares - corp.numShares, "0.000a")}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
);
}
+
+interface IPrivateButtonsProps {
+ corp: ICorporation;
+ player: IPlayer;
+ rerender: () => void;
+}
+// Render the buttons for when your Corporation is still private
+function PrivateButtons({ corp, player, rerender }: IPrivateButtonsProps): React.ReactElement {
+ function openFindInvestorsPopup(): void {
+ const popupId = "cmpy-mgmt-find-investors-popup";
+ createPopup(popupId, FindInvestorsPopup, {
+ rerender,
+ player,
+ popupId,
+ corp: corp,
+ });
+ }
+
+ function openGoPublicPopup(): void {
+ const popupId = "cmpy-mgmt-go-public-popup";
+ createPopup(popupId, GoPublicPopup, {
+ rerender,
+ player,
+ popupId,
+ corp: corp,
+ });
+ }
+
+ const fundingAvailable = corp.fundingRound < 4;
+ const findInvestorsClassName = fundingAvailable ? "std-button" : "a-link-button-inactive";
+ const findInvestorsTooltip = fundingAvailable
+ ? "Search for private investors who will give you startup funding in exchangefor equity (stock shares) in your company"
+ : undefined;
+
+ return (
+ <>
+
+
+
+ >
+ );
+}
+
+interface IUpgradeProps {
+ corp: ICorporation;
+ player: IPlayer;
+ rerender: () => void;
+}
+// Render the UI for Corporation upgrades
+function Upgrades({ corp, player, rerender }: IUpgradeProps): React.ReactElement {
+ // Don't show upgrades
+ if (corp.divisions.length <= 0) {
+ return Unlock upgrades after creating your first division
;
+ }
+
+ return (
+
+
Unlocks
+ {Object.values(CorporationUnlockUpgrades)
+ .filter((upgrade: CorporationUnlockUpgrade) => corp.unlockUpgrades[upgrade[0]] === 0)
+ .map((upgrade: CorporationUnlockUpgrade) => (
+
+ ))}
+
+ Upgrades
+ {corp.upgrades
+ .map((level: number, i: number) => CorporationUpgrades[i])
+ .map((upgrade: CorporationUpgrade) => (
+
+ ))}
+
+ );
+}
+
+interface IPublicButtonsProps {
+ corp: ICorporation;
+ player: IPlayer;
+ rerender: () => void;
+}
+
+// Render the buttons for when your Corporation has gone public
+function PublicButtons({ corp, player, rerender }: IPublicButtonsProps): React.ReactElement {
+ const sellSharesOnCd = corp.shareSaleCooldown > 0;
+ const sellSharesClass = sellSharesOnCd ? "a-link-button-inactive" : "std-button";
+ const sellSharesTooltip = sellSharesOnCd
+ ? "Cannot sell shares for " + corp.convertCooldownToString(corp.shareSaleCooldown)
+ : "Sell your shares in the company. The money earned from selling your " +
+ "shares goes into your personal account, not the Corporation's. " +
+ "This is one of the only ways to profit from your business venture.";
+
+ const issueNewSharesOnCd = corp.issueNewSharesCooldown > 0;
+ const issueNewSharesClass = issueNewSharesOnCd ? "a-link-button-inactive" : "std-button";
+ const issueNewSharesTooltip = issueNewSharesOnCd
+ ? "Cannot issue new shares for " + corp.convertCooldownToString(corp.issueNewSharesCooldown)
+ : "Issue new equity shares to raise capital.";
+
+ function openSellSharesPopup(): void {
+ const popupId = "cmpy-mgmt-sell-shares-popup";
+ createPopup(popupId, SellSharesPopup, {
+ corp: corp,
+ player,
+ popupId,
+ rerender,
+ });
+ }
+
+ function openBuybackSharesPopup(): void {
+ const popupId = "corp-buyback-shares-popup";
+ createPopup(popupId, BuybackSharesPopup, {
+ rerender,
+ player,
+ popupId,
+ corp: corp,
+ });
+ }
+
+ function openIssueNewSharesPopup(): void {
+ const popupId = "cmpy-mgmt-issue-new-shares-popup";
+ createPopup(popupId, IssueNewSharesPopup, {
+ popupId,
+ corp: corp,
+ });
+ }
+
+ function openIssueDividendsPopup(): void {
+ const popupId = "cmpy-mgmt-issue-dividends-popup";
+ createPopup(popupId, IssueDividendsPopup, {
+ popupId,
+ corp: corp,
+ });
+ }
+
+ return (
+ <>
+
+
+
+
+
+
+ >
+ );
+}
+
+// Generic Function for Creating a button
+interface ICreateButtonProps {
+ text: string;
+ className?: string;
+ display?: string;
+ tooltip?: string;
+ onClick?: (event: React.MouseEvent) => void;
+}
+
+function Button({ className = "std-button", text, display, tooltip, onClick }: ICreateButtonProps): React.ReactElement {
+ const hasTooltip = tooltip != null;
+ if (hasTooltip) className += " tooltip";
+ return (
+
+ );
+}
+
+interface IBribeButtonProps {
+ player: IPlayer;
+ corp: ICorporation;
+}
+function BribeButton({ player, corp }: IBribeButtonProps): React.ReactElement {
+ function openBribeFactionPopup(): void {
+ const popupId = "corp-bribe-popup";
+ createPopup(popupId, BribeFactionPopup, {
+ player,
+ popupId,
+ corp: corp,
+ });
+ }
+
+ const canBribe = corp.determineValuation() >= CorporationConstants.BribeThreshold || true;
+ const bribeFactionsClass = canBribe ? "a-link-button" : "a-link-button-inactive";
+ return (
+
+ );
+}
+
+interface IDividendsStatsProps {
+ corp: ICorporation;
+ profit: number;
+}
+function DividendsStats({ corp, profit }: IDividendsStatsProps): React.ReactElement {
+ if (corp.dividendPercentage <= 0 || profit <= 0) return <>>;
+ const totalDividends = (corp.dividendPercentage / 100) * profit;
+ const retainedEarnings = profit - totalDividends;
+ const dividendsPerShare = totalDividends / corp.totalShares;
+ const playerEarnings = corp.numShares * dividendsPerShare;
+ return (
+ <>
+ Retained Profits (after dividends): / s
+
+
+ Dividend Percentage: {numeralWrapper.format(corp.dividendPercentage / 100, "0%")}
+
+ Dividends per share: / s
+ Your earnings as a shareholder (Pre-Tax): / s
+ Dividend Tax Rate: {corp.dividendTaxPercentage}%
+ Your earnings as a shareholder (Post-Tax):{" "}
+ / s
+
+ >
+ );
+}
+
+interface IMultProps {
+ name: string;
+ mult: number;
+}
+function Mult({ name, mult }: IMultProps): React.ReactElement {
+ if (mult <= 1) return <>>;
+ return (
+
+ {name}
+ {numeralWrapper.format(mult, "0.000")}
+
+
+ );
+}
+
+interface IBonusTimeProps {
+ corp: ICorporation;
+}
+// Returns a string with general information about Corporation
+function BonusTime({ corp }: IBonusTimeProps): React.ReactElement {
+ const storedTime = corp.storedCycles * CONSTANTS.MilliPerCycle;
+ if (storedTime <= 15000) return <>>;
+ return (
+
+ Bonus time: {convertTimeMsToTimeElapsedString(storedTime)}
+
+
+
+ );
+}
diff --git a/src/Corporation/ui/UnlockUpgrade.tsx b/src/Corporation/ui/UnlockUpgrade.tsx
index b8f2b638c..c9fe5b5bf 100644
--- a/src/Corporation/ui/UnlockUpgrade.tsx
+++ b/src/Corporation/ui/UnlockUpgrade.tsx
@@ -34,9 +34,9 @@ export function UnlockUpgrade(props: IProps): React.ReactElement {
}
return (
-
+
+
);
}