void;
+}
+
+function ExpandButton(props: IExpandButtonProps): React.ReactElement {
+ const allIndustries = Object.keys(Industries).sort();
+ const possibleIndustries = allIndustries
+ .filter(
+ (industryType: string) =>
+ props.corp.divisions.find(
+ (division: IIndustry) => division.type === industryType,
+ ) === undefined,
+ )
+ .sort();
+ if (possibleIndustries.length === 0) return <>>;
+
+ function openNewIndustryPopup(): void {
+ const popupId = "cmpy-mgmt-expand-industry-popup";
+ createPopup(popupId, NewIndustryPopup, {
+ corp: props.corp,
+ setDivisionName: props.setDivisionName,
+ popupId: popupId,
+ });
+ }
+
+ return (
+
+ );
+}
interface IProps {
corp: ICorporation;
@@ -18,15 +54,6 @@ interface IProps {
export function HeaderTabs(props: IProps): React.ReactElement {
const [divisionName, setDivisionName] = useState("Overview");
- function openNewIndustryPopup(): void {
- const popupId = "cmpy-mgmt-expand-industry-popup";
- createPopup(popupId, NewIndustryPopup, {
- corp: props.corp,
- setDivisionName: setDivisionName,
- popupId: popupId,
- });
- }
-
return (
<>
@@ -44,11 +71,7 @@ export function HeaderTabs(props: IProps): React.ReactElement {
text={division.name}
/>
))}
-
+