use popover over tooltip for badges
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Box, Text, Tooltip, Card } from "@mantine/core";
|
||||
import { Box, Text, Popover, Card } from "@mantine/core";
|
||||
import { usePlayerBadges, useAllBadges } from "../queries";
|
||||
import { useAuth } from "@/contexts/auth-context";
|
||||
import { Badge, BadgeProgress } from "../types";
|
||||
@@ -115,26 +115,8 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
|
||||
}}
|
||||
>
|
||||
{badgesToDisplay.map((display) => (
|
||||
<Tooltip
|
||||
key={display.badge.id}
|
||||
label={
|
||||
<Box>
|
||||
<Text size="xs" fw={600} mb={4}>
|
||||
{display.badge.name}
|
||||
</Text>
|
||||
<Text size="xs" mb={4}>
|
||||
{display.badge.description}
|
||||
</Text>
|
||||
{isCurrentUser && (
|
||||
<Text size="xs" c="dimmed">
|
||||
Progress: {display.progressText}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
}
|
||||
multiline
|
||||
w={220}
|
||||
>
|
||||
<Popover key={display.badge.id} width={220} position="bottom" withArrow shadow="md">
|
||||
<Popover.Target>
|
||||
<Card
|
||||
withBorder
|
||||
padding="sm"
|
||||
@@ -165,7 +147,23 @@ const BadgeShowcase = ({ playerId }: BadgeShowcaseProps) => {
|
||||
{display.badge.name}
|
||||
</Text>
|
||||
</Card>
|
||||
</Tooltip>
|
||||
</Popover.Target>
|
||||
<Popover.Dropdown>
|
||||
<Box>
|
||||
<Text size="xs" fw={600} mb={4}>
|
||||
{display.badge.name}
|
||||
</Text>
|
||||
<Text size="xs" mb={4}>
|
||||
{display.badge.description}
|
||||
</Text>
|
||||
{isCurrentUser && (
|
||||
<Text size="xs" c="dimmed">
|
||||
Progress: {display.progressText}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
</Popover.Dropdown>
|
||||
</Popover>
|
||||
))}
|
||||
</Box>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user