From 02eb65c99ef2f8851921196fd2b022d6ce33a334 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 22 Aug 2017 15:49:48 -0400 Subject: [PATCH] Add torrent view, fix srht styles --- .gitmodules | 3 +++ scss/base.scss | 3 --- scss/main.scss | 37 +++++++++++++++++++++++++++++++++++++ scss/srht | 1 + src/index.js | 14 ++++++++++---- src/ui/main.js | 19 +++++++++++++++++++ src/ui/navigation.js | 20 ++++++++++++++++++++ src/ui/torrent_table.js | 40 ++++++++++++++++++++++++++++++++++++++++ webpack.config.js | 6 +++--- 9 files changed, 133 insertions(+), 10 deletions(-) create mode 100644 .gitmodules delete mode 100644 scss/base.scss create mode 100644 scss/main.scss create mode 160000 scss/srht create mode 100644 src/ui/main.js create mode 100644 src/ui/navigation.js create mode 100644 src/ui/torrent_table.js diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..27b63cd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "scss/srht"] + path = scss/srht + url = https://git.sr.ht/~sircmpwn/srht diff --git a/scss/base.scss b/scss/base.scss deleted file mode 100644 index 468b1c6..0000000 --- a/scss/base.scss +++ /dev/null @@ -1,3 +0,0 @@ -@import "bootstrap"; -$fa-font-path: "../node_modules/font-awesome/fonts/"; -@import "font-awesome"; diff --git a/scss/main.scss b/scss/main.scss new file mode 100644 index 0000000..32b72ec --- /dev/null +++ b/scss/main.scss @@ -0,0 +1,37 @@ +@import "base"; + +.table { + tbody td { + border: none; + } +} + +.torrent { + &.paused { + color: $gray-dark; + background: $gray-lighter; + } + + &.idle { + color: $gray-dark; + } + + &.error { + background-color: $brand-danger; + color: $white; + a { + color: $white; + text-decoration: underline; + } + } + + &.seeding { + background-image: linear-gradient(to right, lighten($brand-info, 20), $brand-info); + } + + &.leeching { + background-image: linear-gradient(to right, lighten($brand-success, 20), $brand-success); + } + + background-repeat: no-repeat; +} diff --git a/scss/srht b/scss/srht new file mode 160000 index 0000000..1cea294 --- /dev/null +++ b/scss/srht @@ -0,0 +1 @@ +Subproject commit 1cea2941056108fe5fb17626ad9a45f4276c83eb diff --git a/src/index.js b/src/index.js index 07c8669..5204d12 100644 --- a/src/index.js +++ b/src/index.js @@ -3,10 +3,13 @@ import { render } from 'react-dom'; import { Provider } from 'react-redux'; import store from './store'; -import scss from '../scss/base.scss'; +import scss from '../scss/main.scss'; import { ws_init } from './socket'; import { filter_subscribe } from './actions/filter_subscribe'; +import Nav from './ui/navigation'; +import Main from './ui/main'; + ws_init(() => { store.dispatch(filter_subscribe()); store.dispatch(filter_subscribe('server')); @@ -14,9 +17,12 @@ ws_init(() => { render( -

- Hello world! -

+
+
, document.getElementById('root') ); diff --git a/src/ui/main.js b/src/ui/main.js new file mode 100644 index 0000000..1c14dd8 --- /dev/null +++ b/src/ui/main.js @@ -0,0 +1,19 @@ +import React, { Component } from 'react'; +import TorrentTable from './torrent_table'; + +export default class Main extends Component { + render() { + return ( +
+
+

Filter

+

TODO

+
+
+

Torrents

+ +
+
+ ); + } +} diff --git a/src/ui/navigation.js b/src/ui/navigation.js new file mode 100644 index 0000000..f6af0ca --- /dev/null +++ b/src/ui/navigation.js @@ -0,0 +1,20 @@ +import React from 'react'; + +export default function render(props) { + return ; +} diff --git a/src/ui/torrent_table.js b/src/ui/torrent_table.js new file mode 100644 index 0000000..85f9d07 --- /dev/null +++ b/src/ui/torrent_table.js @@ -0,0 +1,40 @@ +import React, { Component } from 'react'; +import { connect } from 'react-redux'; + +class TorrentTable extends Component { + render() { + const { torrents } = this.props; + return ( + + + + + + + + + + {Object.values(torrents).map(t => + + + + + + )} + +
nameupdown
+ + {t.name} + + {t.rate_up}{t.rate_down}
+ ); + } +} + +export default connect(state => ({ torrents: state.torrents }))(TorrentTable); diff --git a/webpack.config.js b/webpack.config.js index 12abb6e..7767de6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -28,10 +28,10 @@ module.exports = { loader: 'sass-loader', options: { includePaths: [ - path.resolve(__dirname, './node_modules/bootstrap/scss/'), - path.resolve(__dirname, './node_modules/font-awesome/scss/') + path.resolve(__dirname, './node_modules'), + path.resolve(__dirname, './scss/srht/srht/scss'), ] - } + }, } ], }