* feat: add card context menu and duplication functionality * Implemented a context menu for cards allowing actions such as copying links, duplicating cards, and managing members, labels, and due dates * Added modals for card duplication and context actions. * Updated API with a new endpoint for duplicating cards, including options for copying labels, members, and checklists * refactor: remove cardPublicId from context menu and related components * Removed cardPublicId prop from CardContextMenu and CardContextMembersModal for cleaner context handling * Updated scrollbar styling * feat: add delete card functionality to context menu
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { t } from "@lingui/core/macro";
|
|
|
|
import { useModal } from "~/providers/modal";
|
|
import { api } from "~/utils/api";
|
|
import { DueDateSelector } from "~/views/card/components/DueDateSelector";
|
|
|
|
export function CardContextDueDateModal() {
|
|
const { entityId: cardPublicId, closeModal } = useModal();
|
|
|
|
const { data: card, isLoading } = api.card.byId.useQuery(
|
|
{ cardPublicId: cardPublicId ?? "" },
|
|
{ enabled: !!cardPublicId && cardPublicId.length >= 12 },
|
|
);
|
|
|
|
if (!cardPublicId) return null;
|
|
|
|
return (
|
|
<div className="p-4">
|
|
<h2 className="mb-4 text-lg font-semibold text-light-1000 dark:text-dark-1000">
|
|
{t`Set due date`}
|
|
</h2>
|
|
{isLoading ? (
|
|
<div className="h-10 w-full animate-pulse rounded bg-light-200 dark:bg-dark-300" />
|
|
) : (
|
|
<DueDateSelector
|
|
cardPublicId={cardPublicId}
|
|
dueDate={card?.dueDate ?? null}
|
|
/>
|
|
)}
|
|
<div className="mt-4 flex justify-end">
|
|
<button
|
|
type="button"
|
|
onClick={closeModal}
|
|
className="rounded-md border border-light-300 bg-light-50 px-3 py-1.5 text-sm font-medium text-light-1000 hover:bg-light-200 dark:border-dark-400 dark:bg-dark-200 dark:text-dark-1000 dark:hover:bg-dark-300"
|
|
>
|
|
{t`Done`}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|