Skip to content

Commit

Permalink
fix: only show completed countries when logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoEscaleira committed Apr 20, 2024
1 parent 1a952c6 commit 16cc91f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/pages/Game/MapChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Minus, Plus } from "lucide-react";
import { useSearchParams } from "react-router-dom";
import { ZoomableGroup, ComposableMap, Geographies, Geography, Marker } from "react-simple-maps";
import useBreakpoint from "use-breakpoint";
import { useUserStore } from "@state/userStore.ts";
import { BREAKPOINTS } from "@utils/constants.ts";
import { useCountryInformation } from "@utils/hooks/useCountryInformation";

Expand All @@ -14,6 +15,7 @@ interface Position {
}

export const MapChart: FC = () => {
const { isLoggedIn } = useUserStore();
const [searchParams, setSearchParams] = useSearchParams();
const [position, setPosition] = useState<Position>({ coordinates: [5, 46], zoom: 1 });
const { breakpoint } = useBreakpoint(BREAKPOINTS);
Expand Down Expand Up @@ -147,15 +149,17 @@ export const MapChart: FC = () => {
</Tooltip>
</div>

<div className="absolute -bottom-14 left-0 flex items-center md:left-4">
<Tooltip content="Current selected country">
<div className="flex gap-2">
<Typography variant="small" className="font-medium">
{countriesPassedBy} countries completed out of 202
</Typography>
</div>
</Tooltip>
</div>
{isLoggedIn && (
<div className="absolute -bottom-14 left-0 flex items-center md:left-4">
<Tooltip content="Current selected country">
<div className="flex gap-2">
<Typography variant="small" className="font-medium">
{countriesPassedBy} countries completed out of 202
</Typography>
</div>
</Tooltip>
</div>
)}
</div>
);
};

0 comments on commit 16cc91f

Please sign in to comment.