Skip to content

Commit 29e668e

Browse files
committed
Improve the UI for URLS in the editor
1 parent a697a0e commit 29e668e

File tree

4 files changed

+155
-26
lines changed

4 files changed

+155
-26
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ node build.js
8686
* [ ] Add a cap to how long text can be in the editor
8787

8888
### UI
89-
90-
* [ ] Improve URL display formatting
91-
* [ ] Refine CSS for menu commands and import UI
89+
* [ ] Refine CSS for menu commands
9290
* [ ] Add iframe preview with live refresh
9391
* [ ] Fix editor optimizations
9492
* [ ] Add a cap to how long text can be in the dashboard

src/assets/styles/e_sidebar.css

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,64 @@
331331
display: flex;
332332
align-items: center;
333333
justify-content: space-between;
334-
padding: var(--space-sm);
335-
background: var(--bg-tertiary);
336-
border: 1px solid var(--border-primary);
337-
border-radius: var(--radius-md);
338-
gap: var(--space-sm);
334+
padding: var(--space-sm) var(--space-md);
335+
gap: var(--space-md);
336+
transition: var(--transition-all);
337+
border-radius: var(--radius-sm);
338+
}
339+
340+
.resource-item-content {
341+
flex: 1;
342+
min-width: 0; /* Allows text truncation */
343+
}
344+
345+
.resource-name {
346+
font-weight: 500;
347+
color: var(--text-primary);
348+
margin-bottom: var(--space-xxs);
349+
white-space: nowrap;
350+
overflow: hidden;
351+
text-overflow: ellipsis;
352+
}
353+
354+
.resource-url {
355+
display: block;
356+
font-size: 0.85em;
357+
color: var(--text-secondary);
358+
text-decoration: none;
359+
white-space: nowrap;
360+
overflow: hidden;
361+
text-overflow: ellipsis;
362+
transition: color 0.2s ease;
363+
}
364+
365+
.resource-url:hover {
366+
color: var(--primary);
367+
text-decoration: underline;
368+
}
369+
370+
.remove-resource {
371+
color: var(--text-secondary);
372+
opacity: 0.7;
339373
transition: var(--transition-all);
374+
background: none;
375+
border: none;
376+
border-radius: 50%;
377+
width: 24px;
378+
height: 24px;
379+
display: flex;
380+
align-items: center;
381+
justify-content: center;
382+
cursor: pointer;
383+
flex-shrink: 0;
384+
}
385+
386+
.remove-resource:hover {
387+
color: var(--danger);
388+
background: var(--danger-bg);
389+
opacity: 1;
340390
}
391+
341392
.url-item:hover,
342393
.resource-item:hover {
343394
background: var(--bg-hover);

src/assets/styles/popup.css

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,21 @@ a:hover {
374374

375375
/* Menu Commands */
376376
.menu-command-section {
377-
margin-top: 12px;
378-
padding-top: 8px;
377+
margin: 16px -8px 0;
378+
padding: 12px 8px 0;
379379
border-top: 1px solid var(--border-primary);
380+
position: relative;
381+
}
382+
383+
.menu-command-section::before {
384+
content: '';
385+
position: absolute;
386+
top: -1px;
387+
left: 8px;
388+
right: 8px;
389+
height: 1px;
390+
background: linear-gradient(90deg, transparent, var(--border-primary), transparent);
391+
opacity: 0.6;
380392
}
381393

382394
.menu-command-title {
@@ -385,43 +397,99 @@ a:hover {
385397
color: var(--text-secondary);
386398
text-transform: uppercase;
387399
letter-spacing: 0.5px;
388-
margin-bottom: 6px;
400+
margin: 0 0 8px 4px;
401+
display: flex;
402+
align-items: center;
403+
gap: 6px;
404+
}
405+
406+
.menu-command-title::before {
407+
content: '';
408+
display: block;
409+
width: 12px;
410+
height: 1px;
411+
background: var(--border-primary);
389412
}
390413

391414
.menu-command-list {
392415
display: flex;
393416
flex-direction: column;
394-
gap: 2px;
417+
gap: 4px;
418+
margin: 0;
419+
padding: 0;
420+
list-style: none;
395421
}
396422

397423
.menu-command-item {
398424
display: flex;
399425
justify-content: space-between;
400426
align-items: center;
401-
padding: 4px 8px;
427+
padding: 8px 10px;
428+
margin: 0 -2px;
429+
border-radius: 6px;
430+
border: 1px solid transparent;
402431
background: var(--bg-secondary);
403-
border: 1px solid var(--border-primary);
404-
border-radius: 3px;
405432
cursor: pointer;
406-
transition: all 0.15s;
433+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
434+
position: relative;
435+
overflow: hidden;
436+
}
437+
438+
.menu-command-item::after {
439+
content: '';
440+
position: absolute;
441+
top: 0;
442+
left: 0;
443+
right: 0;
444+
bottom: 0;
445+
background: var(--primary);
446+
opacity: 0;
447+
transition: opacity 0.2s ease;
448+
z-index: 0;
407449
}
408450

409451
.menu-command-item:hover {
410-
background: var(--bg-hover);
411-
border-color: var(--border-secondary);
452+
transform: translateY(-1px);
453+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
454+
background: var(--bg-tertiary);
455+
border-color: var(--border-accent);
456+
}
457+
458+
.menu-command-item:active {
459+
transform: translateY(0);
460+
transition-duration: 0.1s;
412461
}
413462

414463
.menu-command-name {
415-
font-size: 11px;
464+
font-size: 12px;
416465
font-weight: 500;
466+
color: var(--text-primary);
467+
position: relative;
468+
z-index: 1;
469+
transition: color 0.2s ease;
470+
}
471+
472+
.menu-command-item:hover .menu-command-name {
473+
color: var(--primary);
417474
}
418475

419476
.menu-command-key {
420-
font-size: 9px;
477+
font-size: 10px;
478+
font-family: var(--font-mono);
421479
color: var(--text-secondary);
422-
background: var(--bg-tertiary);
423-
padding: 1px 4px;
480+
background: var(--bg-secondary);
481+
padding: 2px 6px;
482+
border-radius: 4px;
424483
border: 1px solid var(--border-primary);
425-
border-radius: 2px;
426-
font-family: var(--font-mono);
484+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
485+
position: relative;
486+
z-index: 1;
487+
transition: all 0.2s ease;
488+
}
489+
490+
.menu-command-item:hover .menu-command-key {
491+
background: var(--bg-primary);
492+
border-color: var(--border-accent);
493+
color: var(--primary);
494+
transform: translateX(2px);
427495
}

src/editor/editor_managers.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,21 @@ export class ResourceManager extends BaseUIComponent {
684684
resourceItem.className = 'resource-item';
685685
resourceItem.dataset.name = name;
686686
resourceItem.dataset.url = url;
687+
// Truncate URL for display (keep first 30 and last 20 chars for long URLs)
688+
const displayUrl = url.length > 60
689+
? `${url.substring(0, 30)}...${url.substring(url.length - 20)}`
690+
: url;
691+
687692
resourceItem.innerHTML = `
688-
<span>${this.escapeHtml(name)} (${this.escapeHtml(url)})</span>
689-
<button class="remove-resource" title="Remove Resource">×</button>
693+
<div class="resource-item-content">
694+
<div class="resource-name" title="${this.escapeHtml(name)}">${this.escapeHtml(name)}</div>
695+
<a href="${this.escapeHtml(url)}" target="_blank" rel="noopener noreferrer" class="resource-url" title="${this.escapeHtml(url)}">
696+
${this.escapeHtml(displayUrl)}
697+
</a>
698+
</div>
699+
<button class="remove-resource" title="Remove Resource">
700+
<i data-feather="x" width="16" height="16"></i>
701+
</button>
690702
`;
691703

692704
this.elements.resourceList.appendChild(resourceItem);

0 commit comments

Comments
 (0)