From 4c2d43850720bcf5676d47eb6fdf0e84bad0e40c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 21 Aug 2019 15:12:04 -0700 Subject: [PATCH] Fixing sizes. --- server/ui/src/components/search.tsx | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/server/ui/src/components/search.tsx b/server/ui/src/components/search.tsx index 2445737..172d922 100644 --- a/server/ui/src/components/search.tsx +++ b/server/ui/src/components/search.tsx @@ -1,5 +1,5 @@ import { Component, linkEvent } from 'inferno'; -import * as moment from 'moment'; +import moment from 'moment'; import { endpoint } from '../env'; import { SearchParams, Results, Torrent } from '../interfaces'; @@ -55,17 +55,17 @@ export class Search extends Component { if (!!this.state.searchParams.q) { this.setState({ searching: true, results: { torrents: [] } }); this.fetchData(this.state.searchParams) - .then(torrents => { - if (!!torrents) { - this.setState({ - results: { - torrents: torrents - } - }); - } - }).catch(error => { - console.error('request failed', error); - }).then(() => this.setState({ searching: false })); + .then(torrents => { + if (!!torrents) { + this.setState({ + results: { + torrents: torrents + } + }); + } + }).catch(error => { + console.error('request failed', error); + }).then(() => this.setState({ searching: false })); } else { this.setState({ results: { torrents: [] } }); } @@ -74,7 +74,7 @@ export class Search extends Component { fetchData(searchParams: SearchParams): Promise> { let q = encodeURI(searchParams.q); return fetch(`${endpoint}/service/search?q=${q}&page=${searchParams.page}&type_=${searchParams.type_}`) - .then(data => data.json()); + .then(data => data.json()); } render() { @@ -83,8 +83,8 @@ export class Search extends Component { { this.state.searching ? this.spinner() : this.state.results.torrents[0] ? - this.torrentsTable() - : this.noResults() + this.torrentsTable() + : this.noResults() } ); @@ -138,7 +138,7 @@ export class Search extends Component { )} - {humanFileSize(torrent.size_bytes, true)} + {humanFileSize(torrent.size_bytes, false)} {torrent.seeders} @@ -190,7 +190,7 @@ export class Search extends Component { +