Skip to content

Commit 9b42a98

Browse files
committed
Add copy for when the people picker is empty
1 parent 7d6d361 commit 9b42a98

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/widgets/peoplePicker.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export default class PeoplePicker {
2727
}
2828

2929
render () {
30-
// This could be more efficient and readable using a view library
3130
const dropContainer = document.createElement('div')
3231
dropContainer.style.maxWidth = '350px'
3332
dropContainer.style.minHeight = '200px'
@@ -45,13 +44,21 @@ export default class PeoplePicker {
4544
})
4645
})
4746

48-
kb.match(this.groupNode, ns.vcard('hasMember'))
49-
.forEach(statement => {
50-
const webIdNode = statement.object
51-
const personDiv = document.createElement('div')
52-
new Person(personDiv, webIdNode, this.handleRemove(webIdNode)).render()
53-
dropContainer.appendChild(personDiv)
54-
})
47+
if (kb.any(this.groupNode, ns.vcard('hasMember'))) {
48+
kb.match(this.groupNode, ns.vcard('hasMember'))
49+
.forEach(statement => {
50+
const webIdNode = statement.object
51+
const personDiv = document.createElement('div')
52+
new Person(personDiv, webIdNode, this.handleRemove(webIdNode)).render()
53+
dropContainer.appendChild(personDiv)
54+
})
55+
} else {
56+
const copy = document.createElement('p')
57+
copy.textContent = escape`
58+
To add someone to this group, drag and drop their WebID URL onto the box.
59+
`
60+
dropContainer.appendChild(copy)
61+
}
5562

5663
this.element.innerHTML = ''
5764
this.element.appendChild(dropContainer)

0 commit comments

Comments
 (0)