Files
reflector/www/app/lib/consent/ConsentDialogButton.tsx
2025-12-19 16:14:28 -05:00

40 lines
987 B
TypeScript

"use client";
import { Button, Icon } from "@chakra-ui/react";
import { FaBars } from "react-icons/fa6";
import { useConsentDialog } from "./useConsentDialog";
import {
CONSENT_BUTTON_TOP_OFFSET,
CONSENT_BUTTON_LEFT_OFFSET,
CONSENT_BUTTON_Z_INDEX,
CONSENT_DIALOG_TEXT,
} from "./constants";
interface ConsentDialogButtonProps {
meetingId: string;
}
export function ConsentDialogButton({ meetingId }: ConsentDialogButtonProps) {
const { showConsentModal, consentState, hasAnswered, consentLoading } =
useConsentDialog(meetingId);
if (!consentState.ready || hasAnswered(meetingId) || consentLoading) {
return null;
}
return (
<Button
position="absolute"
top={CONSENT_BUTTON_TOP_OFFSET}
left={CONSENT_BUTTON_LEFT_OFFSET}
zIndex={CONSENT_BUTTON_Z_INDEX}
colorPalette="blue"
size="sm"
onClick={showConsentModal}
>
{CONSENT_DIALOG_TEXT.triggerButton}
<Icon as={FaBars} ml={2} />
</Button>
);
}