"use client"; import type { AuditActorType } from "@calcom/features/booking-audit/lib/repository/IAuditActorRepository"; import ServerTrans from "@calcom/lib/components/ServerTrans"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Avatar } from "@calcom/ui/components/avatar"; import { Button } from "@calcom/ui/components/button"; import { FilterSearchField, Select } from "@calcom/ui/components/form"; import { Icon, type IconName } from "@calcom/ui/components/icon"; import { SkeletonText } from "@calcom/ui/components/skeleton"; import { Tooltip } from "@calcom/ui/components/tooltip"; import { format, formatDistanceToNow } from "date-fns"; import Link from "next/link"; import { useState } from "react"; interface BookingHistoryProps { bookingUid: string; } type TranslationComponent = { type: "link"; href: string; }; type TranslationWithParams = { key: string; params?: Record; components?: TranslationComponent[]; }; type DisplayFieldValue = | { type: "translationKey"; valueKey: string } | { type: "rawValue"; value: string } | { type: "rawValues"; values: string[] } | { type: "translationsWithParams"; valuesWithParams: TranslationWithParams[] }; type DisplayField = { labelKey: string; fieldValue: DisplayFieldValue; }; type AuditLog = { id: string; action: string; type: string; timestamp: string; source: string; displayJson?: Record | null; actionDisplayTitle: TranslationWithParams; displayFields?: DisplayField[] | null; actor: { type: AuditActorType; displayName: string | null; displayEmail: string | null; displayAvatar: string | null; }; impersonatedBy?: { displayName: string; displayEmail: string | null; displayAvatar: string | null; } | null; hasError?: boolean; }; interface BookingLogsFiltersProps { searchTerm: string; onSearchChange: (value: string) => void; actorFilter: string | null; onActorFilterChange: (value: string | null) => void; actorOptions: Array<{ label: string; value: string }>; } interface BookingLogsTimelineProps { logs: AuditLog[]; } const ACTION_ICON_MAP: Record = { CREATED: "calendar", CANCELLED: "ban", REJECTED: "ban", ACCEPTED: "check", RESCHEDULED: "pencil", RESCHEDULE_REQUESTED: "pencil", REASSIGNMENT: "user-check", ATTENDEE_ADDED: "user-check", ATTENDEE_REMOVED: "user-check", LOCATION_CHANGED: "map-pin", NO_SHOW_UPDATED: "ban", } as const; const ACTOR_ROLE_LABEL_MAP: Record = { GUEST: "guest", ATTENDEE: "attendee", SYSTEM: null, USER: null, APP: null, } as const; function BookingLogsFilters({ searchTerm, onSearchChange, actorFilter, onActorFilterChange, actorOptions, }: BookingLogsFiltersProps) { const { t } = useLocale(); return (
onSearchChange(e.target.value)} containerClassName="" />