refactor: update branding and improve name input UI in demo
- Update context menu labels from "My Addon" to "MyFirst Addon" for consistency - Replace prompt dialog with inline text input field for better UX - Add input validation with focus feedback when name is empty
This commit is contained in:
@@ -193,7 +193,7 @@
|
||||
{
|
||||
"id": "file-context-action",
|
||||
"context": "file-list",
|
||||
"label": "Process with My Addon",
|
||||
"label": "Process with MyFirst Addon",
|
||||
"onClick": {
|
||||
"action": "invoke-method",
|
||||
"method": "processFiles"
|
||||
@@ -202,7 +202,7 @@
|
||||
{
|
||||
"id": "commit-context-action",
|
||||
"context": "commit-list",
|
||||
"label": "Analyze Commit",
|
||||
"label": "Analyze with MyFirst Addon",
|
||||
"onClick": {
|
||||
"action": "invoke-method",
|
||||
"method": "analyzeCommit"
|
||||
|
||||
@@ -371,7 +371,7 @@ class MyFirstAddon {
|
||||
const fileList = files.map(f => f.path).join(', ');
|
||||
|
||||
this.context?.ipc.send('show-notification', {
|
||||
title: 'Process with My Addon',
|
||||
title: 'Process with MyFirst Addon',
|
||||
body: `Processing ${fileCount} file(s): ${fileList}`,
|
||||
});
|
||||
|
||||
@@ -397,7 +397,7 @@ class MyFirstAddon {
|
||||
|
||||
// Show notification to demonstrate the context menu is working
|
||||
this.context?.ipc.send('show-notification', {
|
||||
title: 'Analyze Commit',
|
||||
title: 'Analyze with MyFirst Addon',
|
||||
body: `Analyzing commit: ${commit?.sha?.substring(0, 7) || 'unknown'}\n${commit?.summary || ''}`,
|
||||
});
|
||||
|
||||
|
||||
@@ -437,6 +437,12 @@
|
||||
<button class="btn" onclick="callHelloWorld()">
|
||||
Call Hello World
|
||||
</button>
|
||||
</div>
|
||||
<div style="margin-top: 12px; display: flex; gap: 8px; align-items: center;">
|
||||
<input type="text" id="name-input" placeholder="Enter a name"
|
||||
style="padding: 8px 12px; border: 1px solid var(--border, #3c3c3c);
|
||||
border-radius: 4px; background-color: var(--background, #1e1e1e);
|
||||
color: var(--foreground, #cccccc); font-size: 13px; flex: 1; max-width: 200px;">
|
||||
<button class="btn btn-secondary" onclick="callHelloWorldWithName()">
|
||||
Call with Name
|
||||
</button>
|
||||
@@ -772,8 +778,13 @@
|
||||
}
|
||||
|
||||
async function callHelloWorldWithName() {
|
||||
const name = prompt('Enter your name:', 'World');
|
||||
if (!name) return;
|
||||
const nameInput = document.getElementById('name-input');
|
||||
const name = nameInput.value.trim();
|
||||
if (!name) {
|
||||
log('warn', 'Please enter a name in the input field');
|
||||
nameInput.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
const resultEl = document.getElementById('host-result');
|
||||
resultEl.innerHTML = '<span class="loading"></span> Calling host...';
|
||||
|
||||
Reference in New Issue
Block a user