import { t } from "@lingui/core/macro"; import { useModal } from "~/providers/modal"; import { api } from "~/utils/api"; import LabelIcon from "~/components/LabelIcon"; import LabelSelector from "~/views/card/components/LabelSelector"; export function CardContextLabelsModal() { const { entityId: cardPublicId, closeModal } = useModal(); const { data: card, isLoading } = api.card.byId.useQuery( { cardPublicId: cardPublicId ?? "" }, { enabled: !!cardPublicId && cardPublicId.length >= 12 }, ); const boardLabels = card?.list?.board?.labels ?? []; const selectedLabels = card?.labels ?? []; const formattedLabels = boardLabels.map((label) => ({ key: label.publicId, value: label.name, selected: selectedLabels.some((l) => l.publicId === label.publicId), leftIcon: , })); if (!cardPublicId) return null; return (

{t`Labels`}

{isLoading ? (
) : ( )}
); }