From f19acd400cc5bbe1fe51c004c50ee90d704240d8 Mon Sep 17 00:00:00 2001
From: soryu <soryu@soryu.co>
Date: Thu, 29 Jan 2026 02:56:44 +0000
Subject: Fix contract type selection

---
 .../src/components/templates/TemplateEditor.tsx    | 31 ++++++++++++++--------
 1 file changed, 20 insertions(+), 11 deletions(-)

(limited to 'makima/frontend/src/components/templates/TemplateEditor.tsx')

diff --git a/makima/frontend/src/components/templates/TemplateEditor.tsx b/makima/frontend/src/components/templates/TemplateEditor.tsx
index 03382f3..c8e1f98 100644
--- a/makima/frontend/src/components/templates/TemplateEditor.tsx
+++ b/makima/frontend/src/components/templates/TemplateEditor.tsx
@@ -5,9 +5,10 @@ interface Props {
   template: ContractTemplate;
   onSave: (template: ContractTemplate) => void;
   onCancel: () => void;
+  readOnly?: boolean;
 }
 
-export function TemplateEditor({ template, onSave, onCancel }: Props) {
+export function TemplateEditor({ template, onSave, onCancel, readOnly = false }: Props) {
   const [editedTemplate, setEditedTemplate] = useState<ContractTemplate>({
     ...template,
     phases: template.phases.map((p) => ({
@@ -106,11 +107,16 @@ export function TemplateEditor({ template, onSave, onCancel }: Props) {
       {/* Header */}
       <div className="mb-6 pb-4 border-b border-[rgba(117,170,252,0.15)]">
         <h2 className="text-sm font-mono uppercase tracking-wide text-[#9bc3ff] mb-1">
-          Edit Template: {template.name}
+          {readOnly ? "View" : "Edit"} Template: {template.name}
         </h2>
         <p className="text-xs font-mono text-[#75aafc] opacity-70">
           {template.description}
         </p>
+        {readOnly && (
+          <p className="text-xs font-mono text-amber-400 mt-2">
+            Built-in templates are read-only
+          </p>
+        )}
       </div>
 
       {/* Phases */}
@@ -127,10 +133,11 @@ export function TemplateEditor({ template, onSave, onCancel }: Props) {
               </span>
               <input
                 type="text"
-                className="flex-1 px-3 py-1.5 bg-transparent border border-[rgba(117,170,252,0.25)] text-white font-mono text-sm placeholder-[#556677] focus:outline-none focus:border-[#3f6fb3]"
+                className="flex-1 px-3 py-1.5 bg-transparent border border-[rgba(117,170,252,0.25)] text-white font-mono text-sm placeholder-[#556677] focus:outline-none focus:border-[#3f6fb3] disabled:opacity-60"
                 value={phase.name}
                 onChange={(e) => handlePhaseNameChange(phase.id, e.target.value)}
                 placeholder="Phase name"
+                disabled={readOnly}
               />
               {!template.isBuiltIn && (
                 <button
@@ -233,15 +240,17 @@ export function TemplateEditor({ template, onSave, onCancel }: Props) {
           onClick={onCancel}
           className="px-4 py-2 border border-[rgba(117,170,252,0.25)] text-[#9bc3ff] font-mono text-xs uppercase tracking-wide hover:border-[#3f6fb3] transition-colors"
         >
-          Cancel
-        </button>
-        <button
-          type="button"
-          onClick={() => onSave(editedTemplate)}
-          className="px-4 py-2 border border-[#3f6fb3] bg-[rgba(117,170,252,0.15)] text-[#9bc3ff] font-mono text-xs uppercase tracking-wide hover:bg-[rgba(117,170,252,0.25)] transition-colors"
-        >
-          Save Changes
+          {readOnly ? "Close" : "Cancel"}
         </button>
+        {!readOnly && (
+          <button
+            type="button"
+            onClick={() => onSave(editedTemplate)}
+            className="px-4 py-2 border border-[#3f6fb3] bg-[rgba(117,170,252,0.15)] text-[#9bc3ff] font-mono text-xs uppercase tracking-wide hover:bg-[rgba(117,170,252,0.25)] transition-colors"
+          >
+            Save Changes
+          </button>
+        )}
       </div>
     </div>
   );
-- 
cgit v1.2.3

