Merge pull request #784 from lbryio/revert-783-restructuring

Revert "Update file structure to follow electron-webpack guidelines"
This commit is contained in:
Jeremy Kauffman 2017-11-24 16:36:34 -05:00 committed by GitHub
commit c66c600b89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
338 changed files with 670 additions and 749 deletions

View file

@ -16,11 +16,11 @@ values =
rc rc
production production
[bumpversion:file:src/main/package.json] [bumpversion:file:app/package.json]
search = "version": "{current_version}" search = "version": "{current_version}"
replace = "version": "{new_version}" replace = "version": "{new_version}"
[bumpversion:file:src/renderer/package.json] [bumpversion:file:ui/package.json]
search = "version": "{current_version}" search = "version": "{current_version}"
replace = "version": "{new_version}" replace = "version": "{new_version}"

16
.gitignore vendored
View file

@ -2,16 +2,16 @@
/LBRY-darwin-x64 /LBRY-darwin-x64
/dist /dist
/src/renderer/dist/css/* /ui/dist/css/*
/src/renderer/dist/js/* /ui/dist/js/*
!/src/renderer/dist/js/mediaelement !/ui/dist/js/mediaelement
/src/renderer/node_modules /ui/node_modules
/src/renderer/.sass-cache /ui/.sass-cache
/src/main/dist /app/dist
/src/main/locales /app/locales
/src/main/node_modules /app/node_modules
/build/venv /build/venv
/build/daemon.ver /build/daemon.ver
/lbry-app-venv /lbry-app-venv

View file

@ -2,7 +2,7 @@
host = https://www.transifex.com host = https://www.transifex.com
[lbry-app.app-strings] [lbry-app.app-strings]
file_filter = src/main/dist/locales/<lang>.json file_filter = app/dist/locales/<lang>.json
source_file = src/main/dist/locales/en.json source_file = app/dist/locales/en.json
source_lang = en source_lang = en
type = KEYVALUEJSON type = KEYVALUEJSON

View file

@ -29,13 +29,13 @@ This will download and install the LBRY app and its dependencies, including [the
### Running ### Running
Run `./node_modules/.bin/electron src/main` Run `./node_modules/.bin/electron app`
### Ongoing Development ### Ongoing Development
1. `cd src/renderer` 1. `cd ui`
2. `./watch.sh` 2. `./watch.sh`
This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `src/renderer` folder. This allows you to make changes and see them immediately by reloading the app. This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app.
### Packaging ### Packaging
@ -67,36 +67,36 @@ python build\set_version.py
npm install -g yarn npm install -g yarn
yarn install yarn install
``` ```
3. Change directory to `src\main` and run the following; 3. Change directory to `app` and run the following;
``` ```
yarn install yarn install
node_modules\.bin\electron-rebuild node_modules\.bin\electron-rebuild
node_modules\.bin\electron-rebuild node_modules\.bin\electron-rebuild
cd ..\.. cd ..
``` ```
4. Change directory to `src\renderer` and run the following: 4. Change directory to `ui` and run the following:
``` ```
yarn install yarn install
npm rebuild node-sass npm rebuild node-sass
node node_modules\node-sass\bin\node-sass --output dist\css --sourcemap=none scss\ node node_modules\node-sass\bin\node-sass --output dist\css --sourcemap=none scss\
node_modules\.bin\webpack --config webpack.dev.config.js node_modules\.bin\webpack --config webpack.dev.config.js
xcopy /E dist ..\main\dist xcopy /E dist ..\app\dist
cd ..\.. cd ..
``` ```
4. Download the lbry daemon and cli [binaries](https://github.com/lbryio/lbry/releases) and place them in `src\main\dist\` 4. Download the lbry daemon and cli [binaries](https://github.com/lbryio/lbry/releases) and place them in `app\dist\`
### Building lbry-app ### Building lbry-app
1. run `node_modules\.bin\build -p never` from the root of the project. 1. run `node_modules\.bin\build -p never` from the root of the project.
### Running the electron app ### Running the electron app
1. Run `node_modules\.bin\electron src\main` 1. Run `node_modules\.bin\electron app`
### Ongoing Development ### Ongoing Development
1. `cd src\renderer` 1. `cd ui`
2. `watch.bat` 2. `watch.bat`
This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `src\renderer` folder. This allows you to make changes and see them immediately by reloading the app. This will set up a monitor that will automatically compile any changes to JS or CSS folders inside of the `ui` folder. This allows you to make changes and see them immediately by reloading the app.
## Internationalization ## Internationalization
If you want to help translating the lbry-app, you can copy the en.json file in /src/main/locales and modify the values while leaving the keys as their original English strings. An example for this would be: `"Skip": "Überspringen",` Translations should automatically show up in options. If you want to help translating the lbry-app, you can copy the en.json file in /app/locales and modify the values while leaving the keys as their original English strings. An example for this would be: `"Skip": "Überspringen",` Translations should automatically show up in options.

View file

@ -9,33 +9,33 @@ yarn install
# do app # do app
cd src\main cd app
yarn install yarn install
# necessary to ensure native Node modules (e.g. keytar) are built against the correct version of Node) # necessary to ensure native Node modules (e.g. keytar) are built against the correct version of Node)
# yes, it needs to be run twice. it fails the first time, not sure why # yes, it needs to be run twice. it fails the first time, not sure why
node_modules\.bin\electron-rebuild node_modules\.bin\electron-rebuild
node_modules\.bin\electron-rebuild node_modules\.bin\electron-rebuild
cd ..\.. cd ..
# build ui # build ui
cd main\renderer cd ui
yarn install yarn install
npm rebuild node-sass npm rebuild node-sass
node_modules\.bin\node-sass --output dist\css --sourcemap=none scss\ node_modules\.bin\node-sass --output dist\css --sourcemap=none scss\
node_modules\.bin\webpack --config webpack.prod.js node_modules\.bin\webpack --config webpack.prod.js
Copy-Item dist ..\main\ -recurse Copy-Item dist ..\app\ -recurse
cd ..\.. cd ..
# get daemon and cli executable # get daemon and cli executable
$package_settings = (Get-Content src\main\package.json -Raw | ConvertFrom-Json).lbrySettings $package_settings = (Get-Content app\package.json -Raw | ConvertFrom-Json).lbrySettings
$daemon_ver = $package_settings.lbrynetDaemonVersion $daemon_ver = $package_settings.lbrynetDaemonVersion
$daemon_url_template = $package_settings.lbrynetDaemonUrlTemplate $daemon_url_template = $package_settings.lbrynetDaemonUrlTemplate
$daemon_url = $daemon_url_template.Replace('OSNAME', 'windows').Replace('DAEMONVER', $daemon_ver) $daemon_url = $daemon_url_template.Replace('OSNAME', 'windows').Replace('DAEMONVER', $daemon_ver)
Invoke-WebRequest -Uri $daemon_url -OutFile daemon.zip Invoke-WebRequest -Uri $daemon_url -OutFile daemon.zip
Expand-Archive daemon.zip -DestinationPath src\main\dist\ Expand-Archive daemon.zip -DestinationPath app\dist\
dir src\main\dist\ # verify that daemon binary is there dir app\dist\ # verify that daemon binary is there
rm daemon.zip rm daemon.zip

View file

@ -41,8 +41,8 @@ fi
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist" [ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
mkdir -p "$ROOT/dist" mkdir -p "$ROOT/dist"
[ -d "$ROOT/src/main/dist" ] && rm -rf "$ROOT/src/main/dist" [ -d "$ROOT/app/dist" ] && rm -rf "$ROOT/app/dist"
mkdir -p "$ROOT/src/main/dist" mkdir -p "$ROOT/app/dist"
yarn install yarn install
@ -53,13 +53,13 @@ yarn install
############ ############
echo -e "\033[0;32mCompiling UI\x1b[m" echo -e "\033[0;32mCompiling UI\x1b[m"
( (
cd "$ROOT/src/renderer" cd "$ROOT/ui"
yarn install yarn install
npm rebuild node-sass npm rebuild node-sass
node extractLocals.js node extractLocals.js
node_modules/.bin/node-sass --output dist/css --sourcemap=none scss/ node_modules/.bin/node-sass --output dist/css --sourcemap=none scss/
node_modules/.bin/webpack --config webpack.prod.js node_modules/.bin/webpack --config webpack.prod.js
cp -r dist/* "$ROOT/src/main/dist/" cp -r dist/* "$ROOT/app/dist/"
) )
@ -73,14 +73,14 @@ if $OSX; then
else else
OSNAME="linux" OSNAME="linux"
fi fi
DAEMON_VER=$(node -e "console.log(require(\"$ROOT/src/main/package.json\").lbrySettings.lbrynetDaemonVersion)") DAEMON_VER=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonVersion)")
DAEMON_URL_TEMPLATE=$(node -e "console.log(require(\"$ROOT/src/main/package.json\").lbrySettings.lbrynetDaemonUrlTemplate)") DAEMON_URL_TEMPLATE=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonUrlTemplate)")
DAEMON_URL=$(echo ${DAEMON_URL_TEMPLATE//DAEMONVER/$DAEMON_VER} | sed "s/OSNAME/$OSNAME/g") DAEMON_URL=$(echo ${DAEMON_URL_TEMPLATE//DAEMONVER/$DAEMON_VER} | sed "s/OSNAME/$OSNAME/g")
DAEMON_VER_PATH="$BUILD_DIR/daemon.ver" DAEMON_VER_PATH="$BUILD_DIR/daemon.ver"
echo "$DAEMON_VER_PATH" echo "$DAEMON_VER_PATH"
if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/src/main/dist/lbrynet-daemon || "$(< "$DAEMON_VER_PATH")" != "$DAEMON_VER" ]]; then if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/app/dist/lbrynet-daemon || "$(< "$DAEMON_VER_PATH")" != "$DAEMON_VER" ]]; then
curl -sL -o "$BUILD_DIR/daemon.zip" "$DAEMON_URL" curl -sL -o "$BUILD_DIR/daemon.zip" "$DAEMON_URL"
unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/src/main/dist/" unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/"
rm "$BUILD_DIR/daemon.zip" rm "$BUILD_DIR/daemon.zip"
echo "$DAEMON_VER" > "$DAEMON_VER_PATH" echo "$DAEMON_VER" > "$DAEMON_VER_PATH"
else else
@ -95,16 +95,16 @@ fi
################### ###################
echo -e '\033[0;32mBuilding Lbry-app\x1b[m' echo -e '\033[0;32mBuilding Lbry-app\x1b[m'
( (
cd "$ROOT/src/main" cd "$ROOT/app"
yarn install yarn install
# necessary to ensure native Node modules (e.g. keytar) are built against the correct version of Node) # necessary to ensure native Node modules (e.g. keytar) are built against the correct version of Node)
# yes, it needs to be run twice. it fails the first time, not sure why # yes, it needs to be run twice. it fails the first time, not sure why
set +e set +e
# DEBUG=electron-rebuild node_modules/.bin/electron-rebuild . # DEBUG=electron-rebuild node_modules/.bin/electron-rebuild .
node_modules/.bin/electron-rebuild "$ROOT/src/main" node_modules/.bin/electron-rebuild "$ROOT/app"
set -e set -e
node_modules/.bin/electron-rebuild "$ROOT/src/main" node_modules/.bin/electron-rebuild "$ROOT/app"
) )
if [ "$FULL_BUILD" == "true" ]; then if [ "$FULL_BUILD" == "true" ]; then
@ -133,5 +133,5 @@ if [ "$FULL_BUILD" == "true" ]; then
echo -e '\033[0;32mBuild and packaging complete.\x1b[m' echo -e '\033[0;32mBuild and packaging complete.\x1b[m'
else else
echo -e 'Build complete. Run \033[1;31m./node_modules/.bin/electron src/main\x1b[m to launch the app' echo -e 'Build complete. Run \033[1;31m./node_modules/.bin/electron app\x1b[m to launch the app'
fi fi

View file

@ -17,7 +17,7 @@ import github
import changelog import changelog
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
APP_PACKAGE_JSON_FILE = os.path.join(ROOT, 'src', 'main', 'package.json') APP_PACKAGE_JSON_FILE = os.path.join(ROOT, 'app', 'package.json')
def main(): def main():

View file

@ -3,7 +3,7 @@
"build": { "build": {
"asar": false, "asar": false,
"directories": { "directories": {
"app": "src/main" "app": "app"
}, },
"appId": "io.lbry.LBRY", "appId": "io.lbry.LBRY",
"mac": { "mac": {

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

View file

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 992 KiB

After

Width:  |  Height:  |  Size: 992 KiB

View file

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View file

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,7 +1,7 @@
var extract = require("i18n-extract"); var extract = require("i18n-extract");
const fs = require("fs"); const fs = require("fs");
var dir = __dirname + "/../main/dist/locales"; var dir = __dirname + "/../app/dist/locales";
var path = dir + "/en.json"; var path = dir + "/en.json";
if (!fs.existsSync(dir)) { if (!fs.existsSync(dir)) {

View file

@ -40,19 +40,16 @@ class ChannelTile extends React.PureComponent {
</h3> </h3>
</div> </div>
<div className="card__content card__subtext"> <div className="card__content card__subtext">
{isResolvingUri && ( {isResolvingUri &&
<BusyMessage message={__("Resolving channel")} /> <BusyMessage message={__("Resolving channel")} />}
)} {totalItems > 0 &&
{totalItems > 0 && (
<span> <span>
This is a channel with {totalItems}{" "} This is a channel with {totalItems}{" "}
{totalItems === 1 ? " item" : " items"} inside of it. {totalItems === 1 ? " item" : " items"} inside of it.
</span> </span>}
)}
{!isResolvingUri && {!isResolvingUri &&
!totalItems && ( !totalItems &&
<span className="empty">This is an empty channel.</span> <span className="empty">This is an empty channel.</span>}
)}
</div> </div>
</div> </div>
</div> </div>

View file

@ -50,9 +50,7 @@ export class BusyMessage extends React.PureComponent {
render() { render() {
return ( return (
<span> <span>{this.props.message} <span className="busy-indicator" /></span>
{this.props.message} <span className="busy-indicator" />
</span>
); );
} }
} }
@ -94,8 +92,7 @@ export class CreditAmount extends React.PureComponent {
if (showFullPrice) { if (showFullPrice) {
formattedAmount = fullPrice; formattedAmount = fullPrice;
} else { } else {
formattedAmount = formattedAmount = amount > 0 && amount < minimumRenderableAmount
amount > 0 && amount < minimumRenderableAmount
? "<" + minimumRenderableAmount ? "<" + minimumRenderableAmount
: formatCredits(amount, precision); : formatCredits(amount, precision);
} }
@ -122,15 +119,17 @@ export class CreditAmount extends React.PureComponent {
className={`credit-amount credit-amount--${this.props.look}`} className={`credit-amount credit-amount--${this.props.look}`}
title={fullPrice} title={fullPrice}
> >
<span>{amountText}</span> <span>
{this.props.isEstimate ? ( {amountText}
<span </span>
{this.props.isEstimate
? <span
className="credit-amount__estimate" className="credit-amount__estimate"
title={__("This is an estimate and does not include data fees")} title={__("This is an estimate and does not include data fees")}
> >
* *
</span> </span>
) : null} : null}
</span> </span>
); );
} }

View file

@ -26,8 +26,7 @@ class FileSelector extends React.PureComponent {
handleButtonClick() { handleButtonClick() {
remote.dialog.showOpenDialog( remote.dialog.showOpenDialog(
{ {
properties: properties: this.props.type == "file"
this.props.type == "file"
? ["openFile"] ? ["openFile"]
: ["openDirectory", "createDirectory"], : ["openDirectory", "createDirectory"],
}, },
@ -63,7 +62,8 @@ class FileSelector extends React.PureComponent {
: __("Choose Directory")} : __("Choose Directory")}
</span> </span>
</span> </span>
</button>{" "} </button>
{" "}
<span className="file-selector__path"> <span className="file-selector__path">
<input <input
className="input-copyable" className="input-copyable"

View file

@ -13,24 +13,22 @@ class FileActions extends React.PureComponent {
return ( return (
<section className="card__actions"> <section className="card__actions">
<FileDownloadLink uri={uri} /> <FileDownloadLink uri={uri} />
{showDelete && ( {showDelete &&
<Link <Link
button="text" button="text"
icon="icon-trash" icon="icon-trash"
label={__("Remove")} label={__("Remove")}
className="no-underline" className="no-underline"
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })} onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
/> />}
)} {!claimIsMine &&
{!claimIsMine && (
<Link <Link
button="text" button="text"
icon="icon-flag" icon="icon-flag"
href={`https://lbry.io/dmca?claim_id=${claimId}`} href={`https://lbry.io/dmca?claim_id=${claimId}`}
className="no-underline" className="no-underline"
label={__("report")} label={__("report")}
/> />}
)}
<Link <Link
button="primary" button="primary"
icon="icon-gift" icon="icon-gift"
@ -39,7 +37,7 @@ class FileActions extends React.PureComponent {
className="card__action--right" className="card__action--right"
navigateParams={{ uri, tab: "tip" }} navigateParams={{ uri, tab: "tip" }}
/> />
{claimIsMine && ( {claimIsMine &&
<Link <Link
button="alt" button="alt"
icon="icon-edit" icon="icon-edit"
@ -47,8 +45,7 @@ class FileActions extends React.PureComponent {
navigate="/publish" navigate="/publish"
className="card__action--right" className="card__action--right"
navigateParams={{ id: claimId }} navigateParams={{ id: claimId }}
/> />}
)}
</section> </section>
); );
} }

View file

@ -49,18 +49,15 @@ class FileDetails extends React.PureComponent {
<table className="table-standard table-stretch"> <table className="table-standard table-stretch">
<tbody> <tbody>
<tr> <tr>
<td>{__("Content-Type")}</td> <td>{__("Content-Type")}</td><td>{mediaType}</td>
<td>{mediaType}</td>
</tr> </tr>
<tr> <tr>
<td>{__("Language")}</td> <td>{__("Language")}</td><td>{language}</td>
<td>{language}</td>
</tr> </tr>
<tr> <tr>
<td>{__("License")}</td> <td>{__("License")}</td><td>{license}</td>
<td>{license}</td>
</tr> </tr>
{downloadPath && ( {downloadPath &&
<tr> <tr>
<td>{__("Downloaded to")}</td> <td>{__("Downloaded to")}</td>
<td> <td>
@ -68,8 +65,7 @@ class FileDetails extends React.PureComponent {
{downloadPath} {downloadPath}
</Link> </Link>
</td> </td>
</tr> </tr>}
)}
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -45,8 +45,7 @@ class FileDownloadLink extends React.PureComponent {
} = this.props; } = this.props;
if (loading || downloading) { if (loading || downloading) {
const progress = const progress = fileInfo && fileInfo.written_bytes
fileInfo && fileInfo.written_bytes
? fileInfo.written_bytes / fileInfo.total_bytes * 100 ? fileInfo.written_bytes / fileInfo.total_bytes * 100
: 0, : 0,
label = fileInfo label = fileInfo
@ -55,7 +54,9 @@ class FileDownloadLink extends React.PureComponent {
labelWithIcon = ( labelWithIcon = (
<span className="button__content"> <span className="button__content">
<Icon icon="icon-download" /> <Icon icon="icon-download" />
<span>{label}</span> <span>
{label}
</span>
</span> </span>
); );

View file

@ -39,21 +39,19 @@ class FileListSearch extends React.PureComponent {
return ( return (
<div> <div>
{isSearching && {isSearching &&
!uris && ( !uris &&
<BusyMessage message={__("Looking up the Dewey Decimals")} /> <BusyMessage message={__("Looking up the Dewey Decimals")} />}
)}
{isSearching && {isSearching &&
uris && <BusyMessage message={__("Refreshing the Dewey Decimals")} />} uris &&
<BusyMessage message={__("Refreshing the Dewey Decimals")} />}
{uris && uris.length {uris && uris.length
? uris.map( ? uris.map(
uri => uri =>
lbryuri.parse(uri).name[0] === "@" ? ( lbryuri.parse(uri).name[0] === "@"
<ChannelTile key={uri} uri={uri} /> ? <ChannelTile key={uri} uri={uri} />
) : ( : <FileTile key={uri} uri={uri} />
<FileTile key={uri} uri={uri} />
)
) )
: !isSearching && <SearchNoResults query={query} />} : !isSearching && <SearchNoResults query={query} />}
</div> </div>

View file

@ -72,12 +72,12 @@ class FileTile extends React.PureComponent {
const uri = lbryuri.normalize(this.props.uri); const uri = lbryuri.normalize(this.props.uri);
const isClaimed = !!claim; const isClaimed = !!claim;
const isClaimable = lbryuri.isClaimable(uri); const isClaimable = lbryuri.isClaimable(uri);
const title = const title = isClaimed && metadata && metadata.title
isClaimed && metadata && metadata.title
? metadata.title ? metadata.title
: lbryuri.parse(uri).contentName; : lbryuri.parse(uri).contentName;
const thumbnail = const thumbnail = metadata && metadata.thumbnail
metadata && metadata.thumbnail ? metadata.thumbnail : null; ? metadata.thumbnail
: null;
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
const isRewardContent = const isRewardContent =
claim && rewardedContentClaimIds.includes(claim.claim_id); claim && rewardedContentClaimIds.includes(claim.claim_id);
@ -99,9 +99,8 @@ class FileTile extends React.PureComponent {
description = ( description = (
<span className="empty"> <span className="empty">
{__("This location is unused.")} {" "} {__("This location is unused.")} {" "}
{isClaimable && ( {isClaimable &&
<span className="button-text">{__("Put something here!")}</span> <span className="button-text">{__("Put something here!")}</span>}
)}
</span> </span>
); );
} else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) { } else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) {
@ -124,21 +123,22 @@ class FileTile extends React.PureComponent {
<div className="file-tile__content"> <div className="file-tile__content">
<div className="card__title-primary"> <div className="card__title-primary">
<span className="card__indicators"> <span className="card__indicators">
{showPrice && <FilePrice uri={this.props.uri} />}{" "} {showPrice && <FilePrice uri={this.props.uri} />}
{isRewardContent && <Icon icon={icons.FEATURED} />}{" "} {" "}
{isRewardContent && <Icon icon={icons.FEATURED} />}
{" "}
{showLocal && fileInfo && <Icon icon={icons.LOCAL} />} {showLocal && fileInfo && <Icon icon={icons.LOCAL} />}
</span> </span>
<h3> <h3>
<TruncatedText lines={1}>{title || name}</TruncatedText> <TruncatedText lines={1}>{title || name}</TruncatedText>
</h3> </h3>
</div> </div>
{description && ( {description &&
<div className="card__content card__subtext"> <div className="card__content card__subtext">
<TruncatedText lines={!showActions ? 3 : 2}> <TruncatedText lines={!showActions ? 3 : 2}>
{description} {description}
</TruncatedText> </TruncatedText>
</div> </div>}
)}
</div> </div>
</div> </div>
</div> </div>

Some files were not shown because too many files have changed in this diff Show more