|
616 | 616 | margin-bottom: 6px; |
617 | 617 | } |
618 | 618 |
|
619 | | - .prompt-card-name { |
620 | | - font-family: var(--font-mono); |
621 | | - font-size: 13px; |
| 619 | + .prompt-card-title { |
| 620 | + font-size: 13.5px; |
622 | 621 | font-weight: 600; |
623 | 622 | color: var(--text); |
| 623 | + line-height: 1.3; |
| 624 | + } |
| 625 | + |
| 626 | + .prompt-card-slug { |
| 627 | + font-family: var(--font-mono); |
| 628 | + font-size: 11px; |
| 629 | + color: var(--muted); |
| 630 | + margin-top: 2px; |
624 | 631 | } |
625 | 632 |
|
626 | 633 | .prompt-card-desc { |
|
630 | 637 | margin-bottom: 8px; |
631 | 638 | } |
632 | 639 |
|
| 640 | + .prompt-section-header { |
| 641 | + font-size: 11px; |
| 642 | + font-weight: 600; |
| 643 | + color: var(--muted); |
| 644 | + text-transform: uppercase; |
| 645 | + letter-spacing: 0.05em; |
| 646 | + margin-bottom: 8px; |
| 647 | + margin-top: 4px; |
| 648 | + } |
| 649 | + .prompt-section-header:not(:first-child) { |
| 650 | + margin-top: 16px; |
| 651 | + } |
| 652 | + |
633 | 653 | .prompt-card-args { |
634 | 654 | display: flex; |
635 | 655 | flex-direction: column; |
|
750 | 770 | </div> |
751 | 771 | </div> |
752 | 772 | <div id="tab-prompts" class="tab-pane"> |
753 | | - <div class="tab-intro">Available prompts — select one to copy the prompt text with arguments filled in.</div> |
| 773 | + <div class="tab-intro" id="prompt-intro"></div> |
754 | 774 | <div id="prompt-list" class="prompt-cards"></div> |
755 | 775 | </div> |
756 | 776 | <div id="tab-agent-instructions" class="tab-pane"> |
|
1079 | 1099 |
|
1080 | 1100 | // Prompts tab |
1081 | 1101 | if (d.prompts && d.prompts.length) { |
1082 | | - renderPrompts(d.prompts); |
| 1102 | + renderPrompts(d.prompts, brandName); |
1083 | 1103 | document.getElementById('tab-btn-prompts').classList.remove('hidden'); |
1084 | 1104 | } |
1085 | 1105 |
|
|
1093 | 1113 | // Prompt data stored for copy |
1094 | 1114 | var _prompts = []; |
1095 | 1115 |
|
1096 | | - function renderPrompts(prompts) { |
| 1116 | + function humanize(slug) { |
| 1117 | + return slug.replace(/[-_]/g, ' ').replace(/\b\w/g, function(c) { return c.toUpperCase(); }); |
| 1118 | + } |
| 1119 | + |
| 1120 | + function renderPrompts(prompts, platformName) { |
1097 | 1121 | _prompts = prompts; |
| 1122 | + |
| 1123 | + // Set intro text |
| 1124 | + platformName = platformName || 'This platform'; |
| 1125 | + document.getElementById('prompt-intro').textContent = |
| 1126 | + platformName + ' has many capabilities built in, including the ability to find insights in your data, visualize it, generate reports, and more. Use the prompts below to kick off common workflows or copy a prompt name to invoke it in your MCP client.'; |
| 1127 | + |
| 1128 | + // Group by category |
| 1129 | + var workflows = []; |
| 1130 | + var quickActions = []; |
| 1131 | + prompts.forEach(function(p, idx) { |
| 1132 | + p._idx = idx; |
| 1133 | + if (p.category === 'workflow' || (p.arguments && p.arguments.length)) { |
| 1134 | + workflows.push(p); |
| 1135 | + } else { |
| 1136 | + quickActions.push(p); |
| 1137 | + } |
| 1138 | + }); |
| 1139 | + |
1098 | 1140 | var el = document.getElementById('prompt-list'); |
1099 | | - el.innerHTML = prompts.map(function(p, idx) { |
1100 | | - var argsHtml = ''; |
1101 | | - if (p.arguments && p.arguments.length) { |
1102 | | - argsHtml = '<div class="prompt-card-args">' |
1103 | | - + p.arguments.map(function(a) { |
1104 | | - return '<div class="prompt-arg-row">' |
1105 | | - + '<span class="prompt-arg-label">' + esc(a.name) |
1106 | | - + (a.required ? '<span class="req">*</span>' : '') |
1107 | | - + '</span>' |
1108 | | - + '<input class="prompt-arg-input" data-prompt="' + idx |
1109 | | - + '" data-arg="' + esc(a.name) |
1110 | | - + '" placeholder="' + esc(a.description || a.name) + '">' |
1111 | | - + '</div>'; |
1112 | | - }).join('') |
1113 | | - + '</div>'; |
| 1141 | + var html = ''; |
| 1142 | + var hasMultipleSections = workflows.length > 0 && quickActions.length > 0; |
| 1143 | + |
| 1144 | + if (workflows.length > 0) { |
| 1145 | + if (hasMultipleSections) { |
| 1146 | + html += '<div class="prompt-section-header">Workflows</div>'; |
1114 | 1147 | } |
1115 | | - return '<div class="prompt-card">' |
1116 | | - + '<div class="prompt-card-header">' |
1117 | | - + '<span class="prompt-card-name">' + esc(p.name) + '</span>' |
1118 | | - + '<button class="prompt-copy-btn" onclick="copyPrompt(' + idx + ', this)">Copy</button>' |
1119 | | - + '</div>' |
1120 | | - + (p.description ? '<div class="prompt-card-desc">' + esc(p.description) + '</div>' : '') |
1121 | | - + argsHtml |
| 1148 | + html += workflows.map(renderPromptCard).join(''); |
| 1149 | + } |
| 1150 | + if (quickActions.length > 0) { |
| 1151 | + if (hasMultipleSections) { |
| 1152 | + html += '<div class="prompt-section-header">Quick Actions</div>'; |
| 1153 | + } |
| 1154 | + html += quickActions.map(renderPromptCard).join(''); |
| 1155 | + } |
| 1156 | + el.innerHTML = html; |
| 1157 | + } |
| 1158 | + |
| 1159 | + function renderPromptCard(p) { |
| 1160 | + var idx = p._idx; |
| 1161 | + var argsHtml = ''; |
| 1162 | + if (p.arguments && p.arguments.length) { |
| 1163 | + argsHtml = '<div class="prompt-card-args">' |
| 1164 | + + p.arguments.map(function(a) { |
| 1165 | + return '<div class="prompt-arg-row">' |
| 1166 | + + '<span class="prompt-arg-label">' + esc(a.name) |
| 1167 | + + (a.required ? '<span class="req">*</span>' : '') |
| 1168 | + + '</span>' |
| 1169 | + + '<input class="prompt-arg-input" data-prompt="' + idx |
| 1170 | + + '" data-arg="' + esc(a.name) |
| 1171 | + + '" placeholder="' + esc(a.description || a.name) + '">' |
| 1172 | + + '</div>'; |
| 1173 | + }).join('') |
1122 | 1174 | + '</div>'; |
1123 | | - }).join(''); |
| 1175 | + } |
| 1176 | + return '<div class="prompt-card">' |
| 1177 | + + '<div class="prompt-card-header">' |
| 1178 | + + '<div>' |
| 1179 | + + '<div class="prompt-card-title">' + esc(humanize(p.name)) + '</div>' |
| 1180 | + + '<div class="prompt-card-slug">' + esc(p.name) + '</div>' |
| 1181 | + + '</div>' |
| 1182 | + + '<button class="prompt-copy-btn" onclick="copyPrompt(' + idx + ', this)">Copy</button>' |
| 1183 | + + '</div>' |
| 1184 | + + (p.description ? '<div class="prompt-card-desc">' + esc(p.description) + '</div>' : '') |
| 1185 | + + argsHtml |
| 1186 | + + '</div>'; |
1124 | 1187 | } |
1125 | 1188 |
|
1126 | 1189 | function copyPrompt(idx, btn) { |
1127 | 1190 | var p = _prompts[idx]; |
1128 | 1191 | if (!p) { return; } |
1129 | | - // Resolve prompt name as the text to copy (users paste as /prompt invocation) |
1130 | 1192 | var text = p.name; |
1131 | | - // If prompt has args, collect values and append |
1132 | 1193 | if (p.arguments && p.arguments.length) { |
1133 | 1194 | var inputs = document.querySelectorAll('input[data-prompt="' + idx + '"]'); |
1134 | 1195 | var parts = []; |
|
0 commit comments