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}
|
||||
|
||||
@@ -2519,6 +2519,7 @@
|
||||
"reschedule_reason_info": "The reason for rescheduling the booking",
|
||||
"invalid_event_name_variables": "{{item}} is an invalid variable in your event name",
|
||||
"select_all": "Select all",
|
||||
"select_row": "Select row",
|
||||
"default_conferencing_bulk_title": "Bulk update existing event types",
|
||||
"members_default_schedule": "Member's default schedule",
|
||||
"set_by_admin": "Set by team admin",
|
||||
@@ -4188,6 +4189,8 @@
|
||||
"blocked": "Blocked",
|
||||
"reported_by": "Reported by",
|
||||
"no_pending_reports": "No pending reports",
|
||||
"most_recent": "Most recent",
|
||||
"most_reports": "Most reports",
|
||||
"spam": "Spam",
|
||||
"dont_know_person": "Don't know person",
|
||||
"booking_report_dismissed": "Booking report dismissed",
|
||||
@@ -4195,18 +4198,19 @@
|
||||
"booker_email": "Booker email",
|
||||
"email_slash_domain": "Email/Domain",
|
||||
"related_booking": "Related booking",
|
||||
"related_bookings": "Related bookings",
|
||||
"dont_block": "Don't block",
|
||||
"block_this_email": "Email only",
|
||||
"block_all_from_domain": "All from this domain",
|
||||
"review_report": "Review report",
|
||||
"block": "Block",
|
||||
"system_blocklist": "System blocklist",
|
||||
"system_blocklist": "System Blocklist",
|
||||
"system_blocklist_description": "Manage blocked emails and domains for all bookings on the platform",
|
||||
"system_blocklist_entry_created": "System blocklist entry created successfully",
|
||||
"system_blocklist_entry_deleted": "System blocklist entry deleted successfully",
|
||||
"blocked_by_system_admin": "Blocked by (System Admin)",
|
||||
"add_to_system_blocklist": "Add to system blocklist",
|
||||
"remove_from_system_blocklist": "Remove from system blocklist",
|
||||
"blocked_by_system_admin": "Blocked By (System Admin)",
|
||||
"add_to_system_blocklist": "Add to System Blocklist",
|
||||
"remove_from_system_blocklist": "Remove from System Blocklist",
|
||||
"add_people_to_system_blocklist": "Block emails and domains platform-wide for all users and teams",
|
||||
"remove_value_from_system_blocklist": "Remove {{value}} from system blocklist?",
|
||||
"remove_value_from_system_blocklist_description": "This will unblock the entry platform-wide for all users and teams. This action is irreversible.",
|
||||
@@ -4217,7 +4221,7 @@
|
||||
"system_wide_blocklist_warning_description": "This entry will block bookings for All users and teams on the platform.",
|
||||
"source": "Source",
|
||||
"manual": "Manual",
|
||||
"free_domain_policy": "Free domain policy",
|
||||
"free_domain_policy": "Free Domain Policy",
|
||||
"automatic": "Automatic",
|
||||
"scope": "Scope",
|
||||
"bulk_delete": "Delete",
|
||||
|
||||
Reference in new issue
Block a user