Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions elements/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ HeaderElement.prototype.createElement = function (props) {
}

function clickedOutside (e) {
if (!self.createElement(self.props).contains(e.target)) toggle(false)
if (!self.element.contains(e.target)) toggle(false)
}

return html`
<header class="${header}">
<div class="fr relative">
${importButton.createElement({
${importButton.render({
onsubmit: onimport
})}
${createButton}
Expand Down
22 changes: 11 additions & 11 deletions elements/table-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function Row () {
if (!(this instanceof Row)) return new Row()
Nanocomponent.call(this)

this.parts = {
this.partials = {
hexContent: HexContent(),
finderButton: FinderButton(),
linkButton: LinkButton(),
Expand All @@ -133,15 +133,15 @@ Row.prototype = Object.create(Nanocomponent.prototype)

Row.prototype.createElement = function (props) {
var { dat, emit, highlight } = props
var parts = this.parts
if (dat instanceof Error) return errorRow(dat, emit, parts.deleteButton)
var partials = this.partials
if (dat instanceof Error) return errorRow(dat, emit, partials.deleteButton)

var key = encoding.encode(dat.key)
var styles = cellStyles
if (highlight) styles += ' fade-highlight'

function onclick () {
if (!parts.titleField.state.isEditing) {
if (!partials.titleField.state.isEditing) {
emit('dats:inspect', dat)
}
}
Expand All @@ -150,12 +150,12 @@ Row.prototype.createElement = function (props) {
<tr id=${key} class=${styles} onclick=${onclick}>
<td class="cell-1">
<div class="w2 center">
${parts.hexContent.render(props)}
${partials.hexContent.render(props)}
</div>
</td>
<td class="cell-2">
<div class="cell-truncate">
${parts.titleField.render(props)}
${partials.titleField.render(props)}
<p class="f7 f6-l color-neutral-60 truncate">
<span class="author">${dat.metadata.author || 'Anonymous'} • </span>
<span class="title">
Expand All @@ -171,22 +171,22 @@ Row.prototype.createElement = function (props) {
${datSize(dat)}
</td>
<td class="cell-5 ${networkStyles}">
${parts.networkIcon.render(props)}
${partials.networkIcon.render(props)}
<span class="network v-top f6 f5-l ml1">${datPeers(dat)}</span>
</td>
<td class="cell-6">
<div class="flex justify-end ${iconStyles}">
${parts.finderButton.render(props)}
${parts.linkButton.render(props)}
${parts.deleteButton.render(props)}
${partials.finderButton.render(props)}
${partials.linkButton.render(props)}
${partials.deleteButton.render(props)}
</div>
</td>
</tr>
`
}

Row.prototype.update = function (props) {
return Object.values(this.parts).find(component => component.update(props, true)) !== undefined
return Object.values(this.partials).find(component => component.update(props, true)) !== undefined
}

function FinderButton () {
Expand Down