Implement aggregation frontend, also http on prod

This commit is contained in:
Guntis Smaukstelis
2023-05-15 20:50:53 +03:00
parent db900d6a33
commit ff45876377
12 changed files with 259 additions and 18 deletions
+34
View File
@@ -0,0 +1,34 @@
import { Accessor, Component, Setter } from "solid-js";
import { cityList } from "../consts";
export const SelectCity: Component<{
getCities: Accessor<Set<string>>,
setCities: Setter<Set<string>>,
}> = (props) => {
function handleSelect(e: MouseEvent) {
if (!e.target) return;
const target = e.target as HTMLInputElement;
const { checked: selected, value: city } = target;
const cityList = new Set([...props.getCities()]);
if (selected) cityList.add(city);
else cityList.delete(city);
props.setCities(cityList);
}
return (
<ul>{cityList.map(city =>
<label>
<li>
<input
type="checkbox"
name="city"
value={city}
onClick={handleSelect}
/>
{city}
</li>
</label>
)}</ul>
);
};