diff --git a/src/js/components/branch.jsx b/src/js/components/branch.jsx index 5608af2..700aaef 100644 --- a/src/js/components/branch.jsx +++ b/src/js/components/branch.jsx @@ -2,9 +2,9 @@ import React from 'react' import TreeView from 'react-treeview' import File from './file' -const Branch = ({ nodeLabel, list, href }) => { +const Branch = ({ nodeLabel, list, href, has_comments }) => { if (href) { - return + return } return ( diff --git a/src/js/components/file.jsx b/src/js/components/file.jsx index c99f37f..a518620 100644 --- a/src/js/components/file.jsx +++ b/src/js/components/file.jsx @@ -1,12 +1,12 @@ import React from 'react' import fileIcons from 'file-icons-js' -const File = ({ name, href }) => { +const File = ({ name, href, has_comments }) => { const className = fileIcons.getClassWithColor(name) return (
- {name} + {name}{has_comments ? ' 💬' : ''}
) } diff --git a/src/js/lib.js b/src/js/lib.js index 9993dff..1dfe282 100644 --- a/src/js/lib.js +++ b/src/js/lib.js @@ -36,12 +36,13 @@ export const createFileTree = () => { list: [] } - files.forEach(({ parts, href }) => { + files.forEach(({ parts, href }, index) => { + let has_comments = !!document.getElementsByClassName('diff-table')[index].querySelectorAll('.inline-comments').length; let location = tree parts.forEach((part, index) => { let node = location.list.find(node => node.nodeLabel === part) if (!node) { - node = { nodeLabel: part, list: [], href: (index === parts.length - 1) ? href : null } + node = { nodeLabel: part, list: [], href: (index === parts.length - 1) ? href : null, has_comments } location.list.push(node) } location.list = location.list.sort(sorter)