Skip to content

Commit 7e938e6

Browse files
authored
feat: brave node indicator (#966)
This adds brave badge to indicate that companion is backed by the node managed by the brave browser: https://brave.com/ipfs-support/
1 parent 1c9b00a commit 7e938e6

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

add-on/icons/brave-ipfs-logo-off.svg

+1
Loading

add-on/icons/brave-ipfs-logo-on.svg

+1
Loading

add-on/src/popup/logo.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
/* eslint-env browser, webextensions */
33

44
const html = require('choo/html')
5+
const { braveNodeType } = require('../lib/ipfs-client/brave')
56

67
function logo ({ path, size = 52, ipfsNodeType = 'external', isIpfsOnline = true, heartbeat = true }) {
7-
const logoTypePrefix = ipfsNodeType.startsWith('embedded') ? 'js-' : ''
8-
const logoFileName = `${logoTypePrefix}ipfs-logo-${isIpfsOnline ? 'on' : 'off'}.svg`
98
return html`
109
<img
1110
alt="IPFS"
12-
src="${path}/${logoFileName}"
11+
src="${path}/${logoFileName(ipfsNodeType, isIpfsOnline)}"
1312
class="v-mid ${isIpfsOnline ? '' : 'o-40'} ${isIpfsOnline && heartbeat ? 'heartbeat' : ''}"
1413
style="width:${size}px; height:${size}px" />
1514
`
1615
}
1716

17+
function logoFileName (nodeType, isIpfsOnline) {
18+
let prefix
19+
if (nodeType.startsWith('embedded')) prefix = 'js-'
20+
if (nodeType === braveNodeType) prefix = 'brave-'
21+
return `${prefix || ''}ipfs-logo-${isIpfsOnline ? 'on' : 'off'}.svg`
22+
}
23+
1824
module.exports = logo

0 commit comments

Comments
 (0)