Skip to content

Commit a5f47c2

Browse files
committed
feat(fishing): filter by location
1 parent 7d9cc65 commit a5f47c2

1 file changed

Lines changed: 64 additions & 1 deletion

File tree

src/pages/fishing.tsx

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { useMultiSelect } from "@/contexts/multi-select-context";
2929
import { cn } from "@/lib/utils";
3030
import { X } from "lucide-react";
3131

32-
import { IconClock, IconCloud } from "@tabler/icons-react";
32+
import { IconClock, IconCloud, IconMapPin } from "@tabler/icons-react";
3333

3434
const semverGte = require("semver/functions/gte");
3535

@@ -78,6 +78,55 @@ const seasons = [
7878
},
7979
];
8080

81+
const locationGroups: Record<string, string[]> = {
82+
Ocean: [
83+
"Ocean",
84+
"East Pier on The Beach",
85+
"Beach Farm",
86+
"Fishing Pole: Ocean",
87+
"Foraging: The Beach",
88+
],
89+
River: [
90+
"River",
91+
"Town River",
92+
"Forest River",
93+
"North of JojaMart on the wooden plank bridge",
94+
],
95+
"Mountain Lake": ["Mountain Lake", "The Mountain Lake, near the log"],
96+
"Forest Pond": [
97+
"Forest Pond",
98+
"Forest Farm Pond",
99+
"Waterfalls",
100+
"Cindersap Forest Waterfalls",
101+
"South end of Arrowhead Island in Cindersap Forest",
102+
],
103+
"Secret Woods": ["Secret Woods"],
104+
"Ginger Island": [
105+
"Ginger Island",
106+
"Ginger Island North & West (freshwater)",
107+
"Pirate Cove",
108+
"Volcano Caldera",
109+
"Turtle",
110+
],
111+
"The Mines": [
112+
"The Mines",
113+
"Floor 20 of The Mines",
114+
"Floor 100 of The Mines",
115+
'The "Dangerous Mines"',
116+
"The Mines, Floor 60",
117+
],
118+
"The Sewers": ["The Sewers", "Mutant Bug Lair"],
119+
"The Desert": ["The Desert"],
120+
"Witch's Swamp": ["Witch's Swamp"],
121+
"Crab Pot": ["Crab Pot: Freshwater", "Crab Pot: Saltwater"],
122+
"Night Market": ["Submarine at Night Market"],
123+
};
124+
125+
const locations = [
126+
{ value: "all", label: "All Locations" },
127+
...Object.keys(locationGroups).map((k) => ({ value: k, label: k })),
128+
];
129+
81130
const bubbleColors: Record<string, string> = {
82131
"0": "border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950", // incomplete
83132
"2": "border-green-900 bg-green-500/20", // completed
@@ -95,6 +144,7 @@ export default function Fishing() {
95144
const [_filter, setFilter] = useState("all");
96145
const [_weatherFilter, setWeatherFilter] = useState("both");
97146
const [_seasonFilter, setSeasonFilter] = useState("all");
147+
const [_locationFilter, setLocationFilter] = useState("all");
98148

99149
const [gameVersion, setGameVersion] = useState("1.6.0");
100150

@@ -281,6 +331,13 @@ export default function Fishing() {
281331
icon={IconClock}
282332
setFilter={setSeasonFilter}
283333
/>
334+
<FilterSearch
335+
title="Location"
336+
_filter={_locationFilter}
337+
data={locations}
338+
icon={IconMapPin}
339+
setFilter={setLocationFilter}
340+
/>
284341
<Button
285342
variant={isMultiSelectMode ? "default" : "outline"}
286343
onClick={() => {
@@ -362,6 +419,12 @@ export default function Fishing() {
362419
}
363420
return true;
364421
})
422+
.filter((f) => {
423+
if (_locationFilter === "all") return true;
424+
if (!("locations" in f)) return false;
425+
const group = locationGroups[_locationFilter] ?? [];
426+
return f.locations.some((loc) => group.includes(loc));
427+
})
365428
.map((f) => (
366429
<BooleanCard
367430
key={f.itemID}

0 commit comments

Comments
 (0)