支持自部署需求管理、交付流程与飞书集成

This commit is contained in:
xyt committed 2026-11-25 12:40:33 +08:00
1 parent 4556a5b483
commit e22b66d9dd
148 files changed
+8300 -6393

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
'use client';
import { useRef, useState } from 'react';
import { BookOpen, Download, ExternalLink } from 'lucide-react';
import { FEISHU_TEMPLATE_DIRECTORY, findDocument, templateDownloadUrl, type DocumentId } from '@/lib/documents';
import TemplatePreview from './template-preview';
export type OpenTemplatePreview = (id: DocumentId, trigger: HTMLButtonElement) => void;
export function TemplateActions({ documentId, disabled = false, showDirectory = true, onPreview }: { documentId: DocumentId; disabled?: boolean; showDirectory?: boolean; onPreview?: OpenTemplatePreview }) {
const [open, setOpen] = useState(false);
const trigger = useRef<HTMLButtonElement>(null);
const document = findDocument(documentId)!;
return <><span className="template-actions">
<button ref={trigger} className="text-button" type="button" disabled={disabled} onClick={event => { if (onPreview) onPreview(documentId, event.currentTarget); else setOpen(true); }} aria-label={'查看' + document.title}><BookOpen size={14}/>{documentId==='sop'?'查看规范':'查看模板'}</button>
<a className="text-button" href={disabled ? undefined : templateDownloadUrl(documentId)} aria-disabled={disabled || undefined} tabIndex={disabled ? -1 : undefined} download aria-label={'下载' + document.title + ' Word 版'}><Download size={14}/>{documentId==='sop'?'下载规范':'下载模板'}</a>
{showDirectory && <a className="text-button" href={disabled ? undefined : FEISHU_TEMPLATE_DIRECTORY} aria-disabled={disabled || undefined} tabIndex={disabled ? -1 : undefined} target="_blank" rel="noopener noreferrer"><ExternalLink size={14}/>飞书总目录</a>}
</span>{open && <TemplatePreview documentId={documentId} onClose={() => setOpen(false)} returnFocus={trigger}/>}</>;
}