Files
cal.diy/packages/features/insights/components/FeedbackTable.tsx
T
Eunjae Lee 3e299f9511
Post release / release (push) Canceled after 0s
refactor: update charts on /insights to use InsightsBookingService (#22744)
* refactor: update PopuplarEvents chart to use InsightsBookingService

* use buildHashMapForUsers

* refactor least booked

* refactor charts

* combine methods

* refactor booking kpi cards

* remove unused code

* fix booking kpi cards

* restore code that was removed accidentally

* Revert "restore code that was removed accidentally"

This reverts commit 0c0b444b02498b94fb29ef470da065bad3ad7ece.

* Revert "fix booking kpi cards"

This reverts commit b1e8e9afbd3632a5239495566551ae12bd926b66.

* refactor booking kpi cards

* revert method and remove unused code

* fix previous period

* fix metrics

* clean up trpc call params

* clean up Download.tsx

* split utils

* restructure folders for components

* clean up imports

* rename TotalUserFeedbackTable to UserStatsTable

* add guide

* use client

* add curly braces to case

* fix tests
2025-07-29 12:37:18 +02:00

68 lines
2.1 KiB
TypeScript

"use client";
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>
);
};