Files
cal.diy/packages/features/insights/components/FeedbackTable.tsx
T
Eunjae Lee 1878802213 fix: update styles of charts on /insights (#22557)
* fix: update styles of charts on /insights

* clean up

* clean up

* share the same styles with ChartCardItem

* margin for event trends

* fix type error
2025-07-17 14:42:35 +00:00

66 lines
2.1 KiB
TypeScript

import { getUserAvatarUrl } from "@calcom/lib/getAvatarUrl";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { User } from "@calcom/prisma/client";
import { Avatar } from "@calcom/ui/components/avatar";
import { Button } from "@calcom/ui/components/button";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { Tooltip } from "@calcom/ui/components/tooltip";
export const FeedbackTable = ({
data,
}: {
data:
| {
userId: number | null;
user: Pick<User, "avatarUrl" | "name">;
emailMd5?: string;
username?: string;
rating: number | null;
feedback: string | null;
}[]
| undefined;
}) => {
const { t } = useLocale();
return (
<div className="overflow-hidden rounded-md">
{data && data?.length > 0 ? (
data?.map((item) => (
<div
key={item.userId}
className="border-subtle flex items-center justify-between border-b px-4 py-3 last:border-b-0">
<div className="flex items-center">
<Avatar
alt={item.user.name || ""}
size="sm"
imageSrc={getUserAvatarUrl({ avatarUrl: item.user.avatarUrl })}
title={item.user.name || ""}
className="mr-3"
/>
<div className="text-default text-sm font-medium">{item.user.name}</div>
</div>
<div className="flex items-center space-x-4">
<div className="text-default text-sm font-medium">{item.rating}</div>
<Tooltip content={item.feedback}>
<div className="text-default max-w-32 md:max-w-52 truncate text-sm font-medium">
{item.feedback}
</div>
</Tooltip>
</div>
</div>
))
) : (
<EmptyScreen
Icon="zap"
headline={t("no_ratings")}
description={t("no_ratings_description")}
buttonRaw={
<Button target="_blank" color="secondary" href="/workflows">
{t("workflows")}
</Button>
}
/>
)}
</div>
);
};