Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/csv_linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
python -m pip install csvkit

- name: Lint CSV files
run: find . -name "*.csv" -exec csvclean -n -u 2 {} +
run: find . -name "*.csv" -exec csvclean -u 2 {} +
env:
CI: true
- name: Check for errors
if: always()
run: |
if ! grep -q "No errors." <(find . -name "*.csv" -exec csvclean -n -u 2 {} + | grep -v "^$"); then
if ! grep -q "No errors." <(find . -name "*.csv" -exec csvclean -u 2 {} + | grep -v "^$"); then
echo "Errors were found in one or more CSV files."
exit 1
fi
Expand All @@ -36,4 +36,4 @@ jobs:
exit 1
else
echo "No trailing whitespaces found in prompts.csv"
fi
fi
130 changes: 130 additions & 0 deletions usa-map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>מפת ארצות הברית - לחיצה על מדינה</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background: #f5f7fb;
color: #1a2a44;
}
.container {
max-width: 1100px;
margin: 0 auto;
padding: 24px;
}
h1 {
margin: 0 0 8px;
font-size: 2rem;
}
.subtitle {
margin-bottom: 16px;
color: #445a7a;
}
.map-wrapper {
background: white;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
padding: 16px;
overflow: auto;
}
svg {
width: 100%;
height: auto;
min-height: 600px;
}
.state {
fill: #8fc1ff;
stroke: #ffffff;
stroke-width: 1;
cursor: pointer;
transition: fill 0.2s ease;
}
.state:hover {
fill: #3b82f6;
}
.state.active {
fill: #1d4ed8;
}
#selected-state {
margin-top: 16px;
font-size: 1.2rem;
font-weight: 700;
}
</style>
</head>
<body>
<div class="container">
<h1>מפת ארצות הברית</h1>
<p class="subtitle">לחץ על מדינה במפה כדי לראות את השם שלה.</p>

<div class="map-wrapper">
<svg id="us-map" viewBox="0 0 975 610" aria-label="US map"></svg>
</div>

<p id="selected-state">עדיין לא נבחרה מדינה.</p>
</div>

<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/topojson-client@3"></script>
<script>
const stateNames = {
"01": "Alabama", "02": "Alaska", "04": "Arizona", "05": "Arkansas", "06": "California",
"08": "Colorado", "09": "Connecticut", "10": "Delaware", "11": "District of Columbia", "12": "Florida",
"13": "Georgia", "15": "Hawaii", "16": "Idaho", "17": "Illinois", "18": "Indiana",
"19": "Iowa", "20": "Kansas", "21": "Kentucky", "22": "Louisiana", "23": "Maine",
"24": "Maryland", "25": "Massachusetts", "26": "Michigan", "27": "Minnesota", "28": "Mississippi",
"29": "Missouri", "30": "Montana", "31": "Nebraska", "32": "Nevada", "33": "New Hampshire",
"34": "New Jersey", "35": "New Mexico", "36": "New York", "37": "North Carolina", "38": "North Dakota",
"39": "Ohio", "40": "Oklahoma", "41": "Oregon", "42": "Pennsylvania", "44": "Rhode Island",
"45": "South Carolina", "46": "South Dakota", "47": "Tennessee", "48": "Texas", "49": "Utah",
"50": "Vermont", "51": "Virginia", "53": "Washington", "54": "West Virginia", "55": "Wisconsin",
"56": "Wyoming", "60": "American Samoa", "66": "Guam", "69": "Northern Mariana Islands",
"72": "Puerto Rico", "78": "U.S. Virgin Islands"
};

const svg = d3.select("#us-map");
const selectedStateText = document.getElementById("selected-state");

d3.json("https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json").then((us) => {
const states = topojson.feature(us, us.objects.states).features;
const projection = d3.geoAlbersUsa().fitSize([975, 610], topojson.feature(us, us.objects.nation));
const path = d3.geoPath(projection);

svg.append("g")
.selectAll("path")
.data(states)
.join("path")
.attr("class", "state")
.attr("d", path)
.on("click", function(event, d) {
const stateId = String(d.id).padStart(2, "0");
const name = stateNames[stateId] || `State ID: ${stateId}`;

d3.selectAll(".state").classed("active", false);
d3.select(this).classed("active", true);

selectedStateText.textContent = `בחרת במדינה: ${name}`;
})
.append("title")
.text((d) => {
const stateId = String(d.id).padStart(2, "0");
return stateNames[stateId] || `State ID: ${stateId}`;
});

svg.append("path")
.datum(topojson.mesh(us, us.objects.states, (a, b) => a !== b))
.attr("fill", "none")
.attr("stroke", "#ffffff")
.attr("stroke-linejoin", "round")
.attr("d", path);
}).catch((error) => {
selectedStateText.textContent = "לא הצלחנו לטעון את המפה. נסה שוב מאוחר יותר.";
console.error("Failed to load map:", error);
});
</script>
</body>
</html>
Loading