feat: group same booking reports together (#26529)
Co-authored-by: unknown <> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
35 files changed
+760
-875
No files matched your search
@@ -8,12 +8,20 @@ import {
|
||||
CreateBlocklistEntryModal,
|
||||
PendingReportsBadge,
|
||||
PendingReportsTable,
|
||||
type SortByOption,
|
||||
} from "@calcom/features/blocklist";
|
||||
import { useDataTable } from "@calcom/features/data-table";
|
||||
import { DataTableToolbar } from "~/data-table/components";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import {
|
||||
Dropdown,
|
||||
DropdownItem,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@calcom/ui/components/dropdown";
|
||||
import { ToggleGroup } from "@calcom/ui/components/form";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
@@ -33,6 +41,7 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
const [activeView, setActiveView] = useState<ViewType>("blocked");
|
||||
const [showCreateModal, setShowCreateModal] = useState(false);
|
||||
const [selectedEntryId, setSelectedEntryId] = useState<string | null>(null);
|
||||
const [sortBy, setSortBy] = useState<SortByOption>("createdAt");
|
||||
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
@@ -48,6 +57,7 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
limit,
|
||||
offset,
|
||||
searchTerm,
|
||||
sortBy,
|
||||
filters: { hasWatchlist: false, status: ["PENDING"] },
|
||||
},
|
||||
{ placeholderData: keepPreviousData, enabled: activeView === "pending" }
|
||||
@@ -133,6 +143,33 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
]}
|
||||
/>
|
||||
<DataTableToolbar.SearchBar />
|
||||
{activeView === "pending" && (
|
||||
<Dropdown modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button type="button" color="secondary" EndIcon="chevron-down">
|
||||
{sortBy === "reportCount" ? t("most_reports") : t("most_recent")}
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem>
|
||||
<DropdownItem
|
||||
type="button"
|
||||
onClick={() => setSortBy("createdAt")}
|
||||
className={sortBy === "createdAt" ? "font-medium" : ""}>
|
||||
{t("most_recent")}
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem>
|
||||
<DropdownItem
|
||||
type="button"
|
||||
onClick={() => setSortBy("reportCount")}
|
||||
className={sortBy === "reportCount" ? "font-medium" : ""}>
|
||||
{t("most_reports")}
|
||||
</DropdownItem>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</Dropdown>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{permissions?.canCreate && (
|
||||
@@ -170,11 +207,11 @@ export function BlocklistTable({ permissions }: BlocklistTableProps) {
|
||||
totalRowCount={reportsData?.meta?.totalRowCount ?? 0}
|
||||
isPending={isReportsPending}
|
||||
limit={limit}
|
||||
onAddToBlocklist={(reportIds, type, onSuccess) =>
|
||||
addToWatchlist.mutate({ reportIds, type }, { onSuccess })
|
||||
onAddToBlocklist={(email, type, onSuccess) =>
|
||||
addToWatchlist.mutate({ email, type }, { onSuccess })
|
||||
}
|
||||
onDismiss={(reportId, onSuccess) =>
|
||||
dismissReport.mutate({ reportId }, { onSuccess })
|
||||
onDismiss={(email, onSuccess) =>
|
||||
dismissReport.mutate({ email }, { onSuccess })
|
||||
}
|
||||
isAddingToBlocklist={addToWatchlist.isPending}
|
||||
isDismissing={dismissReport.isPending}
|
||||
|
||||
Reference in new issue
Block a user