import type { ContentAccessTier } from "../../../types/course.types" import { Button } from "../../../components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "../../../components/ui/dialog" export function accessTierConfirmTitle( nextTier: ContentAccessTier, contentLabel = "content", ): string { if (nextTier === "PREMIUM") { return `Set this ${contentLabel} to Premium?` } return `Set this ${contentLabel} to Free?` } export function accessTierConfirmDescription( nextTier: ContentAccessTier, contentLabel = "content", ): string { if (nextTier === "PREMIUM") { return `Learners will need a premium subscription to access this ${contentLabel}.` } return `This ${contentLabel} will be available to all learners at no extra cost.` } type AccessTierConfirmDialogProps = { open: boolean onOpenChange: (open: boolean) => void nextTier: ContentAccessTier | null contentLabel?: string onConfirm: () => void confirming?: boolean } export function AccessTierConfirmDialog({ open, onOpenChange, nextTier, contentLabel = "content", onConfirm, confirming = false, }: AccessTierConfirmDialogProps) { if (!nextTier) return null return ( { if (!confirming) onOpenChange(nextOpen) }} > {accessTierConfirmTitle(nextTier, contentLabel)} {accessTierConfirmDescription(nextTier, contentLabel)} ) }