| 1 | /** |
| 2 | * 抖音扫码发布弹窗 - Douyin QR Code Publish Modal |
| 3 | * 显示抖音发布链接的二维码,引导用户扫码发布 |
| 4 | */ |
| 5 | 'use client' |
| 6 | |
| 7 | import { Smartphone } from 'lucide-react' |
| 8 | import { QRCode } from 'react-qrcode-logo' |
| 9 | import { useTransClient } from '@/app/i18n/client' |
| 10 | import { Button } from '@/components/ui/button' |
| 11 | import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' |
| 12 | |
| 13 | interface DouyinQRCodeModalProps { |
| 14 | open: boolean |
| 15 | permalink: string |
| 16 | onClose: () => void |
| 17 | } |
| 18 | |
| 19 | export function DouyinQRCodeModal({ open, permalink, onClose }: DouyinQRCodeModalProps) { |
| 20 | const { t } = useTransClient('publish') |
| 21 | |
| 22 | return ( |
| 23 | <Dialog open={open} onOpenChange={isOpen => !isOpen && onClose()}> |
| 24 | <DialogContent className="w-[95vw] max-w-[550px]"> |
| 25 | <DialogHeader> |
| 26 | <DialogTitle className="flex items-center gap-2"> |
| 27 | <Smartphone className="w-5 h-5" /> |
| 28 | {t('douyin.scanToPublish')} |
| 29 | </DialogTitle> |
| 30 | </DialogHeader> |
| 31 | |
| 32 | <div className="flex flex-col items-center gap-4 py-4"> |
| 33 | {/* 二维码 */} |
| 34 | <div className="p-4 bg-white rounded-lg shadow-sm"> |
| 35 | {permalink && ( |
| 36 | <QRCode value={permalink} size={450} quietZone={10} qrStyle="squares" eyeRadius={5} /> |
| 37 | )} |
| 38 | </div> |
| 39 | |
| 40 | {/* 提示文字 */} |
| 41 | <div className="text-center space-y-2"> |
| 42 | <p className="text-sm font-medium text-foreground">{t('douyin.scanInstruction')}</p> |
| 43 | <p className="text-xs text-muted-foreground">{t('douyin.scanStep1')}</p> |
| 44 | <p className="text-xs text-muted-foreground">{t('douyin.scanStep2')}</p> |
| 45 | </div> |
| 46 | |
| 47 | {/* 关闭按钮 */} |
| 48 | <Button onClick={onClose} variant="outline" className="w-full"> |
| 49 | {t('douyin.closeButton')} |
| 50 | </Button> |
| 51 | </div> |
| 52 | </DialogContent> |
| 53 | </Dialog> |
| 54 | ) |
| 55 | } |
| 56 |