Skip to content

Scheduling infrastructure for absolutely everyone.

feat: booking reports table and blocklist table for org (#24736)

Udit Takkarc48f2043f216
diff --git a/apps/ui-playground/components/ui/IconGrid.tsx b/apps/ui-playground/components/ui/IconGrid.tsx
index 6bcdb153d06..8ead4d51a12 100644
--- a/apps/ui-playground/components/ui/IconGrid.tsx
+++ b/apps/ui-playground/components/ui/IconGrid.tsx
@@ -22,6 +22,7 @@ type IconName =
| "binary"
| "blocks"
| "bold"
+ | "book"
| "book-open-check"
| "book-open"
| "book-user"
diff --git a/apps/web/modules/settings/organizations/privacy/blocklist-table.tsx b/apps/web/modules/settings/organizations/privacy/blocklist-table.tsx
index 34fe92f86f7..fce84cdf134 100644
--- a/apps/web/modules/settings/organizations/privacy/blocklist-table.tsx
+++ b/apps/web/modules/settings/organizations/privacy/blocklist-table.tsx
@@ -1,23 +1,18 @@
"use client";
-import { keepPreviousData } from "@tanstack/react-query";
-import { getCoreRowModel, getSortedRowModel, useReactTable, type ColumnDef } from "@tanstack/react-table";
-import { useMemo, useState } from "react";
+import { useState } from "react";
-import { DataTableWrapper, DataTableToolbar, useDataTable } from "@calcom/features/data-table";
+import { DataTableToolbar } from "@calcom/features/data-table";
import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { trpc } from "@calcom/trpc";
-import type { RouterOutputs } from "@calcom/trpc/react";
-import { Badge } from "@calcom/ui/components/badge";
import { Button } from "@calcom/ui/components/button";
-import { ButtonGroup } from "@calcom/ui/components/buttonGroup";
-import { ConfirmationDialogContent, Dialog } from "@calcom/ui/components/dialog";
-import { showToast } from "@calcom/ui/components/toast";
+import { ToggleGroup } from "@calcom/ui/components/form";
-import { BlocklistEntryDetailsSheet } from "./components/blocklist-entry-details-sheet";
+import PendingReportsBadge from "./components/PendingReportsBadge";
+import { BlockedEntriesTable } from "./components/blocked-entries-table";
import { CreateBlocklistEntryModal } from "./components/create-blocklist-entry-modal";
+import { PendingReportsTable } from "./components/pending-reports-table";
-type BlocklistEntry = RouterOutputs["viewer"]["organizations"]["listWatchlistEntries"]["rows"][number];
+type ViewType = "blocked" | "pending";
interface BlocklistTableProps {
permissions?: {
@@ -29,179 +24,49 @@ interface BlocklistTableProps {
export function BlocklistTable({ permissions }: BlocklistTableProps) {
const { t } = useLocale();
- const { limit, offset, searchTerm } = useDataTable();
-
+ const [activeView, setActiveView] = useState<ViewType>("blocked");
const [showCreateModal, setShowCreateModal] = useState(false);
- const [showDetailsSheet, setShowDetailsSheet] = useState(false);
- const [selectedEntry, setSelectedEntry] = useState<BlocklistEntry | null>(null);
- const [entryToDelete, setEntryToDelete] = useState<BlocklistEntry | null>(null);
- const [showDeleteDialog, setShowDeleteDialog] = useState(false);
-
- const { data, isPending } = trpc.viewer.organizations.listWatchlistEntries.useQuery(
- {
- limit,
- offset,
- searchTerm,
- },
- {
- placeholderData: keepPreviousData,
- }
- );
-
- const utils = trpc.useUtils();
-
- const deleteWatchlistEntry = trpc.viewer.organizations.deleteWatchlistEntry.useMutation({
- onSuccess: async () => {
- await utils.viewer.organizations.listWatchlistEntries.invalidate();
- showToast(t("blocklist_entry_deleted"), "success");
- setShowDeleteDialog(false);
- setEntryToDelete(null);
- },
- onError: (error) => {
- showToast(error.message, "error");
- },
- });
-
- const handleDelete = (entry: BlocklistEntry) => {
- setEntryToDelete(entry);
- setShowDeleteDialog(true);
- };
-
- const confirmDelete = () => {
- if (entryToDelete) {
- deleteWatchlistEntry.mutate({ id: entryToDelete.id });
- }
- };
-
- const handleViewDetails = (entry: BlocklistEntry) => {
- setSelectedEntry(entry);
- setShowDetailsSheet(true);
- };
-
- const totalRowCount = data?.meta?.totalRowCount ?? 0;
- const flatData = useMemo<BlocklistEntry[]>(() => data?.rows ?? [], [data]);
-
- const columns = useMemo<ColumnDef<BlocklistEntry>[]>(
- () => [
- {
- id: "value",
- header: t("value"),
- accessorKey: "value",
- enableHiding: false,
- cell: ({ row }) => <span className="text-emphasis">{row.original.value}</span>,
- },
- {
- id: "type",
- header: t("type"),
- accessorKey: "type",
- size: 100,
- cell: ({ row }) => (
- <Badge variant="blue">{row.original.type === "EMAIL" ? t("email") : t("domain")}</Badge>
- ),
- },
- {
- id: "createdBy",
- header: t("blocked_by"),
- size: 180,
- cell: ({ row }) => {
- const audit = row.original.audits?.[0] as
- | { changedByUserId: number | null }
- | {
- changedByUser?: { id: number; email: string; name: string | null } | undefined;
- changedByUserId: number | null;
- }
- | undefined;
- const email =
- (audit && "changedByUser" in audit ? audit.changedByUser?.email : undefined) ?? undefined;
- return <span className="text-default">{email ?? "—"}</span>;
- },
- },
- {
- id: "actions",
- header: "",
- size: 120,
- enableHiding: false,
- enableSorting: false,
- enableResizing: false,
- cell: ({ row }) => {
- const entry = row.original;
- return (
- <div className="flex items-center justify-end">
- <ButtonGroup combined containerProps={{ className: "border-default" }}>
- <Button
- color="secondary"
- variant="icon"
- StartIcon="eye"
- onClick={() => handleViewDetails(entry)}
- tooltip={t("view")}
- />
- {permissions?.canDelete && (
- <Button
- color="destructive"
- variant="icon"
- StartIcon="trash"
- onClick={() => handleDelete(entry)}
- tooltip={t("delete")}
- />
- )}
- </ButtonGroup>
- </div>
- );
- },
- },
- ],
- [t, permissions?.canDelete]
- );
-
- const table = useReactTable({
- data: flatData,
- columns,
- getCoreRowModel: getCoreRowModel(),
- getSortedRowModel: getSortedRowModel(),
- manualPagination: true,
- pageCount: Math.ceil(totalRowCount / limit),
- });
return (
<>
- <DataTableWrapper
- table={table}
- isPending={isPending}
- variant="default"
- paginationMode="standard"
- totalRowCount={totalRowCount}>
- <div className="flex items-center justify-between">
+ <div className="mb-4 flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <ToggleGroup
+ value={activeView}
+ onValueChange={(value) => {
+ if (value) setActiveView(value as ViewType);
+ }}
+ options={[
+ { value: "blocked", label: t("blocked") },
+ {
+ value: "pending",
+ label: (
+ <span className="flex items-center">
+ {t("pending")}
+ <PendingReportsBadge />
+ </span>
+ ),
+ },
+ ]}
+ />
<DataTableToolbar.SearchBar />
- <div className="flex items-center gap-2">
- {permissions?.canCreate && (
- <Button color="primary" StartIcon="plus" onClick={() => setShowCreateModal(true)}>
- {t("create_block_entry")}
- </Button>
- )}
- </div>
</div>
- </DataTableWrapper>
-
- <CreateBlocklistEntryModal isOpen={showCreateModal} onClose={() => setShowCreateModal(false)} />
+ <div className="flex items-center gap-2">
+ {permissions?.canCreate && (
+ <Button color="primary" StartIcon="plus" onClick={() => setShowCreateModal(true)}>
+ {t("add")}
+ </Button>
+ )}
+ </div>
+ </div>
- <BlocklistEntryDetailsSheet
- entry={selectedEntry}
- isOpen={showDetailsSheet}
- onClose={() => {
- setShowDetailsSheet(false);
- setSelectedEntry(null);
- }}
- />
+ {activeView === "blocked" ? (
+ <BlockedEntriesTable permissions={permissions} onAddClick={() => setShowCreateModal(true)} />
+ ) : (
+ <PendingReportsTable />
+ )}
- <Dialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
- <ConfirmationDialogContent
- variety="danger"
- title={t("delete_blocklist_entry")}
- confirmBtnText={t("delete")}
- onConfirm={confirmDelete}>
- {t("delete_blocklist_entry_confirmation", { value: entryToDelete?.value })}
- </ConfirmationDialogContent>
- </Dialog>
+ <CreateBlocklistEntryModal isOpen={showCreateModal} onClose={() => setShowCreateModal(false)} />
</>
);
}
diff --git a/apps/web/modules/settings/organizations/privacy/components/PendingReportsBadge.tsx b/apps/web/modules/settings/organizations/privacy/components/PendingReportsBadge.tsx
new file mode 100644
index 00000000000..aec0f3781e9
--- /dev/null
+++ b/apps/web/modules/settings/organizations/privacy/components/PendingReportsBadge.tsx
@@ -0,0 +1,12 @@
+import { trpc } from "@calcom/trpc/react";
+import { Badge } from "@calcom/ui/components/badge";
+
+export default function PendingReportsBadge() {
+ const { data: pendingReportsCount } = trpc.viewer.organizations.pendingReportsCount.useQuery();
+ if (!pendingReportsCount) return null;
+ return (
+ <Badge rounded variant="orange" className="ml-1">
+ {pendingReportsCount}
+ </Badge>
+ );
+}
diff --git a/apps/web/modules/settings/organizations/privacy/components/blocked-entries-columns.tsx b/apps/web/modules/settings/organizations/privacy/components/blocked-entries-columns.tsx
new file mode 100644
index 00000000000..cd81c18ad0b
--- /dev/null
+++ b/apps/web/modules/settings/organizations/privacy/components/blocked-entries-columns.tsx
@@ -0,0 +1,108 @@
+import type { ColumnDef } from "@tanstack/react-table";
+import { useMemo } from "react";
+
+import type { RouterOutputs } from "@calcom/trpc/react";
+import { Badge } from "@calcom/ui/components/badge";
+import { Button } from "@calcom/ui/components/button";
+import {
+ Dropdown,
+ DropdownItem,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@calcom/ui/components/dropdown";
+
+type BlocklistEntry = RouterOutputs["viewer"]["organizations"]["listWatchlistEntries"]["rows"][number];
+
+interface UseBlockedEntriesColumnsProps {
+ t: (key: string) => string;
+ canDelete?: boolean;
+ onViewDetails: (entry: BlocklistEntry) => void;
+ onDelete: (entry: BlocklistEntry) => void;
+}
+
+export function useBlockedEntriesColumns({
+ t,
+ canDelete,
+ onViewDetails,
+ onDelete,
+}: UseBlockedEntriesColumnsProps) {
+ return useMemo<ColumnDef<BlocklistEntry>[]>(
+ () => [
+ {
+ id: "email_slash_domain",
+ header: t("email_slash_domain"),
+ accessorKey: "value",
+ enableHiding: false,
+ cell: ({ row }) => <span className="text-emphasis">{row.original.value}</span>,
+ },
+ {
+ id: "type",
+ header: t("type"),
+ accessorKey: "type",
+ size: 100,
+ cell: ({ row }) => (
+ <Badge variant="blue">{row.original.type === "EMAIL" ? t("email") : t("domain")}</Badge>
+ ),
+ },
+ {
+ id: "createdBy",
+ header: t("blocked_by"),
+ size: 180,
+ cell: ({ row }) => {
+ const audit = row.original.audits?.[0] as
+ | { changedByUserId: number | null }
+ | {
+ changedByUser?: { id: number; email: string; name: string | null } | undefined;
+ changedByUserId: number | null;
+ }
+ | undefined;
+ const email =
+ (audit && "changedByUser" in audit ? audit.changedByUser?.email : undefined) ?? undefined;
+ return <span className="text-default">{email ?? "—"}</span>;
+ },
+ },
+ {
+ id: "actions",
+ header: "",
+ size: 90,
+ minSize: 90,
+ maxSize: 90,
+ enableHiding: false,
+ enableSorting: false,
+ enableResizing: false,
+ cell: ({ row }) => {
+ const entry = row.original;
+ return (
+ <div className="flex items-center justify-end">
+ <Dropdown modal={false}>
+ <DropdownMenuTrigger asChild>
+ <Button type="button" variant="icon" color="secondary" StartIcon="ellipsis" />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuItem>
+ <DropdownItem type="button" StartIcon="eye" onClick={() => onViewDetails(entry)}>
+ {t("view_details")}
+ </DropdownItem>
+ </DropdownMenuItem>
+ {canDelete && (
+ <DropdownMenuItem>
+ <DropdownItem
+ type="button"
+ color="destructive"
+ StartIcon="trash"
+ onClick={() => onDelete(entry)}>
+ {t("remove_from_blocklist")}
+ </DropdownItem>
+ </DropdownMenuItem>
+ )}
+ </DropdownMenuContent>
+ </Dropdown>
+ </div>
+ );
+ },
+ },
+ ],
+ [t, canDelete, onViewDetails, onDelete]
+ );
+}
diff --git a/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx b/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx
new file mode 100644
index 00000000000..e8013c63ad9
--- /dev/null
+++ b/apps/web/modules/settings/organizations/privacy/components/blocked-entries-table.tsx
@@ -0,0 +1,165 @@
+"use client";
+
+import { keepPreviousData } from "@tanstack/react-query";
+import { getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
+import { useMemo, useState } from "react";
+
+import { DataTableWrapper, useDataTable } from "@calcom/features/data-table";
+import { IS_CALCOM } from "@calcom/lib/constants";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { trpc } from "@calcom/trpc";
+import type { RouterOutputs } from "@calcom/trpc/react";
+import { Button } from "@calcom/ui/components/button";
+import { ConfirmationDialogContent, Dialog, DialogClose } from "@calcom/ui/components/dialog";
+import { EmptyScreen } from "@calcom/ui/components/empty-screen";
+import { showToast } from "@calcom/ui/components/toast";
+
+import { useBlockedEntriesColumns } from "./blocked-entries-columns";
+import { BlocklistEntryDetailsSheet } from "./blocklist-entry-details-sheet";
+
+type BlocklistEntry = RouterOutputs["viewer"]["organizations"]["listWatchlistEntries"]["rows"][number];
+
+interface BlockedEntriesTableProps {
+ permissions?: {
+ canRead: boolean;
+ canCreate: boolean;
+ canDelete: boolean;
+ };
+ onAddClick: () => void;
+}
+
+export function BlockedEntriesTable({ permissions, onAddClick }: BlockedEntriesTableProps) {
+ const { t } = useLocale();
+ const { limit, offset, searchTerm } = useDataTable();
+
+ const [showDetailsSheet, setShowDetailsSheet] = useState(false);
+ const [selectedEntry, setSelectedEntry] = useState<BlocklistEntry | null>(null);
+ const [entryToDelete, setEntryToDelete] = useState<BlocklistEntry | null>(null);
+ const [showDeleteDialog, setShowDeleteDialog] = useState(false);
+
+ const { data, isPending } = trpc.viewer.organizations.listWatchlistEntries.useQuery(
+ {
+ limit,
+ offset,
+ searchTerm,
+ },
+ {
+ placeholderData: keepPreviousData,
+ }
+ );
+
+ const utils = trpc.useUtils();
+
+ const deleteWatchlistEntry = trpc.viewer.organizations.deleteWatchlistEntry.useMutation({
+ onSuccess: async () => {
+ await utils.viewer.organizations.listWatchlistEntries.invalidate();
+ showToast(t("blocklist_entry_deleted"), "success");
+ setShowDeleteDialog(false);
+ setEntryToDelete(null);
+ },
+ onError: (error) => {
+ showToast(error.message, "error");
+ },
+ });
+
+ const handleViewDetails = (entry: BlocklistEntry) => {
+ setSelectedEntry(entry);
+ setShowDetailsSheet(true);
+ };
+
+ const handleDelete = (entry: BlocklistEntry) => {
+ setEntryToDelete(entry);
+ setShowDeleteDialog(true);
+ };
+
+ const confirmDelete = () => {
+ if (entryToDelete) {
+ deleteWatchlistEntry.mutate({ id: entryToDelete.id });
+ }
+ };
+
+ const columns = useBlockedEntriesColumns({
+ t,
+ canDelete: permissions?.canDelete,
+ onViewDetails: handleViewDetails,
+ onDelete: handleDelete,
+ });
+
+ const totalRowCount = data?.meta?.totalRowCount ?? 0;
+ const flatData = useMemo(() => data?.rows ?? [], [data]);
+
+ const table = useReactTable({
+ data: flatData,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getSortedRowModel: getSortedRowModel(),
+ manualPagination: true,
+ pageCount: Math.ceil(totalRowCount / limit),
+ });
+
+ return (
+ <>
+ <DataTableWrapper
+ table={table}
+ isPending={isPending}
+ variant="default"
+ paginationMode="standard"
+ EmptyView={
+ <EmptyScreen
+ customIcon={<img className="mb-6" src="/slash-icon-cards.svg" />}
+ headline={searchTerm ? t("no_result_found_for", { searchTerm }) : t("pbac_resource_blocklist")}
+ description={t("add_people_to_blocklist")}
+ className="bg-muted mb-16"
+ iconWrapperClassName="bg-default"
+ dashedBorder={false}
+ buttonRaw={
+ <div className="flex gap-2">
+ <Button
+ StartIcon="plus"
+ onClick={onAddClick}
+ color="primary"
+ disabled={!permissions?.canCreate}>
+ {t("add")}
+ </Button>
+ {IS_CALCOM && (
+ <Button
+ StartIcon="book"
+ color="secondary"
+ onClick={() =>
+ window.open("https://cal.com/help/security/blocklist", "_blank", "noopener,noreferrer")
+ }>
+ {t("docs")}
+ </Button>
+ )}
+ </div>
+ }
+ />
+ }
+ totalRowCount={totalRowCount}
+ />
+
+ <BlocklistEntryDetailsSheet
+ entry={selectedEntry}
+ isOpen={showDetailsSheet}
+ onClose={() => {
+ setShowDetailsSheet(false);
+ setSelectedEntry(null);
+ }}
+ handleDeleteBlocklistEntry={handleDelete}
+ />
+
+ <Dialog open={showDeleteDialog} onOpenChange={setShowDeleteDialog}>
+ <ConfirmationDialogContent
+ variety="danger"
+ title={t("remove_value_from_blocklist", { value: entryToDelete?.value })}
+ confirmBtn={
+ <DialogClose color="destructive" onClick={confirmDelete}>
+ {t("remove")}
+ </DialogClose>
+ }>
+ {t("remove_value_from_blocklist_description")}
+ </ConfirmationDialogContent>
+ </Dialog>
+ </>
+ );
+}
diff --git a/apps/web/modules/settings/organizations/privacy/components/blocklist-entry-details-sheet.tsx b/apps/web/modules/settings/organizations/privacy/components/blocklist-entry-details-sheet.tsx
index 3ac4140fa21..1120d1ed0e2 100644
--- a/apps/web/modules/settings/organizations/privacy/components/blocklist-entry-details-sheet.tsx
+++ b/apps/web/modules/settings/organizations/privacy/components/blocklist-entry-details-sheet.tsx
@@ -1,12 +1,21 @@
"use client";
import { format } from "date-fns";
+import Link from "next/link";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { RouterOutputs } from "@calcom/trpc/react";
import { trpc } from "@calcom/trpc/react";
-import { Badge } from "@calcom/ui/components/badge";
-import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@calcom/ui/components/sheet";
+import { Button } from "@calcom/ui/components/button";
+import { Icon } from "@calcom/ui/components/icon";
+import {
+ Sheet,
+ SheetContent,
+ SheetBody,
+ SheetHeader,
+ SheetTitle,
+ SheetFooter,
+} from "@calcom/ui/components/sheet";
import { SkeletonText } from "@calcom/ui/components/skeleton";
type BlocklistEntry = RouterOutputs["viewer"]["organizations"]["listWatchlistEntries"]["rows"][number];
@@ -15,9 +24,15 @@ interface BlocklistEntryDetailsSheetProps {
entry: BlocklistEntry | null;
isOpen: boolean;
onClose: () => void;
+ handleDeleteBlocklistEntry: (entry: BlocklistEntry) => void;
}
-export function BlocklistEntryDetailsSheet({ entry, isOpen, onClose }: BlocklistEntryDetailsSheetProps) {
+export function BlocklistEntryDetailsSheet({
+ entry,
+ isOpen,
+ onClose,
+ handleDeleteBlocklistEntry,
+}: BlocklistEntryDetailsSheetProps) {
const { t } = useLocale();
const { data, isLoading } = trpc.viewer.organizations.getWatchlistEntryDetails.useQuery(
@@ -27,104 +42,115 @@ export function BlocklistEntryDetailsSheet({ entry, isOpen, onClose }: Blocklist
}
);
- const getActionVariant = (action: string) => {
- switch (action) {
- case "BLOCK":
- return "red";
- case "REPORT":
- return "orange";
- case "ALERT":
- return "blue";
- default:
- return "gray";
- }
- };
-
return (
- <Sheet open={isOpen} onOpenChange={(open) => { if (!open) onClose(); }}>
- <SheetContent className="overflow-y-auto">
- <SheetHeader>
- <SheetTitle>{t("blocklist_entry_details")}</SheetTitle>
+ <Sheet
+ open={isOpen}
+ onOpenChange={(open) => {
+ if (!open) onClose();
+ }}>
+ <SheetContent className="px-0 pb-0 sm:max-w-xl sm:px-0 sm:pb-0">
+ <SheetHeader className="px-6">
+ <SheetTitle>{entry?.value}</SheetTitle>
</SheetHeader>
- {isLoading ? (
- <div className="mt-6 space-y-4">
- <SkeletonText className="h-6 w-32" />
- <SkeletonText className="h-10 w-full" />
- <SkeletonText className="h-6 w-32" />
- <SkeletonText className="h-10 w-full" />
- <SkeletonText className="h-6 w-32" />
- <SkeletonText className="h-20 w-full" />
- </div>
- ) : data?.entry ? (
- <div className="mt-6">
- <div className="space-y-4">
- <div>
- <label className="text-default mb-1 block text-sm font-medium">{t("type")}</label>
- <Badge variant="blue" size="lg">
- {data.entry.type === "EMAIL" ? t("email") : t("domain")}
- </Badge>
- </div>
+ <SheetBody className="px-6">
+ {isLoading ? (
+ <div className="mt-3 space-y-3">
+ <SkeletonText className="h-6 w-32" />
+ <SkeletonText className="h-40 w-full" />
+ </div>
+ ) : data?.entry ? (
+ <div className="mt-3 space-y-6">
+ <div className="bg-subtle rounded-xl p-1">
+ <h2 className="text-default p-5 text-sm font-semibold">{t("details")}</h2>
- <div>
- <label className="text-default mb-1 block text-sm font-medium">{t("value")}</label>
- <p className="text-emphasis text-base">{data.entry.value}</p>
- </div>
+ <div className="bg-default space-y-3 rounded-xl p-5">
+ <div>
+ <label className="text-default block text-sm font-semibold">
+ {data.entry.type === "EMAIL" ? t("email") : t("domain")}
+ </label>
+ <p className="text-subtle text-sm">{data.entry.value}</p>
+ </div>
- <div>
- <label className="text-default mb-1 block text-sm font-medium">{t("action")}</label>
- <Badge variant={getActionVariant(data.entry.action)} size="lg">
- {t(data.entry.action.toLowerCase())}
- </Badge>
- </div>
+ <div>
+ <label className="text-default block text-sm font-semibold">{t("type")}</label>
+ <p className="text-subtle text-sm">
+ {data.entry.type === "EMAIL" ? t("email") : t("domain")}
+ </p>
+ </div>
- <div>
- <label className="text-default mb-1 block text-sm font-medium">{t("description")}</label>
- <p className="text-default">{data.entry.description || t("no_description_provided")}</p>
- </div>
+ <div>
+ <label className="text-default block text-sm font-semibold">{t("blocked_by")}</label>
+ <p className="text-subtle text-sm">{data.auditHistory[0]?.changedByUser?.email || "—"}</p>
+ </div>
- <div>
- <label className="text-default mb-1 block text-sm font-medium">{t("created_by")}</label>
- <p className="text-default">{data.auditHistory[0]?.changedByUser?.email || "—"}</p>
- </div>
- </div>
+ <div>
+ <label className="text-default block text-sm font-semibold">{t("description")}</label>
+ <p className="text-subtle text-sm">
+ {data.entry.description || t("no_description_provided")}
+ </p>
+ </div>
- <div className="border-subtle my-6 border-t" />
+ {data.entry.bookingReports && data.entry.bookingReports.length > 0 && (
+ <div>
+ <label className="text-default block text-sm font-semibold">
+ {t("related_booking")}
+ </label>
- <div>
- <h3 className="text-emphasis mb-4 font-semibold">{t("audit_history")}</h3>
- {data.auditHistory.length > 0 ? (
- <div className="space-y-0">
- {data.auditHistory.map((audit, index) => (
- <div
- key={audit.id}
- className={`py-3 ${
- index !== data.auditHistory.length - 1 ? "border-subtle border-b" : ""
- }`}>
- <div className="mb-1 flex items-start justify-between">
- <div className="flex items-center gap-1.5">
- <span className="text-muted text-xs">{t("by")}:</span>
- <span className="text-default text-sm">{audit.changedByUser?.email || "—"}</span>
- </div>
- <span className="text-muted text-xs">
- {format(new Date(audit.changedAt), "MMM d, h:mm a")}
- </span>
- </div>
- <div className="flex items-center gap-1.5">
- <span className="text-muted text-xs">{t("added")}:</span>
- <span className="text-emphasis text-sm">{audit.value}</span>
- </div>
+ {data.entry.bookingReports.map((report) => {
+ return (
+ <Link key={report.booking.uid} href={`/booking/${report.booking.uid}`}>
+ <div className="text-subtle flex items-center gap-1 text-sm">
+ {report.booking.title}
+ <Icon name="external-link" className="h-4 w-4" />
+ </div>
+ </Link>
+ );
+ })}
</div>
- ))}
+ )}
</div>
- ) : (
- <p className="text-muted text-sm">{t("no_audit_history")}</p>
- )}
+ </div>
+
+ <div className="bg-subtle rounded-xl p-1">
+ <h2 className="text-default p-5 text-sm font-semibold">{t("history")}</h2>
+ {data.auditHistory.length > 0 ? (
+ <div className="space-y-3">
+ {data.auditHistory.map((audit) => (
+ <div key={audit.id} className="bg-default border-subtle rounded-xl border p-4">
+ <div className="flex items-start justify-between">
+ <div>
+ <span className="text-default text-sm font-semibold">
+ {audit.changedByUser?.name || audit.changedByUser?.email || "—"}
+ </span>
+ <span className="text-subtle text-sm"> {t("added")}</span>
+ <div className="text-default mt-1 text-sm font-semibold">{audit.value}</div>
+ </div>
+ <span className="text-subtle text-sm">
+ {format(new Date(audit.changedAt), "MMM d, h:mm a")}
+ </span>
+ </div>
+ </div>
+ ))}
+ </div>
+ ) : (
+ <p className="text-subtle text-sm">{t("no_audit_history")}</p>
+ )}
+ </div>
</div>
- </div>
- ) : (
- <div className="text-muted mt-8 text-center">{t("blocklist_entry_not_found")}</div>
- )}
+ ) : (
+ <div className="text-muted mt-8 text-center">{t("blocklist_entry_not_found")}</div>
+ )}
+ </SheetBody>
+ <SheetFooter className="bg-muted px-6 py-5">
+ <Button
+ type="button"
+ color="secondary"
+ onClick={() => entry && handleDeleteBlocklistEntry(entry)}
+ disabled={!entry}>
+ {t("remove_from_blocklist")}
+ </Button>
+ </SheetFooter>
</SheetContent>
</Sheet>
);
diff --git a/apps/web/modules/settings/organizations/privacy/components/booking-report-entry-details-modal.tsx b/apps/web/modules/settings/organizations/privacy/components/booking-report-entry-details-modal.tsx
new file mode 100644
index 00000000000..5d0858fd3d9
--- /dev/null
+++ b/apps/web/modules/settings/organizations/privacy/components/booking-report-entry-details-modal.tsx
@@ -0,0 +1,208 @@
+"use client";
+
+import Link from "next/link";
+import { Controller, useForm } from "react-hook-form";
+
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { WatchlistType } from "@calcom/prisma/enums";
+import type { RouterOutputs } from "@calcom/trpc/react";
+import { trpc } from "@calcom/trpc/react";
+import { Button } from "@calcom/ui/components/button";
+import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog";
+import { ToggleGroup } from "@calcom/ui/components/form";
+import { Icon } from "@calcom/ui/components/icon";
+import { showToast } from "@calcom/ui/components/toast";
+
+type BookingReport = RouterOutputs["viewer"]["organizations"]["listBookingReports"]["rows"][number];
+
+interface BookingReportEntryDetailsModalProps {
+ entry: BookingReport | null;
+ isOpen: boolean;
+ onClose: () => void;
+}
+
+interface FormData {
+ blockType: WatchlistType;
+}
+
+export function BookingReportEntryDetailsModal({
+ entry,
+ isOpen,
+ onClose,
+}: BookingReportEntryDetailsModalProps) {
+ const { t } = useLocale();
+ const utils = trpc.useUtils();
+
+ const {
+ control,
+ handleSubmit,
+ reset,
+ formState: { isSubmitting },
+ } = useForm<FormData>({
+ defaultValues: {
+ blockType: WatchlistType.EMAIL,
+ },
+ });
+
+ const addToWatchlist = trpc.viewer.organizations.addToWatchlist.useMutation({
+ onSuccess: async () => {
+ await utils.viewer.organizations.listBookingReports.invalidate();
+ await utils.viewer.organizations.listWatchlistEntries.invalidate();
+ showToast(t("blocklist_entry_created"), "success");
+ onClose();
+ reset();
+ },
+ onError: (error) => {
+ showToast(error.message, "error");
+ },
+ });
+
+ const dismissBookingReport = trpc.viewer.organizations.dismissBookingReport.useMutation({
+ onSuccess: async () => {
+ await utils.viewer.organizations.listBookingReports.invalidate();
+ showToast(t("booking_report_dismissed"), "success");
+ onClose();
+ reset();
+ },
+ onError: (error) => {
+ showToast(error.message, "error");
+ },
+ });
+
+ const onSubmit = (data: FormData) => {
+ if (!entry) return;
+
+ addToWatchlist.mutate({
+ reportIds: [entry.id],
+ type: data.blockType,
+ });
+ };
+
+ const handleDismiss = () => {
+ if (!entry) return;
+
+ dismissBookingReport.mutate({
+ reportId: entry.id,
+ });
+ };
+
+ const handleGoBack = () => {
+ onClose();
+ reset();
+ };
+
+ const reasonMap: Record<string, string> = {
+ SPAM: t("spam"),
+ DONT_KNOW_PERSON: t("dont_know_person"),
+ OTHER: t("other"),
+ };
+
+ if (!entry) return null;
+
+ return (
+ <Dialog open={isOpen} onOpenChange={onClose}>
+ <DialogContent enableOverflow>
+ <DialogHeader title={t("review_report") + ` - ${entry.bookerEmail}`} />
+ <form onSubmit={handleSubmit(onSubmit)}>
+ <div className="space-y-5">
+ <div className="bg-subtle rounded-xl p-1">
+ <h2 className="text-emphasis px-5 py-4 text-base font-semibold">{t("details")}</h2>
+ <div className="bg-default space-y-4 rounded-xl p-5">
+ <div>
+ <label className="text-emphasis mb-1 block text-sm font-semibold">{t("email")}</label>
+ <p className="text-subtle text-sm">{entry.bookerEmail}</p>
+ </div>
+
+ <div>
+ <label className="text-emphasis mb-1 block text-sm font-semibold">{t("reason")}</label>
+ <p className="text-subtle text-sm">{reasonMap[entry.reason] || entry.reason}</p>
+ </div>
+
+ <div>
+ <label className="text-emphasis mb-1 block text-sm font-semibold">{t("reported_by")}</label>
+ <p className="text-subtle text-sm">{entry.reporter?.email || "—"}</p>
+ </div>
+
+ <div>
+ <label className="text-emphasis mb-1 block text-sm font-semibold">{t("description")}</label>
+ <p className="text-subtle text-sm">{entry.description || t("no_description_provided")}</p>
+ </div>
+
+ <div>
+ <label className="text-emphasis mb-1 block text-sm font-semibold">
+ {t("related_booking")}
+ </label>
+ <Link href={`/booking/${entry.booking.uid}`}>
+ <div className="text-subtle flex items-center gap-1 text-sm">
+ {entry.booking.title}
+ <Icon name="external-link" className="h-4 w-4" />
+ </div>
+ </Link>
+ </div>
+ </div>
+ </div>
+
+ <div>
+ <h2 className="text-emphasis mb-2 text-base font-semibold">
+ {t("what_would_you_like_to_block")}
+ </h2>
+ <Controller
+ name="blockType"
+ control={control}
+ render={({ field }) => (
+ <ToggleGroup
+ value={field.value}
+ onValueChange={(value) => {
+ if (value) field.onChange(value);
+ }}
+ options={[
+ {
+ value: WatchlistType.EMAIL,
+ label: t("block_this_email"),
+ iconLeft: <Icon name="mail" className="h-4 w-4" />,
+ },
+ {
+ value: WatchlistType.DOMAIN,
+ label: t("block_all_from_domain"),
+ iconLeft: <Icon name="globe" className="h-4 w-4" />,
+ },
+ ]}
+ />
+ )}
+ />
+ </div>
+ </div>
+
+ <DialogFooter className="mt-6">
+ <div className="flex w-full items-center justify-between">
+ <Button
+ type="button"
+ color="minimal"
+ onClick={handleGoBack}
+ disabled={isSubmitting || addToWatchlist.isPending || dismissBookingReport.isPending}>
+ {t("go_back")}
+ </Button>
+
+ <div className="flex gap-2">
+ <Button
+ type="button"
+ color="secondary"
+ onClick={handleDismiss}
+ loading={dismissBookingReport.isPending}
+ disabled={isSubmitting || addToWatchlist.isPending || dismissBookingReport.isPending}>
+ {t("dont_block")}
+ </Button>
+ <Button
+ type="submit"
+ loading={isSubmitting || addToWatchlist.isPending}
+ disabled={isSubmitting || addToWatchlist.isPending || dismissBookingReport.isPending}>
+ {t("add_to_blocklist")}
+ </Button>
+ </div>
+ </div>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/apps/web/modules/settings/organizations/privacy/components/create-blocklist-entry-modal.tsx b/apps/web/modules/settings/organizations/privacy/components/create-blocklist-entry-modal.tsx
index b2b5d036c27..75645eb05f6 100644
--- a/apps/web/modules/settings/organizations/privacy/components/create-blocklist-entry-modal.tsx
+++ b/apps/web/modules/settings/organizations/privacy/components/create-blocklist-entry-modal.tsx
@@ -8,7 +8,8 @@ import { WatchlistType } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
import { Button } from "@calcom/ui/components/button";
import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog";
-import { Input, Select, Label, TextArea } from "@calcom/ui/components/form";
+import { Input, Label, TextArea, ToggleGroup } from "@calcom/ui/components/form";
+import { Icon } from "@calcom/ui/components/icon";
import { showToast } from "@calcom/ui/components/toast";
interface CreateBlocklistEntryModalProps {
@@ -80,35 +81,34 @@ export function CreateBlocklistEntryModal({ isOpen, onClose }: CreateBlocklistEn
};
const typeOptions = [
- { label: t("email"), value: WatchlistType.EMAIL },
- { label: t("domain"), value: WatchlistType.DOMAIN },
+ { label: t("email"), value: WatchlistType.EMAIL, iconLeft: <Icon name="mail" className="h-4 w-4" /> },
+ { label: t("domain"), value: WatchlistType.DOMAIN, iconLeft: <Icon name="globe" className="h-4 w-4" /> },
];
return (
<Dialog open={isOpen} onOpenChange={onClose}>
<DialogContent enableOverflow>
- <DialogHeader title={t("create_block_entry")} />
+ <DialogHeader title={t("add_to_blocklist")} />
<form onSubmit={handleSubmit(onSubmit)}>
<div className="space-y-4">
<div>
<Label htmlFor="type" className="text-emphasis mb-2 block text-sm font-medium">
- {t("what_would_you_like_to_block")} <span className="text-destructive">*</span>
+ {t("what_would_you_like_to_block")}
</Label>
<Controller
name="type"
control={control}
rules={{ required: t("field_required") }}
render={({ field }) => (
- <Select
- {...field}
- options={typeOptions}
- onChange={(option) => {
- if (option) {
- field.onChange(option.value);
+ <ToggleGroup
+ value={field.value}
+ onValueChange={(value) => {
+ if (value) {
+ field.onChange(value);
setValue("value", "");
}
}}
- value={typeOptions.find((opt) => opt.value === field.value)}
+ options={typeOptions}
/>
)}
/>
@@ -117,8 +117,7 @@ export function CreateBlocklistEntryModal({ isOpen, onClose }: CreateBlocklistEn
<div>
<Label htmlFor="value" className="text-emphasis mb-2 block text-sm font-medium">
- {watchType === WatchlistType.EMAIL ? t("email_address") : t("domain_name")}{" "}
- <span className="text-destructive">*</span>
+ {watchType === WatchlistType.EMAIL ? t("email") : t("domain_name")}{" "}
</Label>
<Controller
name="value"
@@ -139,7 +138,7 @@ export function CreateBlocklistEntryModal({ isOpen, onClose }: CreateBlocklistEn
<div>
<Label htmlFor="description" className="text-emphasis mb-2 block text-sm font-medium">
- {t("description")} <span className="text-subtle font-normal">({t("optional")})</span>
+ {t("description")} <span className="text-muted font-normal">{t("optional")}</span>
</Label>
<Controller
name="description"
@@ -163,7 +162,7 @@ export function CreateBlocklistEntryModal({ isOpen, onClose }: CreateBlocklistEn
type="submit"
loading={isSubmitting || createWatchlistEntry.isPending}
disabled={isSubmitting || createWatchlistEntry.isPending}>
- {t("create_entry")}
+ {t("add_to_blocklist")}
</Button>
</DialogFooter>
</form>
diff --git a/apps/web/modules/settings/organizations/privacy/components/pending-reports-columns.tsx b/apps/web/modules/settings/organizations/privacy/components/pending-reports-columns.tsx
new file mode 100644
index 00000000000..bfd822ce91d
--- /dev/null
+++ b/apps/web/modules/settings/organizations/privacy/components/pending-reports-columns.tsx
@@ -0,0 +1,90 @@
+import type { ColumnDef } from "@tanstack/react-table";
+import { useMemo } from "react";
+
+import type { RouterOutputs } from "@calcom/trpc/react";
+import { Badge } from "@calcom/ui/components/badge";
+import { Button } from "@calcom/ui/components/button";
+import {
+ Dropdown,
+ DropdownItem,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@calcom/ui/components/dropdown";
+
+type BookingReport = RouterOutputs["viewer"]["organizations"]["listBookingReports"]["rows"][number];
+
+interface UsePendingReportsColumnsProps {
+ t: (key: string) => string;
+ onViewDetails: (entry: BookingReport) => void;
+}
+
+export function usePendingReportsColumns({ t, onViewDetails }: UsePendingReportsColumnsProps) {
+ return useMemo<ColumnDef<BookingReport>[]>(
+ () => [
+ {
+ id: "emailOrDomain",
+ header: t("email_slash_domain"),
+ accessorKey: "bookerEmail",
+ enableHiding: false,
+ size: 250,
+ cell: ({ row }) => {
+ const email = row.original.bookerEmail;
+ return (
+ <div className="flex flex-col">
+ <span className="text-emphasis font-medium">{email}</span>
+ </div>
+ );
+ },
+ },
+ {
+ id: "reportedBy",
+ header: t("reported_by"),
+ accessorFn: (row) => row.reporter?.email ?? "-",
+ size: 250,
+ cell: ({ row }) => <span className="text-default">{row.original.reporter?.email ?? "-"}</span>,
+ },
+ {
+ id: "reason",
+ header: t("reason"),
+ size: 150,
+ cell: ({ row }) => {
+ const reason = t(row.original.reason.toLowerCase());
+ const capitalizedReason = reason.charAt(0).toUpperCase() + reason.slice(1);
+
+ return <Badge variant="blue">{capitalizedReason}</Badge>;
+ },
+ },
+ {
+ id: "actions",
+ header: "",
+ size: 90,
+ minSize: 90,
+ maxSize: 90,
+ enableHiding: false,
+ enableSorting: false,
+ enableResizing: false,
+ cell: ({ row }) => {
+ const entry = row.original;
+ return (
+ <div className="flex items-center justify-end">
+ <Dropdown modal={false}>
+ <DropdownMenuTrigger asChild>
+ <Button type="button" variant="icon" color="secondary" StartIcon="ellipsis" />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuItem>
+ <DropdownItem type="button" StartIcon="eye" onClick={() => onViewDetails(entry)}>
+ {t("view_details")}
+ </DropdownItem>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </Dropdown>
+ </div>
+ );
+ },
+ },
+ ],
+ [t, onViewDetails]
+ );
+}
diff --git a/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx b/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx
new file mode 100644
index 00000000000..442861c7fe0
--- /dev/null
+++ b/apps/web/modules/settings/organizations/privacy/components/pending-reports-table.tsx
@@ -0,0 +1,88 @@
+"use client";
+
+import { keepPreviousData } from "@tanstack/react-query";
+import { getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
+import { useMemo, useState } from "react";
+
+import { DataTableWrapper, useDataTable } from "@calcom/features/data-table";
+import { useLocale } from "@calcom/lib/hooks/useLocale";
+import { trpc } from "@calcom/trpc";
+import type { RouterOutputs } from "@calcom/trpc/react";
+import { EmptyScreen } from "@calcom/ui/components/empty-screen";
+
+import { BookingReportEntryDetailsModal } from "./booking-report-entry-details-modal";
+import { usePendingReportsColumns } from "./pending-reports-columns";
+
+type BookingReport = RouterOutputs["viewer"]["organizations"]["listBookingReports"]["rows"][number];
+
+export function PendingReportsTable() {
+ const { t } = useLocale();
+ const { limit, offset, searchTerm } = useDataTable();
+
+ const [showReviewDialog, setShowReviewDialog] = useState(false);
+ const [selectedReport, setSelectedReport] = useState<BookingReport | null>(null);
+
+ const { data, isPending } = trpc.viewer.organizations.listBookingReports.useQuery(
+ {
+ limit,
+ offset,
+ searchTerm,
+ filters: { hasWatchlist: false, status: ["PENDING"] },
+ },
+ {
+ placeholderData: keepPreviousData,
+ }
+ );
+
+ const handleViewDetails = (entry: BookingReport) => {
+ setSelectedReport(entry);
+ setShowReviewDialog(true);
+ };
+
+ const columns = usePendingReportsColumns({
+ t,
+ onViewDetails: handleViewDetails,
+ });
+
+ const totalRowCount = data?.meta?.totalRowCount ?? 0;
+ const flatData = useMemo(() => data?.rows ?? [], [data]);
+
+ const table = useReactTable({
+ data: flatData,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getSortedRowModel: getSortedRowModel(),
+ manualPagination: true,
+ pageCount: Math.ceil(totalRowCount / limit),
+ });
+
+ return (
+ <>
+ <DataTableWrapper
+ table={table}
+ isPending={isPending}
+ variant="default"
+ paginationMode="standard"
+ EmptyView={
+ <EmptyScreen
+ customIcon={<img className="mb-6" src="/slash-icon-cards.svg" />}
+ headline={t("no_pending_reports")}
+ className="bg-muted mb-16"
+ iconWrapperClassName="bg-default"
+ dashedBorder={false}
+ />
+ }
+ totalRowCount={totalRowCount}
+ />
+
+ <BookingReportEntryDetailsModal
+ entry={selectedReport}
+ isOpen={showReviewDialog}
+ onClose={() => {
+ setShowReviewDialog(false);
+ setSelectedReport(null);
+ }}
+ />
+ </>
+ );
+}
diff --git a/apps/web/public/icons/sprite.svg b/apps/web/public/icons/sprite.svg
index bda988eb282..49bb392212a 100644
--- a/apps/web/public/icons/sprite.svg
+++ b/apps/web/public/icons/sprite.svg
@@ -80,6 +80,9 @@
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" ></path>
<circle cx="12" cy="8" r="2" ></circle>
</symbol>
+<symbol class="lucide lucide-book" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="book">
+ <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" ></path>
+</symbol>
<symbol class="lucide lucide-bookmark" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="bookmark">
<path d="m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" ></path>
</symbol>
diff --git a/apps/web/public/slash-icon-cards.svg b/apps/web/public/slash-icon-cards.svg
new file mode 100644
index 00000000000..b02c7724bc7
--- /dev/null
+++ b/apps/web/public/slash-icon-cards.svg
@@ -0,0 +1,84 @@
+<svg width="121" height="50" viewBox="0 0 121 50" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g filter="url(#filter0_dd_8417_4219)">
+<rect x="55.7931" y="3.74902" width="31.6098" height="33.9512" rx="6.01331" transform="rotate(10 55.7931 3.74902)" fill="white"/>
+<rect x="55.437" y="3.24043" width="32.4878" height="34.8293" rx="6.45234" transform="rotate(10 55.437 3.24043)" stroke="#E8E8E8" stroke-width="0.878049"/>
+<g clip-path="url(#clip0_8417_4219)">
+<path d="M73.8384 20.2918C73.5604 20.0762 73.1621 20.1296 72.9486 20.4053C72.7348 20.6827 72.7849 21.0805 73.0622 21.2951C73.7489 21.8266 74.0832 22.6866 73.9326 23.5409L73.1984 27.7043C73.1782 27.8192 73.0685 27.896 72.9536 27.8758L68.1448 27.0279C68.1669 26.9614 68.1899 26.8942 68.2023 26.8234L68.9365 22.66C69.0911 21.7831 68.8989 20.9302 68.4767 20.2178L71.2138 20.7004C71.5585 20.7612 71.8876 20.5308 71.9484 20.186C72.0092 19.8413 71.7787 19.5122 71.434 19.4514L66.0216 18.4971C64.0698 18.1529 62.2027 19.461 61.8587 21.4119L61.1245 25.5754C60.9829 26.3789 61.5213 27.1478 62.3248 27.2895L66.6964 28.0603L66.5128 29.1012C66.4521 29.4459 66.6825 29.775 67.0272 29.8358C67.372 29.8966 67.7011 29.6662 67.7619 29.3214L67.9454 28.2806L72.7333 29.1248C73.5369 29.2665 74.3058 28.7281 74.4475 27.9246L75.1816 23.7611C75.4143 22.4413 74.8992 21.1116 73.8384 20.2918ZM65.6062 25.7217L63.9409 25.428C63.5961 25.3672 63.3657 25.0381 63.4265 24.6934C63.4873 24.3487 63.8164 24.1182 64.1611 24.179L65.8265 24.4727C66.1712 24.5334 66.4017 24.8626 66.3409 25.2073C66.2801 25.552 65.951 25.7825 65.6062 25.7217Z" fill="#070A0D"/>
+<path d="M74.1031 16.4878L72.0214 16.1207C71.6766 16.06 71.3475 16.2904 71.2867 16.6351L70.4792 21.2149C70.4184 21.5596 70.6489 21.8887 70.9936 21.9495C71.3383 22.0103 71.6674 21.7799 71.7282 21.4351L72.2421 18.5207L73.6993 18.7777C74.044 18.8385 74.3731 18.608 74.4339 18.2633L74.6175 17.2224C74.6782 16.8777 74.4478 16.5486 74.1031 16.4878Z" fill="#070A0D"/>
+</g>
+</g>
+<g filter="url(#filter1_dd_8417_4219)">
+<rect x="31.7512" y="9.05933" width="32.7805" height="33.9512" rx="6.01331" transform="rotate(-10 31.7512 9.05933)" fill="white"/>
+<rect x="31.2426" y="8.70321" width="33.6585" height="34.8293" rx="6.45234" transform="rotate(-10 31.2426 8.70321)" stroke="#E8E8E8" stroke-width="0.878049"/>
+<g clip-path="url(#clip1_8417_4219)">
+<path d="M54.9429 18.331C54.608 18.2235 54.252 18.4099 54.1457 18.742C54.0397 19.0758 54.2228 19.4325 54.5567 19.5393C55.3838 19.8038 55.9921 20.4976 56.1427 21.352L56.8769 25.5154C56.8971 25.6303 56.8203 25.74 56.7054 25.7603L51.8966 26.6082C51.8946 26.5381 51.8932 26.4671 51.8808 26.3963L51.1466 22.2329C50.992 21.3561 50.5197 20.6203 49.8794 20.0953L52.6164 19.6127C52.9611 19.5519 53.1916 19.2228 53.1308 18.878C53.07 18.5333 52.7409 18.3029 52.3962 18.3637L46.9837 19.318C45.0319 19.6622 43.7248 21.5299 44.0688 23.4809L44.803 27.6443C44.9446 28.4479 45.7135 28.9863 46.5171 28.8446L50.8887 28.0738L51.0722 29.1146C51.133 29.4593 51.4621 29.6898 51.8068 29.629C52.1516 29.5682 52.382 29.2391 52.3212 28.8944L52.1377 27.8535L56.9256 27.0093C57.7292 26.8676 58.2676 26.0987 58.1259 25.2951L57.3918 21.1317C57.159 19.8119 56.2202 18.7385 54.9429 18.331ZM49.0644 26.249L47.3991 26.5426C47.0543 26.6034 46.7252 26.373 46.6644 26.0282C46.6036 25.6835 46.8341 25.3544 47.1788 25.2936L48.8442 25C49.1889 24.9392 49.518 25.1696 49.5788 25.5144C49.6396 25.8591 49.4091 26.1882 49.0644 26.249Z" fill="#070A0D"/>
+<path d="M53.8905 14.6659L51.8088 15.0329C51.4641 15.0937 51.2337 15.4228 51.2944 15.7676L52.102 20.3473C52.1628 20.6921 52.4919 20.9225 52.8366 20.8617C53.1813 20.8009 53.4118 20.4718 53.351 20.1271L52.8371 17.2127L54.2943 16.9558C54.639 16.895 54.8695 16.5659 54.8087 16.2211L54.6252 15.1803C54.5644 14.8355 54.2353 14.6051 53.8905 14.6659Z" fill="#070A0D"/>
+</g>
+</g>
+<g filter="url(#filter2_dd_8417_4219)">
+<rect x="40.9756" y="4.68298" width="38.6341" height="38.6341" rx="6.01331" fill="white"/>
+<rect x="40.5366" y="4.24396" width="39.5122" height="39.5122" rx="6.45234" stroke="#E8E8E8" stroke-width="0.878049"/>
+<g clip-path="url(#clip2_8417_4219)">
+<path d="M54.7747 17.8968L65.8108 28.9329M68.0977 23.4149C68.0977 27.7254 64.6033 31.2197 60.2928 31.2197C55.9823 31.2197 52.4879 27.7254 52.4879 23.4149C52.4879 19.1043 55.9823 15.61 60.2928 15.61C64.6033 15.61 68.0977 19.1043 68.0977 23.4149Z" stroke="#3C3F43" stroke-width="2.5625" stroke-linecap="round" stroke-linejoin="round"/>
+</g>
+</g>
+<defs>
+<filter id="filter0_dd_8417_4219" x="46.8976" y="2.74902" width="43.025" height="44.9244" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
+<feFlood flood-opacity="0" result="BackgroundImageFix"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_dropShadow_8417_4219"/>
+<feOffset dy="2"/>
+<feGaussianBlur stdDeviation="1"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"/>
+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8417_4219"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+<feOffset dy="2"/>
+<feGaussianBlur stdDeviation="1.5"/>
+<feComposite in2="hardAlpha" operator="out"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"/>
+<feBlend mode="normal" in2="effect1_dropShadow_8417_4219" result="effect2_dropShadow_8417_4219"/>
+<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_8417_4219" result="shape"/>
+</filter>
+<filter id="filter1_dd_8417_4219" x="28.7512" y="2.36707" width="44.1781" height="45.1277" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
+<feFlood flood-opacity="0" result="BackgroundImageFix"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_dropShadow_8417_4219"/>
+<feOffset dy="2"/>
+<feGaussianBlur stdDeviation="1"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"/>
+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8417_4219"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+<feOffset dy="2"/>
+<feGaussianBlur stdDeviation="1.5"/>
+<feComposite in2="hardAlpha" operator="out"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"/>
+<feBlend mode="normal" in2="effect1_dropShadow_8417_4219" result="effect2_dropShadow_8417_4219"/>
+<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_8417_4219" result="shape"/>
+</filter>
+<filter id="filter2_dd_8417_4219" x="37.0975" y="2.80493" width="46.3903" height="46.3903" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
+<feFlood flood-opacity="0" result="BackgroundImageFix"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_dropShadow_8417_4219"/>
+<feOffset dy="2"/>
+<feGaussianBlur stdDeviation="1"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"/>
+<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_8417_4219"/>
+<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
+<feOffset dy="2"/>
+<feGaussianBlur stdDeviation="1.5"/>
+<feComposite in2="hardAlpha" operator="out"/>
+<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"/>
+<feBlend mode="normal" in2="effect1_dropShadow_8417_4219" result="effect2_dropShadow_8417_4219"/>
+<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_8417_4219" result="shape"/>
+</filter>
+<clipPath id="clip0_8417_4219">
+<rect width="15.2195" height="15.2195" fill="white" transform="translate(62.2373 14.3956) rotate(10)"/>
+</clipPath>
+<clipPath id="clip1_8417_4219">
+<rect width="15.2195" height="15.2195" fill="white" transform="translate(42.0248 16.7581) rotate(-10)"/>
+</clipPath>
+<clipPath id="clip2_8417_4219">
+<rect width="18.7317" height="18.7317" fill="white" transform="translate(50.9269 14.049)"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json
index c216e39f394..1263118749f 100644
--- a/apps/web/public/static/locales/en/common.json
+++ b/apps/web/public/static/locales/en/common.json
@@ -797,7 +797,8 @@
"remove_attribute": "Remove attribute",
"remove_attribute_confirmation_message": "Are you sure you want to remove the attribute '{{name}}'? All users currently assigned to it will be unassigned.",
"delete": "Delete",
- "view": "View",
+ "view_details": "View details",
+ "remove_from_blocklist": "Remove from blocklist",
"update": "Update",
"save": "Save",
"pending": "Pending",
@@ -1556,6 +1557,7 @@
"text_message": "Text message",
"specific_issue": "Have a specific issue?",
"browse_our_docs": "browse our docs",
+ "docs": "Docs",
"choose_template": "Choose a template",
"custom": "Custom",
"reminder": "Reminder",
@@ -2238,6 +2240,8 @@
"booking_questions_description": "Customize the questions asked on the booking page. <0>Learn more</0>",
"add_a_booking_question": "Add a question",
"identifier": "Identifier",
+ "no_entries": "No entries",
+ "no_entries_description": "Add an email/domain to get started.",
"duplicate_email": "Email is duplicate",
"enter_redirect_url_on_exit_description": "Enter a redirect URL to which the attendee will be sent once they leave the meeting.",
"booking_with_payment_cancelled": "Paying for this event is no longer possible",
@@ -3598,6 +3602,7 @@
"pbac_desc_create_availability": "Create availability",
"pbac_desc_view_availability": "View availability",
"pbac_desc_update_availability": "Update availability",
+ "add_people_to_blocklist": "Add email addresses or domains to your blocklist to prevent them from booking your event types",
"pbac_desc_delete_availability": "Delete availability",
"pbac_desc_create_out_of_office": "Create out of office",
"pbac_desc_view_out_of_office": "View out of office",
@@ -3859,19 +3864,19 @@
"edit_configuration": "Edit Configuration",
"select_event_type_for_inbound_calls": "Inbound calls can book only one event type. Select the event type where meetings will be scheduled when callers reach your agent.",
"setup_inbound_agent_for_incoming_calls": "Set up inbound agent for incoming calls",
- "create_block_entry": "Create Block Entry",
"blocklist_entry_details": "Blocklist Entry Details",
"blocklist_entry_not_found": "Blocklist entry not found",
"blocklist_entry_created": "Blocklist entry created successfully",
"blocklist_entry_deleted": "Blocklist entry deleted successfully",
- "audit_history": "Audit History",
+ "history": "History",
"no_audit_history": "No audit history available",
- "delete_blocklist_entry": "Delete Blocklist Entry",
+ "remove_value_from_blocklist": "Remove {{value}} from blocklist?",
+ "remove_value_from_blocklist_description":"The action is irreversible",
"delete_blocklist_entry_confirmation": "Are you sure you want to remove \"{{value}}\" from the blocklist? This action cannot be undone.",
"created_by": "Created By",
"blocked_by": "Blocked By",
"by": "By",
- "added": "Added",
+ "added": "added",
"no_description_provided": "No description provided",
"organization_blocklist": "Organization Blocklist",
"manage_blocked_emails_and_domains": "Manage blocked emails and domains for your organization",
@@ -3880,6 +3885,21 @@
"reason_for_adding_to_blocklist": "Reason for adding to blocklist",
"what_would_you_like_to_block": "What would you like to block?",
"domain_name": "Domain Name",
+ "blocked": "Blocked",
+ "reported_by": "Reported By",
+ "no_pending_reports": "No pending reports",
+ "spam": "Spam",
+ "dont_know_person": "Don't Know Person",
+ "booking_report_dismissed": "Booking report dismissed",
+ "add_to_blocklist": "Add to Blocklist",
+ "booker_email": "Booker Email",
+ "email_slash_domain": "Email/Domain",
+ "related_booking": "Related booking",
+ "dont_block": "Don't block",
+ "block_this_email": "Email only",
+ "block_all_from_domain": "All from this domain",
+ "review_report": "Review report",
+ "block": "Block",
"onboarding_org_details_title": "Add your Organization's details",
"onboarding_org_details_subtitle": "Customize your booking pages with your Organization's name and bio",
"onboarding_org_bio_label": "Organization bio",
diff --git a/packages/features/data-table/components/DataTableToolbar.tsx b/packages/features/data-table/components/DataTableToolbar.tsx
index d5ad8bcdf97..a7508c773db 100644
--- a/packages/features/data-table/components/DataTableToolbar.tsx
+++ b/packages/features/data-table/components/DataTableToolbar.tsx
@@ -8,7 +8,7 @@ import { useState, type Ref, type ChangeEvent } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import classNames from "@calcom/ui/classNames";
import { Button, type ButtonProps } from "@calcom/ui/components/button";
-import { Input } from "@calcom/ui/components/form";
+import { FilterSearchField } from "@calcom/ui/components/form";
import { useColumnFilters, useDataTable } from "../hooks";
@@ -50,7 +50,7 @@ function SearchBarComponent({ className }: SearchBarProps, ref: Ref<HTMLInputEle
};
return (
- <Input
+ <FilterSearchField
ref={ref}
className={classNames("max-w-48", className)}
placeholder={t("search")}
diff --git a/packages/lib/server/repository/bookingReport.interface.ts b/packages/lib/server/repository/bookingReport.interface.ts
index f09957ef02d..0bf2d473e36 100644
--- a/packages/lib/server/repository/bookingReport.interface.ts
+++ b/packages/lib/server/repository/bookingReport.interface.ts
@@ -83,4 +83,6 @@ export interface IBookingReportRepository {
status: BookingReportStatus;
organizationId?: number;
}): Promise<void>;
+
+ countPendingReports(params: { organizationId: number }): Promise<number>;
}
diff --git a/packages/lib/server/repository/bookingReport.ts b/packages/lib/server/repository/bookingReport.ts
index d33c9cb27ee..acec86866f0 100644
--- a/packages/lib/server/repository/bookingReport.ts
+++ b/packages/lib/server/repository/bookingReport.ts
@@ -212,4 +212,14 @@ export class PrismaBookingReportRepository implements IBookingReportRepository {
data: { status: params.status },
});
}
+
+ async countPendingReports(params: { organizationId: number }): Promise<number> {
+ return this.prismaClient.bookingReport.count({
+ where: {
+ organizationId: params.organizationId,
+ status: "PENDING",
+ watchlistId: null,
+ },
+ });
+ }
}
diff --git a/packages/trpc/server/routers/viewer/organizations/_router.tsx b/packages/trpc/server/routers/viewer/organizations/_router.tsx
index a03c31a3773..1e18bf49a07 100644
--- a/packages/trpc/server/routers/viewer/organizations/_router.tsx
+++ b/packages/trpc/server/routers/viewer/organizations/_router.tsx
@@ -212,5 +212,9 @@ export const viewerOrganizationsRouter = router({
const { default: handler } = await import("./dismissBookingReport.handler");
return handler(opts);
}),
+ pendingReportsCount: authedOrgAdminProcedure.query(async (opts) => {
+ const { default: handler } = await import("./pendingReportsCount.handler");
+ return handler(opts);
+ }),
});
diff --git a/packages/trpc/server/routers/viewer/organizations/pendingReportsCount.handler.ts b/packages/trpc/server/routers/viewer/organizations/pendingReportsCount.handler.ts
new file mode 100644
index 00000000000..a09542fc2fb
--- /dev/null
+++ b/packages/trpc/server/routers/viewer/organizations/pendingReportsCount.handler.ts
@@ -0,0 +1,41 @@
+import { PermissionCheckService } from "@calcom/features/pbac/services/permission-check.service";
+import { PrismaBookingReportRepository } from "@calcom/lib/server/repository/bookingReport";
+import { prisma } from "@calcom/prisma";
+import { MembershipRole } from "@calcom/prisma/enums";
+
+import { TRPCError } from "@trpc/server";
+
+import type { TrpcSessionUser } from "../../../types";
+
+type PendingReportsCountOptions = {
+ ctx: {
+ user: NonNullable<TrpcSessionUser>;
+ };
+};
+
+export const pendingReportsCountHandler = async ({ ctx }: PendingReportsCountOptions) => {
+ const { user } = ctx;
+
+ const organizationId = user.profile?.organizationId || user.organizationId;
+ if (!organizationId) {
+ return 0;
+ }
+
+ const permissionCheckService = new PermissionCheckService();
+ const hasPermission = await permissionCheckService.checkPermission({
+ userId: user.id,
+ teamId: organizationId,
+ permission: "watchlist.read",
+ fallbackRoles: [MembershipRole.OWNER, MembershipRole.ADMIN],
+ });
+
+ if (!hasPermission) {
+ return 0;
+ }
+
+ const bookingReportRepo = new PrismaBookingReportRepository(prisma);
+
+ return bookingReportRepo.countPendingReports({ organizationId });
+};
+
+export default pendingReportsCountHandler;
diff --git a/packages/ui/components/icon/icon-list.mjs b/packages/ui/components/icon/icon-list.mjs
index f7cc57d4b78..a696d09e653 100644
--- a/packages/ui/components/icon/icon-list.mjs
+++ b/packages/ui/components/icon/icon-list.mjs
@@ -16,6 +16,7 @@ export const lucideIconList = new Set([
"binary",
"blocks",
"bold",
+ "book",
"book-open-check",
"book-open",
"book-user",
diff --git a/packages/ui/components/icon/icon-names.ts b/packages/ui/components/icon/icon-names.ts
index 3c8b5b6a063..d6d891205dd 100644
--- a/packages/ui/components/icon/icon-names.ts
+++ b/packages/ui/components/icon/icon-names.ts
@@ -19,6 +19,7 @@ export type IconName =
| "book-open-check"
| "book-open"
| "book-user"
+ | "book"
| "bookmark"
| "building"
| "calendar-check-2"