Skip to content

Commit

Permalink
fixing merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
webdevcody committed Oct 18, 2024
1 parent 22cd75c commit e60bc43
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/play/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@ export default function PlayPage() {

const [resMap, setResMap] = useState(new Map());
const [countMap, setCountMap] = useState(new Map());
const [filter, setFilter] = useState("all");
const [filter, setFilter] = useState(() => {
if (typeof window !== "undefined") {
return localStorage.getItem("mapFilter") || "all";
}
return "all";
});

useEffect(() => {
localStorage.setItem("mapFilter", filter);
}, [filter]);

useEffect(() => {
if (userMapResults && mapCountResults) {
Expand Down Expand Up @@ -69,6 +78,7 @@ export default function PlayPage() {
type="single"
variant="outline"
className="w-max pb-4"
value={filter}
onValueChange={(value) => setFilter(value)}
>
<ToggleGroupItem value="all">All</ToggleGroupItem>
Expand Down Expand Up @@ -96,6 +106,7 @@ export default function PlayPage() {
type="single"
variant="outline"
className="w-max pb-4"
value={filter}
onValueChange={(value) => setFilter(value)}
>
<ToggleGroupItem value="all">All</ToggleGroupItem>
Expand All @@ -106,7 +117,6 @@ export default function PlayPage() {

<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
{filteredMaps.map((map) => (
<Card key={map._id} className="flex flex-col h-full">
<Card
key={map._id}
className={cn(
Expand Down

0 comments on commit e60bc43

Please sign in to comment.