Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
097052a468 |
No files matched your search
+7
-6
@@ -16,7 +16,7 @@ COMMENT_SERVER_NAME=Odysee
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
THUMBNAIL_CDN_URL=https://image-processor.vanwanet.com/optimize/
|
||||
WELCOME_VERSION=1.2
|
||||
WELCOME_VERSION=1.1
|
||||
|
||||
# STRIPE
|
||||
# STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
@@ -26,15 +26,16 @@ MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
|
||||
# OG
|
||||
OG_TITLE_SUFFIX=| lbry.tv
|
||||
OG_HOMEPAGE_TITLE=lbry.tv
|
||||
OG_TITLE_SUFFIX=| lbry.com
|
||||
OG_HOMEPAGE_TITLE=lbry.com
|
||||
OG_IMAGE_URL=
|
||||
SITE_CANONICAL_URL=https://lbry.tv
|
||||
SITE_CANONICAL_URL=https://lbry.com
|
||||
|
||||
# UI
|
||||
## Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
DOMAIN=lbry.com
|
||||
CLOUD_DOMAIN=odysee.com
|
||||
URL=https://lbry.com
|
||||
SITE_TITLE=LBRY
|
||||
SITE_NAME=LBRY
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
|
||||
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
Vendored
Whitespace-only changes.
@@ -3,29 +3,6 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [0.53.4] - [2022-06-10]
|
||||
|
||||
## Added
|
||||
- Add top in language category for non-english on homepage ([#7585](https://github.com/lbryio/lbry-desktop/pull/7585))
|
||||
- Auto hosting in settings and hosting first run page ([#7598](https://github.com/lbryio/lbry-desktop/pull/7598))
|
||||
|
||||
### Changed
|
||||
- Updated lbry-sdk to [0.107.2](https://github.com/lbryio/lbry-sdk/releases/tag/v0.107.2)
|
||||
|
||||
## Fixed
|
||||
- Better handle empty collections ([#7571](https://github.com/lbryio/lbry-desktop/pull/7571))
|
||||
- Better handle thumbnails in uploads/collections ([#7574](https://github.com/lbryio/lbry-desktop/pull/7574))
|
||||
- Work towards supporting collections of any claim type ([#7578](https://github.com/lbryio/lbry-desktop/pull/7578))
|
||||
- Improve handling of downed custom servers on startup ([#7593](https://github.com/lbryio/lbry-desktop/pull/7593))
|
||||
- Hide watch progress in related if being played ([#7606](https://github.com/lbryio/lbry-desktop/pull/7606))
|
||||
- IPC disk space calls wait for daemon ready; refresh on vis. component load ([#7610](https://github.com/lbryio/lbry-desktop/pull/7610))
|
||||
|
||||
## [0.53.3] - [2022-04-27]
|
||||
|
||||
## Fixed
|
||||
- Reverted lbry.tv changes that broke production login ([#7569](https://github.com/lbryio/lbry-desktop/pull/7569))
|
||||
- Reverted lbry.tv changes that broke login ([#7570](https://github.com/lbryio/lbry-desktop/pull/7570))
|
||||
|
||||
## [0.53.2] - [2022-04-26]
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -70,10 +70,12 @@ _Note: If coming from a deb install, the directory structure is different and yo
|
||||
|
||||
## Usage
|
||||
|
||||
Start the installed application to interact with the LBRY network.
|
||||
Double click the installed application to interact with the LBRY network.
|
||||
|
||||
## Running from Source
|
||||
|
||||
You can run the web version (lbry.tv), the electron app, or both at the same time.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
@@ -21,6 +21,7 @@ const config = {
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
CLOUD_DOMAIN: process.env.CLOUD_DOMAIN,
|
||||
URL: process.env.URL,
|
||||
THUMBNAIL_CDN_URL: process.env.THUMBNAIL_CDN_URL,
|
||||
SITE_TITLE: process.env.SITE_TITLE,
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
"from": "./static/font",
|
||||
"to": "static/font",
|
||||
"filter": ["**/*"]
|
||||
},
|
||||
{
|
||||
"from": "./static/app-update.yml",
|
||||
"to": "app-update.yml"
|
||||
}
|
||||
],
|
||||
"publish": [
|
||||
|
||||
+100
-174
@@ -22,7 +22,6 @@ import { diskSpaceLinux, diskSpaceWindows, diskSpaceMac } from '../ui/util/disks
|
||||
const { download } = require('electron-dl');
|
||||
const remote = require('@electron/remote/main');
|
||||
const os = require('os');
|
||||
const sudo = require('sudo-prompt');
|
||||
|
||||
remote.initialize();
|
||||
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||
@@ -34,23 +33,29 @@ try {
|
||||
upgradeDisabled = false;
|
||||
}
|
||||
autoUpdater.autoDownload = !upgradeDisabled;
|
||||
autoUpdater.allowPrerelease = false;
|
||||
|
||||
const UPDATE_STATE_INIT = 0;
|
||||
const UPDATE_STATE_CHECKING = 1;
|
||||
const UPDATE_STATE_UPDATES_FOUND = 2;
|
||||
const UPDATE_STATE_NO_UPDATES_FOUND = 3;
|
||||
const UPDATE_STATE_DOWNLOADING = 4;
|
||||
const UPDATE_STATE_DOWNLOADED = 5;
|
||||
let updateState = UPDATE_STATE_INIT;
|
||||
let updateDownloadItem;
|
||||
|
||||
const isAutoUpdateSupported = ['win32', 'darwin'].includes(process.platform) || !!process.env.APPIMAGE;
|
||||
// This is set to true if an auto update has been downloaded through the Electron
|
||||
// auto-update system and is ready to install. If the user declined an update earlier,
|
||||
// it will still install on shutdown.
|
||||
let autoUpdateDownloaded = false;
|
||||
|
||||
// This is used to keep track of whether we are showing the special dialog
|
||||
// that we show on Windows after you decline an upgrade and close the app later.
|
||||
let showingAutoUpdateCloseAlert = false;
|
||||
|
||||
// This is used to prevent downloading updates multiple times when
|
||||
// using the auto updater API.
|
||||
// As read in the documentation:
|
||||
// "Calling autoUpdater.checkForUpdates() twice will download the update two times."
|
||||
// https://www.electronjs.org/docs/latest/api/auto-updater#autoupdatercheckforupdates
|
||||
let keepCheckingForUpdates = true;
|
||||
|
||||
// Auto updater doesn't support Linux installations (only trough AppImages)
|
||||
// this is why, for that case, we download a full executable (.deb package)
|
||||
// as a fallback support. This variable will be used to prevent
|
||||
// multiple downloads when auto updater isn't supported.
|
||||
let downloadUpgradeInProgress = false;
|
||||
|
||||
// Keep a global reference, if you don't, they will be closed automatically when the JavaScript
|
||||
// object is garbage collected.
|
||||
let rendererWindow;
|
||||
@@ -238,8 +243,7 @@ app.on('activate', () => {
|
||||
app.on('will-quit', event => {
|
||||
if (
|
||||
process.platform === 'win32' &&
|
||||
updateState === UPDATE_STATE_DOWNLOADED &&
|
||||
isAutoUpdateSupported &&
|
||||
autoUpdateDownloaded &&
|
||||
!appState.autoUpdateAccepted &&
|
||||
!showingAutoUpdateCloseAlert
|
||||
) {
|
||||
@@ -319,10 +323,91 @@ ipcMain.on('get-disk-space', async (event) => {
|
||||
rendererWindow.webContents.send('send-disk-space', { diskSpace });
|
||||
} catch (e) {
|
||||
rendererWindow.webContents.send('send-disk-space', { error: e.message || e });
|
||||
console.log('Failed to get disk space', e);
|
||||
console.log('Failed to start LbryFirst', e);
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('download-upgrade', async (event, params) => {
|
||||
if (downloadUpgradeInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { url, options } = params;
|
||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||
options.onProgress = function(p) {
|
||||
rendererWindow.webContents.send('download-progress-update', p);
|
||||
};
|
||||
options.directory = dir;
|
||||
options.onCompleted = function(c) {
|
||||
downloadUpgradeInProgress = false;
|
||||
rendererWindow.webContents.send('download-update-complete', c);
|
||||
};
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
downloadUpgradeInProgress = true;
|
||||
await download(win, url, options).catch(e => console.log('e', e));
|
||||
});
|
||||
|
||||
ipcMain.on('upgrade', (event, installerPath) => {
|
||||
app.on('quit', () => {
|
||||
console.log('Launching upgrade installer at', installerPath);
|
||||
// This gets triggered called after *all* other quit-related events, so
|
||||
// we'll only get here if we're fully prepared and quitting for real.
|
||||
shell.openPath(installerPath);
|
||||
});
|
||||
// what to do if no shutdown in a long time?
|
||||
console.log('Update downloaded to', installerPath);
|
||||
console.log('The app will close and you will be prompted to install the latest version of LBRY.');
|
||||
console.log('After the install is complete, please reopen the app.');
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.on('check-for-updates', (event, autoDownload) => {
|
||||
// Prevent downloading the same update multiple times.
|
||||
if (!keepCheckingForUpdates) {
|
||||
return;
|
||||
}
|
||||
|
||||
keepCheckingForUpdates = false;
|
||||
autoUpdater.autoDownload = autoDownload;
|
||||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdateDownloaded = true;
|
||||
|
||||
// If this download was trigger by
|
||||
// autoUpdateAccepted it means, the user
|
||||
// wants to install the new update but
|
||||
// needed to downloaded the files first.
|
||||
if (appState.autoUpdateAccepted) {
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
});
|
||||
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
keepCheckingForUpdates = true;
|
||||
});
|
||||
|
||||
ipcMain.on('autoUpdateAccepted', () => {
|
||||
appState.autoUpdateAccepted = true;
|
||||
|
||||
// quitAndInstall can only be called if the
|
||||
// update has been downloaded. Since the user
|
||||
// can disable auto updates, we have to make
|
||||
// sure it has been downloaded first.
|
||||
if (autoUpdateDownloaded) {
|
||||
autoUpdater.quitAndInstall();
|
||||
return;
|
||||
}
|
||||
|
||||
// If the update hasn't been downloaded,
|
||||
// start downloading it. After it's done, the
|
||||
// event 'update-downloaded' will be triggered,
|
||||
// where we will be able to resume the
|
||||
// update installation.
|
||||
autoUpdater.downloadUpdate();
|
||||
});
|
||||
|
||||
ipcMain.on('version-info-requested', () => {
|
||||
function formatRc(ver) {
|
||||
// Adds dash if needed to make RC suffix SemVer friendly
|
||||
@@ -415,162 +500,3 @@ process.on('uncaughtException', error => {
|
||||
if (daemon) daemon.quit();
|
||||
app.exit(1);
|
||||
});
|
||||
|
||||
// Auto updater
|
||||
autoUpdater.on('download-progress', () => {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
updateState = UPDATE_STATE_DOWNLOADED;
|
||||
|
||||
// If this download was trigger by
|
||||
// autoUpdateAccepted it means, the user
|
||||
// wants to install the new update but
|
||||
// needed to downloaded the files first.
|
||||
if (appState.autoUpdateAccepted) {
|
||||
autoUpdater.quitAndInstall();
|
||||
}
|
||||
});
|
||||
|
||||
autoUpdater.on('update-available', () => {
|
||||
if (updateState === UPDATE_STATE_DOWNLOADING) {
|
||||
return;
|
||||
}
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
});
|
||||
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
updateState = UPDATE_STATE_NO_UPDATES_FOUND;
|
||||
});
|
||||
|
||||
autoUpdater.on('error', () => {
|
||||
if (updateState === UPDATE_STATE_DOWNLOADING) {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
return;
|
||||
}
|
||||
updateState = UPDATE_STATE_INIT;
|
||||
});
|
||||
|
||||
// Manual (.deb) update
|
||||
ipcMain.on('cancel-download-upgrade', () => {
|
||||
if (updateDownloadItem) {
|
||||
// Cancel the download and execute the onCancel
|
||||
// callback set in the options.
|
||||
updateDownloadItem.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('download-upgrade', (event, params) => {
|
||||
if (updateState !== UPDATE_STATE_UPDATES_FOUND) {
|
||||
return;
|
||||
}
|
||||
if (isAutoUpdateSupported) {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
autoUpdater.downloadUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
const { url, options } = params;
|
||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
|
||||
// Grab the download item's handler to allow
|
||||
// cancelling the operation if required.
|
||||
options.onStarted = function(downloadItem) {
|
||||
updateDownloadItem = downloadItem;
|
||||
};
|
||||
options.onCancel = function() {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
updateDownloadItem = undefined;
|
||||
};
|
||||
options.onProgress = function(p) {
|
||||
rendererWindow.webContents.send('download-progress-update', p);
|
||||
};
|
||||
options.onCompleted = function(c) {
|
||||
updateState = UPDATE_STATE_DOWNLOADED;
|
||||
updateDownloadItem = undefined;
|
||||
rendererWindow.webContents.send('download-update-complete', c);
|
||||
};
|
||||
options.directory = dir;
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
download(win, url, options).catch(e => {
|
||||
updateState = UPDATE_STATE_UPDATES_FOUND;
|
||||
console.log('e', e);
|
||||
});
|
||||
});
|
||||
|
||||
// Update behavior
|
||||
ipcMain.on('autoUpdateAccepted', () => {
|
||||
appState.autoUpdateAccepted = true;
|
||||
|
||||
// quitAndInstall can only be called if the
|
||||
// update has been downloaded. Since the user
|
||||
// can disable auto updates, we have to make
|
||||
// sure it has been downloaded first.
|
||||
if (updateState === UPDATE_STATE_DOWNLOADED) {
|
||||
autoUpdater.quitAndInstall();
|
||||
return;
|
||||
}
|
||||
|
||||
if (updateState !== UPDATE_STATE_UPDATES_FOUND) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the update hasn't been downloaded,
|
||||
// start downloading it. After it's done, the
|
||||
// event 'update-downloaded' will be triggered,
|
||||
// where we will be able to resume the
|
||||
// update installation.
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
autoUpdater.downloadUpdate();
|
||||
});
|
||||
|
||||
ipcMain.on('check-for-updates', (event, autoDownload) => {
|
||||
if (![UPDATE_STATE_INIT, UPDATE_STATE_NO_UPDATES_FOUND].includes(updateState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateState = UPDATE_STATE_CHECKING;
|
||||
|
||||
// If autoDownload is true, checkForUpdates will begin the
|
||||
// download automatically.
|
||||
if (autoDownload) {
|
||||
updateState = UPDATE_STATE_DOWNLOADING;
|
||||
}
|
||||
|
||||
autoUpdater.autoDownload = autoDownload;
|
||||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
|
||||
ipcMain.on('upgrade', (event, installerPath) => {
|
||||
// what to do if no shutdown in a long time?
|
||||
console.log('Update downloaded to', installerPath);
|
||||
console.log('The app will close and you will be prompted to install the latest version of LBRY.');
|
||||
console.log('After the install is complete, please reopen the app.');
|
||||
|
||||
// Prevent .deb package from opening with archive manager (Ubuntu >= 20)
|
||||
if (process.platform === 'linux' && !process.env.APPIMAGE) {
|
||||
sudo.exec(`dpkg -i ${installerPath}`, { name: app.name }, (err, stdout, stderr) => {
|
||||
if (err || stderr) {
|
||||
rendererWindow.webContents.send('upgrade-installing-error');
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-launch the application when the installation finishes.
|
||||
app.relaunch();
|
||||
app.quit();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
app.on('quit', () => {
|
||||
console.log('Launching upgrade installer at', installerPath);
|
||||
// This gets triggered called after *all* other quit-related events, so
|
||||
// we'll only get here if we're fully prepared and quitting for real.
|
||||
shell.openPath(installerPath);
|
||||
});
|
||||
app.quit();
|
||||
});
|
||||
@@ -155,10 +155,7 @@ Lbryio.authenticate = (domain, language) => {
|
||||
.then(
|
||||
status =>
|
||||
new Promise((res, rej) => {
|
||||
const appId =
|
||||
domain && domain !== 'lbry.tv'
|
||||
? (domain.replace(/[.]/gi, '') + status.installation_id).slice(0, 66)
|
||||
: status.installation_id;
|
||||
const appId = status.installation_id;
|
||||
Lbryio.call(
|
||||
'user',
|
||||
'new',
|
||||
|
||||
Vendored
+1
@@ -67,6 +67,7 @@ declare type GenericMetadata = {
|
||||
languages?: Array<string>,
|
||||
tags?: Array<string>,
|
||||
locations?: Array<Location>,
|
||||
release_time?: number, // this shouldn't be here, but... fixme?
|
||||
};
|
||||
|
||||
declare type ChannelMetadata = GenericMetadata & {
|
||||
|
||||
Vendored
+2
-2
@@ -8,6 +8,6 @@ declare type WalletServerDetails = {
|
||||
};
|
||||
|
||||
declare type DiskSpace = {
|
||||
total: number,
|
||||
free: number,
|
||||
total: string,
|
||||
free: string,
|
||||
};
|
||||
Vendored
-1
@@ -22,7 +22,6 @@ declare type RowDataItem = {
|
||||
channelIds?: Array<string>,
|
||||
limitClaimsPerChannel?: number,
|
||||
pageSize?: number,
|
||||
languages?: Array<string>,
|
||||
},
|
||||
route?: string,
|
||||
hideForUnauth?: boolean,
|
||||
|
||||
Vendored
+3
@@ -16,4 +16,7 @@ declare type SubscriptionState = {
|
||||
following: Array<Following>,
|
||||
loading: boolean,
|
||||
firstRunCompleted: boolean,
|
||||
downloadEnabledByUrl: any,
|
||||
downloadQueue: Array<string>,
|
||||
lastReleaseBySubUrl: any,
|
||||
};
|
||||
+6
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.53.4",
|
||||
"version": "0.53.2",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -23,8 +23,11 @@
|
||||
"analyze": "source-map-explorer --only-mapped dist/electron/webpack/ui*.js --html dist/sourceMap.html",
|
||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron",
|
||||
"copyenv": "copyfiles ./.env* web/",
|
||||
"dev": "yarn dev:electron",
|
||||
"dev:electron": "cross-env NODE_ENV=development node ./electron/devServer.js",
|
||||
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev:electron",
|
||||
"dev:iatv": "LBRY_API_URL='http://localhost:15400' SDK_API_URL='http://localhost:15100' yarn dev:web",
|
||||
"pack": "electron-builder --dir",
|
||||
"dist": "electron-builder",
|
||||
"build": "cross-env NODE_ENV=production yarn compile:electron && electron-builder build",
|
||||
@@ -64,7 +67,6 @@
|
||||
"remove-markdown": "^0.3.0",
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"sudo-prompt": "^9.2.1",
|
||||
"tempy": "^0.6.0",
|
||||
"videojs-logo": "^2.1.4"
|
||||
},
|
||||
@@ -124,7 +126,7 @@
|
||||
"dom-scroll-into-view": "^1.2.1",
|
||||
"dotenv-defaults": "^2.0.1",
|
||||
"dotenv-webpack": "^1.8.0",
|
||||
"electron": "15.5.5",
|
||||
"electron": "15.4.0",
|
||||
"electron-builder": "^22.10.5",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-is-dev": "^0.3.0",
|
||||
@@ -236,7 +238,7 @@
|
||||
"yarn": "^1.3"
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.107.2",
|
||||
"lbrynetDaemonVersion": "0.107.1",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet"
|
||||
|
||||
+29
-36
@@ -2206,6 +2206,13 @@
|
||||
"Enabling a minimum amount to comment will force all comments to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments to have tips associated with them. This can help prevent spam.",
|
||||
"Comments containing these words will be blocked.": "Comments containing these words will be blocked.",
|
||||
"Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8": "Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8",
|
||||
"Disk Space": "Disk Space",
|
||||
"Data Hosting": "Data Hosting",
|
||||
"Limit": "Limit",
|
||||
"Limit Space Used": "Limit Space Used",
|
||||
"Apply": "Apply",
|
||||
"Limit in GB": "Limit in GB",
|
||||
"If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.": "If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.",
|
||||
"Enable Data Hosting": "Enable Data Hosting",
|
||||
"Data over the limit will be deleted within 30 minutes. This will make the Yrbl cry a little bit.": "Data over the limit will be deleted within 30 minutes. This will make the Yrbl cry a little bit.",
|
||||
"Choose %asset%": "Choose %asset%",
|
||||
@@ -2221,6 +2228,13 @@
|
||||
"Enable Prerelease Updates": "Enable Prerelease Updates",
|
||||
"Enable Upgrade to Test Builds": "Enable Upgrade to Test Builds",
|
||||
"Prereleases may break things and we may not be able to fix them for you.": "Prereleases may break things and we may not be able to fix them for you.",
|
||||
"Limit (GB)": "Limit (GB)",
|
||||
"Limit Hosting for Content you Use": "Limit Hosting for Content you Use",
|
||||
"Allow (GB)": "Allow (GB)",
|
||||
"Content Data Hosting helps to seed things that you watch and download.": "Content Data Hosting helps to seed things that you watch and download.",
|
||||
"Network Data Hosting allows the p2p network to store blobs unrelated to your browsing.": "Network Data Hosting allows the p2p network to store blobs unrelated to your browsing.",
|
||||
"Content: Limit (GB)": "Content: Limit (GB)",
|
||||
"Network: Allow (GB)": "Network: Allow (GB)",
|
||||
"A channel is required to repost on LBRY": "A channel is required to repost on LBRY",
|
||||
"Admin": "Admin",
|
||||
"Stickers": "Stickers",
|
||||
@@ -2242,6 +2256,19 @@
|
||||
"Move Up": "Move Up",
|
||||
"Move Down": "Move Down",
|
||||
"Trending for #Game": "Trending for #Game",
|
||||
"Help the P2P data network by hosting data.": "Help the P2P data network by hosting data.",
|
||||
"History hosting lets you choose how much storage to use helping content you've consumed.": "History hosting lets you choose how much storage to use helping content you've consumed.",
|
||||
"Automatic hosting lets you delegate some amount of storage for the network to automatically download ad host.": "Automatic hosting lets you delegate some amount of storage for the network to automatically download ad host.",
|
||||
"Playing videos may exceed your history hosting limit until cleanup runs every 30 minutes.": "Playing videos may exceed your history hosting limit until cleanup runs every 30 minutes.",
|
||||
"History: Limit (GB)": "History: Limit (GB)",
|
||||
"Automatic: Allow (GB)": "Automatic: Allow (GB)",
|
||||
"Automatic hosting lets you delegate some amount of storage for the network to automatically download and host.": "Automatic hosting lets you delegate some amount of storage for the network to automatically download and host.",
|
||||
"History Hosting": "History Hosting",
|
||||
"Automatic Hosting": "Automatic Hosting",
|
||||
"History Hosting lets you choose how much storage to use helping content you've consumed.": "History Hosting lets you choose how much storage to use helping content you've consumed.",
|
||||
"Automatic Hosting lets you delegate some amount of storage for the network to automatically download and host.": "Automatic Hosting lets you delegate some amount of storage for the network to automatically download and host.",
|
||||
"Help improve the P2P data network (and make LBRY happy) by hosting data.": "Help improve the P2P data network (and make LBRY happy) by hosting data.",
|
||||
"Limit Hosting of Content History": "Limit Hosting of Content History",
|
||||
"Remove custom comment server": "Remove custom comment server",
|
||||
"Use Https": "Use Https",
|
||||
"Server URL": "Server URL",
|
||||
@@ -2288,41 +2315,7 @@
|
||||
"Clear Views": "Clear Views",
|
||||
"Show Video View Progress": "Show Video View Progress",
|
||||
"Display view progress on thumbnail. This setting will not hide any blockchain activity or downloads.": "Display view progress on thumbnail. This setting will not hide any blockchain activity or downloads.",
|
||||
"Content Hosting": "Content Hosting",
|
||||
"Hosting": "Hosting",
|
||||
"Viewed Hosting": "Viewed Hosting",
|
||||
"Auto Hosting": "Auto Hosting",
|
||||
"Help creators and improve the P2P data network by hosting content.": "Help creators and improve the P2P data network by hosting content.",
|
||||
"I'm happy with my settings": "I'm happy with my settings",
|
||||
"We've noticed you already have some settings.": "We've noticed you already have some settings.",
|
||||
"You choose how much data to host.": "You choose how much data to host.",
|
||||
"Go back": "Go back",
|
||||
"Custom Hosting": "Custom Hosting",
|
||||
"Automatic Hosting (GB)": "Automatic Hosting (GB)",
|
||||
"* Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.": "* Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.",
|
||||
"Help improve the P2P data network (and make LBRY users happy) by hosting data.": "Help improve the P2P data network (and make LBRY users happy) by hosting data.",
|
||||
"View History Hosting lets you choose how much storage to use hosting content you've consumed.": "View History Hosting lets you choose how much storage to use hosting content you've consumed.",
|
||||
"Automatic Hosting downloads a small portion of content active on the network.": "Automatic Hosting downloads a small portion of content active on the network.",
|
||||
"Publishes --[legend, storage category]--": "Publishes",
|
||||
"Auto Hosting --[legend, storage category]--": "Auto Hosting",
|
||||
"View Hosting --[legend, storage category]--": "View Hosting",
|
||||
"%spaceUsed% of %limit% GB": "%spaceUsed% of %limit% GB",
|
||||
"%spaceUsed% of %limit% Free GB": "%spaceUsed% of %limit% Free GB",
|
||||
"Disabled": "Disabled",
|
||||
"Free --[legend, unused disk space]--": "Free",
|
||||
"Top content in %language%": "Top content in %language%",
|
||||
"Apply": "Apply",
|
||||
"Disable background": "Disable background",
|
||||
"Installing, please wait...": "Installing, please wait...",
|
||||
"There was an error during installation. Please, try again.": "There was an error during installation. Please, try again.",
|
||||
"Odysee Connect --[Section in Help Page]--": "Odysee Connect",
|
||||
"Export Wallet": "Export Wallet",
|
||||
"Export encrypted sync data for import in another app.": "Export encrypted sync data for import in another app.",
|
||||
"Export wallet sync data. Choose a secure password you will need for import.": "Export wallet sync data. Choose a secure password you will need for import.",
|
||||
"Choose Password": "Choose Password",
|
||||
"Sync data copied.": "Sync data copied.",
|
||||
"Your Sync Data is prepared. You can now copy or save it.": "Your Sync Data is prepared. You can now copy or save it.",
|
||||
"Export wallet": "Export wallet",
|
||||
"Sync data saved.": "Sync data saved.",
|
||||
"%anonymous%": "%anonymous%",
|
||||
"Anon --[used in <%anonymous% Reposted>]--": "Anon",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
owner: lbryio
|
||||
repo: lbry-desktop
|
||||
provider: github
|
||||
+1
-1
@@ -19,7 +19,7 @@ const WATCHMAN_BACKEND_ENDPOINT = 'https://watchman.na-backend.odysee.com/report
|
||||
|
||||
if (isProduction) {
|
||||
ElectronCookies.enable({
|
||||
origin: 'https://lbry.tv',
|
||||
origin: 'https://lbry.com',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,7 @@ function App(props: Props) {
|
||||
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
|
||||
const hasActiveChannelClaim = activeChannelId !== undefined;
|
||||
const isPersonalized = hasVerifiedEmail;
|
||||
const renderFiledrop = isAuthenticated;
|
||||
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
@@ -348,7 +349,7 @@ function App(props: Props) {
|
||||
>
|
||||
<Router />
|
||||
<ModalRouter />
|
||||
<FileDrop />
|
||||
{renderFiledrop && <FileDrop />}
|
||||
<FileRenderFloating />
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import StorageViz from './view';
|
||||
import {
|
||||
selectViewBlobSpace,
|
||||
selectViewHostingLimit,
|
||||
selectAutoBlobSpace,
|
||||
selectPrivateBlobSpace,
|
||||
selectAutoHostingLimit,
|
||||
} from 'redux/selectors/settings';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
diskSpace: selectDiskSpace(state),
|
||||
viewHostingLimit: selectViewHostingLimit(state),
|
||||
autoHostingLimit: selectAutoHostingLimit(state),
|
||||
viewBlobSpace: selectViewBlobSpace(state),
|
||||
autoBlobSpace: selectAutoBlobSpace(state),
|
||||
privateBlobSpace: selectPrivateBlobSpace(state),
|
||||
});
|
||||
|
||||
export default connect(select)(StorageViz);
|
||||
@@ -1,130 +0,0 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import { ipcRenderer } from 'electron';
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
diskSpace: DiskSpace, // KB
|
||||
viewHostingLimit: number, // MB
|
||||
autoHostingLimit: number,
|
||||
viewBlobSpace: number,
|
||||
autoBlobSpace: number,
|
||||
privateBlobSpace: number,
|
||||
};
|
||||
|
||||
function StorageViz(props: Props) {
|
||||
const { diskSpace, viewHostingLimit, autoHostingLimit, viewBlobSpace, autoBlobSpace, privateBlobSpace } = props;
|
||||
React.useEffect(() => {
|
||||
ipcRenderer.send('get-disk-space');
|
||||
}, []);
|
||||
|
||||
if (!diskSpace || !diskSpace.total) {
|
||||
return (
|
||||
<div className={'storage__wrapper'}>
|
||||
<div className={'storage__bar'}>
|
||||
<div className="help">{__('Cannot get disk space information.')}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||
const otherMB = totalMB - (freeMB + viewBlobSpace + autoBlobSpace + privateBlobSpace);
|
||||
const autoFree = autoHostingLimit - autoBlobSpace;
|
||||
const viewFree = viewHostingLimit > 0 ? viewHostingLimit - viewBlobSpace : freeMB - autoFree;
|
||||
const unallocFree = freeMB - viewFree - autoFree;
|
||||
const viewLimit =
|
||||
viewHostingLimit === 0
|
||||
? freeMB - (autoHostingLimit - autoBlobSpace) + viewBlobSpace
|
||||
: viewHostingLimit + viewBlobSpace;
|
||||
|
||||
const getPercent = (val, lim = totalMB) => (val / lim) * 100;
|
||||
const getGB = (val) => (Number(val) / 1024).toFixed(2);
|
||||
|
||||
const otherPercent = getPercent(otherMB);
|
||||
const privatePercent = getPercent(privateBlobSpace);
|
||||
const autoLimitPercent = getPercent(autoHostingLimit);
|
||||
const viewLimitPercent = getPercent(viewLimit);
|
||||
const viewUsedPercentOfLimit = getPercent(viewBlobSpace, viewLimit);
|
||||
const autoUsedPercentOfLimit = getPercent(autoBlobSpace, autoHostingLimit);
|
||||
|
||||
return (
|
||||
<div className={'storage__wrapper'}>
|
||||
<div className={'storage__bar'}>
|
||||
<div className={'storage__other'} style={{ width: `${otherPercent}%` }} />
|
||||
<div className={'storage__private'} style={{ width: `${privatePercent}%` }} />
|
||||
<div className={'storage__auto'} style={{ width: `${autoLimitPercent}%` }}>
|
||||
<div className={'storage__auto--used'} style={{ width: `${autoUsedPercentOfLimit}%` }} />
|
||||
<div className={'storage__auto--free'} />
|
||||
</div>
|
||||
<div className={'storage__viewed'} style={{ width: `${viewLimitPercent}%` }}>
|
||||
<div className={'storage__viewed--used'} style={{ width: `${viewUsedPercentOfLimit}%` }} />
|
||||
<div className={'storage__viewed--free'} />
|
||||
</div>
|
||||
{viewHostingLimit !== 0 && <div style={{ 'background-color': 'unset' }} />}
|
||||
</div>
|
||||
<div className={'storage__legend-wrapper'}>
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--private'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('Publishes --[legend, storage category]--')}</label>
|
||||
<div className={'help'}>{`${getGB(privateBlobSpace)} GB`}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--auto'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('Auto Hosting --[legend, storage category]--')}</label>
|
||||
<div className={'help'}>
|
||||
{autoHostingLimit === 0 ? (
|
||||
__('Disabled')
|
||||
) : (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
spaceUsed: getGB(autoBlobSpace),
|
||||
limit: getGB(autoHostingLimit),
|
||||
}}
|
||||
>
|
||||
%spaceUsed% of %limit% GB
|
||||
</I18nMessage>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--viewed'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('View Hosting --[legend, storage category]--')}</label>
|
||||
<div className={'help'}>
|
||||
{viewHostingLimit === 1 ? (
|
||||
__('Disabled')
|
||||
) : (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
spaceUsed: getGB(viewBlobSpace),
|
||||
limit: viewHostingLimit !== 0 ? getGB(viewHostingLimit) : getGB(viewFree),
|
||||
}}
|
||||
>
|
||||
%spaceUsed% of %limit% Free GB
|
||||
</I18nMessage>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{viewHostingLimit !== 0 && (
|
||||
<div className={'storage__legend-item'}>
|
||||
<div className={'storage__legend-item-swatch storage__legend-item-swatch--free'} />
|
||||
<div className={'storage__legend-item-label'}>
|
||||
<label>{__('Free --[legend, unused disk space]--')}</label>
|
||||
<div className={'help'}>{`${getGB(unallocFree)} GB`}</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default StorageViz;
|
||||
@@ -6,7 +6,6 @@ import CreditAmount from 'component/common/credit-amount';
|
||||
import DateTime from 'component/dateTime';
|
||||
import YoutubeBadge from 'component/youtubeBadge';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
claim: ChannelClaim,
|
||||
@@ -75,7 +74,7 @@ function ChannelAbout(props: Props) {
|
||||
</div>
|
||||
|
||||
<label>{__('Total Uploads')}</label>
|
||||
<div className="media__info-text">{formatNumber(claim.meta.claims_in_channel || 0, 2, true)}</div>
|
||||
<div className="media__info-text">{claim.meta.claims_in_channel}</div>
|
||||
|
||||
<label>{__('Last Updated')}</label>
|
||||
<div className="media__info-text">
|
||||
|
||||
@@ -50,7 +50,6 @@ function ChannelThumbnail(props: Props) {
|
||||
setThumbUploadError,
|
||||
ThumbUploadError,
|
||||
} = props;
|
||||
const [retries, setRetries] = React.useState(3);
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const shouldResolve = !isResolving && claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
@@ -59,15 +58,6 @@ function ChannelThumbnail(props: Props) {
|
||||
const channelThumbnail = thumbnailPreview || thumbnail || defaultAvatar;
|
||||
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||
const avatarSrc = React.useMemo(() => {
|
||||
if (retries <= 0) {
|
||||
return defaultAvatar;
|
||||
}
|
||||
if (!thumbLoadError) {
|
||||
return channelThumbnail;
|
||||
}
|
||||
return defaultAvatar;
|
||||
}, [retries, thumbLoadError, channelThumbnail, defaultAvatar]);
|
||||
|
||||
// Generate a random color class based on the first letter of the channel name
|
||||
const { channelName } = parseURI(uri);
|
||||
@@ -110,10 +100,9 @@ function ChannelThumbnail(props: Props) {
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={avatarSrc}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
setRetries((retries) => retries - 1);
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
|
||||
@@ -110,11 +110,6 @@ function ClaimMenuList(props: Props) {
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
|
||||
const isChannel = !incognitoClaim && !contentSigningChannel;
|
||||
// $FlowFixMe
|
||||
const claimLength = claim && claim.value && claim.value.claims && claim.value.claims.length;
|
||||
// $FlowFixMe
|
||||
const claimCount = editedCollection ? editedCollection.items.length : claimLength;
|
||||
const isEmptyCollection = (Number(claimCount) || 0) <= 0;
|
||||
const { channelName } = parseURI(contentChannelUri);
|
||||
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
|
||||
const subscriptionLabel = repostedClaim
|
||||
@@ -302,20 +297,18 @@ function ClaimMenuList(props: Props) {
|
||||
{__('View List')}
|
||||
</a>
|
||||
</MenuItem>
|
||||
{!isEmptyCollection && (
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
if (!resolvedList) fetchItems();
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
if (!resolvedList) fetchItems();
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{isMyCollection && (
|
||||
<>
|
||||
<MenuItem
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { isChannelClaim } from 'util/claim';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { formatNumber } from 'util/number';
|
||||
import { toCompactNotation } from 'util/string';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
@@ -138,6 +138,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
indexInContainer,
|
||||
channelSubCount,
|
||||
swipeLayout = false,
|
||||
lang,
|
||||
showEdit,
|
||||
dragHandleProps,
|
||||
unavailableUris,
|
||||
@@ -161,8 +162,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
if (channelSubCount === undefined) {
|
||||
return <span />;
|
||||
}
|
||||
const formattedSubCount = formatNumber(channelSubCount, 2, true);
|
||||
const formattedSubCountLocale = formatNumber(channelSubCount, 2, false);
|
||||
const formattedSubCount = toCompactNotation(channelSubCount, lang, 10000);
|
||||
const formattedSubCountLocale = Number(channelSubCount).toLocaleString();
|
||||
return (
|
||||
<div className="media__subtitle">
|
||||
<Tooltip title={formattedSubCountLocale} followCursor placement="top">
|
||||
|
||||
@@ -5,7 +5,6 @@ import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import FileViewCountInline from 'component/fileViewCountInline';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -35,7 +34,7 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||
<>
|
||||
{isChannel &&
|
||||
type !== 'inline' &&
|
||||
`${formatNumber(claimsInChannel, 2, true)} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||
`${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||
|
||||
{!isChannel && (
|
||||
<>
|
||||
|
||||
@@ -54,13 +54,9 @@ function CollectionActions(props: Props) {
|
||||
const isMobile = useIsMobile();
|
||||
const claimId = claim && claim.claim_id;
|
||||
const webShareable = true; // collections have cost?
|
||||
const isEmptyCollection = !firstItem;
|
||||
|
||||
const doPlay = React.useCallback(
|
||||
(playUri) => {
|
||||
if (!playUri) {
|
||||
return;
|
||||
}
|
||||
const navigateUrl = formatLbryUrlForWeb(playUri);
|
||||
push({
|
||||
pathname: navigateUrl,
|
||||
@@ -85,7 +81,6 @@ function CollectionActions(props: Props) {
|
||||
icon={ICONS.PLAY}
|
||||
label={__('Play')}
|
||||
title={__('Play')}
|
||||
disabled={isEmptyCollection}
|
||||
onClick={() => {
|
||||
doToggleShuffleList(collectionId, false);
|
||||
doPlay(firstItem);
|
||||
@@ -96,7 +91,6 @@ function CollectionActions(props: Props) {
|
||||
icon={ICONS.SHUFFLE}
|
||||
label={__('Shuffle Play')}
|
||||
title={__('Shuffle Play')}
|
||||
disabled={isEmptyCollection}
|
||||
onClick={() => {
|
||||
doToggleShuffleList(collectionId, true);
|
||||
setDoShuffle(true);
|
||||
|
||||
@@ -23,7 +23,6 @@ import CollectionForm from './view';
|
||||
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
||||
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
import { doCollectionEdit } from 'redux/actions/collections';
|
||||
import { doResetThumbnailStatus } from 'redux/actions/publish';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
@@ -53,7 +52,6 @@ const perform = (dispatch, ownProps) => ({
|
||||
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
||||
setIncognito: (incognito) => dispatch(doSetIncognito(incognito)),
|
||||
doCollectionEdit: (params) => dispatch(doCollectionEdit(ownProps.collectionId, params)),
|
||||
resetThumbnailStatus: () => dispatch(doResetThumbnailStatus()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionForm);
|
||||
@@ -58,7 +58,6 @@ type Props = {
|
||||
setActiveChannel: (string) => void,
|
||||
setIncognito: (boolean) => void,
|
||||
doCollectionEdit: (CollectionEditParams) => void,
|
||||
resetThumbnailStatus: () => void,
|
||||
};
|
||||
|
||||
function CollectionForm(props: Props) {
|
||||
@@ -93,7 +92,6 @@ function CollectionForm(props: Props) {
|
||||
setIncognito,
|
||||
onDone,
|
||||
doCollectionEdit,
|
||||
resetThumbnailStatus,
|
||||
} = props;
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
let prefix = 'lbry://';
|
||||
@@ -160,7 +158,7 @@ function CollectionForm(props: Props) {
|
||||
}
|
||||
|
||||
function handleUpdateThumbnail(update: { [string]: string }) {
|
||||
if (update.thumbnail_url !== undefined) {
|
||||
if (update.thumbnail_url) {
|
||||
setParam(update);
|
||||
} else if (update.thumbnail_status) {
|
||||
setThumbStatus(update.thumbnail_status);
|
||||
@@ -311,10 +309,6 @@ function CollectionForm(props: Props) {
|
||||
}
|
||||
}, [uri, hasClaim]);
|
||||
|
||||
React.useEffect(() => {
|
||||
resetThumbnailStatus();
|
||||
}, [resetThumbnailStatus]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={classnames('main--contained', { 'card--disabled': disabled })}>
|
||||
@@ -364,11 +358,10 @@ function CollectionForm(props: Props) {
|
||||
/>
|
||||
<fieldset-section>
|
||||
<SelectThumbnail
|
||||
thumbnail={params.thumbnail_url}
|
||||
thumbnailError={thumbError}
|
||||
thumbnailParam={params.thumbnail_url}
|
||||
thumbnailParamError={thumbError}
|
||||
thumbnailParamStatus={thumbStatus}
|
||||
updateThumbnailParams={handleUpdateThumbnail}
|
||||
usePublishFormMode
|
||||
/>
|
||||
</fieldset-section>
|
||||
<FormField
|
||||
|
||||
@@ -33,7 +33,7 @@ function CollectionPreviewOverlay(props: Props) {
|
||||
collectionItemUrls.map((item, index) => {
|
||||
if (index < 2) {
|
||||
return (
|
||||
<div key={item} className="collection-preview__overlay-grid-items">
|
||||
<div className="collection-preview__overlay-grid-items">
|
||||
<FileThumbnail uri={item} key={item} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -95,7 +95,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
{builtin.map((list: Collection) => {
|
||||
const { items: itemUrls } = list;
|
||||
return (
|
||||
<React.Fragment key={list.name}>
|
||||
<>
|
||||
{Boolean(itemUrls && itemUrls.length) && (
|
||||
<div className="claim-grid__wrapper" key={list.name}>
|
||||
<h1 className="claim-grid__header">
|
||||
@@ -124,7 +124,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
<ClaimList tileLayout key={list.name} uris={itemUrls.slice(0, 6)} collectionId={list.id} />
|
||||
</div>
|
||||
)}
|
||||
</React.Fragment>
|
||||
</>
|
||||
);
|
||||
})}
|
||||
<div className="claim-grid__wrapper">
|
||||
|
||||
@@ -8,7 +8,6 @@ import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
|
||||
import { SITE_NAME, ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { formatNumber } from 'util/number';
|
||||
import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import Expandable from 'component/expandable';
|
||||
@@ -385,7 +384,7 @@ function CommentView(props: Props) {
|
||||
label={
|
||||
numDirectReplies < 2
|
||||
? __('Show reply')
|
||||
: __('Show %count% replies', { count: formatNumber(numDirectReplies, 2, true) })
|
||||
: __('Show %count% replies', { count: numDirectReplies })
|
||||
}
|
||||
button="link"
|
||||
onClick={() => {
|
||||
|
||||
@@ -9,7 +9,6 @@ import Button from 'component/button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { useHistory } from 'react-router';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import { formatNumber } from 'util/number';
|
||||
|
||||
type Props = {
|
||||
myReacts: Array<string>,
|
||||
@@ -110,11 +109,7 @@ export default function CommentReactions(props: Props) {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.LIKE),
|
||||
})}
|
||||
onClick={handleCommentLike}
|
||||
label={
|
||||
<span className="comment__reaction-count">
|
||||
{formatNumber(getCountForReact(REACTION_TYPES.LIKE), 2, true)}
|
||||
</span>
|
||||
}
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.LIKE)}</span>}
|
||||
/>
|
||||
<Button
|
||||
title={__('Downvote')}
|
||||
@@ -124,11 +119,7 @@ export default function CommentReactions(props: Props) {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.DISLIKE),
|
||||
})}
|
||||
onClick={handleCommentDislike}
|
||||
label={
|
||||
<span className="comment__reaction-count">
|
||||
{formatNumber(getCountForReact(REACTION_TYPES.DISLIKE), 2, true)}
|
||||
</span>
|
||||
}
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.DISLIKE)}</span>}
|
||||
/>
|
||||
|
||||
{!shouldHide && ENABLE_CREATOR_REACTIONS && (canCreatorReact || creatorLiked) && (
|
||||
|
||||
@@ -47,24 +47,7 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
};
|
||||
|
||||
handleDirectoryInputSelection = () => {
|
||||
let defaultPath;
|
||||
let properties;
|
||||
let isWin = process.platform === 'win32';
|
||||
let type = this.props.type;
|
||||
|
||||
if (isWin === true) {
|
||||
defaultPath = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||
}
|
||||
|
||||
if (type === 'openFile') {
|
||||
properties = ['openFile'];
|
||||
}
|
||||
|
||||
if (type === 'openDirectory') {
|
||||
properties = ['openDirectory'];
|
||||
}
|
||||
|
||||
remote.dialog.showOpenDialog({ properties, defaultPath }).then((result) => {
|
||||
remote.dialog.showOpenDialog({ properties: ['openDirectory'] }).then((result) => {
|
||||
const path = result && result.filePaths[0];
|
||||
if (path) {
|
||||
// $FlowFixMe
|
||||
@@ -99,11 +82,7 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
autoFocus={autoFocus}
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
onClick={
|
||||
type === 'openDirectory' || type === 'openFile'
|
||||
? this.handleDirectoryInputSelection
|
||||
: this.fileInputButton
|
||||
}
|
||||
onClick={type === 'openDirectory' ? this.handleDirectoryInputSelection : this.fileInputButton}
|
||||
label={__('Browse')}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ export class FormField extends React.PureComponent<Props> {
|
||||
{!noEmojis && openEmoteMenu && (
|
||||
<Button
|
||||
type="alt"
|
||||
className="button--comment-icons"
|
||||
className="button--file-action"
|
||||
title="Emotes"
|
||||
onClick={openEmoteMenu}
|
||||
icon={ICONS.EMOJI}
|
||||
|
||||
@@ -2054,4 +2054,28 @@ export const icons = {
|
||||
<path d="M12.5,23.24v-1A10.74,10.74,0,0,1,23.24,11.52" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.HOST]: buildIcon(
|
||||
<g>
|
||||
<path d="M9 22.5 12 9l3 13.5" />
|
||||
<circle cx={12} cy={7.657} r={1.25} />
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M4 7.657c0-2.21.895-4.21 2.343-5.657l1.06 1.06A6.48 6.48 0 0 0 5.5 7.658a6.48 6.48 0 0 0 1.904 4.596l-1.06 1.06A7.975 7.975 0 0 1 4 7.658Zm13.657 5.657A7.975 7.975 0 0 0 20 7.657c0-2.21-.895-4.21-2.343-5.657l-1.06 1.06A6.48 6.48 0 0 1 18.5 7.658a6.48 6.48 0 0 1-1.904 4.596l1.06 1.06Z"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M7 7.657c0-1.38.56-2.63 1.464-3.536l1.061 1.061A3.49 3.49 0 0 0 8.5 7.657c0 .966.392 1.841 1.025 2.475l-1.06 1.06A4.984 4.984 0 0 1 7 7.657Zm8.536 3.535A4.984 4.984 0 0 0 17 7.657c0-1.38-.56-2.63-1.464-3.536l-1.061 1.061A3.49 3.49 0 0 1 15.5 7.657a3.49 3.49 0 0 1-1.025 2.475l1.06 1.06Z"
|
||||
/>
|
||||
<path d="M2 22h20" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.NO_HOST]: buildIcon(
|
||||
<g>
|
||||
<path d="M9 22.5 12 9l3 13.5" />
|
||||
<circle cx={12} cy={7.657} r={1.25} />
|
||||
<path d="M2 22h20" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import FileDescription from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
@@ -16,6 +17,7 @@ const select = (state, props) => {
|
||||
claim,
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
tags: makeSelectTagsForUri(props.uri)(state),
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
metadata: StreamMetadata,
|
||||
user: ?any,
|
||||
tags: any,
|
||||
pendingAmount: number,
|
||||
doOpenModal: (id: string, {}) => void,
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import { formatNumber } from 'util/number';
|
||||
import { formatNumberWithCommas } from 'util/number';
|
||||
import NudgeFloating from 'component/nudgeFloating';
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
@@ -18,8 +18,16 @@ type Props = {
|
||||
};
|
||||
|
||||
function FileReactions(props: Props) {
|
||||
const { claim, uri, doFetchReactions, doReactionLike, doReactionDislike, myReaction, likeCount, dislikeCount } =
|
||||
props;
|
||||
const {
|
||||
claim,
|
||||
uri,
|
||||
doFetchReactions,
|
||||
doReactionLike,
|
||||
doReactionDislike,
|
||||
myReaction,
|
||||
likeCount,
|
||||
dislikeCount,
|
||||
} = props;
|
||||
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channel = claim && claim.signing_channel && claim.signing_channel.name;
|
||||
@@ -51,7 +59,7 @@ function FileReactions(props: Props) {
|
||||
className={classnames('button--file-action button-like', {
|
||||
'button--file-action-active': myReaction === REACTION_TYPES.LIKE,
|
||||
})}
|
||||
label={<>{formatNumber(likeCount, 2, true)}</>}
|
||||
label={<>{formatNumberWithCommas(likeCount, 0)}</>}
|
||||
iconSize={18}
|
||||
icon={likeIcon}
|
||||
onClick={() => doReactionLike(uri)}
|
||||
@@ -62,7 +70,7 @@ function FileReactions(props: Props) {
|
||||
className={classnames('button--file-action button-dislike', {
|
||||
'button--file-action-active': myReaction === REACTION_TYPES.DISLIKE,
|
||||
})}
|
||||
label={<>{formatNumber(dislikeCount, 2, true)}</>}
|
||||
label={<>{formatNumberWithCommas(dislikeCount, 0)}</>}
|
||||
iconSize={18}
|
||||
icon={dislikeIcon}
|
||||
onClick={() => doReactionDislike(uri)}
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectPrimaryUri, makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||
import CardMedia from './view';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claimUriBeingPlayed = selectPrimaryUri(state);
|
||||
let isBeingPlayed = false;
|
||||
|
||||
if (claimUriBeingPlayed) {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const claimBeingPlayed = makeSelectClaimForUri(claimUriBeingPlayed)(state);
|
||||
isBeingPlayed = claim.claim_id === claimBeingPlayed.claim_id;
|
||||
}
|
||||
|
||||
return {
|
||||
watchedPercentage: makeSelectContentWatchedPercentageForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
showPercentage: !isBeingPlayed && makeSelectClientSetting(SETTINGS.PERSIST_WATCH_TIME)(state),
|
||||
showPercentage: makeSelectClientSetting(SETTINGS.PERSIST_WATCH_TIME)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet';
|
||||
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
import FileValues from './view';
|
||||
@@ -19,6 +20,7 @@ const select = (state, props) => {
|
||||
contentType: makeSelectContentTypeForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
claimIsMine: selectClaimIsMine(state, claim),
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ type Props = {
|
||||
metadata: StreamMetadata,
|
||||
openFolder: (string) => void,
|
||||
contentType: string,
|
||||
user: ?any,
|
||||
pendingAmount: string,
|
||||
openModal: (id: string, { uri: string }) => void,
|
||||
claimIsMine: boolean,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import React from 'react';
|
||||
import HelpLink from 'component/common/help-link';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import { formatNumber } from 'util/number';
|
||||
import { toCompactNotation } from 'util/string';
|
||||
|
||||
type Props = {
|
||||
claimId: ?string, // this
|
||||
@@ -14,8 +14,8 @@ type Props = {
|
||||
|
||||
function FileViewCount(props: Props) {
|
||||
const { claimId, uri, fetchViewCount, viewCount } = props; // claimId
|
||||
const countCompact = formatNumber(Number(viewCount), 2, true);
|
||||
const countFullResolution = formatNumber(Number(viewCount), 2, false);
|
||||
const countCompact = toCompactNotation(viewCount);
|
||||
const countFullResolution = Number(viewCount).toLocaleString();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (claimId) {
|
||||
@@ -24,7 +24,7 @@ function FileViewCount(props: Props) {
|
||||
}, [fetchViewCount, uri, claimId]);
|
||||
|
||||
return (
|
||||
<Tooltip title={`${countFullResolution}`}>
|
||||
<Tooltip label={countFullResolution}>
|
||||
<span className="media__subtitle--centered">
|
||||
{viewCount !== 1 ? __('%view_count% views', { view_count: countCompact }) : __('1 view')}
|
||||
{<HelpLink href="https://lbry.com/faq/views" />}
|
||||
|
||||
@@ -6,11 +6,12 @@ import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
|
||||
import { selectHasNavigated } from 'redux/selectors/app';
|
||||
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
|
||||
import { selectEmailToVerify, selectUser } from 'redux/selectors/user';
|
||||
import { selectUserVerifiedEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import Header from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
balance: selectBalance(state),
|
||||
emailToVerify: selectEmailToVerify(state),
|
||||
hasNavigated: selectHasNavigated(state),
|
||||
|
||||
@@ -4,10 +4,11 @@ import { selectActiveChannelStakedLevel } from 'redux/selectors/app';
|
||||
import { selectClientSetting } from 'redux/selectors/settings';
|
||||
import * as SETTINGS from 'constants/settings';
|
||||
import HeaderMenuButtons from './view';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||
|
||||
const select = (state) => ({
|
||||
activeChannelStakedLevel: selectActiveChannelStakedLevel(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
automaticDarkModeEnabled: selectClientSetting(state, SETTINGS.AUTOMATIC_DARK_MODE_ENABLED),
|
||||
currentTheme: selectClientSetting(state, SETTINGS.THEME),
|
||||
user: selectUser(state),
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// @flow
|
||||
// import 'scss/component/_header.scss'; // ody codesplits this; no.
|
||||
|
||||
import { ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
@@ -12,16 +9,14 @@ import React from 'react';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
|
||||
type HeaderMenuButtonProps = {
|
||||
authenticated: boolean,
|
||||
automaticDarkModeEnabled: boolean,
|
||||
currentTheme: string,
|
||||
user: ?User,
|
||||
handleThemeToggle: (boolean, string) => void,
|
||||
};
|
||||
|
||||
export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
const { automaticDarkModeEnabled, currentTheme, user, handleThemeToggle } = props;
|
||||
|
||||
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
|
||||
const { automaticDarkModeEnabled, currentTheme, handleThemeToggle } = props;
|
||||
|
||||
return (
|
||||
<div className="header__buttons">
|
||||
@@ -38,7 +33,7 @@ export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
</MenuList>
|
||||
</Menu>
|
||||
|
||||
{notificationsEnabled && <NotificationHeaderButton />}
|
||||
<NotificationHeaderButton />
|
||||
|
||||
<Menu>
|
||||
<Tooltip title={__('Settings')}>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
||||
import { doSeeAllNotifications } from 'redux/actions/notifications';
|
||||
import { selectUnseenNotificationCount, selectUnseenLocalNotificationCount } from 'redux/selectors/notifications';
|
||||
import { doLbryioSeeAllNotifications, doLocalSeeAllNotifications } from 'redux/actions/notifications';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import NotificationHeaderButton from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
unseenCount: selectUnseenNotificationCount(state),
|
||||
unseenLocalCount: selectUnseenLocalNotificationCount(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doSeeAllNotifications,
|
||||
doLbryioSeeAllNotifications,
|
||||
doLocalSeeAllNotifications,
|
||||
})(NotificationHeaderButton);
|
||||
@@ -1,7 +1,4 @@
|
||||
// @flow
|
||||
// import 'scss/component/_header.scss'; // ody codesplits this; no. REMOVE THESE
|
||||
|
||||
import { ENABLE_UI_NOTIFICATIONS } from 'config';
|
||||
import { useHistory } from 'react-router';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
@@ -13,23 +10,22 @@ import Tooltip from 'component/common/tooltip';
|
||||
|
||||
type Props = {
|
||||
unseenCount: number,
|
||||
user: ?User,
|
||||
doSeeAllNotifications: () => void,
|
||||
unseenLocalCount: number,
|
||||
doLbryioSeeAllNotifications: () => void,
|
||||
doLocalSeeAllNotifications: () => void,
|
||||
};
|
||||
|
||||
export default function NotificationHeaderButton(props: Props) {
|
||||
const { unseenCount, user, doSeeAllNotifications } = props;
|
||||
const { unseenCount, unseenLocalCount, doLbryioSeeAllNotifications, doLocalSeeAllNotifications } = props;
|
||||
|
||||
const { push } = useHistory();
|
||||
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
|
||||
|
||||
function handleMenuClick() {
|
||||
if (unseenCount > 0) doSeeAllNotifications();
|
||||
if (unseenCount > 0) doLbryioSeeAllNotifications();
|
||||
if (unseenLocalCount > 0) doLocalSeeAllNotifications();
|
||||
push(`/$/${PAGES.NOTIFICATIONS}`);
|
||||
}
|
||||
|
||||
if (!notificationsEnabled) return null;
|
||||
|
||||
return (
|
||||
<Tooltip title={__('Notifications')}>
|
||||
<Button onClick={handleMenuClick} className="header__navigationItem--icon">
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import HostingSplash from './view';
|
||||
import {
|
||||
selectViewBlobSpace,
|
||||
selectViewHostingLimit,
|
||||
selectAutoBlobSpace,
|
||||
selectAutoHostingLimit,
|
||||
selectSaveBlobs,
|
||||
} from 'redux/selectors/settings';
|
||||
import { doSetDaemonSetting } from 'redux/actions/settings';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
diskSpace: selectDiskSpace(state),
|
||||
viewHostingLimit: selectViewHostingLimit(state),
|
||||
autoHostingLimit: selectAutoHostingLimit(state),
|
||||
viewBlobSpace: selectViewBlobSpace(state),
|
||||
autoBlobSpace: selectAutoBlobSpace(state),
|
||||
saveBlobs: selectSaveBlobs(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(HostingSplash);
|
||||
@@ -1,156 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { FormField } from 'component/common/form-components/form-field';
|
||||
import { Form } from 'component/common/form-components/form';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
// $FlowFixMe cannot resolve ...
|
||||
import image from 'static/img/yrblhappy.svg';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type Props = {
|
||||
handleNextPage: () => void,
|
||||
handleDone: () => void,
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
// --- select ---
|
||||
diskSpace: DiskSpace, // KB
|
||||
viewHostingLimit: number, // MB
|
||||
autoHostingLimit: number,
|
||||
viewBlobSpace: number,
|
||||
autoBlobSpace: number,
|
||||
privateBlobSpace: number,
|
||||
saveBlobs: boolean,
|
||||
};
|
||||
|
||||
const TWENTY_PERCENT = 0.2;
|
||||
const TEN_PRECNT = 0.1;
|
||||
|
||||
function HostingSplash(props: Props) {
|
||||
const {
|
||||
handleNextPage,
|
||||
diskSpace,
|
||||
viewHostingLimit,
|
||||
autoHostingLimit,
|
||||
viewBlobSpace,
|
||||
autoBlobSpace,
|
||||
saveBlobs,
|
||||
setDaemonSetting,
|
||||
handleDone,
|
||||
} = props;
|
||||
|
||||
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||
const blobSpaceUsed = viewBlobSpace + autoBlobSpace;
|
||||
|
||||
const [hostingChoice, setHostingChoice] = React.useState('MANAGED');
|
||||
function handleSubmit() {
|
||||
if (hostingChoice === 'CUSTOM') {
|
||||
handleNextPage();
|
||||
} else {
|
||||
handleAuto();
|
||||
}
|
||||
}
|
||||
|
||||
function getManagedLimitMB() {
|
||||
const value =
|
||||
freeMB > totalMB * TWENTY_PERCENT // lots of free space?
|
||||
? blobSpaceUsed > totalMB * TEN_PRECNT // using more than 10%?
|
||||
? (freeMB + blobSpaceUsed) / 2 // e.g. 40g used plus 30g free, knock back to 35g limit, freeing to 35g
|
||||
: totalMB * TEN_PRECNT // let it go up to 10%
|
||||
: (freeMB + blobSpaceUsed) / 2; // e.g. 40g used plus 10g free, knock back to 25g limit, freeing to 25g
|
||||
return value > 10240 ? Math.floor(value / 1024) * 1024 : 0;
|
||||
}
|
||||
|
||||
function getAutoLimit() {
|
||||
// return floor of 10% of total
|
||||
const totalGB = Math.floor(getManagedLimitMB() / 1024); // eg, 25GB
|
||||
return Math.floor(totalGB / 10) * 1024; // eg, 2 GB -> 2048MB
|
||||
}
|
||||
|
||||
function getViewedLimit() {
|
||||
return getManagedLimitMB() - getAutoLimit();
|
||||
}
|
||||
|
||||
function getManagedCopy() {
|
||||
if (viewHostingLimit || autoHostingLimit || !saveBlobs) {
|
||||
return __("I'm happy with my settings");
|
||||
} else if (getManagedLimitMB() > 0) {
|
||||
return __(`Host up to %percent% of my drive (%limit% GB)`, {
|
||||
percent: `${Math.round((Math.floor(getManagedLimitMB() / 1024) / Math.floor(totalMB / 1024)) * 100)}%`,
|
||||
limit: Math.floor(getManagedLimitMB() / 1024),
|
||||
});
|
||||
} else {
|
||||
return __(`Not now, my disk is almost full.`);
|
||||
}
|
||||
}
|
||||
|
||||
function getManagedHelper() {
|
||||
if (viewHostingLimit || autoHostingLimit || !saveBlobs) {
|
||||
return __(`We've noticed you already have some settings.`);
|
||||
} else if (getManagedLimitMB() > 0) {
|
||||
return __(`Donate space without filling up your drive.`);
|
||||
} else {
|
||||
return __(`You can clear some space and check hosting settings later.`);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAuto() {
|
||||
if (viewHostingLimit || autoHostingLimit || !saveBlobs) {
|
||||
handleDone();
|
||||
} else if (getManagedLimitMB() > 0) {
|
||||
// limit to used // maybe move this to a single action function that doesn't live inside the component.
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, getViewedLimit());
|
||||
await setDaemonSetting(DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB, getAutoLimit());
|
||||
handleDone();
|
||||
} else {
|
||||
// running low on space
|
||||
handleDone();
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="main--contained">
|
||||
<div className={'columns first-run__wrapper'}>
|
||||
<div className={'first-run__left'}>
|
||||
<div>
|
||||
<h1 className="section__title--large">{__('Hosting')}</h1>
|
||||
<h3 className="section__subtitle">
|
||||
{__('Help creators and improve the P2P data network by hosting content.')}
|
||||
</h3>
|
||||
<fieldset>
|
||||
<FormField
|
||||
name={'managedhosting'}
|
||||
type="radio"
|
||||
checked={hostingChoice === 'MANAGED'}
|
||||
label={getManagedCopy()}
|
||||
helper={getManagedHelper()}
|
||||
onChange={(e) => setHostingChoice('MANAGED')}
|
||||
/>
|
||||
<FormField
|
||||
name={'customhosting'}
|
||||
type="radio"
|
||||
checked={hostingChoice === 'CUSTOM'}
|
||||
label={<>{__('Custom')}</>}
|
||||
helper={__(`You choose how much data to host.`)}
|
||||
onChange={(e) => setHostingChoice('CUSTOM')}
|
||||
/>
|
||||
</fieldset>
|
||||
</div>
|
||||
<Form onSubmit={handleSubmit} className="section__body">
|
||||
<div className={'card__actions'}>
|
||||
<Button button="primary" label={hostingChoice === 'CUSTOM' ? __('Next') : __(`Let's go`)} type="submit" />
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
<div className={'first-run__image-wrapper'}>
|
||||
<img src={image} className="privacy-img" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default withRouter(HostingSplash);
|
||||
@@ -1,3 +0,0 @@
|
||||
import HostingSplashCustom from './view';
|
||||
|
||||
export default HostingSplashCustom;
|
||||
@@ -1,31 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { Form } from 'component/common/form-components/form';
|
||||
import SettingStorage from 'component/settingStorage';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
type Props = {
|
||||
handleNextPage: () => void,
|
||||
handleGoBack: () => void,
|
||||
};
|
||||
|
||||
function HostingSplashCustom(props: Props) {
|
||||
const { handleNextPage, handleGoBack } = props;
|
||||
|
||||
return (
|
||||
<section className="main--contained">
|
||||
<div className={'first-run__wrapper'}>
|
||||
<SettingStorage isWelcome />
|
||||
<Form onSubmit={handleNextPage} className="section__body">
|
||||
<div className={'card__actions'}>
|
||||
<Button button="primary" label={__(`Let's go`)} type="submit" />
|
||||
<Button button="link" label={__(`Go back`)} onClick={handleGoBack} />
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default withRouter(HostingSplashCustom);
|
||||
@@ -0,0 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectReferralReward } from 'redux/selectors/rewards';
|
||||
import { selectUserInvitees, selectUserInviteStatusIsPending } from 'redux/selectors/user';
|
||||
import InviteList from './view';
|
||||
|
||||
const select = state => ({
|
||||
invitees: selectUserInvitees(state),
|
||||
isPending: selectUserInviteStatusIsPending(state),
|
||||
referralReward: selectReferralReward(state),
|
||||
});
|
||||
|
||||
const perform = () => ({});
|
||||
|
||||
export default connect(select, perform)(InviteList);
|
||||
@@ -0,0 +1,99 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import RewardLink from 'component/rewardLink';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Card from 'component/common/card';
|
||||
import LbcMessage from 'component/common/lbc-message';
|
||||
|
||||
type Props = {
|
||||
invitees: ?Array<{
|
||||
email: string,
|
||||
invite_accepted: boolean,
|
||||
invite_reward_claimed: boolean,
|
||||
invite_reward_claimable: boolean,
|
||||
}>,
|
||||
referralReward: ?Reward,
|
||||
};
|
||||
|
||||
class InviteList extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { invitees, referralReward } = this.props;
|
||||
|
||||
if (!invitees || !invitees.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let rewardAmount = 0;
|
||||
let rewardHelp = __(
|
||||
"Woah, you have a lot of friends! You've claimed the maximum amount of invite rewards. Email %email% if you'd like to be whitelisted for more invites.",
|
||||
{ email: 'hello@lbry.com' }
|
||||
);
|
||||
|
||||
if (referralReward) {
|
||||
rewardAmount = referralReward.reward_amount;
|
||||
rewardHelp = referralReward.reward_description;
|
||||
}
|
||||
const showClaimable = invitees.some(invite => invite.invite_reward_claimable && !invite.invite_reward_claimed);
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={<div className="table__header-text">{__('Invite History')}</div>}
|
||||
subtitle={
|
||||
<div className="table__header-text">
|
||||
<LbcMessage>{rewardHelp}</LbcMessage>
|
||||
</div>
|
||||
}
|
||||
titleActions={
|
||||
referralReward &&
|
||||
showClaimable && (
|
||||
<div className="card__actions--inline">
|
||||
<RewardLink
|
||||
button
|
||||
label={__(`Claim Your %reward_amount% Credit Invite Reward`, { reward_amount: rewardAmount })}
|
||||
claim_code={referralReward.claim_code}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
isBodyList
|
||||
body={
|
||||
<div className="table__wrapper">
|
||||
<table className="table section">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{__('Invitee Email')}</th>
|
||||
<th>{__('Invite Status')}</th>
|
||||
<th>{__('Reward')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{invitees.map(invitee => (
|
||||
<tr key={invitee.email}>
|
||||
<td>{invitee.email}</td>
|
||||
<td>
|
||||
<span>{invitee.invite_accepted ? __('Accepted') : __('Not Accepted')}</span>
|
||||
</td>
|
||||
<td>
|
||||
{invitee.invite_reward_claimed && (
|
||||
<React.Fragment>
|
||||
<span>{__('Claimed')}</span>
|
||||
<Icon icon={ICONS.COMPLETE} />
|
||||
</React.Fragment>
|
||||
)}
|
||||
|
||||
{!invitee.invite_reward_claimed &&
|
||||
(invitee.invite_reward_claimable ? <span>{__('Claimable')}</span> : __('Unclaimable'))}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default InviteList;
|
||||
@@ -0,0 +1,29 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectUserInvitesRemaining,
|
||||
selectUserInviteNewIsPending,
|
||||
selectUserInviteNewErrorMessage,
|
||||
selectUserInviteReferralLink,
|
||||
selectUserInviteReferralCode,
|
||||
} from 'redux/selectors/user';
|
||||
// import { doUserInviteNew } from 'redux/actions/user';
|
||||
import { selectMyChannelClaims, selectFetchingMyChannels } from 'redux/selectors/claims';
|
||||
import { doFetchChannelListMine } from 'redux/actions/claims';
|
||||
import InviteNew from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
errorMessage: selectUserInviteNewErrorMessage(state),
|
||||
invitesRemaining: selectUserInvitesRemaining(state),
|
||||
referralLink: selectUserInviteReferralLink(state),
|
||||
referralCode: selectUserInviteReferralCode(state),
|
||||
isPending: selectUserInviteNewIsPending(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
// inviteNew: (email) => dispatch(doUserInviteNew(email)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(InviteNew);
|
||||
@@ -0,0 +1,154 @@
|
||||
// @flow
|
||||
import { URL, SITE_NAME } from 'config';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import Button from 'component/button';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import CopyableText from 'component/copyableText';
|
||||
import Card from 'component/common/card';
|
||||
import analytics from 'analytics';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
|
||||
type Props = {
|
||||
errorMessage: ?string,
|
||||
inviteNew: (string) => void,
|
||||
isPending: boolean,
|
||||
referralLink: string,
|
||||
referralCode: string,
|
||||
channels: ?Array<ChannelClaim>,
|
||||
};
|
||||
|
||||
function InviteNew(props: Props) {
|
||||
const { inviteNew, errorMessage, isPending, referralCode = '', channels } = props;
|
||||
|
||||
// Email
|
||||
const [email, setEmail] = useState('');
|
||||
function handleSubmit() {
|
||||
inviteNew(email);
|
||||
}
|
||||
|
||||
function handleEmailChanged(event: any) {
|
||||
setEmail(event.target.value);
|
||||
}
|
||||
|
||||
// Referral link
|
||||
const [referralSource, setReferralSource] = useState(referralCode);
|
||||
|
||||
const handleReferralChange = React.useCallback(
|
||||
(code) => {
|
||||
setReferralSource(code);
|
||||
// TODO: keep track of this in an array?
|
||||
const matchingChannel = channels && channels.find((ch) => ch.name === code);
|
||||
if (matchingChannel) {
|
||||
analytics.apiLogPublish(matchingChannel);
|
||||
}
|
||||
},
|
||||
[setReferralSource]
|
||||
);
|
||||
|
||||
const topChannel =
|
||||
channels &&
|
||||
channels.reduce((top, channel) => {
|
||||
const topClaimCount = (top && top.meta && top.meta.claims_in_channel) || 0;
|
||||
const currentClaimCount = (channel && channel.meta && channel.meta.claims_in_channel) || 0;
|
||||
return topClaimCount >= currentClaimCount ? top : channel;
|
||||
});
|
||||
const referralString =
|
||||
channels && channels.length && referralSource !== referralCode
|
||||
? lookupUrlByClaimName(referralSource, channels)
|
||||
: referralSource;
|
||||
|
||||
const referral = `${URL}/$/invite/${referralString.replace('#', ':')}`;
|
||||
|
||||
useEffect(() => {
|
||||
// set default channel
|
||||
if (topChannel) {
|
||||
handleReferralChange(topChannel.name);
|
||||
}
|
||||
}, [topChannel, handleReferralChange]);
|
||||
|
||||
function lookupUrlByClaimName(name, channels) {
|
||||
const claim = channels.find((channel) => channel.name === name);
|
||||
return claim && claim.canonical_url ? claim.canonical_url.replace('lbry://', '') : name;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={'columns'}>
|
||||
<div className="column">
|
||||
<Card
|
||||
title={__('Invites')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ SITE_NAME, lbc: <LbcSymbol /> }}>
|
||||
Earn %lbc% for inviting subscribers, followers, fans, friends, etc. to join and follow you on %SITE_NAME%.
|
||||
You can use invites just like affiliate links.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<CopyableText label={__('Your invite link')} copyable={referral} />
|
||||
{channels && channels.length > 0 && (
|
||||
<FormField
|
||||
type="select"
|
||||
label={__('Customize link')}
|
||||
value={referralSource}
|
||||
onChange={(e) => handleReferralChange(e.target.value)}
|
||||
>
|
||||
{channels.map((channel) => (
|
||||
<option key={channel.claim_id} value={channel.name}>
|
||||
{channel.name}
|
||||
</option>
|
||||
))}
|
||||
<option value={referralCode}>{referralCode}</option>
|
||||
</FormField>
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="column">
|
||||
<Card
|
||||
title={__('Invite by email')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ SITE_NAME, lbc: <LbcSymbol /> }}>
|
||||
Invite someone you know by email and earn %lbc% when they join %SITE_NAME%.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormField
|
||||
type="text"
|
||||
label={__('Email')}
|
||||
placeholder="youremail@example.org"
|
||||
name="email"
|
||||
value={email}
|
||||
error={errorMessage}
|
||||
inputButton={
|
||||
<Button button="secondary" type="submit" label={__('Invite')} disabled={isPending || !email} />
|
||||
}
|
||||
onChange={(event) => {
|
||||
handleEmailChanged(event);
|
||||
}}
|
||||
/>
|
||||
<p className="help">
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />,
|
||||
referral_faq_link: (
|
||||
<Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />
|
||||
),
|
||||
}}
|
||||
>
|
||||
Read our %referral_faq_link% to learn more about rewards.
|
||||
</I18nMessage>
|
||||
</p>
|
||||
</Form>
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default InviteNew;
|
||||
@@ -0,0 +1,30 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router';
|
||||
import REWARDS from 'rewards';
|
||||
import { selectUser, selectSetReferrerPending, selectSetReferrerError } from 'redux/selectors/user';
|
||||
import { doClaimRewardType } from 'redux/actions/rewards';
|
||||
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
||||
import { doUserSetReferrer } from 'redux/actions/user';
|
||||
import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
|
||||
import { doChannelSubscribe } from 'redux/actions/subscriptions';
|
||||
import Invited from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
user: selectUser(state),
|
||||
referrerSetPending: selectSetReferrerPending(state),
|
||||
referrerSetError: selectSetReferrerError(state),
|
||||
rewards: selectUnclaimedRewards(state),
|
||||
isSubscribed: selectIsSubscribedForUri(state, props.fullUri),
|
||||
fullUri: props.fullUri,
|
||||
referrer: props.referrer,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
claimReward: () => dispatch(doClaimRewardType(REWARDS.TYPE_REFEREE)),
|
||||
setReferrer: (referrer) => dispatch(doUserSetReferrer(referrer)),
|
||||
channelSubscribe: (uri) => dispatch(doChannelSubscribe(uri)),
|
||||
});
|
||||
|
||||
export default withRouter(connect(select, perform)(Invited));
|
||||
@@ -0,0 +1,225 @@
|
||||
// @flow
|
||||
import { SITE_NAME } from 'config';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React, { useEffect } from 'react';
|
||||
import Button from 'component/button';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
import Card from 'component/common/card';
|
||||
import { buildURI, parseURI } from 'util/lbryURI';
|
||||
import { ERRORS } from 'lbryinc';
|
||||
import REWARDS from 'rewards';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import ChannelContent from 'component/channelContent';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
|
||||
type Props = {
|
||||
user: any,
|
||||
claimReward: () => void,
|
||||
setReferrer: (string) => void,
|
||||
referrerSetPending: boolean,
|
||||
referrerSetError: string,
|
||||
channelSubscribe: (sub: Subscription) => void,
|
||||
history: { push: (string) => void },
|
||||
rewards: Array<Reward>,
|
||||
referrer: string,
|
||||
fullUri: string,
|
||||
isSubscribed: boolean,
|
||||
};
|
||||
|
||||
function Invited(props: Props) {
|
||||
const {
|
||||
user,
|
||||
claimReward,
|
||||
setReferrer,
|
||||
referrerSetPending,
|
||||
referrerSetError,
|
||||
channelSubscribe,
|
||||
history,
|
||||
rewards,
|
||||
fullUri,
|
||||
referrer,
|
||||
isSubscribed,
|
||||
} = props;
|
||||
|
||||
const refUri = referrer && 'lbry://' + referrer.replace(':', '#');
|
||||
const {
|
||||
isChannel: referrerIsChannel,
|
||||
claimName: referrerChannelName,
|
||||
channelClaimId: referrerChannelClaimId,
|
||||
} = parseURI(refUri);
|
||||
const channelUri =
|
||||
referrerIsChannel &&
|
||||
formatLbryUrlForWeb(buildURI({ channelName: referrerChannelName, channelClaimId: referrerChannelClaimId }));
|
||||
const rewardsApproved = user && user.is_reward_approved;
|
||||
const hasVerifiedEmail = user && user.has_verified_email;
|
||||
const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE);
|
||||
const redirect = channelUri || `/`;
|
||||
|
||||
// always follow if it's a channel
|
||||
useEffect(() => {
|
||||
if (fullUri && !isSubscribed && fullUri) {
|
||||
let channelName;
|
||||
try {
|
||||
const { claimName } = parseURI(fullUri);
|
||||
channelName = claimName;
|
||||
} catch (e) {}
|
||||
if (channelName) {
|
||||
channelSubscribe({
|
||||
channelName: channelName,
|
||||
uri: fullUri,
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [fullUri, isSubscribed, channelSubscribe]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!referrerSetPending && hasVerifiedEmail) {
|
||||
claimReward();
|
||||
}
|
||||
}, [referrerSetPending, hasVerifiedEmail, claimReward]);
|
||||
|
||||
useEffect(() => {
|
||||
if (referrer) {
|
||||
setReferrer(referrer.replace(':', '#'));
|
||||
}
|
||||
}, [referrer, setReferrer]);
|
||||
|
||||
function handleDone() {
|
||||
history.push(redirect);
|
||||
}
|
||||
|
||||
if (referrerSetError === ERRORS.ALREADY_CLAIMED) {
|
||||
return (
|
||||
<Card
|
||||
title={__(`Whoa`)}
|
||||
subtitle={
|
||||
referrerIsChannel
|
||||
? __(`You've already claimed your referrer, but we've followed this channel for you.`)
|
||||
: __(`You've already claimed your referrer.`)
|
||||
}
|
||||
body={
|
||||
referrerIsChannel && (
|
||||
<div className="claim-preview--channel">
|
||||
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
actions={
|
||||
<div className="card__actions">
|
||||
<Button button="primary" label={__('Done!')} onClick={handleDone} />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (referrerSetError && referredRewardAvailable) {
|
||||
return (
|
||||
<Card
|
||||
title={__(`Welcome!`)}
|
||||
subtitle={__(
|
||||
`Something went wrong with your invite link. You can set and claim your invite reward after signing in.`
|
||||
)}
|
||||
actions={
|
||||
<>
|
||||
<p className="error__text">{__('Not a valid invite')}</p>
|
||||
<div className="card__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
label={hasVerifiedEmail ? __('Verify') : __('Create Account')}
|
||||
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.REWARDS}`}
|
||||
/>
|
||||
<Button button="link" label={__('Explore')} onClick={handleDone} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (!rewardsApproved) {
|
||||
const signUpButton = (
|
||||
<Button
|
||||
button="link"
|
||||
label={hasVerifiedEmail ? __(`Finish verification `) : __(`Create an account `)}
|
||||
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.INVITE}/${referrer}`}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={
|
||||
referrerIsChannel
|
||||
? __('%channel_name% invites you to the party!', { channel_name: referrerChannelName })
|
||||
: __(`You're invited!`)
|
||||
}
|
||||
subtitle={
|
||||
<p>
|
||||
{referrerIsChannel ? (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
channel_name: referrerChannelName,
|
||||
signup_link: signUpButton,
|
||||
SITE_NAME,
|
||||
}}
|
||||
>
|
||||
%channel_name% is waiting for you on %SITE_NAME%. Create your account now.
|
||||
</I18nMessage>
|
||||
) : (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
signup_link: signUpButton,
|
||||
}}
|
||||
>
|
||||
Content freedom and a present are waiting for you. %signup_link% to claim it.
|
||||
</I18nMessage>
|
||||
)}
|
||||
</p>
|
||||
}
|
||||
body={
|
||||
referrerIsChannel && (
|
||||
<div className="claim-preview--channel">
|
||||
<div className="section">
|
||||
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
||||
</div>
|
||||
<div className="section">
|
||||
<ChannelContent uri={fullUri} defaultPageSize={3} defaultInfiniteScroll={false} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
label={hasVerifiedEmail ? __('Finish Account') : __('Create Account')}
|
||||
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.INVITE}/${referrer}`}
|
||||
/>
|
||||
<Button button="link" label={__('Skip')} onClick={handleDone} />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__(`Welcome!`)}
|
||||
subtitle={referrerIsChannel ? __(`We've followed your invitee for you. Check them out!`) : __(`Congrats!`)}
|
||||
body={
|
||||
referrerIsChannel && (
|
||||
<div className="claim-preview--channel">
|
||||
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<Button button="primary" label={__('Done')} onClick={handleDone} />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default Invited;
|
||||
@@ -1,11 +1,3 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectRemoteVersion } from 'redux/selectors/app';
|
||||
import LastReleaseChanges from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
releaseVersion: selectRemoteVersion(state),
|
||||
});
|
||||
|
||||
const perform = {};
|
||||
|
||||
export default connect(select, perform)(LastReleaseChanges);
|
||||
export default LastReleaseChanges;
|
||||
@@ -5,12 +5,11 @@ import Button from 'component/button';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
|
||||
type Props = {
|
||||
releaseVersion: string,
|
||||
hideReleaseVersion?: boolean,
|
||||
};
|
||||
|
||||
const LastReleaseChanges = (props: Props) => {
|
||||
const { hideReleaseVersion, releaseVersion } = props;
|
||||
const { hideReleaseVersion } = props;
|
||||
const [releaseTag, setReleaseTag] = useState('');
|
||||
const [releaseChanges, setReleaseChanges] = useState('');
|
||||
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
|
||||
@@ -36,7 +35,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const lastReleaseUrl = `https://api.github.com/repos/lbryio/lbry-desktop/releases/tags/${releaseVersion}`;
|
||||
const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest';
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/vnd.github.v3+json' },
|
||||
@@ -55,7 +54,7 @@ const LastReleaseChanges = (props: Props) => {
|
||||
setFetchingReleaseChanges(false);
|
||||
setFetchReleaseFailed(true);
|
||||
});
|
||||
}, [releaseVersion, setFetchingReleaseChanges, setReleaseTag, setReleaseChanges, setFetchReleaseFailed]);
|
||||
}, []);
|
||||
|
||||
if (fetchingReleaseChanges) {
|
||||
return <p>{__('Loading...')}</p>;
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doReadNotifications, doDeleteNotification } from 'redux/actions/notifications';
|
||||
import {
|
||||
doLbryioNotificationsMarkRead,
|
||||
doLbryioDeleteNotification,
|
||||
doLocalDeleteNotification,
|
||||
} from 'redux/actions/notifications';
|
||||
import Notification from './view';
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
readNotification: () => dispatch(doReadNotifications([ownProps.notification.id])),
|
||||
deleteNotification: () => dispatch(doDeleteNotification(ownProps.notification.id)),
|
||||
readNotification: () => dispatch(doLbryioNotificationsMarkRead([ownProps.notification.id])),
|
||||
deleteNotification: () => dispatch(doLbryioDeleteNotification(ownProps.notification.id)),
|
||||
deleteLocalNotification: () => dispatch(doLocalDeleteNotification(ownProps.notification.id)),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(Notification);
|
||||
@@ -72,9 +72,9 @@ function PrivacyAgreement(props: Props) {
|
||||
{__('No')} <span>😢</span>
|
||||
</>
|
||||
}
|
||||
helper={__(
|
||||
`* Note that as peer-to-peer software, your IP address and potentially other system information can be sent to other users, though this information is not stored permanently.`
|
||||
)}
|
||||
helper={__(`* Note that as
|
||||
peer-to-peer software, your IP address and potentially other system information can be sent to other
|
||||
users, though this information is not stored permanently.`)}
|
||||
onChange={(e) => setShare(NONE)}
|
||||
/>
|
||||
{authenticated && (
|
||||
@@ -92,7 +92,7 @@ function PrivacyAgreement(props: Props) {
|
||||
)}
|
||||
</fieldset>
|
||||
<div className={'card__actions'}>
|
||||
<Button button="primary" label={__(`Next`)} disabled={!share} type="submit" />
|
||||
<Button button="primary" label={__(`Let's go`)} disabled={!share} type="submit" />
|
||||
</div>
|
||||
{share === NONE && (
|
||||
<p className="help">
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// @flow
|
||||
import { formatCredits } from 'util/format-credits';
|
||||
|
||||
type Props = {
|
||||
uri: ?string,
|
||||
isResolvingUri: boolean,
|
||||
@@ -25,7 +23,7 @@ function BidHelpText(props: Props) {
|
||||
bidHelpText = __(
|
||||
'If you bid more than %amount% LBRY Credits, when someone navigates to %uri%, it will load your published content. However, you can get a longer version of this URL for any bid.',
|
||||
{
|
||||
amount: formatCredits(amountNeededForTakeover, 2, true),
|
||||
amount: amountNeededForTakeover,
|
||||
uri: uri,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -325,7 +325,6 @@ function PublishFile(props: Props) {
|
||||
{showFileUpload && (
|
||||
<>
|
||||
<FileSelector
|
||||
type="openFile"
|
||||
label={__('File')}
|
||||
disabled={disabled}
|
||||
currentPath={currentFile}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnclaimedRewardValue } from 'redux/selectors/rewards';
|
||||
import RewardAuthIntro from './view';
|
||||
|
||||
const select = state => ({
|
||||
totalRewardValue: selectUnclaimedRewardValue(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(RewardAuthIntro);
|
||||
@@ -0,0 +1,46 @@
|
||||
// @flow
|
||||
import { SITE_NAME } from 'config';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React from 'react';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
|
||||
type Props = {
|
||||
balance: number,
|
||||
totalRewardValue: number,
|
||||
title?: string,
|
||||
};
|
||||
|
||||
function RewardAuthIntro(props: Props) {
|
||||
const { totalRewardValue, title } = props;
|
||||
const totalRewardRounded = Math.floor(totalRewardValue / 10) * 10;
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={title || __('Log in to %SITE_NAME% to earn rewards', { SITE_NAME })}
|
||||
subtitle={
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
credit_amount: <CreditAmount inheritStyle amount={totalRewardRounded} />,
|
||||
site_name: SITE_NAME,
|
||||
}}
|
||||
>
|
||||
A %site_name% account allows you to earn more than %credit_amount% in rewards, backup your data, and get
|
||||
content and security updates.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<Button
|
||||
requiresAuth
|
||||
button="primary"
|
||||
navigate={`/$/${PAGES.REWARDS_VERIFY}?redirect=/$/${PAGES.REWARDS}`}
|
||||
label={__('Unlock Rewards')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default RewardAuthIntro;
|
||||
@@ -0,0 +1,17 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectRewardByClaimCode, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards';
|
||||
import { doClaimRewardType } from 'redux/actions/rewards';
|
||||
|
||||
import RewardLink from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
isPending: makeSelectIsRewardClaimPending()(state, props),
|
||||
reward: makeSelectRewardByClaimCode()(state, props.claim_code),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimReward: reward =>
|
||||
dispatch(doClaimRewardType(reward.reward_type, { notifyError: true, params: { claim_code: reward.claim_code } })),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(RewardLink);
|
||||
@@ -0,0 +1,48 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import LbcMessage from 'component/common/lbc-message';
|
||||
|
||||
type Reward = {
|
||||
reward_amount: number,
|
||||
reward_range: string,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
isPending: boolean,
|
||||
label: ?string,
|
||||
reward: Reward,
|
||||
button: ?boolean,
|
||||
disabled: boolean,
|
||||
claimReward: (Reward) => void,
|
||||
};
|
||||
|
||||
const RewardLink = (props: Props) => {
|
||||
const { reward, claimReward, label, isPending, button, disabled = false } = props;
|
||||
let displayLabel = label;
|
||||
if (isPending) {
|
||||
displayLabel = __('Claiming...');
|
||||
} else if (label) {
|
||||
displayLabel = label;
|
||||
} else if (reward && reward.reward_range && reward.reward_range.includes('-')) {
|
||||
displayLabel = __('Claim %range% LBC', { range: reward.reward_range });
|
||||
} else if (reward && reward.reward_amount > 0) {
|
||||
displayLabel = __('Claim %amount% LBC', { amount: reward.reward_amount });
|
||||
} else {
|
||||
displayLabel = __('Claim ??? LBC');
|
||||
}
|
||||
|
||||
return !reward ? null : (
|
||||
<Button
|
||||
button={button ? 'primary' : 'link'}
|
||||
disabled={disabled || isPending}
|
||||
label={<LbcMessage>{displayLabel}</LbcMessage>}
|
||||
aria-label={displayLabel}
|
||||
onClick={() => {
|
||||
claimReward(reward);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RewardLink;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectClaimedRewards } from 'redux/selectors/rewards';
|
||||
import RewardListClaimed from './view';
|
||||
|
||||
const select = state => ({
|
||||
rewards: selectClaimedRewards(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(RewardListClaimed);
|
||||
@@ -0,0 +1,68 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import ButtonTransaction from 'component/common/transaction-link';
|
||||
import moment from 'moment';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import Card from 'component/common/card';
|
||||
|
||||
type Reward = {
|
||||
id: string,
|
||||
reward_title: string,
|
||||
reward_amount: number,
|
||||
transaction_id: string,
|
||||
created_at: string,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
rewards: Array<Reward>,
|
||||
};
|
||||
|
||||
const RewardListClaimed = (props: Props) => {
|
||||
const { rewards } = props;
|
||||
|
||||
if (!rewards || !rewards.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={<div className="table__header-text">{__('Claimed Rewards')}</div>}
|
||||
subtitle={
|
||||
<div className="table__header-text">
|
||||
{__(
|
||||
'Reward history is tied to your email. In case of lost or multiple wallets, your balance may differ from the amounts claimed'
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
isBodyList
|
||||
body={
|
||||
<div className="table__wrapper">
|
||||
<table className="table table--rewards">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{__('Title')}</th>
|
||||
<th>
|
||||
<LbcSymbol size={20} />
|
||||
</th>
|
||||
<th>{__('Transaction')}</th>
|
||||
<th>{__('Date')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rewards.reverse().map(reward => (
|
||||
<tr key={reward.id}>
|
||||
<td>{reward.reward_title}</td>
|
||||
<td>{reward.reward_amount}</td>
|
||||
<td>{reward.transaction_id && <ButtonTransaction id={reward.transaction_id} />}</td>
|
||||
<td>{moment(reward.created_at).format('LLL')}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RewardListClaimed;
|
||||
@@ -0,0 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnclaimedRewardValue, selectFetchingRewards } from 'redux/selectors/rewards';
|
||||
import RewardSummary from './view';
|
||||
|
||||
const select = state => ({
|
||||
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
|
||||
fetching: selectFetchingRewards(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(RewardSummary);
|
||||
@@ -0,0 +1,52 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import Button from 'component/button';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import Card from 'component/common/card';
|
||||
|
||||
type Props = {
|
||||
unclaimedRewardAmount: number,
|
||||
fetching: boolean,
|
||||
};
|
||||
|
||||
class RewardSummary extends React.Component<Props> {
|
||||
render() {
|
||||
const { unclaimedRewardAmount, fetching } = this.props;
|
||||
const hasRewards = unclaimedRewardAmount > 0;
|
||||
return (
|
||||
<Card
|
||||
title={__('Available rewards')}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{fetching && __('You have...')}
|
||||
{!fetching && hasRewards ? (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
credit_amount: <CreditAmount inheritStyle amount={unclaimedRewardAmount} precision={8} />,
|
||||
}}
|
||||
f
|
||||
>
|
||||
You have %credit_amount% in unclaimed rewards.
|
||||
</I18nMessage>
|
||||
) : (
|
||||
__('You have no rewards available.')
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<Button
|
||||
button="primary"
|
||||
navigate="/$/rewards"
|
||||
label={hasRewards ? __('Claim Rewards') : __('View Rewards')}
|
||||
/>
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/rewards" />
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default RewardSummary;
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import RewardTile from './view';
|
||||
|
||||
const select = state => ({
|
||||
user: selectUser(state),
|
||||
});
|
||||
const perform = dispatch => ({
|
||||
openRewardCodeModal: () => dispatch(doOpenModal(MODALS.REWARD_GENERATED_CODE)),
|
||||
openSetReferrerModal: () => dispatch(doOpenModal(MODALS.SET_REFERRER)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(RewardTile);
|
||||
@@ -0,0 +1,78 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Icon from 'component/common/icon';
|
||||
import RewardLink from 'component/rewardLink';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import rewards from 'rewards';
|
||||
import LbcMessage from 'component/common/lbc-message';
|
||||
|
||||
type Props = {
|
||||
openRewardCodeModal: () => void,
|
||||
openSetReferrerModal: () => void,
|
||||
reward: {
|
||||
id: string,
|
||||
reward_title: string,
|
||||
reward_amount: number,
|
||||
reward_range?: string,
|
||||
transaction_id: string,
|
||||
created_at: string,
|
||||
reward_description: string,
|
||||
reward_type: string,
|
||||
claim_code: string,
|
||||
},
|
||||
user: User,
|
||||
disabled: boolean,
|
||||
};
|
||||
|
||||
const RewardTile = (props: Props) => {
|
||||
const { reward, openRewardCodeModal, openSetReferrerModal, user, disabled = false } = props;
|
||||
const referrerSet = user && user.invited_by_id;
|
||||
const claimed = !!reward.transaction_id;
|
||||
const customActionsRewards = [rewards.TYPE_REFERRAL, rewards.TYPE_REFEREE];
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__(reward.reward_title)}
|
||||
subtitle={<LbcMessage>{reward.reward_description}</LbcMessage>}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
{reward.reward_type === rewards.TYPE_GENERATED_CODE && (
|
||||
<Button button="primary" onClick={openRewardCodeModal} label={__('Enter Code')} disabled={disabled} />
|
||||
)}
|
||||
{reward.reward_type === rewards.TYPE_REFERRAL && (
|
||||
<Button
|
||||
button="primary"
|
||||
navigate="/$/invite"
|
||||
label={__('Go To Invites')}
|
||||
aria-hidden={disabled}
|
||||
tabIndex={disabled ? -1 : 0}
|
||||
/>
|
||||
)}
|
||||
{reward.reward_type === rewards.TYPE_REFEREE && (
|
||||
<>
|
||||
{referrerSet && <RewardLink button reward_type={reward.reward_type} disabled={disabled} />}
|
||||
<Button
|
||||
button={referrerSet ? 'link' : 'primary'}
|
||||
onClick={openSetReferrerModal}
|
||||
label={referrerSet ? __('Change Inviter') : __('Set Inviter')}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{!customActionsRewards.some((i) => i === reward.reward_type) &&
|
||||
(claimed ? (
|
||||
<span>
|
||||
<Icon icon={ICONS.COMPLETED} /> {__('Reward claimed.')}
|
||||
</span>
|
||||
) : (
|
||||
<RewardLink button claim_code={reward.claim_code} disabled={disabled} />
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default RewardTile;
|
||||
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUnclaimedRewardValue, selectFetchingRewards, selectClaimedRewards } from 'redux/selectors/rewards';
|
||||
import { doRewardList } from 'redux/actions/rewards';
|
||||
import RewardSummary from './view';
|
||||
|
||||
const select = state => ({
|
||||
unclaimedRewardAmount: selectUnclaimedRewardValue(state),
|
||||
fetching: selectFetchingRewards(state),
|
||||
rewards: selectClaimedRewards(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchRewards: () => dispatch(doRewardList()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(RewardSummary);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
@@ -0,0 +1,26 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import TotalBackground from './total-background.png';
|
||||
import useTween from 'effects/use-tween';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
|
||||
type Props = {
|
||||
rewards: Array<Reward>,
|
||||
};
|
||||
|
||||
function RewardTotal(props: Props) {
|
||||
const { rewards } = props;
|
||||
const rewardTotal = rewards.reduce((acc, val) => acc + val.reward_amount, 0);
|
||||
const modifier = rewardTotal > 500 ? 1 : 15; // used to tweak the reward count speed
|
||||
const total = useTween(rewardTotal * modifier);
|
||||
const integer = Math.round(total * rewardTotal);
|
||||
|
||||
return (
|
||||
<section className="card card--section card--reward-total" style={{ backgroundImage: `url(${TotalBackground})` }}>
|
||||
<I18nMessage tokens={{ amount: integer, lbc: <LbcSymbol /> }}>%amount% %lbc% earned from rewards</I18nMessage>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default RewardTotal;
|
||||
@@ -37,6 +37,7 @@ import ChannelsPage from 'page/channels';
|
||||
import CreatorDashboard from 'page/creatorDashboard';
|
||||
import DiscoverPage from 'page/discover';
|
||||
import FileListPublished from 'page/fileListPublished';
|
||||
import FourOhFourPage from 'page/fourOhFour';
|
||||
import HelpPage from 'page/help';
|
||||
import LibraryPage from 'page/library';
|
||||
import ListBlockedPage from 'page/listBlocked';
|
||||
@@ -226,20 +227,18 @@ function AppRouter(props: Props) {
|
||||
/>
|
||||
))}
|
||||
|
||||
{/* Odysee signin */}
|
||||
<Route path={`/$/${PAGES.AUTH_SIGNIN}`} exact component={SignInPage} />
|
||||
<Route path={`/$/${PAGES.AUTH_PASSWORD_RESET}`} exact component={PasswordResetPage} />
|
||||
<Route path={`/$/${PAGES.AUTH_PASSWORD_SET}`} exact component={PasswordSetPage} />
|
||||
<Route path={`/$/${PAGES.AUTH}`} exact component={SignUpPage} />
|
||||
<Route path={`/$/${PAGES.AUTH}/*`} exact component={SignUpPage} />
|
||||
<Route path={`/$/${PAGES.AUTH_VERIFY}`} exact component={SignInVerifyPage} />
|
||||
|
||||
<Route path={`/$/${PAGES.WELCOME}`} exact component={Welcome} />
|
||||
|
||||
<Route path={`/$/${PAGES.HELP}`} exact component={HelpPage} />
|
||||
{/* @if TARGET='app' */}
|
||||
<Route path={`/$/${PAGES.BACKUP}`} exact component={BackupPage} />
|
||||
{/* @endif */}
|
||||
<Route path={`/$/${PAGES.AUTH_VERIFY}`} exact component={SignInVerifyPage} />
|
||||
<Route path={`/$/${PAGES.SEARCH}`} exact component={SearchPage} />
|
||||
<Route path={`/$/${PAGES.TOP}`} exact component={TopPage} />
|
||||
<Route path={`/$/${PAGES.SETTINGS}`} exact component={SettingsPage} />
|
||||
@@ -280,6 +279,7 @@ function AppRouter(props: Props) {
|
||||
{/* Below need to go at the end to make sure we don't match any of our pages first */}
|
||||
<Route path="/:claimName" exact component={ShowPage} />
|
||||
<Route path="/:claimName/:streamName" exact component={ShowPage} />
|
||||
<Route path="/*" component={FourOhFourPage} />
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,15 +5,11 @@ import { doUpdatePublishForm, doResetThumbnailStatus } from 'redux/actions/publi
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import PublishPage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const publishFormFields = selectPublishFormValues(state);
|
||||
return {
|
||||
...publishFormFields,
|
||||
thumbnail: props.thumbnail || publishFormFields.thumbnail,
|
||||
fileInfos: selectFileInfosByOutpoint(state),
|
||||
myClaimForUri: selectMyClaimForUri(state),
|
||||
};
|
||||
};
|
||||
const select = (state) => ({
|
||||
...selectPublishFormValues(state),
|
||||
fileInfos: selectFileInfosByOutpoint(state),
|
||||
myClaimForUri: selectMyClaimForUri(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
updatePublishForm: (value) => dispatch(doUpdatePublishForm(value)),
|
||||
|
||||
@@ -26,7 +26,6 @@ type Props = {
|
||||
updatePublishForm: ({}) => void,
|
||||
updateThumbnailParams: ({}) => void,
|
||||
resetThumbnailStatus: () => void,
|
||||
usePublishFormMode: boolean,
|
||||
};
|
||||
|
||||
function SelectThumbnail(props: Props) {
|
||||
@@ -43,10 +42,9 @@ function SelectThumbnail(props: Props) {
|
||||
updateThumbnailParams,
|
||||
thumbnailPath,
|
||||
resetThumbnailStatus,
|
||||
usePublishFormMode,
|
||||
} = props;
|
||||
|
||||
const publishForm = usePublishFormMode || !updateThumbnailParams;
|
||||
const publishForm = !updateThumbnailParams;
|
||||
const thumbnail = publishForm ? props.thumbnail : thumbnailParam;
|
||||
const thumbnailError = publishForm ? props.thumbnailError : props.thumbnailParamError;
|
||||
|
||||
@@ -69,10 +67,10 @@ function SelectThumbnail(props: Props) {
|
||||
|
||||
function handleThumbnailChange(e: SyntheticInputEvent<*>) {
|
||||
const newThumbnail = e.target.value.replace(' ', '');
|
||||
|
||||
if (updateThumbnailParams) {
|
||||
updateThumbnailParams({ thumbnail_url: newThumbnail });
|
||||
}
|
||||
if (updatePublishForm) {
|
||||
} else {
|
||||
updatePublishForm({ thumbnail: newThumbnail });
|
||||
}
|
||||
}
|
||||
@@ -108,22 +106,16 @@ function SelectThumbnail(props: Props) {
|
||||
style={{ display: 'none' }}
|
||||
src={thumbnail}
|
||||
alt={__('Thumbnail Preview')}
|
||||
onError={() => {
|
||||
if (updateThumbnailParams) {
|
||||
updateThumbnailParams({ thumbnail_error: Boolean(thumbnail) });
|
||||
}
|
||||
if (publishForm) {
|
||||
updatePublishForm({ thumbnailError: true });
|
||||
}
|
||||
}}
|
||||
onLoad={() => {
|
||||
if (updateThumbnailParams) {
|
||||
updateThumbnailParams({ thumbnail_error: !isUrlInput });
|
||||
}
|
||||
if (publishForm) {
|
||||
updatePublishForm({ thumbnailError: !isUrlInput });
|
||||
}
|
||||
}}
|
||||
onError={() =>
|
||||
publishForm
|
||||
? updatePublishForm({ thumbnailError: true })
|
||||
: updateThumbnailParams({ thumbnail_error: Boolean(thumbnail) })
|
||||
}
|
||||
onLoad={() =>
|
||||
publishForm
|
||||
? updatePublishForm({ thumbnailError: !isUrlInput })
|
||||
: updateThumbnailParams({ thumbnail_error: !isUrlInput })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -163,7 +155,7 @@ function SelectThumbnail(props: Props) {
|
||||
onFileChosen={(file) =>
|
||||
openModal(MODALS.CONFIRM_THUMBNAIL_UPLOAD, {
|
||||
file,
|
||||
cb: (url) => updateThumbnailParams && updateThumbnailParams({ thumbnail_url: url }),
|
||||
cb: (url) => !publishForm && updateThumbnailParams({ thumbnail_url: url }),
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -53,7 +53,9 @@ export default function SettingAccount(props: Props) {
|
||||
</SettingsRow>
|
||||
)}
|
||||
|
||||
{/* @if TARGET='app' */}
|
||||
<SyncToggle disabled={walletEncrypted && !storedPassword && storedPassword !== ''} />
|
||||
{/* @endif */}
|
||||
|
||||
{hasChannels && (
|
||||
<SettingsRow title={__('Comments')} subtitle={__('View your past comments.')}>
|
||||
|
||||
@@ -5,7 +5,6 @@ import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import SettingAppearance from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
disableBackground: makeSelectClientSetting(SETTINGS.DISABLE_BACKGROUND)(state),
|
||||
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state),
|
||||
|
||||
@@ -12,7 +12,6 @@ import ThemeSelector from 'component/themeSelector';
|
||||
import homepages from 'homepages';
|
||||
|
||||
type Props = {
|
||||
disableBackground: boolean,
|
||||
clock24h: boolean,
|
||||
searchInLanguage: boolean,
|
||||
hideBalance: boolean,
|
||||
@@ -21,7 +20,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function SettingAppearance(props: Props) {
|
||||
const { clock24h, disableBackground, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
||||
const { clock24h, searchInLanguage, hideBalance, setClientSetting, setSearchInLanguage } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -64,14 +63,6 @@ export default function SettingAppearance(props: Props) {
|
||||
checked={clock24h}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={__('Disable background')}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="background"
|
||||
onChange={() => setClientSetting(SETTINGS.DISABLE_BACKGROUND, !disableBackground)}
|
||||
checked={disableBackground}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow title={__('Hide wallet balance in header')}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectDaemonStatus, selectDaemonSettings, selectSettingDaemonSettings } from 'redux/selectors/settings';
|
||||
import { selectDaemonStatus, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingWalletServer from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
@@ -8,13 +8,12 @@ const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
daemonStatus: selectDaemonStatus(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
isSetting: selectSettingDaemonSettings(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs(false)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingWalletServer);
|
||||
@@ -4,35 +4,88 @@ import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import { formatBytes } from 'util/format-bytes';
|
||||
import { isTrulyANumber } from 'util/number';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
const BYTES_PER_MB = 1048576;
|
||||
const ENABLE_AUTOMATIC_HOSTING = false;
|
||||
|
||||
import { convertGbToMbStr, isValidHostingAmount } from 'util/hosting';
|
||||
type Price = {
|
||||
currency: string,
|
||||
amount: number,
|
||||
};
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
type DaemonStatus = {
|
||||
disk_space: {
|
||||
content_blobs_storage_used_mb: string,
|
||||
published_blobs_storage_used_mb: string,
|
||||
running: true,
|
||||
seed_blobs_storage_used_mb: string,
|
||||
total_used_mb: string,
|
||||
},
|
||||
};
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number | Price;
|
||||
|
||||
type DaemonSettings = {
|
||||
download_dir: string,
|
||||
share_usage_data: boolean,
|
||||
max_key_fee?: Price,
|
||||
max_connections_per_download?: number,
|
||||
save_files: boolean,
|
||||
save_blobs: boolean,
|
||||
ffmpeg_path: string,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
daemonSettings: DaemonSettings,
|
||||
daemonStatus: DaemonStatus,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
cleanBlobs: () => string,
|
||||
diskSpace?: DiskSpace,
|
||||
getDaemonStatus: () => void,
|
||||
isSetting: boolean,
|
||||
};
|
||||
|
||||
function SettingDataHosting(props: Props) {
|
||||
const { daemonSettings, setDaemonSetting, cleanBlobs, getDaemonStatus, isSetting } = props;
|
||||
const { daemonSettings, daemonStatus, setDaemonSetting, cleanBlobs, diskSpace, getDaemonStatus } = props;
|
||||
|
||||
const networkLimitSetting = daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] || 0;
|
||||
const [networkBlobSpaceLimitGB, setNetworkBlobSpaceLimit] = React.useState(
|
||||
networkLimitSetting ? String(networkLimitSetting / 1024) : 0
|
||||
const { disk_space: blobSpace } = daemonStatus;
|
||||
const contentSpaceUsed = Number(blobSpace.content_blobs_storage_used_mb);
|
||||
const blobLimitSetting = daemonSettings[DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB] || '0';
|
||||
const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState(
|
||||
blobLimitSetting ? String(blobLimitSetting / 1024) : '10'
|
||||
);
|
||||
const [applying, setApplying] = React.useState(false);
|
||||
|
||||
const networkSpaceUsed = Number(blobSpace.seed_blobs_storage_used_mb);
|
||||
const networkLimitSetting = daemonSettings[DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB] || '0';
|
||||
const [networkBlobSpaceLimitGB, setNetworkBlobSpaceLimit] = React.useState(
|
||||
networkLimitSetting ? String(networkLimitSetting / 1024) : '0'
|
||||
);
|
||||
|
||||
const [unlimited, setUnlimited] = React.useState(blobLimitSetting === '0');
|
||||
|
||||
React.useEffect(() => {
|
||||
getDaemonStatus();
|
||||
}, []);
|
||||
|
||||
function convertGbToMb(gb) {
|
||||
return Number(gb) * 1024;
|
||||
}
|
||||
|
||||
function handleContentLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
setContentBlobSpaceLimit('');
|
||||
} else if (gb === '0') {
|
||||
setContentBlobSpaceLimit('0.01'); // setting 0 means unlimited.
|
||||
} else {
|
||||
if (isTrulyANumber(Number(gb))) {
|
||||
setContentBlobSpaceLimit(gb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleNetworkLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
@@ -45,68 +98,109 @@ function SettingDataHosting(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeyDown(e) {
|
||||
if (e.keyCode === KEYCODES.ESCAPE) {
|
||||
e.preventDefault();
|
||||
setNetworkBlobSpaceLimit(String(networkLimitSetting / 1024));
|
||||
} else if (e.keyCode === KEYCODES.ENTER) {
|
||||
e.preventDefault();
|
||||
handleApply();
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
setApplying(true);
|
||||
if (unlimited) {
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, '0');
|
||||
} else {
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB,
|
||||
String(contentBlobSpaceLimitGB === '0.01' ? '1' : convertGbToMb(contentBlobSpaceLimitGB))
|
||||
);
|
||||
}
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.NETWORK_STORAGE_LIMIT_MB,
|
||||
String(convertGbToMbStr(Number(networkBlobSpaceLimitGB)))
|
||||
String(convertGbToMb(Number(networkBlobSpaceLimitGB)))
|
||||
);
|
||||
await cleanBlobs();
|
||||
getDaemonStatus();
|
||||
setApplying(false);
|
||||
}
|
||||
|
||||
function validHostingAmount(amountString) {
|
||||
const numberAmount = Number(amountString);
|
||||
return amountString.length && ((numberAmount && String(numberAmount)) || numberAmount === 0);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'fieldset-section'}>
|
||||
<FormField
|
||||
name="network_blob_limit_gb"
|
||||
type="number"
|
||||
label={__(`Automatic Hosting (GB)`)}
|
||||
disabled={!daemonSettings.save_blobs || isSetting}
|
||||
onKeyDown={handleKeyDown}
|
||||
inputButton={
|
||||
<>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
String(networkLimitSetting) === convertGbToMbStr(networkBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(networkBlobSpaceLimitGB)) ||
|
||||
isSetting ||
|
||||
!daemonSettings.save_blobs
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={handleApply}
|
||||
aria-label={__('Apply')}
|
||||
icon={ICONS.COMPLETE}
|
||||
/>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
String(networkLimitSetting) === convertGbToMbStr(networkBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(networkBlobSpaceLimitGB)) ||
|
||||
isSetting ||
|
||||
!daemonSettings.save_blobs
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={() => setNetworkBlobSpaceLimit(String(networkLimitSetting / 1024))}
|
||||
aria-label={__('Reset')}
|
||||
icon={ICONS.REMOVE}
|
||||
/>
|
||||
</>
|
||||
type="checkbox"
|
||||
name="save_blobs"
|
||||
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
|
||||
checked={daemonSettings.save_blobs}
|
||||
label={__('Enable Data Hosting')}
|
||||
helper={
|
||||
diskSpace && (
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
free: formatBytes(Number(diskSpace.free) * 1024, 0),
|
||||
total: formatBytes(Number(diskSpace.total) * 1024, 0),
|
||||
}}
|
||||
>
|
||||
%free% of %total% available
|
||||
</I18nMessage>
|
||||
)
|
||||
}
|
||||
onChange={(e) => handleNetworkLimitChange(e.target.value)}
|
||||
value={networkBlobSpaceLimitGB}
|
||||
/>
|
||||
</div>
|
||||
{daemonSettings.save_blobs && (
|
||||
<div className={'fieldset-section'}>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="no_hosting_limit"
|
||||
checked={unlimited}
|
||||
label={__('Unlimited View Hosting')}
|
||||
onChange={() => setUnlimited(true)}
|
||||
/>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="set_hosting_limit"
|
||||
checked={!unlimited}
|
||||
onChange={() => setUnlimited(false)}
|
||||
label={__('Choose View Hosting Limit')}
|
||||
/>
|
||||
{!unlimited && (
|
||||
<FormField
|
||||
name="content_blob_limit_gb"
|
||||
type="number"
|
||||
min={0}
|
||||
onWheel={(e) => e.preventDefault()}
|
||||
label={__(`View Hosting Limit (GB)`)}
|
||||
onChange={(e) => handleContentLimitChange(e.target.value)}
|
||||
value={Number(contentBlobSpaceLimitGB) <= Number('0.01') ? '0' : contentBlobSpaceLimitGB}
|
||||
/>
|
||||
)}
|
||||
<div className={'help'}>{`Currently using ${formatBytes(contentSpaceUsed * BYTES_PER_MB)}`}</div>
|
||||
</div>
|
||||
)}
|
||||
{daemonSettings.save_blobs && ENABLE_AUTOMATIC_HOSTING && (
|
||||
<fieldset-section>
|
||||
<FormField
|
||||
name="network_blob_limit_gb"
|
||||
type="number"
|
||||
label={__(`Automatic Hosting (GB)`)}
|
||||
onChange={(e) => handleNetworkLimitChange(e.target.value)}
|
||||
value={networkBlobSpaceLimitGB}
|
||||
/>
|
||||
<div className={'help'}>{`Auto-hosting ${formatBytes(networkSpaceUsed * BYTES_PER_MB)}`}</div>
|
||||
</fieldset-section>
|
||||
)}
|
||||
<div className={'card__actions'}>
|
||||
<Button
|
||||
disabled={
|
||||
(unlimited && blobLimitSetting === '0') ||
|
||||
(!unlimited &&
|
||||
(blobLimitSetting === convertGbToMb(contentBlobSpaceLimitGB) || // &&
|
||||
// networkLimitSetting === convertGbToMb(networkBlobSpaceLimitGB)
|
||||
!validHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
applying
|
||||
}
|
||||
type="button"
|
||||
button="primary"
|
||||
onClick={handleApply}
|
||||
label={__('Apply')}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus } from 'redux/actions/settings';
|
||||
import { selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingWalletServer from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingWalletServer);
|
||||
@@ -1,34 +0,0 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type DaemonSettings = {
|
||||
save_blobs: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
daemonSettings: DaemonSettings,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
};
|
||||
|
||||
function SettingDataHosting(props: Props) {
|
||||
const { daemonSettings, setDaemonSetting } = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="save_blobs"
|
||||
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
|
||||
checked={daemonSettings.save_blobs}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingDataHosting;
|
||||
@@ -1,25 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doWalletStatus } from 'redux/actions/wallet';
|
||||
import { doClearCache } from 'redux/actions/app';
|
||||
import { doSetDaemonSetting, doClearDaemonSetting, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectDaemonSettings, selectDaemonStatus, selectSettingDaemonSettings } from 'redux/selectors/settings';
|
||||
|
||||
import SettingStorage from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
daemonStatus: selectDaemonStatus(state),
|
||||
isSetting: selectSettingDaemonSettings(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
clearDaemonSetting: (key) => dispatch(doClearDaemonSetting(key)),
|
||||
clearCache: () => dispatch(doClearCache()),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs()),
|
||||
updateWalletStatus: () => dispatch(doWalletStatus()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingStorage);
|
||||
@@ -1,94 +0,0 @@
|
||||
// @flow
|
||||
import { SETTINGS_GRP } from 'constants/settings';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import SettingDataHosting from 'component/settingDataHosting';
|
||||
import SettingViewHosting from 'component/settingViewHosting';
|
||||
import SettingSaveBlobs from 'component/settingSaveBlobs';
|
||||
import SettingsRow from 'component/settingsRow';
|
||||
import AppStorageViz from 'component/appStorageVisualization';
|
||||
import Spinner from 'component/spinner';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type DaemonSettings = {
|
||||
save_blobs: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
daemonSettings: DaemonSettings,
|
||||
isSetting: boolean,
|
||||
isWelcome?: boolean,
|
||||
cleanBlobs: () => Promise<any>,
|
||||
};
|
||||
|
||||
export default function SettingStorage(props: Props) {
|
||||
const { daemonSettings, isSetting, isWelcome, cleanBlobs } = props;
|
||||
|
||||
const saveBlobs = daemonSettings && daemonSettings.save_blobs;
|
||||
const [isCleaning, setCleaning] = React.useState(false);
|
||||
|
||||
// currently, it seems, blob space statistics are only updated during clean
|
||||
React.useEffect(() => {
|
||||
setCleaning(true);
|
||||
cleanBlobs().then(() => {
|
||||
setCleaning(false);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="card__title-section">
|
||||
<h2 className={classnames('card__title', { 'section__title--large': isWelcome })}>
|
||||
{isWelcome ? __('Custom Hosting') : __('Hosting')}
|
||||
{(isSetting || isCleaning) && <Spinner type={'small'} />}
|
||||
</h2>
|
||||
</div>
|
||||
<Card
|
||||
id={SETTINGS_GRP.STORAGE}
|
||||
isBodyList
|
||||
body={
|
||||
<>
|
||||
<SettingsRow
|
||||
title={__('Enable Data Hosting')}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Help improve the P2P data network (and make LBRY users happy) by hosting data.')}
|
||||
</React.Fragment>
|
||||
}
|
||||
footer={<AppStorageViz />}
|
||||
>
|
||||
<SettingSaveBlobs />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Viewed Hosting')}
|
||||
multirow
|
||||
disabled={!saveBlobs}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__("View History Hosting lets you choose how much storage to use hosting content you've consumed.")}{' '}
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
<SettingViewHosting disabled={!saveBlobs} />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Auto Hosting')}
|
||||
multirow
|
||||
disabled={!saveBlobs}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Automatic Hosting downloads a small portion of content active on the network.')}{' '}
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
<SettingDataHosting />
|
||||
</SettingsRow>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -6,13 +6,12 @@ import {
|
||||
doNotifyDecryptWallet,
|
||||
doNotifyEncryptWallet,
|
||||
doNotifyForgetPassword,
|
||||
doOpenModal,
|
||||
doToggle3PAnalytics,
|
||||
} from 'redux/actions/app';
|
||||
import { doSetDaemonSetting, doClearDaemonSetting, doFindFFmpeg } from 'redux/actions/settings';
|
||||
import { selectAllowAnalytics } from 'redux/selectors/app';
|
||||
import { selectDaemonSettings, selectFfmpegStatus, selectFindingFFmpeg } from 'redux/selectors/settings';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user'; // here
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
|
||||
import SettingSystem from './view';
|
||||
|
||||
@@ -26,7 +25,6 @@ const select = (state) => ({
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
clearDaemonSetting: (key) => dispatch(doClearDaemonSetting(key)),
|
||||
clearCache: () => dispatch(doClearCache()),
|
||||
|
||||
@@ -10,6 +10,7 @@ import I18nMessage from 'component/i18nMessage';
|
||||
import SettingAutoLaunch from 'component/settingAutoLaunch';
|
||||
import SettingClosingBehavior from 'component/settingClosingBehavior';
|
||||
import SettingCommentsServer from 'component/settingCommentsServer';
|
||||
import SettingDataHosting from 'component/settingDataHosting';
|
||||
import SettingShareUrl from 'component/settingShareUrl';
|
||||
import SettingsRow from 'component/settingsRow';
|
||||
import SettingWalletServer from 'component/settingWalletServer';
|
||||
@@ -18,7 +19,6 @@ import { getPasswordFromCookie } from 'util/saved-passwords';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import SettingEnablePrereleases from 'component/settingEnablePrereleases';
|
||||
import SettingDisableAutoUpdates from 'component/settingDisableAutoUpdates';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
|
||||
const IS_MAC = process.platform === 'darwin';
|
||||
|
||||
@@ -57,7 +57,6 @@ type Props = {
|
||||
updateWalletStatus: () => void,
|
||||
confirmForgetPassword: ({}) => void,
|
||||
toggle3PAnalytics: (boolean) => void,
|
||||
openModal: (string, any) => void,
|
||||
};
|
||||
|
||||
export default function SettingSystem(props: Props) {
|
||||
@@ -77,7 +76,6 @@ export default function SettingSystem(props: Props) {
|
||||
updateWalletStatus,
|
||||
confirmForgetPassword,
|
||||
toggle3PAnalytics,
|
||||
openModal,
|
||||
} = props;
|
||||
|
||||
const [clearingCache, setClearingCache] = React.useState(false);
|
||||
@@ -153,6 +151,24 @@ export default function SettingSystem(props: Props) {
|
||||
checked={daemonSettings.save_files}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Data Hosting')}
|
||||
multirow
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{__('Help improve the P2P data network (and make LBRY happy) by hosting data.')}{' '}
|
||||
{__("View History Hosting lets you choose how much storage to use helping content you've consumed.")}{' '}
|
||||
{/* {__( */}
|
||||
{/* 'Automatic Hosting lets you delegate some amount of storage for the network to automatically download and host.' */}
|
||||
{/* )}{' '} */}
|
||||
{__('Playing videos may exceed your history hosting limit until cleanup runs every 30 minutes.')}
|
||||
<br />
|
||||
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />
|
||||
</React.Fragment>
|
||||
}
|
||||
>
|
||||
<SettingDataHosting />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Share usage and diagnostic data')}
|
||||
subtitle={
|
||||
@@ -379,20 +395,6 @@ export default function SettingSystem(props: Props) {
|
||||
<SettingsRow title={__('Share url')} multirow>
|
||||
<SettingShareUrl />
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Export Wallet')}
|
||||
subtitle={__('Export encrypted sync data for import in another app.')}
|
||||
>
|
||||
<Button
|
||||
button="primary"
|
||||
className="expandable__button"
|
||||
label={__('Export')}
|
||||
aria-label={__('Export wallet')}
|
||||
onClick={() => {
|
||||
openModal(MODALS.WALLET_EXPORT, {});
|
||||
}}
|
||||
/>
|
||||
</SettingsRow>
|
||||
<SettingsRow
|
||||
title={__('Clear application cache')}
|
||||
subtitle={__('This might fix issues that you are having. Your wallet will not be affected.')}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting, doGetDaemonStatus, doCleanBlobs } from 'redux/actions/settings';
|
||||
import { selectViewHostingLimit, selectViewBlobSpace, selectSettingDaemonSettings } from 'redux/selectors/settings';
|
||||
import SettingViewHosting from './view';
|
||||
import { selectDiskSpace } from 'redux/selectors/app';
|
||||
|
||||
const select = (state) => ({
|
||||
viewHostingLimit: selectViewHostingLimit(state),
|
||||
viewBlobSpace: selectViewBlobSpace(state),
|
||||
diskSpace: selectDiskSpace(state),
|
||||
isSetting: selectSettingDaemonSettings(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
getDaemonStatus: () => dispatch(doGetDaemonStatus()),
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
cleanBlobs: () => dispatch(doCleanBlobs(false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingViewHosting);
|
||||
@@ -1,182 +0,0 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Button from 'component/button';
|
||||
import * as DAEMON_SETTINGS from 'constants/daemon_settings';
|
||||
import { isTrulyANumber } from 'util/number';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import { convertGbToMbStr, isValidHostingAmount } from 'util/hosting';
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number;
|
||||
|
||||
type Props = {
|
||||
// --- select ---
|
||||
viewBlobSpace: number,
|
||||
viewHostingLimit: number,
|
||||
disabled?: boolean,
|
||||
isSetting: boolean,
|
||||
// --- perform ---
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
cleanBlobs: () => string,
|
||||
getDaemonStatus: () => void,
|
||||
diskSpace: DiskSpace,
|
||||
};
|
||||
|
||||
const TWENTY_PERCENT = 0.2;
|
||||
const TEN_PERCENT = 0.1;
|
||||
const MINIMUM_VIEW_SETTING = '0.01';
|
||||
|
||||
function SettingViewHosting(props: Props) {
|
||||
const {
|
||||
diskSpace,
|
||||
viewHostingLimit,
|
||||
viewBlobSpace,
|
||||
setDaemonSetting,
|
||||
cleanBlobs,
|
||||
getDaemonStatus,
|
||||
disabled,
|
||||
isSetting,
|
||||
} = props;
|
||||
|
||||
// best effort to recommend a hosting amount default for the user
|
||||
const totalMB = diskSpace && Math.floor(diskSpace.total / 1024);
|
||||
const freeMB = diskSpace && Math.floor(diskSpace.free / 1024);
|
||||
const getGB = (val) => (Number(val) / 1024).toFixed(2);
|
||||
const recommendedSpace =
|
||||
freeMB > totalMB * TWENTY_PERCENT // plenty of space?
|
||||
? Math.ceil(Number(getGB(totalMB * TEN_PERCENT))) // 10% of total
|
||||
: Math.ceil(Number(getGB(viewBlobSpace))); // current amount to avoid deleting
|
||||
// daemon settings come in as 'number', but we manage them as 'String'.
|
||||
const [contentBlobSpaceLimitGB, setContentBlobSpaceLimit] = React.useState(
|
||||
viewHostingLimit === 0 ? String(recommendedSpace) : String(viewHostingLimit / 1024)
|
||||
);
|
||||
|
||||
const [unlimited, setUnlimited] = React.useState(viewHostingLimit === 0);
|
||||
|
||||
function handleContentLimitChange(gb) {
|
||||
if (gb === '') {
|
||||
setContentBlobSpaceLimit('');
|
||||
} else if (gb === '0') {
|
||||
setContentBlobSpaceLimit(MINIMUM_VIEW_SETTING); // setting 0 means unlimited.
|
||||
} else {
|
||||
if (isTrulyANumber(Number(gb))) {
|
||||
setContentBlobSpaceLimit(gb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getContentLimitValue() {
|
||||
if (contentBlobSpaceLimitGB === '') {
|
||||
return '';
|
||||
} else if (Number(contentBlobSpaceLimitGB) <= Number(MINIMUM_VIEW_SETTING)) {
|
||||
return '0';
|
||||
} else {
|
||||
return contentBlobSpaceLimitGB;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApply() {
|
||||
if (unlimited) {
|
||||
await setDaemonSetting(DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB, '0');
|
||||
} else {
|
||||
await setDaemonSetting(
|
||||
DAEMON_SETTINGS.BLOB_STORAGE_LIMIT_MB,
|
||||
contentBlobSpaceLimitGB === MINIMUM_VIEW_SETTING ? '1' : convertGbToMbStr(contentBlobSpaceLimitGB)
|
||||
);
|
||||
}
|
||||
await cleanBlobs();
|
||||
getDaemonStatus();
|
||||
}
|
||||
|
||||
function handleKeyDown(e) {
|
||||
if (e.keyCode === KEYCODES.ESCAPE) {
|
||||
e.preventDefault();
|
||||
setContentBlobSpaceLimit(String(viewHostingLimit / 1024));
|
||||
} else if (e.keyCode === KEYCODES.ENTER) {
|
||||
e.preventDefault();
|
||||
handleApply();
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
// basically handle setUnlimited
|
||||
if (unlimited && viewHostingLimit !== 0) {
|
||||
handleApply();
|
||||
}
|
||||
}, [unlimited, viewHostingLimit]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={'fieldset-section'}>
|
||||
<FormField
|
||||
type="checkbox"
|
||||
name="hosting_limit"
|
||||
checked={unlimited}
|
||||
disabled={disabled || isSetting}
|
||||
label={__('Unlimited View Hosting')}
|
||||
onChange={() => setUnlimited(!unlimited)}
|
||||
/>
|
||||
<FormField
|
||||
name="content_blob_limit_gb"
|
||||
type="number"
|
||||
min={0}
|
||||
onKeyDown={handleKeyDown}
|
||||
inputButton={
|
||||
<>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
(viewHostingLimit === 1 && contentBlobSpaceLimitGB <= MINIMUM_VIEW_SETTING) ||
|
||||
(unlimited && viewHostingLimit === 0) ||
|
||||
(!unlimited &&
|
||||
(String(viewHostingLimit) === convertGbToMbStr(contentBlobSpaceLimitGB) ||
|
||||
!isValidHostingAmount(String(contentBlobSpaceLimitGB)))) ||
|
||||
(!unlimited &&
|
||||
String(viewHostingLimit) ===
|
||||
convertGbToMbStr(
|
||||
contentBlobSpaceLimitGB || !isValidHostingAmount(String(contentBlobSpaceLimitGB))
|
||||
)) ||
|
||||
isSetting ||
|
||||
disabled
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={handleApply}
|
||||
aria-label={__('Apply')}
|
||||
icon={ICONS.COMPLETE}
|
||||
/>
|
||||
<Button
|
||||
disabled={
|
||||
// disabled if settings are equal or not valid amounts
|
||||
(viewHostingLimit === 1 && contentBlobSpaceLimitGB <= MINIMUM_VIEW_SETTING) ||
|
||||
(unlimited && viewHostingLimit === 0) ||
|
||||
(!unlimited &&
|
||||
String(viewHostingLimit) ===
|
||||
convertGbToMbStr(
|
||||
contentBlobSpaceLimitGB || !isValidHostingAmount(String(contentBlobSpaceLimitGB))
|
||||
)) ||
|
||||
isSetting ||
|
||||
disabled
|
||||
}
|
||||
type="button"
|
||||
button="alt"
|
||||
onClick={() => setContentBlobSpaceLimit(String(viewHostingLimit / 1024))}
|
||||
aria-label={__('Reset')}
|
||||
icon={ICONS.REMOVE}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
disabled={isSetting || disabled || unlimited}
|
||||
onWheel={(e) => e.preventDefault()}
|
||||
label={__(`View Hosting Limit (GB)`)}
|
||||
onChange={(e) => handleContentLimitChange(e.target.value)}
|
||||
value={getContentLimitValue()}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingViewHosting;
|
||||
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user