mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 09:42:56 +00:00
Playing with note styling, add avatars and more metadata
This commit is contained in:
@@ -28,16 +28,45 @@
|
||||
.comment {
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
margin: 10px auto;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
.commentText {
|
||||
margin-bottom: 15px;
|
||||
|
||||
.comment-main {
|
||||
padding: 0 10px;
|
||||
flex: 1 1 100%;
|
||||
flex-flow: column nowrap;
|
||||
overflow: hidden;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
.comment-avatar {
|
||||
flex: 0 0 40px;
|
||||
}
|
||||
.comment-avatar .icon.comment-avatar-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.comment-metadata {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.comment-author {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.commentCreator {
|
||||
.comment-date {
|
||||
color: #aaa;
|
||||
}
|
||||
.comment-text {
|
||||
color: #333;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* Note editor UI */
|
||||
#new-comment-input {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { uiFormFields } from './form_fields';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import {
|
||||
utilGetSetValue,
|
||||
utilNoAuto,
|
||||
@@ -48,11 +49,6 @@ export function uiNoteEditor(context) {
|
||||
|
||||
|
||||
function noteComments(selection) {
|
||||
function noteCreator(d) {
|
||||
var userName = d.user ? d.user : t('note.anonymous');
|
||||
return String(userName + ' ' + localeDateString(d.date));
|
||||
}
|
||||
|
||||
var comments = selection.selectAll('.comments')
|
||||
.data([0]);
|
||||
|
||||
@@ -62,23 +58,43 @@ export function uiNoteEditor(context) {
|
||||
.merge(comments);
|
||||
|
||||
var commentEnter = comments.selectAll('.comment')
|
||||
.data(_note.comments, function(d) { return d.uid; })
|
||||
.data(_note.comments)
|
||||
.enter()
|
||||
.append('div')
|
||||
.attr('class', 'comment');
|
||||
|
||||
commentEnter
|
||||
.append('p')
|
||||
.attr('class', 'commentText')
|
||||
var avatar = commentEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-avatar');
|
||||
|
||||
avatar
|
||||
.call(svgIcon('#iD-icon-avatar', 'comment-avatar-icon'));
|
||||
|
||||
var main = commentEnter
|
||||
.append('div')
|
||||
.attr('class', 'comment-main');
|
||||
|
||||
var meta = main
|
||||
.append('div')
|
||||
.attr('class', 'comment-metadata');
|
||||
|
||||
meta
|
||||
.append('div')
|
||||
.attr('class', 'comment-author')
|
||||
.text(function(d) { return d.user || t('note.anonymous'); });
|
||||
|
||||
meta
|
||||
.append('div')
|
||||
.attr('class', 'comment-date')
|
||||
.text(function(d) { return d.action + ' ' + localeDateString(d.date); });
|
||||
|
||||
main
|
||||
.append('div')
|
||||
.attr('class', 'comment-text')
|
||||
.text(function(d) { return d.text; });
|
||||
|
||||
commentEnter
|
||||
.append('p')
|
||||
.attr('class', 'commentCreator')
|
||||
.text(function(d) { return noteCreator(d); });
|
||||
|
||||
}
|
||||
|
||||
|
||||
function saveHeader(selection) {
|
||||
var header = selection.selectAll('.notesSaveHeader')
|
||||
.data([0]);
|
||||
@@ -89,8 +105,8 @@ export function uiNoteEditor(context) {
|
||||
.merge(header);
|
||||
}
|
||||
|
||||
function input(selection) {
|
||||
|
||||
function input(selection) {
|
||||
// Input
|
||||
var input = selection.selectAll('textarea')
|
||||
.data([0]);
|
||||
|
||||
Reference in New Issue
Block a user