
* WIP bookings page ui changes, created api endpoint * Ui changes mobile/desktop * Added translations * Fix lib import and common names * WIP reschedule * WIP * Save wip * [WIP] builder and class for CalendarEvent, email for attende * update rescheduled emails, booking view and availability page view * Working version reschedule * Fix for req.user as array * Added missing translation and refactor dialog to self component * Test for reschedule * update on types * Update lib no required * Update type on createBooking * fix types * remove preview stripe sub * remove unused file * remove unused import * Fix reschedule test * Refactor and cleaning up code * Email reschedule title fixes * Adding calendar delete and recreate placeholder of cancelled * Add translation * Removed logs, notes, fixed types * Fixes process.env types * Use strict compare * Fixes type inference * Type fixing is my middle name * Update apps/web/components/booking/BookingListItem.tsx * Update apps/web/components/dialog/RescheduleDialog.tsx * Update packages/core/builders/CalendarEvent/director.ts * Update apps/web/pages/success.tsx * Updates rescheduling labels * Update packages/core/builders/CalendarEvent/builder.ts * Type fixes * Update packages/core/builders/CalendarEvent/builder.ts * Only validating input blocked once * E2E fixes * Stripe tests fixes Co-authored-by: Peer Richelsen <peer@cal.com> Co-authored-by: zomars <zomars@me.com>
86 lines
2.7 KiB
TypeScript
86 lines
2.7 KiB
TypeScript
import { ChevronDownIcon, DotsHorizontalIcon } from "@heroicons/react/solid";
|
|
import React, { FC } from "react";
|
|
|
|
import Button from "@calcom/ui/Button";
|
|
import Dropdown, { DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@calcom/ui/Dropdown";
|
|
|
|
import { SVGComponent } from "@lib/types/SVGComponent";
|
|
|
|
export type ActionType = {
|
|
id: string;
|
|
icon?: SVGComponent;
|
|
label: string;
|
|
disabled?: boolean;
|
|
color?: "primary" | "secondary";
|
|
} & ({ href?: never; onClick: () => any } | { href?: string; onClick?: never }) & {
|
|
actions?: ActionType[];
|
|
};
|
|
|
|
interface Props {
|
|
actions: ActionType[];
|
|
}
|
|
|
|
const DropdownActions = ({ actions, actionTrigger }: { actions: ActionType[]; actionTrigger?: any }) => {
|
|
return (
|
|
<Dropdown>
|
|
{!actionTrigger ? (
|
|
<DropdownMenuTrigger className="h-[38px] w-[38px] cursor-pointer rounded-sm border border-transparent text-neutral-500 hover:border-gray-300 hover:text-neutral-900">
|
|
<DotsHorizontalIcon className="h-5 w-5 group-hover:text-gray-800" />
|
|
</DropdownMenuTrigger>
|
|
) : (
|
|
<DropdownMenuTrigger asChild>{actionTrigger}</DropdownMenuTrigger>
|
|
)}
|
|
<DropdownMenuContent portalled>
|
|
{actions.map((action) => (
|
|
<DropdownMenuItem key={action.id} className="focus-visible:outline-none">
|
|
<Button
|
|
type="button"
|
|
size="sm"
|
|
color="minimal"
|
|
className="w-full rounded-none font-normal"
|
|
href={action.href}
|
|
StartIcon={action.icon}
|
|
onClick={action.onClick}
|
|
data-testid={action.id}>
|
|
{action.label}
|
|
</Button>
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</Dropdown>
|
|
);
|
|
};
|
|
|
|
const TableActions: FC<Props> = ({ actions }) => {
|
|
return (
|
|
<>
|
|
<div className="hidden space-x-2 rtl:space-x-reverse lg:block">
|
|
{actions.map((action) => {
|
|
const button = (
|
|
<Button
|
|
key={action.id}
|
|
data-testid={action.id}
|
|
href={action.href}
|
|
onClick={action.onClick}
|
|
StartIcon={action.icon}
|
|
{...(action?.actions ? { EndIcon: ChevronDownIcon } : null)}
|
|
disabled={action.disabled}
|
|
color={action.color || "secondary"}>
|
|
{action.label}
|
|
</Button>
|
|
);
|
|
if (!action.actions) {
|
|
return button;
|
|
}
|
|
|
|
return <DropdownActions key={action.id} actions={action.actions} actionTrigger={button} />;
|
|
})}
|
|
</div>
|
|
<div className="inline-block text-left lg:hidden">
|
|
<DropdownActions actions={actions} />
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TableActions;
|