Add new torrents to top and scroll to top

This means people who add a lot of torrents will always have their latest torrents at the top when they open the app, instead of having to scroll all the way down
This commit is contained in:
DC
2016-05-19 00:44:59 -07:00
parent 189e4bdc24
commit 81d5a367da
2 changed files with 12 additions and 4 deletions

View File

@@ -54,12 +54,13 @@ function App (state) {
function getErrorPopover (state) {
var now = new Date().getTime()
var recentErrors = state.errors.filter((x) => now - x.time < 5000)
var hasErrors = recentErrors.length > 0
var errorElems = recentErrors.map(function (error) {
return hx`<div class='error'>${error.message}</div>`
})
return hx`
<div class='error-popover ${recentErrors.length > 0 ? 'visible' : 'hidden'}'>
<div class='error-popover ${hasErrors ? 'visible' : 'hidden'}'>
<div class='title'>Error</div>
${errorElems}
</div>