Skip to content

Commit 94b4de8

Browse files
authored
Merge pull request #1011 from crane-cloud/fix-graphs-flow
fix: graph filters
2 parents bdc9350 + 5e4778f commit 94b4de8

File tree

14 files changed

+663
-338
lines changed

14 files changed

+663
-338
lines changed

src/components/Cards/OtherCards.tsx

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Box, Card, Divider, Group, Stack, Text, Tooltip } from "@mantine/core";
22
import { PiBuildingsBold } from "react-icons/pi";
3-
import { FaGithub, FaLinkedin, FaTwitter } from "react-icons/fa";
43
import { ProfileAvatar } from "../Common";
54
import { Link } from "react-router-dom";
5+
import { SOCIAL_LINKS_DATA } from "@/utils/constants";
66

77
function UserProfileCard({ user }: { user: any }) {
88
const userStats = [
@@ -17,11 +17,6 @@ function UserProfileCard({ user }: { user: any }) {
1717
url: value,
1818
}));
1919

20-
const socialLinksIcons = {
21-
github: <FaGithub />,
22-
linkedin: <FaLinkedin />,
23-
twitter: <FaTwitter />,
24-
};
2520
return (
2621
<Card withBorder padding="xl" radius="md" w={350}>
2722
<Card.Section
@@ -43,32 +38,44 @@ function UserProfileCard({ user }: { user: any }) {
4338
</Text>
4439
<StatsList stats={userStats} />
4540
<Divider my="md" />
41+
<Stack gap={7}>
42+
<Text fz="sm" c="dimmed" ta="center">
43+
Joined Cranecloud {user?.age}
44+
</Text>
4645

47-
<Text fz="sm" mb="md" c="dimmed" ta="center">
48-
Joined Cranecloud {user?.age}
49-
</Text>
50-
<Stack gap={4}>
5146
{user?.biography && (
52-
<Text fz="sm" c="black" ta="center" lineClamp={3} fw={300}>
47+
<Text fz="sm" ta="center" lineClamp={3} fw={500}>
5348
{user?.biography}
5449
</Text>
5550
)}
56-
<Divider my="md" />
57-
51+
</Stack>
52+
<Divider my="md" />
53+
<Stack gap={7} fz="sm" fw={500}>
5854
{user?.organisation && (
59-
<Group gap={5} fz="0.9rem" fw={600} mt="sm">
60-
<PiBuildingsBold size={17} />
55+
<Group gap={10}>
56+
<PiBuildingsBold size={16} />
6157
{user?.organisation}
6258
</Group>
6359
)}
64-
{links.map((link, index) => (
65-
<Link key={index} to={link.url as string} target="_blank">
66-
<Group gap={5} fz="0.9rem">
67-
{socialLinksIcons[link.platform as keyof typeof socialLinksIcons]}
68-
{link.url as string}
69-
</Group>
70-
</Link>
71-
))}
60+
{links.map((link, index) => {
61+
const platform = SOCIAL_LINKS_DATA.find(
62+
(p) => p.value === link.platform,
63+
);
64+
const IconComponent = platform?.icon;
65+
66+
return (
67+
<Link key={index} to={link.url as string} target="_blank">
68+
<Group gap={10} align="center">
69+
{IconComponent && (
70+
<IconComponent size={16} color={platform?.color} />
71+
)}
72+
<Text size="sm" style={{ flex: 1 }}>
73+
{link.url as string}
74+
</Text>
75+
</Group>
76+
</Link>
77+
);
78+
})}
7279
</Stack>
7380
</Card>
7481
);

src/components/Elements/ChartTooltip.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { formatMetricValue, formatTimestamp } from "@/utils/helpers";
22
import { Paper, Text } from "@mantine/core";
3+
import moment from "moment";
34

45
interface ChartTooltipProps {
56
label: string;
@@ -16,14 +17,28 @@ export default function ChartTooltip({
1617
return null;
1718
}
1819

20+
const getTimeLabel = () => {
21+
if (label) {
22+
return formatTimestamp(Number(label));
23+
}
24+
const firstPayload = payload[0]?.payload;
25+
if (firstPayload) {
26+
return moment([firstPayload.year, firstPayload.month - 1]).format(
27+
"MMM YYYY",
28+
);
29+
}
30+
return null;
31+
};
32+
1933
return (
2034
<Paper px="md" py="sm" withBorder shadow="md" radius="md">
2135
<Text fw={500} mb={5}>
22-
{formatTimestamp(Number(label))}
36+
{getTimeLabel()}
37+
{/* {formatTimestamp(Number(label))} */}
2338
</Text>
2439
{payload.map((item: any) => (
2540
<Text key={item.name} c={item.color} fz="sm">
26-
Usage: {formatMetricValue(chartType, item.value)}
41+
{formatMetricValue(chartType, item.value)}
2742
</Text>
2843
))}
2944
</Paper>

0 commit comments

Comments
 (0)