Skip to content

Commit

Permalink
Merge pull request #97 from bavix/comment
Browse files Browse the repository at this point in the history
dynamic info
  • Loading branch information
rez1dent3 authored Feb 26, 2024
2 parents 847d1e7 + d78b950 commit c24c75d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions public/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/history.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class HistoryComponent extends React.Component {
<nav className="panel">
<p className="panel-heading">History</p>
{ [...items].slice(0, 30).map(i =>
<div className="panel-block">
<div key={i.toString()} className="panel-block">
<div className="field">
<a href="javascript:" onClick={this.copy} className="tag is-link is-light" data-tooltip={i.info}>{ i.output }</a>

Expand Down
14 changes: 9 additions & 5 deletions src/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,21 @@ export default class InputComponent extends React.Component {
}

addItems = (items) => {
let result = []
let result = new Map()
for (const item of items.reverse()) {
const obj = this.newItem(item)
if (obj !== null) {
result = result.concat(obj)
result.set(obj.toString(), obj)
}
}

this.props.setItems([
...new Map(result.concat(...this.props.items).map((item) => [item.toString(), item])).values(),
])
for (const item of this.props.items) {
if (!result.has(item.toString())) {
result.set(item.toString(), item)
}
}

this.props.setItems([...result.values()])
}

newItem = (line) => {
Expand Down

0 comments on commit c24c75d

Please sign in to comment.