템플릿 팔레트에서 시스템 템플릿 섹션 제거
This commit is contained in:
parent
6f7a76febe
commit
f47a0c770b
|
|
@ -6,7 +6,6 @@ import { Trash2, Loader2, RefreshCw } from "lucide-react";
|
|||
import { useReportDesigner } from "@/contexts/ReportDesignerContext";
|
||||
import { reportApi } from "@/lib/api/reportApi";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
interface Template {
|
||||
template_id: string;
|
||||
|
|
@ -17,7 +16,6 @@ interface Template {
|
|||
|
||||
export function TemplatePalette() {
|
||||
const { applyTemplate } = useReportDesigner();
|
||||
const [systemTemplates, setSystemTemplates] = useState<Template[]>([]);
|
||||
const [customTemplates, setCustomTemplates] = useState<Template[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [deletingId, setDeletingId] = useState<string | null>(null);
|
||||
|
|
@ -28,7 +26,6 @@ export function TemplatePalette() {
|
|||
try {
|
||||
const response = await reportApi.getTemplates();
|
||||
if (response.success && response.data) {
|
||||
setSystemTemplates(Array.isArray(response.data.system) ? response.data.system : []);
|
||||
setCustomTemplates(Array.isArray(response.data.custom) ? response.data.custom : []);
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
@ -79,31 +76,10 @@ export function TemplatePalette() {
|
|||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{/* 시스템 템플릿 (DB에서 조회) */}
|
||||
{systemTemplates.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-xs font-semibold text-gray-600">시스템 템플릿</p>
|
||||
</div>
|
||||
{systemTemplates.map((template) => (
|
||||
<Button
|
||||
key={template.template_id}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="w-full justify-start gap-2 text-sm"
|
||||
onClick={() => handleApplyTemplate(template.template_id)}
|
||||
>
|
||||
<span>{template.template_name_kor}</span>
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-2">
|
||||
{/* 사용자 정의 템플릿 */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-xs font-semibold text-gray-600">사용자 정의 템플릿</p>
|
||||
<div className="flex items-center justify-end">
|
||||
<Button variant="ghost" size="sm" onClick={fetchTemplates} disabled={isLoading} className="h-6 w-6 p-0">
|
||||
<RefreshCw className={`h-3 w-3 ${isLoading ? "animate-spin" : ""}`} />
|
||||
</Button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue