Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 10 #40

Merged
merged 2 commits into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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