diff --git a/package.json b/package.json index 0efdd04..422c8e7 100644 --- a/package.json +++ b/package.json @@ -16,45 +16,45 @@ "author": "Drew DeVault ", "license": "BSD-3-Clause", "devDependencies": { - "babel-core": "^6.25.0", - "babel-loader": "^7.1.1", - "babel-preset-env": "^1.6.0", + "babel-core": "^6.26.0", + "babel-loader": "^7.1.2", + "babel-preset-env": "^1.6.1", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", "babel-preset-stage-0": "^6.24.1", - "css-loader": "^0.28.4", - "react-redux": "^5.0.5", + "css-loader": "^0.28.7", + "react-redux": "^5.0.6", "reactstrap": "^4.8.0", "redux": "^3.7.2", "redux-thunk": "^2.2.0", "style-loader": "^0.18.2", "uglifyjs-webpack-plugin": "^0.4.6", - "webpack": "^3.1.0", - "webpack-dev-middleware": "^1.12.0", - "webpack-hot-middleware": "^2.18.2" + "webpack": "^3.10.0", + "webpack-dev-middleware": "^1.12.2", + "webpack-hot-middleware": "^2.21.0" }, "dependencies": { "babel-plugin-transform-react-jsx": "^6.24.1", "babel-polyfill": "^6.26.0", "bencode": "^1.0.0", - "bootstrap": "^4.0.0-alpha.6", - "express": "^4.15.3", + "bootstrap": "^4.0.0-beta.3", + "express": "^4.16.2", "file-loader": "^0.11.2", "font-awesome": "^4.7.0", "font-awesome-sass-loader": "^2.0.1", "history": "^4.7.2", "isomorphic-fetch": "^2.2.1", - "moment": "^2.18.1", - "node-sass": "^4.5.3", - "preact": "^8.2.4", + "moment": "^2.20.1", + "node-sass": "^4.7.2", + "preact": "^8.2.7", "preact-compat": "^3.17.0", - "react": "^15.6.1", - "react-dom": "^15.6.1", + "react": "^15.6.2", + "react-dom": "^15.6.2", "react-fontawesome": "^1.6.1", - "react-hot-loader": "^3.0.0-beta.7", - "react-router-dom": "^4.2.0", - "react-router-redux": "^5.0.0-alpha.6", - "react-transition-group": "^2.2.0", + "react-hot-loader": "^3.1.3", + "react-router-dom": "^4.2.2", + "react-router-redux": "^5.0.0-alpha.9", + "react-transition-group": "^2.2.1", "sass-loader": "^6.0.6", "url-loader": "^0.5.9" } diff --git a/scss/main.scss b/scss/main.scss index 463e3b2..23e8391 100644 --- a/scss/main.scss +++ b/scss/main.scss @@ -202,3 +202,52 @@ fieldset .form-check-input:only-child { } } } + +.files { + .file { + display: flex; + padding: 0.1rem 0.25rem; + + &:nth-child(even) { + background: #dfdfdf; + } + + div { + margin: 0 0.5rem; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + .progress { + min-width: 3rem; + align-self: center; + + .progress-bar { + height: 100%; + } + } + + .path { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + flex-grow: 1; + line-height: 1.7; + } + + select { + min-width: 5rem; + } + } +} + +.toggles * { + flex-grow: 1 !important; + margin: 0 0.25rem; +} diff --git a/scss/srht b/scss/srht index 1cea294..1c07693 160000 --- a/scss/srht +++ b/scss/srht @@ -1 +1 @@ -Subproject commit 1cea2941056108fe5fb17626ad9a45f4276c83eb +Subproject commit 1c076933d77236b78a33b817d19071017d907a00 diff --git a/src/ui/torrent_details.js b/src/ui/torrent_details.js index 6f648c2..62a15fe 100644 --- a/src/ui/torrent_details.js +++ b/src/ui/torrent_details.js @@ -10,6 +10,8 @@ import { Collapse, Card, CardBlock, + Progress, + Input, } from 'reactstrap'; import moment from 'moment'; import TorrentOptions from './torrent_options'; @@ -27,24 +29,47 @@ import { updateResource } from '../actions/resources'; const dlURI = (uri, password, id) => `${uri.replace('ws', 'http')}/dl/${id}?password=${encodeURIComponent(password)}`; -function File({ file }) { - // TODO: show progress bar +function basename(path) { + const parts = path.split("/"); + return parts[parts.length - 1]; +} + +function File({ dispatch, file }) { // TODO: edit priority const { uri, password } = store.getState().socket; return ( - - - { - file.progress == 1.0 - ? - {file.path} - - : file.path - } - - {file.priority} - {file.availability} - +
+ + {file.progress == 1.0 ? + "done" : `${(file.progress * 100).toFixed(0)}%`} + +
+ {file.progress == 1.0 ? + + {basename(file.path)} + : basename(file.path)} +
+
+ dispatch(updateResource({ + id: file.id, + priority: parseInt(e.target.value) + }))} + > + + + + + + +
+
); } @@ -129,7 +154,7 @@ class Torrent extends Component { - + this.setState({ infoShown: !this.state.infoShown })} @@ -152,7 +177,7 @@ class Torrent extends Component { /> - +
Downloading to
@@ -177,12 +202,12 @@ class Torrent extends Component { - - - - {files.slice().sort((a, b) => a.path.localeCompare(b.path)).map(file => )} - -
+ +
+ {files.slice().sort((a, b) => + a.path.localeCompare(b.path)).map(file => + )} +