Overall clean-up and improvement of the project #5
12 changed files with 4273 additions and 6673 deletions
4
.babelrc
Normal file
4
.babelrc
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"presets": ["env", "stage-2"],
|
||||||
|
"plugins": ["transform-flow-comments"]
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"plugins": ["flowtype"],
|
"plugins": ["flowtype"],
|
||||||
"extends": [
|
"extends": [
|
||||||
"airbnb",
|
"airbnb-base",
|
||||||
"plugin:import/electron",
|
"plugin:import/electron",
|
||||||
"plugin:flowtype/recommended",
|
"plugin:flowtype/recommended",
|
||||||
"plugin:prettier/recommended"
|
"plugin:prettier/recommended"
|
||||||
|
|
9
.flowconfig
Normal file
9
.flowconfig
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[ignore]
|
||||||
|
|
||||||
|
[include]
|
||||||
|
|
||||||
|
[libs]
|
||||||
|
|
||||||
|
[options]
|
||||||
|
module.system.node.resolve_dirname=src
|
||||||
|
module.system.node.resolve_dirname=node_modules
|
30
.gitignore
vendored
30
.gitignore
vendored
|
@ -1,30 +1,2 @@
|
||||||
/node_modules
|
/node_modules
|
||||||
/LBRY-darwin-x64
|
yarn-error.log
|
||||||
/dist
|
|
||||||
|
|
||||||
/src/main/dist
|
|
||||||
/src/main/locales
|
|
||||||
/src/main/node_modules
|
|
||||||
/src/renderer/dist
|
|
||||||
/build/venv
|
|
||||||
/build/daemon.ver
|
|
||||||
/lbry-app-venv
|
|
||||||
/lbry-app
|
|
||||||
/lbry-venv
|
|
||||||
/static/daemon/lbrynet*
|
|
||||||
/static/locales
|
|
||||||
/daemon/build
|
|
||||||
/daemon/venv
|
|
||||||
/daemon/requirements.txt
|
|
||||||
/.idea
|
|
||||||
|
|
||||||
*.pyc
|
|
||||||
*.iml
|
|
||||||
.#*
|
|
||||||
|
|
||||||
build/daemon.zip
|
|
||||||
.vimrc
|
|
||||||
|
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
.DS_Store
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"linters": {
|
"linters": {
|
||||||
"src/**/*.js": [
|
"src/**/*.{js,json}": [
|
||||||
"prettier --write",
|
"prettier --write",
|
||||||
|
"git add"
|
||||||
|
],
|
||||||
|
"src/**/*.js": [
|
||||||
"eslint --fix",
|
"eslint --fix",
|
||||||
"git add"
|
"git add"
|
||||||
]
|
]
|
5651
build/index.js → dist/bundle.js
vendored
5651
build/index.js → dist/bundle.js
vendored
File diff suppressed because it is too large
Load diff
80
package.json
80
package.json
|
@ -2,6 +2,10 @@
|
||||||
"name": "lbry-redux",
|
"name": "lbry-redux",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Common shared components for desktop and mobile.",
|
"description": "Common shared components for desktop and mobile.",
|
||||||
|
"keywords": [
|
||||||
|
"lbry"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
"homepage": "https://lbry.io/",
|
"homepage": "https://lbry.io/",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/lbryio/lbry-redux/issues"
|
"url": "https://github.com/lbryio/lbry-redux/issues"
|
||||||
|
@ -14,79 +18,41 @@
|
||||||
"name": "LBRY Inc.",
|
"name": "LBRY Inc.",
|
||||||
"email": "hello@lbry.io"
|
"email": "hello@lbry.io"
|
||||||
},
|
},
|
||||||
"main": "build/index.js",
|
"main": "dist/bundle.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
"lint": "eslint 'src/**/*.{js,jsx}' --fix",
|
"lint": "eslint 'src/**/*.js' --fix",
|
||||||
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write"
|
"format": "prettier 'src/**/*.{js,json}' --write"
|
||||||
},
|
},
|
||||||
"keywords": [
|
|
||||||
"lbry"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"amplitude-js": "^4.0.0",
|
"proxy-polyfill": "^0.2.0",
|
||||||
"bluebird": "^3.5.1",
|
"reselect": "^3.0.0"
|
||||||
"classnames": "^2.2.5",
|
|
||||||
"electron-dl": "^1.6.0",
|
|
||||||
"from2": "^2.3.0",
|
|
||||||
"install": "^0.10.2",
|
|
||||||
"jayson": "^2.0.2",
|
|
||||||
"jshashes": "^1.0.7",
|
|
||||||
"proxy-polyfill": "0.1.6",
|
|
||||||
"rc-progress": "^2.0.6",
|
|
||||||
"react": "^16.2.0",
|
|
||||||
"react-redux": "^5.0.3",
|
|
||||||
"redux": "^3.6.0",
|
|
||||||
"redux-action-buffer": "^1.1.0",
|
|
||||||
"redux-logger": "^3.0.1",
|
|
||||||
"redux-persist": "^4.8.0",
|
|
||||||
"redux-persist-transform-compress": "^4.2.0",
|
|
||||||
"redux-persist-transform-filter": "0.0.10",
|
|
||||||
"reselect": "^3.0.0",
|
|
||||||
"semver": "^5.3.0",
|
|
||||||
"tree-kill": "^1.1.0",
|
|
||||||
"y18n": "^4.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.26.0",
|
||||||
"babel-eslint": "^8.0.3",
|
"babel-eslint": "^8.0.3",
|
||||||
|
"babel-loader": "^7.1.4",
|
||||||
"babel-plugin-module-resolver": "^3.0.0",
|
"babel-plugin-module-resolver": "^3.0.0",
|
||||||
"babel-plugin-react-require": "^3.0.0",
|
|
||||||
"babel-polyfill": "^6.20.0",
|
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-preset-env": "^1.6.1",
|
||||||
"babel-preset-react": "^6.24.1",
|
|
||||||
"babel-preset-stage-2": "^6.18.0",
|
"babel-preset-stage-2": "^6.18.0",
|
||||||
"devtron": "^1.4.0",
|
"eslint": "^4.19.1",
|
||||||
"electron": "^1.7.9",
|
"eslint-config-airbnb-base": "^12.1.0",
|
||||||
"electron-builder": "^19.49.0",
|
|
||||||
"electron-devtools-installer": "^2.2.1",
|
|
||||||
"electron-webpack": "^1.11.0",
|
|
||||||
"eslint": "^4.13.1",
|
|
||||||
"eslint-config-airbnb": "^16.1.0",
|
|
||||||
"eslint-config-prettier": "^2.9.0",
|
"eslint-config-prettier": "^2.9.0",
|
||||||
"eslint-import-resolver-webpack": "^0.8.3",
|
"eslint-import-resolver-webpack": "^0.9.0",
|
||||||
"eslint-plugin-flowtype": "^2.40.1",
|
"eslint-plugin-flowtype": "^2.40.1",
|
||||||
"eslint-plugin-import": "^2.8.0",
|
"eslint-plugin-import": "^2.10.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.0.3",
|
|
||||||
"eslint-plugin-prettier": "^2.4.0",
|
"eslint-plugin-prettier": "^2.4.0",
|
||||||
"eslint-plugin-react": "^7.5.1",
|
"flow-babel-webpack-plugin": "^1.1.1",
|
||||||
"flow-babel-webpack-plugin": "^1.1.0",
|
"flow-bin": "^0.69.0",
|
||||||
"flow-bin": "^0.61.0",
|
"flow-typed": "^2.4.0",
|
||||||
"flow-typed": "^2.2.3",
|
|
||||||
"husky": "^0.14.3",
|
"husky": "^0.14.3",
|
||||||
"i18n-extract": "^0.5.1",
|
"lint-staged": "^7.0.4",
|
||||||
"json-loader": "^0.5.4",
|
|
||||||
"lint-staged": "^6.0.0",
|
|
||||||
"node-loader": "^0.6.0",
|
|
||||||
"node-sass": "^4.7.2",
|
|
||||||
"prettier": "^1.4.2",
|
"prettier": "^1.4.2",
|
||||||
"sass-loader": "^6.0.6",
|
"webpack": "^4.5.0",
|
||||||
"webpack": "^3.10.0",
|
"webpack-cli": "^2.0.14"
|
||||||
"webpack-build-notifier": "^0.1.18"
|
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"engines": {
|
||||||
"lbrySettings": {
|
"yarn": "^1.3"
|
||||||
"lbrynetDaemonVersion": "0.18.0",
|
|
||||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
src/lbry.js
12
src/lbry.js
|
@ -49,16 +49,6 @@ function apiCall(method: string, params: ?{}, resolve: Function, reject: Functio
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLocal(key, fallback = undefined) {
|
|
||||||
// const itemRaw = localStorage.getItem(key);
|
|
||||||
const itemRaw = null;
|
|
||||||
return itemRaw === null ? fallback : JSON.parse(itemRaw);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setLocal(key, value) {
|
|
||||||
// localStorage.setItem(key, JSON.stringify(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
// core
|
// core
|
||||||
Lbry.status = () =>
|
Lbry.status = () =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
@ -141,8 +131,6 @@ Lbry.getMediaType = (contentType, fileName) => {
|
||||||
*/
|
*/
|
||||||
Lbry.file_list = (params = {}) =>
|
Lbry.file_list = (params = {}) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
const { claim_name: claimName, channel_name: channelName, outpoint } = params;
|
|
||||||
|
|
||||||
apiCall(
|
apiCall(
|
||||||
'file_list',
|
'file_list',
|
||||||
params,
|
params,
|
||||||
|
|
|
@ -69,18 +69,6 @@ export const doSearch = rawQuery => (dispatch, getState) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => {
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.UPDATE_SEARCH_QUERY,
|
|
||||||
data: { query },
|
|
||||||
});
|
|
||||||
|
|
||||||
// Don't fetch new suggestions if the user just added a space
|
|
||||||
if (!query.endsWith(' ') || !shouldSkipSuggestions) {
|
|
||||||
dispatch(getSearchSuggestions(query));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getSearchSuggestions = (value: string) => dispatch => {
|
export const getSearchSuggestions = (value: string) => dispatch => {
|
||||||
const query = value.trim();
|
const query = value.trim();
|
||||||
|
|
||||||
|
@ -121,7 +109,7 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
||||||
);
|
);
|
||||||
|
|
||||||
// If it's a valid url, don't fetch any extra search results
|
// If it's a valid url, don't fetch any extra search results
|
||||||
return dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_SEARCH_SUGGESTIONS,
|
type: ACTIONS.UPDATE_SEARCH_SUGGESTIONS,
|
||||||
data: { suggestions },
|
data: { suggestions },
|
||||||
});
|
});
|
||||||
|
@ -146,7 +134,7 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
||||||
searchValue = searchValue.substring(0, searchValue.indexOf('#'));
|
searchValue = searchValue.substring(0, searchValue.indexOf('#'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return fetch(`https://lighthouse.lbry.io/autocomplete?s=${searchValue}`)
|
fetch(`https://lighthouse.lbry.io/autocomplete?s=${searchValue}`)
|
||||||
.then(handleFetchResponse)
|
.then(handleFetchResponse)
|
||||||
.then(apiSuggestions => {
|
.then(apiSuggestions => {
|
||||||
const formattedSuggestions = apiSuggestions.slice(0, 6).map(suggestion => {
|
const formattedSuggestions = apiSuggestions.slice(0, 6).map(suggestion => {
|
||||||
|
@ -172,3 +160,15 @@ export const getSearchSuggestions = (value: string) => dispatch => {
|
||||||
// Basic search suggestions are already populated at this point
|
// Basic search suggestions are already populated at this point
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boolean) => dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.UPDATE_SEARCH_QUERY,
|
||||||
|
data: { query },
|
||||||
|
});
|
||||||
|
|
||||||
|
// Don't fetch new suggestions if the user just added a space
|
||||||
|
if (!query.endsWith(' ') || !shouldSkipSuggestions) {
|
||||||
|
dispatch(getSearchSuggestions(query));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ export function doUpdateBalance() {
|
||||||
const { wallet: { balance: balanceInStore } } = getState();
|
const { wallet: { balance: balanceInStore } } = getState();
|
||||||
Lbry.wallet_balance().then(balance => {
|
Lbry.wallet_balance().then(balance => {
|
||||||
if (balanceInStore !== balance) {
|
if (balanceInStore !== balance) {
|
||||||
return dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_BALANCE,
|
type: ACTIONS.UPDATE_BALANCE,
|
||||||
data: {
|
data: {
|
||||||
balance,
|
balance,
|
||||||
|
|
|
@ -1,31 +1,25 @@
|
||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
mode: 'none',
|
||||||
entry: './src/index.js',
|
entry: './src/index.js',
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'build'),
|
filename: 'bundle.js',
|
||||||
filename: 'index.js',
|
path: path.resolve(__dirname, 'dist'),
|
||||||
libraryTarget: 'umd'
|
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
include: path.resolve(__dirname, 'src'),
|
exclude: /node_modules/,
|
||||||
exclude: /(node_modules|bower_components|build)/,
|
loader: 'babel-loader',
|
||||||
use: {
|
},
|
||||||
loader: 'babel-loader',
|
],
|
||||||
options: {
|
|
||||||
presets: ['env', 'react', 'stage-2']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
modules: [path.resolve(__dirname, 'src/'), 'node_modules', __dirname],
|
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
|
||||||
extensions: ['.js', '.jsx', '.scss'],
|
|
||||||
},
|
},
|
||||||
externals: {
|
plugins: [new FlowBabelWebpackPlugin()],
|
||||||
'react': 'commonjs react'
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue