dere-cbai commited on
Commit
a9b1c9e
·
1 Parent(s): fd35ca5

Add US Only filter button for international students

Browse files
Files changed (1) hide show
  1. src/pages/Index.tsx +22 -0
src/pages/Index.tsx CHANGED
@@ -105,6 +105,9 @@ const Index = () => {
105
  window.history.replaceState({}, '', `${window.location.pathname}?${searchParams}`);
106
  };
107
 
 
 
 
108
  // Toggle a single tag
109
  const toggleTag = (tag: string) => {
110
  const newTags = new Set(selectedTags);
@@ -232,6 +235,25 @@ const Index = () => {
232
  </PopoverContent>
233
  </Popover>
234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
235
  {/* Display selected countries */}
236
  {Array.from(selectedCountries).map(country => (
237
  <button
 
105
  window.history.replaceState({}, '', `${window.location.pathname}?${searchParams}`);
106
  };
107
 
108
+ // Define US states and territories that should be included in "US Only" filter
109
+ const usRegions = new Set(["USA", "PENNSYLVANIA", "New Mexico", "Michigan", "Tennessee", "Hawaii"]);
110
+
111
  // Toggle a single tag
112
  const toggleTag = (tag: string) => {
113
  const newTags = new Set(selectedTags);
 
235
  </PopoverContent>
236
  </Popover>
237
 
238
+ {/* US Only filter button */}
239
+ <Button
240
+ variant={Array.from(selectedCountries).every(country => usRegions.has(country)) && selectedCountries.size > 0 ? "default" : "outline"}
241
+ size="sm"
242
+ className="h-8 gap-1"
243
+ onClick={() => {
244
+ const isUSOnlyActive = Array.from(selectedCountries).every(country => usRegions.has(country)) && selectedCountries.size > 0;
245
+ if (isUSOnlyActive) {
246
+ // If already filtering US only, clear the filter
247
+ handleCountriesChange(new Set());
248
+ } else {
249
+ // Set filter to US only (all US regions)
250
+ handleCountriesChange(usRegions);
251
+ }
252
+ }}
253
+ >
254
+ 🇺🇸 US Only
255
+ </Button>
256
+
257
  {/* Display selected countries */}
258
  {Array.from(selectedCountries).map(country => (
259
  <button