Grade comments: mark suggestion tone with colored icon and left border
This commit is contained in:
@@ -24,6 +24,9 @@ body {
|
|||||||
--c-badge-ok-text: #166534;
|
--c-badge-ok-text: #166534;
|
||||||
--c-badge-warn-bg: #fef3c7;
|
--c-badge-warn-bg: #fef3c7;
|
||||||
--c-badge-warn-text: #92400e;
|
--c-badge-warn-text: #92400e;
|
||||||
|
--c-tone-pos: #16803c;
|
||||||
|
--c-tone-neg: #b3283b;
|
||||||
|
--c-tone-neu: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme="dark"] {
|
[data-theme="dark"] {
|
||||||
@@ -39,6 +42,9 @@ body {
|
|||||||
--c-badge-ok-text: #6ee7b7;
|
--c-badge-ok-text: #6ee7b7;
|
||||||
--c-badge-warn-bg: rgba(251, 191, 36, 0.15);
|
--c-badge-warn-bg: rgba(251, 191, 36, 0.15);
|
||||||
--c-badge-warn-text: #fcd34d;
|
--c-badge-warn-text: #fcd34d;
|
||||||
|
--c-tone-pos: #4ade80;
|
||||||
|
--c-tone-neg: #f87171;
|
||||||
|
--c-tone-neu: #9aa3b2;
|
||||||
}
|
}
|
||||||
|
|
||||||
a { color: var(--c-text-link); text-decoration: none; }
|
a { color: var(--c-text-link); text-decoration: none; }
|
||||||
@@ -319,8 +325,15 @@ code.code { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-family: monos
|
|||||||
border-radius: 0.4rem; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
border-radius: 0.4rem; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
.ac-list.drop-up { top: auto; bottom: 100%; margin-top: 0; margin-bottom: 2px; }
|
.ac-list.drop-up { top: auto; bottom: 100%; margin-top: 0; margin-bottom: 2px; }
|
||||||
.ac-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; cursor: pointer; font-size: 0.875rem; }
|
.ac-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; padding-left: 0.45rem; border-left: 3px solid transparent; cursor: pointer; font-size: 0.875rem; }
|
||||||
.ac-item:hover, .ac-item.active { background: var(--c-bg); }
|
.ac-item:hover, .ac-item.active { background: var(--c-bg); }
|
||||||
|
.ac-item.ac-pos { border-left-color: var(--c-tone-pos); }
|
||||||
|
.ac-item.ac-neg { border-left-color: var(--c-tone-neg); }
|
||||||
|
.ac-item.ac-neu { border-left-color: var(--c-tone-neu); }
|
||||||
|
.ac-tone { flex: 0 0 auto; width: 1rem; text-align: center; font-size: 0.8rem; font-weight: 700; }
|
||||||
|
.ac-tone-pos { color: var(--c-tone-pos); }
|
||||||
|
.ac-tone-neg { color: var(--c-tone-neg); }
|
||||||
|
.ac-tone-neu { color: var(--c-tone-neu); }
|
||||||
.ac-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.ac-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.ac-count { flex: 0 0 auto; background: var(--c-border); color: var(--c-text-muted); }
|
.ac-count { flex: 0 0 auto; background: var(--c-border); color: var(--c-text-muted); }
|
||||||
.ac-del { flex: 0 0 auto; border: none; background: transparent; color: var(--c-text-muted); cursor: pointer; padding: 0 0.25rem; border-radius: 0.25rem; font-size: 0.75rem; line-height: 1.4; }
|
.ac-del { flex: 0 0 auto; border: none; background: transparent; color: var(--c-text-muted); cursor: pointer; padding: 0 0.25rem; border-radius: 0.25rem; font-size: 0.75rem; line-height: 1.4; }
|
||||||
|
|||||||
@@ -106,8 +106,16 @@ function attachCommentAutocomplete(input) {
|
|||||||
list.innerHTML = '';
|
list.innerHTML = '';
|
||||||
items.forEach(function (item) {
|
items.forEach(function (item) {
|
||||||
var count = parseInt(item.count || 0, 10) || 0;
|
var count = parseInt(item.count || 0, 10) || 0;
|
||||||
|
var tone = String(item.tone || 'neutral').toLowerCase();
|
||||||
|
var toneKey = tone.indexOf('pos') === 0 ? 'pos' : (tone.indexOf('neg') === 0 ? 'neg' : 'neu');
|
||||||
var row = document.createElement('div');
|
var row = document.createElement('div');
|
||||||
row.className = 'ac-item';
|
row.className = 'ac-item ac-' + toneKey;
|
||||||
|
|
||||||
|
var mark = document.createElement('span');
|
||||||
|
mark.className = 'ac-tone ac-tone-' + toneKey;
|
||||||
|
mark.textContent = toneKey === 'pos' ? '+' : (toneKey === 'neg' ? '—' : '○');
|
||||||
|
mark.title = toneKey === 'pos' ? 'Позитивный' : (toneKey === 'neg' ? 'Негативный' : 'Нейтральный');
|
||||||
|
row.appendChild(mark);
|
||||||
|
|
||||||
var text = document.createElement('span');
|
var text = document.createElement('span');
|
||||||
text.className = 'ac-text';
|
text.className = 'ac-text';
|
||||||
|
|||||||
Reference in New Issue
Block a user