Skip to content

Commit

Permalink
chore: style fixes + warning
Browse files Browse the repository at this point in the history
  • Loading branch information
eMerzh committed Sep 28, 2023
1 parent 8b9e960 commit 35dd64b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 41 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ il est actuellement en cours de développement et terriblement incomplet, buggé
- [x] ajouter une indication de remplissage
- [x] improve immersion (filter school, doc, )
- [x] https://inscription.cfwb.be/fileadmin/sites/insc/uploads/Documents_2023-2024/Liste_des_ecoles_immersion.xlsx
- [ ] carte ?
- [ ] exclude techniques?
- [x] carte ?
- [ ] perf
- [x] taille du json
- [ ] efficience du code
Expand Down
13 changes: 0 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@
<title>Indice Compositor</title>
</head>
<body>
<style>
#root {
min-height: 100vh;
margin: 0;

display: grid;
grid-template-rows: auto 1fr auto;
}

.footer {
min-height: 50px;
}
</style>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
8 changes: 4 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MantineProvider } from "@mantine/core";
import { AppShell, MantineProvider } from "@mantine/core";
import { QueryParamProvider } from "use-query-params";
import { WindowHistoryAdapter } from "use-query-params/adapters/window";

Expand All @@ -9,9 +9,9 @@ export default function Home() {
return (
<MantineProvider withGlobalStyles withNormalizeCSS>
<QueryParamProvider adapter={WindowHistoryAdapter}>
<div></div>
<AppContainer />
<Footer />
<AppShell footer={<Footer />}>
<AppContainer />
</AppShell>
</QueryParamProvider>
</MantineProvider>
);
Expand Down
25 changes: 23 additions & 2 deletions src/AppContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
import { Container, Modal, Text } from "@mantine/core";
import { Alert, Container, Modal, Text } from "@mantine/core";
import { useMemo, useState } from "react";
import { BooleanParam, JsonParam } from "use-query-params";
import { useQueryParam, StringParam } from "use-query-params";
import { useDisclosure } from "@mantine/hooks";
import { useDisclosure, useLocalStorage } from "@mantine/hooks";

import { ComputeResult, computeAll, primarySchools, secondarySchools } from "./compute";
import { NamedLoc } from "./GeoAutoComplete";
import { InputConfig } from "./InputConfig";
import ResultTable from "./ResultTable";
import SchoolDetail from "./SchoolDetail";
import { IconAlertCircle } from "@tabler/icons-react";

const Warning = () => {
const [hide, setHide] = useLocalStorage({ key: "hide-warning", defaultValue: false });
if (hide) return <IconAlertCircle size="1rem" onClick={() => setHide(false)} />;
return (
<Alert icon={<IconAlertCircle size="1rem" />} title="Compositor2000" withCloseButton onClose={() => setHide(true)}>
Cet outil est un outil alternatif de calcul de l'indice composite. Les données n'étant pas complètement ouvertes,
il pourrait contenir des erreurs. N'oubliez par de vérifier le score obtenu sur le{" "}
<a href="https://inscription.cfwb.be/nc/simulation-de-lindice-composite/" target="_blank" rel="noopener">
calculateur officiel
</a>
, et de voir les disponibilités dans l'école de votre choix sur le{" "}
<a href="https://monespace.fw-b.be/demarrer-demarche/?codeDemarche=ciriparent" target="_blank" rel="noopener">
site adéquat
</a>
.
</Alert>
);
};
function useConfiguration() {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, setRefresher] = useState(0);
Expand Down Expand Up @@ -80,6 +99,7 @@ function AppContainer() {
if (!school_prim || !locHome || !date) {
return (
<Container>
<Warning />
<InputConfig
primarySchools={primarySchools}
idPrimaire={idPrimaire}
Expand All @@ -97,6 +117,7 @@ function AppContainer() {

return (
<Container>
<Warning />
<InputConfig
primarySchools={primarySchools}
idPrimaire={idPrimaire}
Expand Down
12 changes: 6 additions & 6 deletions src/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { IconBrandGithub } from "@tabler/icons-react";

import { Container, Text } from "@mantine/core";
import { Footer, Text } from "@mantine/core";

const Footer = () => {
const AppFooter = () => {
return (
<Container className="footer">
<Footer height={60} p="md">
<Text c="dimmed" size="sm" align="center">
Made by{" "}
<a href="https://github.com/eMerzh/compositor">
Expand All @@ -13,10 +13,10 @@ const Footer = () => {
Brice
</Text>
<Text c="dimmed" size="sm" align="center">
Question - Suggestions - Soutiens compositor__at__bmaron.net
Question, Suggestions, Soutiens compositor__at__bmaron.net
</Text>
</Container>
</Footer>
);
};

export default Footer;
export default AppFooter;
9 changes: 5 additions & 4 deletions src/GeoAutoComplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function GeoAutoComplete({ value, onSelect }: Props) {
if (ref.current) {
ref.current.value = value?.name || "";
}
}, [value]);
}, [value, showDetails]);
return (
<form>
<AddressAutofill
Expand Down Expand Up @@ -65,11 +65,12 @@ function GeoAutoComplete({ value, onSelect }: Props) {
<Button variant="white" compact onClick={() => setShowDetails(!showDetails)} leftIcon={<IconMap size="1rem" />}>
{showDetails ? "Cacher" : "Afficher"} la carte
</Button>
{showDetails && value && (
{showDetails && (
<Map
initialLat={value.lat}
initialLon={value.lon}
initialLat={value?.lat || 50.527942}
initialLon={value?.lon || 5.529293}
setHomeLoc={(lat, lon) => {
console.log("setHomeLoc", lat, lon);
onSelect({ lat, lon, name: "Personnalisé" });
}}
/>
Expand Down
13 changes: 3 additions & 10 deletions src/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AspectRatio } from "@mantine/core";
import maplibregl from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
import { useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -47,15 +48,7 @@ const Map = ({ initialLat, initialLon, setHomeLoc }: MapProps) => {
}, [initialLat, initialLon]);

return (
<div
className="map-wrap"
style={{
height: "calc(50vh - 77px)",
width: "100%",
marginBottom: "30px",
marginTop: "30px",
}}
>
<AspectRatio ratio={16 / 9}>
<div
ref={mapContainer}
className="map"
Expand All @@ -65,7 +58,7 @@ const Map = ({ initialLat, initialLon, setHomeLoc }: MapProps) => {
borderRadius: "3px",
}}
/>
</div>
</AspectRatio>
);
};

Expand Down

0 comments on commit 35dd64b

Please sign in to comment.