Skip to content

Commit

Permalink
Merge pull request #40 from MediaComem/fix-10
Browse files Browse the repository at this point in the history
Fix 10
  • Loading branch information
zweiro authored Oct 22, 2022
2 parents 3b853d9 + 486ba66 commit 7f8335b
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 68 deletions.
45 changes: 27 additions & 18 deletions src/app/types/generalFormTypes.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
import { EBoolean } from "./types";

export enum ServerType {
RENEWABLE = "Renewable energy",
NON_RENEWABLE = "Non renewable energy",
UNKNOWN = "Do not know",
}
RENEWABLE = "Renewable energy",
NON_RENEWABLE = "Non renewable energy",
UNKNOWN = "Do not know",
}

export const GeneralFormEntries = {
nbVisit: 0,
server: ServerType,
plugins: EBoolean,
genericFont: EBoolean,
inifiteScroll: EBoolean,
};

export const GeneralFormEntries = {
nbVisit: 0,
server: ServerType,
plugins: EBoolean,
genericFont: EBoolean,
inifiteScroll: EBoolean,
};
export const getGeneralEntryLabel = (entry: string) => {
switch (entry) {
case "nbVisit":
return "number of visits/month";
default:
return entry;
}
};

export interface GenericParameters {
nbVisit?: number;
server?: ServerType;
plugins?: boolean;
genericFont?: boolean;
inifiteScroll?: boolean;
}
export interface GenericParameters {
nbVisit?: number;
server?: ServerType;
plugins?: boolean;
genericFont?: boolean;
inifiteScroll?: boolean;
}
4 changes: 2 additions & 2 deletions src/components/recommandations/ReportGeneralInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function ReportGeneralInfo() {
<Flex justify={"stretch"} align="center" minHeight={"fit-content"}>
<Flex direction={"column"} justify="center" p={2} grow={1}>
<Text fontSize={"sm"} color={"gray.500"}>
Energy (KWh)
Energy (KWh)/month
</Text>
<Flex justify={"stretch"} align="center" minHeight={"fit-content"}>
<Text fontSize="lg" color={"gray.600"} fontWeight={"semibold"}>
Expand All @@ -45,7 +45,7 @@ export default function ReportGeneralInfo() {
grow={1}
>
<Text fontSize={"sm"} color={"gray.500"}>
GWP ( kg CO2eq)
GWP ( kg CO2eq)/month
</Text>
<Flex justify={"stretch"} align="center" minHeight={"fit-content"}>
<Text fontSize="lg" color={"gray.600"} fontWeight={"semibold"}>
Expand Down
13 changes: 8 additions & 5 deletions src/components/zones/GeneralForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useAppSelector } from "../../app/hooks";
import {
GeneralFormEntries,
GenericParameters,
getGeneralEntryLabel,
} from "../../app/types/generalFormTypes";
import { Project } from "../../app/types/types";
import {
Expand All @@ -38,15 +39,15 @@ export default function GeneralFormAccordion() {
const dispatch = useDispatch();
const { isOpen, onOpen, onClose } = useDisclosure();
return (
<AccordionItem borderTop={'none'}>
<AccordionItem borderTop={"none"}>
{({ isExpanded }) => (
<>
<AccordionItemTitleCustom
p={2}
label={
<>
<Flex align={"center"}>
<AccordionCustomTitle label='General' icon="settings" />
<AccordionCustomTitle label="General" icon="settings" />
<ProgressPoints
completeObject={GeneralFormEntries}
params={project.params}
Expand All @@ -62,7 +63,8 @@ export default function GeneralFormAccordion() {
onClick={onOpen}
disabled={project.status === "SIMULATION"}
>
Reset <ResetIcon className={css({ margin: "3px" })} stroke='black'/>
Reset{" "}
<ResetIcon className={css({ margin: "3px" })} stroke="black" />
</Button>
</AccordionItemTitleCustom>
<AccordionPanel>
Expand Down Expand Up @@ -96,13 +98,14 @@ function GeneralForm({ project }: { project: Project }) {
return (
<div key={key}>
<Heading size="sm" my={2}>
{key}
{getGeneralEntryLabel(key)}
</Heading>
{typeof data === "number" && (
<NumberInputCustom
defaultValue={0}
value={
project.params && project.params[key as keyof GenericParameters]
project.params &&
project.params[key as keyof GenericParameters]
? Number(project.params[key as keyof GenericParameters])
: 0
}
Expand Down
86 changes: 43 additions & 43 deletions src/components/zones/ZonesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,49 +72,49 @@ export default function ZonesView({
grow={1}
alignSelf="stretch"
>
<Flex opacity={0.5} width='400' minWidth='400' maxWidth='400'>
<Routes>
<Route
path="bytesim-webapp/1/*"
element={
<Flex>
<TestSVG />
</Flex>
}
/>
<Route
path="bytesim-webapp/2/*"
element={
<Flex>
<img src={REHome} alt="RE homepage"/>
</Flex>
}
/>
<Route
path="bytesim-webapp/3/*"
element={
<Flex>
<img src={REabout} alt="RE about page"/>
</Flex>
}
/>
<Route
path="bytesim-webapp/4/*"
element={
<Flex>
<img src={REmap} alt="RE network map"/>
</Flex>
}
/>
<Route
path="bytesim-webapp/*"
element={
<Flex>
<TestSVG />
</Flex>
}
/>
</Routes>
<Flex opacity={0.5} width="400px" minWidth="400" maxWidth="400">
<Routes>
<Route
path="bytesim-webapp/1/*"
element={
<Flex>
<TestSVG />
</Flex>
}
/>
<Route
path="bytesim-webapp/2/*"
element={
<Flex>
<img src={REHome} alt="RE homepage" />
</Flex>
}
/>
<Route
path="bytesim-webapp/3/*"
element={
<Flex>
<img src={REabout} alt="RE about page" />
</Flex>
}
/>
<Route
path="bytesim-webapp/4/*"
element={
<Flex>
<img src={REmap} alt="RE network map" />
</Flex>
}
/>
<Route
path="bytesim-webapp/*"
element={
<Flex>
<TestSVG />
</Flex>
}
/>
</Routes>
</Flex>
{zones.map((z) => {
return (
Expand Down

0 comments on commit 7f8335b

Please sign in to comment.