Skip to content

Commit

Permalink
feat(ui-hydro): add form prop to SplitHydroMatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia committed Jan 31, 2024
1 parent 23a28ce commit a17b969
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ interface Props {
types: [HydroMatrixType, HydroMatrixType];
direction?: SplitViewProps["direction"];
sizes: [number, number];
form?: React.ComponentType;
}

function SplitHydroMatrix({ types, direction, sizes }: Props) {
function SplitHydroMatrix({ types, direction, sizes, form: Form }: Props) {
return (
<SplitView direction={direction} sizes={sizes}>
<HydroMatrix type={types[0]} />
<HydroMatrix type={types[1]} />
</SplitView>
<>
{Form && <Form />}
<SplitView direction={direction} sizes={sizes}>
<HydroMatrix type={types[0]} />
<HydroMatrix type={types[1]} />
</SplitView>
</>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { MatrixStats, MatrixType } from "../../../../../../../common/types";
import { SplitViewProps } from "../../../../../../common/SplitView";
import { getAllocationMatrix } from "./Allocation/utils";
import { getCorrelationMatrix } from "./Correlation/utils";
import InflowStructure from "./InflowStructure";

////////////////////////////////////////////////////////////////
// Enums
Expand Down Expand Up @@ -48,6 +49,7 @@ export interface HydroRoute {
partnerType: HydroMatrixType;
sizes: [number, number];
};
form?: React.ComponentType;
}

export interface AreaCoefficientItem {
Expand All @@ -69,6 +71,7 @@ export const HYDRO_ROUTES: HydroRoute[] = [
partnerType: HydroMatrixType.OverallMonthlyHydro,
sizes: [50, 50],
},
form: InflowStructure,
},
{
path: "dailypower&energy",
Expand Down
9 changes: 8 additions & 1 deletion webapp/src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,13 @@ function App() {
element={<Correlation />}
/>
{HYDRO_ROUTES.map(
({ path, type, isSplitView, splitConfig }) => {
({
path,
type,
isSplitView,
splitConfig,
form,
}) => {
return isSplitView && splitConfig ? (
<Route
key={path}
Expand All @@ -122,6 +128,7 @@ function App() {
]}
direction={splitConfig.direction}
sizes={splitConfig.sizes}
form={form}
/>
}
/>
Expand Down

0 comments on commit a17b969

Please sign in to comment.