"git@forgeb1.univ-lehavre.fr:khraimes/cours.git" n'existait pas sur "6ece551f8aeedff2c62fdd447240a844b2948c05"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import React from "react";
import { TaxType } from "../../../api/stats";
import { AVAILABLE_YEARS } from "./scatterplot.utils";
import "./ScatterPlot.css";
const TAX_LABELS: Record<TaxType, string> = {
tfpnb: "tfpnb",
tfpb: "tfpb",
th: "th",
cfe: "cfe",
};
type Props = {
selectedTax: TaxType;
year: number;
department: string;
onTaxChange: (t: TaxType) => void;
onYearChange: (y: number) => void;
onDepartmentChange: (y: string) => void;
};
export const ScatterPlotControls: React.FC<Props> = ({
selectedTax,
year,
department,
onTaxChange,
onYearChange,
onDepartmentChange,
}) => {
return (
<div className="controls-panel">
<div className="control-group">
<label className="control-label">Type de taxe</label>
<div className="button-group">
{(Object.keys(TAX_LABELS) as TaxType[]).map((tax) => (
<button
key={tax}
className={`filter-button ${selectedTax === tax ? "active" : ""}`}
onClick={() => onTaxChange(tax)}
type="button"
>
{TAX_LABELS[tax]}
</button>
))}
</div>
</div>
<div className="control-group">
<label className="control-label">Année</label>
<div className="year-controls">
<div className="year-selector">
<span className="year-label">En</span>
<select
className="year-select"
value={year}
onChange={(e) => onYearChange(Number(e.target.value))}
>
{AVAILABLE_YEARS.map((year) => (
<option key={year} value={year}>
{year}
</option>
))}
</select>
</div>
</div>
</div>
<div className="control-group">
<label className="control-label">Département</label>
<div className="department-controls">
<div className="department-selector">
<span className="department-label">De</span>
<select
className="department-select"
value={department}
onChange={(e) => onDepartmentChange(String(e.target.value))}
>
<option>
Allier
</option>
</select>
</div>
</div>
</div>
</div>
);
};