| 16 | 'flex flex-col min-h-0 bg-[var(--chrome-bg)] border border-transparent rounded-none py-[10px] px-[12px] max-[800px]:px-[10px] max-[600px]:px-[6px] max-[600px]:py-[8px]'; |
| 17 | |
| 18 | export default function ScriptPanel({ |
| 19 | t, |
| 20 | defineMethod, |
| 21 | text, |
| 22 | setText, |
| 23 | activePersonality, |
| 24 | demoPresets, |
| 25 | applyDemoPreset, |
| 26 | showDemoCoachmark, |
| 27 | setShowDemoCoachmark, |
| 28 | selectedProfile, |
| 29 | DEMO_PROFILE_ID, |
| 30 | textAreaRef, |
| 31 | insertOpen, |
| 32 | setInsertOpen, |
| 33 | insertTag, |
| 34 | }) { |
| 35 | return ( |
| 36 | <div className="flex flex-col gap-[6px] flex-none min-h-0 relative z-[2]"> |
| 37 | {/* overflow-visible: the ⊕ Insert popover opens BELOW the textarea and |
| 38 | must escape the panel's box instead of being clipped (#481). It |
| 39 | used to open upward — but the script input sits at the very top of |
| 40 | the clone modal, so the tag list (max-h 280px) climbed straight out |
| 41 | of the viewport with no way to see or scroll it (owner-reported, |
| 42 | screenshot showed the CMU chips clipped). Below always has room |
| 43 | here: the panel is the topmost element in every mount. */} |
| 44 | <div className={`${STUDIO_PANEL} relative z-[10] overflow-visible`}> |
| 45 | <div className="label-row"> |
| 46 | <Command className="label-icon" size={14} />{' '} |
| 47 | {t('clone.script', { defaultValue: 'Script' })} |
| 48 | </div> |
| 49 | {/* Design-tab empty state: 7-card demo grid until the user |
| 50 | interacts; then it steps aside for the standard form. */} |
| 51 | {defineMethod === 'design' && !text && !activePersonality && demoPresets.length > 0 && ( |
| 52 | <DemoPresetGrid presets={demoPresets} onUse={applyDemoPreset} /> |
| 53 | )} |
| 54 | {showDemoCoachmark && defineMethod === 'audio' && selectedProfile === DEMO_PROFILE_ID && ( |
| 55 | <div |
| 56 | className="flex items-center gap-[8px] px-[10px] py-[6px] mb-[8px] rounded-[8px] bg-[rgba(243,165,182,0.08)] [border:1px_solid_rgba(243,165,182,0.25)] text-[11px] text-fg" |
| 57 | role="note" |
| 58 | > |
| 59 | <span className="text-[14px] leading-none">💡</span> |
| 60 | <span className="flex-1">{t('demo.clone_coachmark')}</span> |
| 61 | <button |
| 62 | type="button" |
| 63 | className="border-0 bg-transparent text-[var(--color-fg-muted)] cursor-pointer text-[16px] leading-none px-1 rounded-[4px] hover:bg-white/[0.08] hover:text-[var(--color-fg)]" |
| 64 | onClick={() => setShowDemoCoachmark(false)} |
| 65 | aria-label="Dismiss coach mark" |
| 66 | > |
| 67 | × |
| 68 | </button> |
| 69 | </div> |
| 70 | )} |
| 71 | <div className="relative flex-1 flex flex-col min-h-0"> |
| 72 | <textarea |
| 73 | ref={textAreaRef} |
| 74 | className="input-base studio-script-input flex-[0_1_auto] resize-y mb-[6px]" |
| 75 | placeholder={ |