Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f23add605 |
No files matched your search
+2
-12
@@ -11,15 +11,12 @@ WEB_SERVER_PORT=1337
|
||||
LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
COMMENT_SERVER_NAME=Odysee
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
COMMENT_SERVER_API=https://comments.lbry.com/api/v2
|
||||
THUMBNAIL_CDN_URL=https://image-processor.vanwanet.com/optimize/
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# STRIPE
|
||||
# STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
|
||||
# Analytics
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
@@ -40,9 +37,6 @@ SITE_NAME=lbry.tv
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
SITE_HELP_EMAIL=help@lbry.com
|
||||
LOGO_TITLE=lbry.tv
|
||||
## Social media
|
||||
TWITTER_ACCOUNT=LBRYcom
|
||||
BRANDED_SITE=odysee
|
||||
|
||||
## IMAGE ASSETS
|
||||
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
@@ -52,7 +46,6 @@ YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649
|
||||
#LOGO_TEXT_LIGHT=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#LOGO_TEXT_DARK=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#AVATAR_DEFAULT=
|
||||
#MISSING_THUMB_DEFAULT=
|
||||
#FAVICON=
|
||||
|
||||
# LOCALE
|
||||
@@ -75,7 +68,6 @@ AUTO_FOLLOW_CHANNELS=lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a
|
||||
|
||||
## FEATURES AND LIMITS
|
||||
SIMPLE_SITE=false
|
||||
#BRANDED_SITE
|
||||
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=false
|
||||
@@ -111,5 +103,3 @@ ENABLE_UI_NOTIFICATIONS=false
|
||||
#IMAGES_ENABLED=true
|
||||
#FILES_ENABLED=true
|
||||
#MODELS_ENABLED=true
|
||||
|
||||
BRANDED_SITE=odysee
|
||||
@@ -1,39 +1,4 @@
|
||||
## Fixes
|
||||
|
||||
Issue Number:
|
||||
|
||||
<!-- Tip:
|
||||
- Add keywords to directly close the Issue when the PR is merged.
|
||||
- Skip the keyword if the Issue contains multiple items.
|
||||
- https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
|
||||
-->
|
||||
|
||||
## What is the current behavior?
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
## Other information
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->
|
||||
|
||||
## PR Type & Checklist
|
||||
|
||||
<details><summary>PR Type...</summary>
|
||||
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update (formatting)
|
||||
- [ ] Refactoring (no functional changes)
|
||||
- [ ] Documentation changes
|
||||
- [ ] Other - Please describe:
|
||||
|
||||
</details>
|
||||
|
||||
<!---------------------------------------------------------------------------->
|
||||
|
||||
<details><summary>PR Checklist...</summary>
|
||||
## PR Checklist
|
||||
|
||||
<!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" -->
|
||||
|
||||
@@ -44,4 +9,25 @@ Please check all that apply to this PR using "x":
|
||||
- [ ] I have checked that this PR does not introduce a breaking change
|
||||
- [ ] This PR introduces breaking changes and I have provided a detailed explanation below
|
||||
|
||||
</details>
|
||||
## PR Type
|
||||
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
- [ ] Bugfix
|
||||
- [ ] Feature
|
||||
- [ ] Code style update (formatting)
|
||||
- [ ] Refactoring (no functional changes)
|
||||
- [ ] Documentation changes
|
||||
- [ ] Other - Please describe:
|
||||
|
||||
## Fixes
|
||||
|
||||
Issue Number:
|
||||
|
||||
## What is the current behavior?
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
## Other information
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and solution strategy for existing applications below. -->
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"ui/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"web/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"web/**/*.{js,jsx}": ["eslint", "git add"]
|
||||
"web/**/*.{js,jsx,scss}": ["eslint", "git add"]
|
||||
},
|
||||
"ignore": ["node_modules", "web/dist/**/*", "dist/**/*", "package-lock.json"]
|
||||
}
|
||||
+1
-22
@@ -3,43 +3,22 @@
|
||||
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.51.2] - [2021-08-20]
|
||||
## [Unreleased for Desktop]
|
||||
|
||||
### Added
|
||||
- Show currently active playing item on playlist _community pr!_ ([#6453](https://github.com/lbryio/lbry-desktop/pull/6453))
|
||||
- Add watch later to hover action for last used playlist on popup _community pr!_ ([#6274](https://github.com/lbryio/lbry-desktop/pull/6274))
|
||||
- Add confirmation on comment removal _community pr!_ ([#6563](https://github.com/lbryio/lbry-desktop/pull/6563))
|
||||
- Show on content page if a file is part of a playlist already _community pr!_([#6393](https://github.com/lbryio/lbry-desktop/pull/6393))
|
||||
- Add filtering to playlists ([#6905](https://github.com/lbryio/lbry-desktop/pull/6905))
|
||||
|
||||
### Changed
|
||||
- Use Canonical Url for copy link ([#6500](https://github.com/lbryio/lbry-desktop/pull/6500))
|
||||
- Use better icon for copy link ([#6485](https://github.com/lbryio/lbry-desktop/pull/6485))
|
||||
- Comments load paginated ([#6390](https://github.com/lbryio/lbry-desktop/pull/6390))
|
||||
- Improve twitter share _community pr!_ ([#6690](https://github.com/lbryio/lbry-desktop/pull/6690))
|
||||
- Update lighthouse search api _community pr!_ ([#6731](https://github.com/lbryio/lbry-desktop/pull/6731))
|
||||
- Update sockety api _community pr!_ ([#6747](https://github.com/lbryio/lbry-desktop/pull/6747))
|
||||
- Use resolve for OG metadata instead of chainquery _community pr!_ ([#6787](https://github.com/lbryio/lbry-desktop/pull/6787))
|
||||
- Improved clickability of notification links _community pr!_ ([#6711](https://github.com/lbryio/lbry-desktop/pull/6711))
|
||||
|
||||
### Fixed
|
||||
- App now supports '#' and ':' for claimId separator ([#6496](https://github.com/lbryio/lbry-desktop/pull/6496))
|
||||
- Fix "exact match" being applied to Recommended ([#6460](https://github.com/lbryio/lbry-desktop/pull/6460))
|
||||
- Fix upload button on creator analytics _community pr!_ ([#6458](https://github.com/lbryio/lbry-desktop/pull/6458))
|
||||
- Prevent sidebar shortcut activation on textarea _community pr!_ ([#6454](https://github.com/lbryio/lbry-desktop/pull/6454))
|
||||
- Improve accessibility and some minor css fixes _community pr!_ ([#6470](https:/github.com/lbryio/lbry-desktop/pull/6470))
|
||||
- Fix drag / drop publish issues for web users _community pr!_ ([#6466](https://github.com/lbryio/lbry-desktop/pull/6466))
|
||||
- Fix yarn copyenv on windows _community pr!_ ([#6702](https://github.com/lbryio/lbry-desktop/pull/6702))
|
||||
- Fix unnecessary livestream api calls in channel page _community pr!_ ([#6652](https://github.com/lbryio/lbry-desktop/pull/6652))
|
||||
- Fix desktop app fails to resolve deep links _community pr!_ ([#6779](https://github.com/lbryio/lbry-desktop/pull/6779))
|
||||
- Fix wrong release date on GoogleVideo metadata _community pr!_ ([#6787](https://github.com/lbryio/lbry-desktop/pull/6787))
|
||||
- Fix markdown line breaking mid word _community pr!_ ([#6805](https://github.com/lbryio/lbry-desktop/pull/6805))
|
||||
- Added \ and = to reserved symbol warning _community pr!_ ([#6733](https://github.com/lbryio/lbry-desktop/pull/6733))
|
||||
- Don't break words in chat + fix text overflow past 3 dot menu _community pr!_ ([#6602](https://github.com/lbryio/lbry-desktop/pull/6602))
|
||||
- Fix embed shows wrong OG metadata _community pr!_ ([#6815](https://github.com/lbryio/lbry-desktop/pull/6815))
|
||||
- Fix OG: "Unparsable data structure - Truncated Unicode character" _community pr!_ ([#6839](https://github.com/lbryio/lbry-desktop/pull/6839))
|
||||
- Fix Paid embed warning overlay redirection button now links to odysee _community pr!_ ([#6819](https://github.com/lbryio/lbry-desktop/pull/6819))
|
||||
- Fix comment section redirection to create channel _community pr!_ ([#6557](https://github.com/lbryio/lbry-desktop/pull/6557))
|
||||
|
||||
## [0.51.1] - [2021-06-26]
|
||||
|
||||
|
||||
@@ -13,10 +13,7 @@ const config = {
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, //api.lbry.com',
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
COMMENT_SERVER_NAME: process.env.COMMENT_SERVER_NAME,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
@@ -26,8 +23,6 @@ const config = {
|
||||
SITE_NAME: process.env.SITE_NAME,
|
||||
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
|
||||
SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL,
|
||||
// SOCIAL MEDIA
|
||||
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
|
||||
// LOGO
|
||||
LOGO_TITLE: process.env.LOGO_TITLE,
|
||||
FAVICON: process.env.FAVICON,
|
||||
@@ -35,7 +30,6 @@ const config = {
|
||||
LOGO_TEXT_LIGHT: process.env.LOGO_TEXT_LIGHT,
|
||||
LOGO_TEXT_DARK: process.env.LOGO_TEXT_DARK,
|
||||
AVATAR_DEFAULT: process.env.AVATAR_DEFAULT,
|
||||
MISSING_THUMB_DEFAULT: process.env.MISSING_THUMB_DEFAULT,
|
||||
// OG
|
||||
OG_TITLE_SUFFIX: process.env.OG_TITLE_SUFFIX,
|
||||
OG_HOMEPAGE_TITLE: process.env.OG_HOMEPAGE_TITLE,
|
||||
@@ -75,7 +69,7 @@ const config = {
|
||||
BRANDED_SITE: process.env.BRANDED_SITE,
|
||||
};
|
||||
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
|
||||
module.exports = config;
|
||||
+5
-17
@@ -45,15 +45,9 @@ let daemon;
|
||||
let lbryFirst;
|
||||
|
||||
const appState = {};
|
||||
const PROTOCOL = 'lbry';
|
||||
|
||||
if (isDev && process.platform === 'win32') {
|
||||
// Setting this is required to get this working in dev mode.
|
||||
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [
|
||||
path.resolve(process.argv[1]),
|
||||
]);
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL);
|
||||
if (process.platform !== 'linux') {
|
||||
app.setAsDefaultProtocolClient('lbry');
|
||||
}
|
||||
|
||||
app.name = 'LBRY';
|
||||
@@ -155,15 +149,9 @@ if (!gotSingleInstanceLock) {
|
||||
app.on('second-instance', (event, argv) => {
|
||||
// Send the url to the app to navigate first, then focus
|
||||
if (rendererWindow) {
|
||||
// External uri (last item on argv):
|
||||
const EXTERNAL_URI = (argv.length) ? argv[argv.length - 1] : '';
|
||||
// Handle protocol requests for windows and linux
|
||||
const platforms = (process.platform === 'win32' || process.platform === 'linux');
|
||||
// Is LBRY protocol
|
||||
const isProtocolURI = String(EXTERNAL_URI).startsWith(PROTOCOL + '://');
|
||||
// External protocol requested:
|
||||
if (platforms && isProtocolURI) {
|
||||
let URI = EXTERNAL_URI;
|
||||
if ((process.platform === 'win32' || process.platform === 'linux') && String(argv[1]).startsWith('lbry')) {
|
||||
let URI = argv[1];
|
||||
|
||||
// Keep only command line / deep linked arguments
|
||||
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
||||
// restore the original URI that was typed.
|
||||
|
||||
Vendored
+4
-17
@@ -14,9 +14,6 @@ declare type Comment = {
|
||||
is_pinned: boolean,
|
||||
support_amount: number,
|
||||
replies: number, // number of direct replies (i.e. excluding nested replies).
|
||||
is_moderator: boolean,
|
||||
is_creator: boolean,
|
||||
is_global_mod: boolean,
|
||||
is_fiat?: boolean,
|
||||
};
|
||||
|
||||
@@ -41,7 +38,6 @@ declare type CommentsState = {
|
||||
topLevelTotalCommentsById: { [string]: number }, // ClaimID -> total top level comments in commentron.
|
||||
commentById: { [string]: Comment },
|
||||
linkedCommentAncestors: { [string]: Array<string> }, // {"linkedCommentId": ["parentId", "grandParentId", ...]}
|
||||
pinnedCommentsById: {}, // ClaimId -> array of pinned comment IDs
|
||||
isLoading: boolean,
|
||||
isLoadingByParentId: { [string]: boolean },
|
||||
myComments: ?Set<string>,
|
||||
@@ -61,6 +57,7 @@ declare type CommentsState = {
|
||||
blockingByUri: {},
|
||||
unBlockingByUri: {},
|
||||
togglingForDelegatorMap: {[string]: Array<string>}, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
commentsDisabledChannelIds: Array<string>,
|
||||
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
||||
fetchingSettings: boolean,
|
||||
fetchingBlockedWords: boolean,
|
||||
@@ -224,20 +221,10 @@ declare type ModerationAmIParams = {
|
||||
};
|
||||
|
||||
declare type SettingsParams = {
|
||||
channel_name?: string,
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature?: string,
|
||||
signing_ts?: string,
|
||||
};
|
||||
|
||||
declare type SettingsResponse = {
|
||||
words?: string,
|
||||
comments_enabled: boolean,
|
||||
min_tip_amount_comment: number,
|
||||
min_tip_amount_super_chat: number,
|
||||
slow_mode_min_gap: number,
|
||||
curse_jar_amount: number,
|
||||
filters_enabled?: boolean,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type UpdateSettingsParams = {
|
||||
|
||||
Vendored
+1
-2
@@ -28,7 +28,7 @@ declare type SearchOptions = {
|
||||
|
||||
declare type SearchState = {
|
||||
options: SearchOptions,
|
||||
resultsByQuery: {},
|
||||
urisByQuery: {},
|
||||
hasReachedMaxResultsLength: {},
|
||||
searching: boolean,
|
||||
};
|
||||
@@ -40,7 +40,6 @@ declare type SearchSuccess = {
|
||||
from: number,
|
||||
size: number,
|
||||
uris: Array<string>,
|
||||
recsys: string,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+6
-9
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.51.2",
|
||||
"version": "0.51.1",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -24,7 +24,7 @@
|
||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
||||
"copyenv": "copyfiles ./.env* web/",
|
||||
"copyenv": "cp ./.env* web/",
|
||||
"dev": "yarn dev:electron",
|
||||
"dev:electron": "cross-env NODE_ENV=development node ./electron/devServer.js",
|
||||
"dev:web": "yarn copyenv && cd web && yarn dev",
|
||||
@@ -38,7 +38,7 @@
|
||||
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
|
||||
"crossenv": "./node_modules/cross-env/dist/bin/cross-env",
|
||||
"lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'web/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow",
|
||||
"lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'web/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'",
|
||||
"lint-fix": "eslint --fix 'ui/**/*.{js,jsx}' && eslint --fix 'web/**/*.{js,jsx}' && eslint --fix 'electron/**/*.js' && flow",
|
||||
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
|
||||
"flow-defs": "flow-typed install",
|
||||
"precommit": "lint-staged",
|
||||
@@ -48,20 +48,18 @@
|
||||
"postinstall:warning": "echo '\n\nWARNING\n\nNot all node modules were installed because NODE_ENV is set to \"production\".\nThis should only be set after installing dependencies with \"yarn\". The app will not work.\n\n'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-keycloak/web": "^3.4.0",
|
||||
"auto-launch": "^5.0.5",
|
||||
"electron-dl": "^1.11.0",
|
||||
"electron-log": "^2.2.12",
|
||||
"electron-notarize": "^1.0.0",
|
||||
"electron-updater": "^4.2.4",
|
||||
"express": "^4.17.1",
|
||||
"feed": "^4.2.2",
|
||||
"if-env": "^1.0.4",
|
||||
"keycloak-js": "^15.0.2",
|
||||
"react-datetime-picker": "^3.2.1",
|
||||
"react-plastic": "^1.1.1",
|
||||
"react-top-loading-bar": "^2.0.1",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"tempy": "^0.6.0",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
@@ -109,7 +107,6 @@
|
||||
"concurrently": "^4.1.2",
|
||||
"connected-react-router": "^6.8.0",
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"copyfiles": "^2.4.1",
|
||||
"country-data": "^0.0.31",
|
||||
"cross-env": "^7.0.3",
|
||||
"crypto-js": "^4.0.0",
|
||||
@@ -154,8 +151,8 @@
|
||||
"imagesloaded": "^4.1.4",
|
||||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#372e559caee6af2b2d927e5d42419a71c3d15b57",
|
||||
"lbryinc": "lbryio/lbryinc#eefac4af0dd539b8e7dd7b193fd664e426948cb4",
|
||||
"lbry-redux": "lbryio/lbry-redux#a327385cdf71568dbd15a17f3dcf5f4b83e0966d",
|
||||
"lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
"lodash-es": "^4.17.14",
|
||||
|
||||
+11
-52
@@ -209,7 +209,6 @@
|
||||
"Your comment": "Your comment",
|
||||
"Post --[button to submit something]--": "Post",
|
||||
"Post --[noun, markdown post tab button]--": "Post",
|
||||
"Livestream --[noun, livestream tab button]--": "Livestream",
|
||||
"Posting...": "Posting...",
|
||||
"Incompatible daemon": "Incompatible daemon",
|
||||
"Incompatible daemon running": "Incompatible daemon running",
|
||||
@@ -378,6 +377,8 @@
|
||||
"Unfollow": "Unfollow",
|
||||
"Follow @%channelName%": "Follow @%channelName%",
|
||||
"Unfollow @%channelName%": "Unfollow @%channelName%",
|
||||
"Item removed from %name%": "Item removed from %name%",
|
||||
"Item added to %name%": "Item added to %name%",
|
||||
"These LBRY Credits remain yours. It is a deposit to reserve the name and can be undone at any time.": "These LBRY Credits remain yours. It is a deposit to reserve the name and can be undone at any time.",
|
||||
"Create channel": "Create channel",
|
||||
"Uh oh. The flux in our Retro Encabulator must be out of whack. Try refreshing to fix it.": "Uh oh. The flux in our Retro Encabulator must be out of whack. Try refreshing to fix it.",
|
||||
@@ -1186,7 +1187,6 @@
|
||||
"Edit existing claim instead": "Edit existing claim instead",
|
||||
"You already have a claim at %existing_uri%. Publishing will update (overwrite) your existing claim.": "You already have a claim at %existing_uri%. Publishing will update (overwrite) your existing claim.",
|
||||
"Save": "Save",
|
||||
"Saved": "Saved",
|
||||
"Saving...": "Saving...",
|
||||
"Downloading update": "Downloading update",
|
||||
"complete": "complete",
|
||||
@@ -1449,14 +1449,13 @@
|
||||
"Best": "Best",
|
||||
"Controversial": "Controversial",
|
||||
"Show Replies": "Show Replies",
|
||||
"Hide replies": "Hide replies",
|
||||
"Unable to create comment, please try again later.": "Unable to create comment, please try again later.",
|
||||
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
|
||||
"Unable to comment. Your channel has been blocked by an admin.": "Unable to comment. Your channel has been blocked by an admin.",
|
||||
"Unable to comment. The content owner has disabled comments.": "Unable to comment. The content owner has disabled comments.",
|
||||
"Please do not spam.": "Please do not spam.",
|
||||
"Slow mode is on. Please wait up to %1% seconds before commenting again.": "Slow mode is on. Please wait up to %1% seconds before commenting again.",
|
||||
"The comment contains contents that are blocked by %1%.": "The comment contains contents that are blocked by %1%.",
|
||||
"Your user name \"%1%\" is too close to the creator's user name \"%2%\" and may cause confusion. Please use another identity.": "Your user name \"%1%\" is too close to the creator's user name \"%2%\" and may cause confusion. Please use another identity.",
|
||||
"Slow mode is on. Please wait up to %value% seconds before commenting again.": "Slow mode is on. Please wait up to %value% seconds before commenting again.",
|
||||
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
|
||||
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
|
||||
"Unable to delete this comment, please try again later.": "Unable to delete this comment, please try again later.",
|
||||
"Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.",
|
||||
@@ -1620,7 +1619,7 @@
|
||||
"No Reposts Found": "No Reposts Found",
|
||||
"Publish Something": "Publish Something",
|
||||
"Repost Something": "Repost Something",
|
||||
"Watch on %SITE_NAME%": "Watch on %SITE_NAME%",
|
||||
"Watch on lbry.tv": "Watch on lbry.tv",
|
||||
"Paid content cannot be embedded.": "Paid content cannot be embedded.",
|
||||
"Please wait a bit, we are still getting your account ready.": "Please wait a bit, we are still getting your account ready.",
|
||||
"this channel is connected to a different account. Contact hello@lbry.com for help.": "this channel is connected to a different account. Contact hello@lbry.com for help.",
|
||||
@@ -1728,7 +1727,6 @@
|
||||
"Are you sure you want to view this content? Viewing will not unmute @%channel%": "Are you sure you want to view this content? Viewing will not unmute @%channel%",
|
||||
"View Content": "View Content",
|
||||
"Global": "Global",
|
||||
"Global Admin": "Global Admin",
|
||||
"Moderator": "Moderator",
|
||||
"Global Unblock Channel": "Global Unblock Channel",
|
||||
"Global Block Channel": "Global Block Channel",
|
||||
@@ -1943,7 +1941,6 @@
|
||||
"Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.",
|
||||
"Minimum %lbc% tip amount for hyperchats": "Minimum %lbc% tip amount for hyperchats",
|
||||
"Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.": "Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.",
|
||||
"This settings is not applicable if all comments require a tip.": "This settings is not applicable if all comments require a tip.",
|
||||
"Settings unavailable for this channel": "Settings unavailable for this channel",
|
||||
"This channel isn't staking enough LBRY Credits to enable Creator Settings.": "This channel isn't staking enough LBRY Credits to enable Creator Settings.",
|
||||
"Not a channel (prefix with \"@\", or enter the channel URL)": "Not a channel (prefix with \"@\", or enter the channel URL)",
|
||||
@@ -2024,28 +2021,19 @@
|
||||
"Chat": "Chat",
|
||||
"Tipped": "Tipped",
|
||||
"Fromage": "Fromage",
|
||||
"In Favorites": "In Favorites",
|
||||
"In Favorites": "In Favorites",
|
||||
"In Watch Later": "In Watch Later",
|
||||
"In %lastCollectionName%": "In %lastCollectionName%",
|
||||
"Remove from Watch Later": "Remove from Watch Later",
|
||||
"Add to Watch Later": "Add to Watch Later",
|
||||
"Added": "Added",
|
||||
"Item removed from %name%": "Item removed from %name%",
|
||||
"Item added to %name%": "Item added to %name%",
|
||||
"Added": "Added",
|
||||
"Item added to Watch Later": "Item added to Watch Later",
|
||||
"Item removed from Watch Later": "Item removed from Watch Later",
|
||||
"Item added to Favorites": "Item added to Favorites",
|
||||
"Item removed from Favorites": "Item removed from Favorites",
|
||||
"Item removed from Watch Later": "Item removed from Watch Later",
|
||||
"Item added to %lastCollectionName%": "Item added to %lastCollectionName%",
|
||||
"Item removed from %lastCollectionName%": "Item removed from %lastCollectionName%",
|
||||
"Your publish is being confirmed and will be live soon": "Your publish is being confirmed and will be live soon",
|
||||
"Clear Edits": "Clear Edits",
|
||||
"Something not quite right..": "Something not quite right..",
|
||||
"Comments server": "Comments server",
|
||||
"Default comments server (%name%)": "Default comments server (%name%)",
|
||||
"Custom comments server": "Custom comments server",
|
||||
"Failed to fetch comments.": "Failed to fetch comments.",
|
||||
"Failed to fetch comments. Verify custom server settings.": "Failed to fetch comments. Verify custom server settings.",
|
||||
"Commenting server is not set.": "Commenting server is not set.",
|
||||
"Comments are not currently enabled.": "Comments are not currently enabled.",
|
||||
"See All": "See All",
|
||||
"Supporting content requires %lbc%": "Supporting content requires %lbc%",
|
||||
"With %lbc%, you can send tips to your favorite creators, or help boost their content for more people to see.": "With %lbc%, you can send tips to your favorite creators, or help boost their content for more people to see.",
|
||||
@@ -2069,36 +2057,7 @@
|
||||
"Only select creators can receive tips at this time": "Only select creators can receive tips at this time",
|
||||
"The payment will be made from your saved card": "The payment will be made from your saved card",
|
||||
"Commenting...": "Commenting...",
|
||||
"Show %count% replies": "Show %count% replies",
|
||||
"Show reply": "Show reply",
|
||||
"added to": "added to",
|
||||
"removed from": "removed from",
|
||||
"Skip Navigation": "Skip Navigation",
|
||||
"Reset": "Reset",
|
||||
"Reset to original (previous) publish date": "Reset to original (previous) publish date",
|
||||
"Search for something...": "Search for something...",
|
||||
"Confirm Comment Deletion": "Confirm Comment Deletion",
|
||||
"Remove Comment": "Remove Comment",
|
||||
"Are you sure you want to remove this comment?": "Are you sure you want to remove this comment?",
|
||||
"This comment has a tip associated with it which cannot be reverted.": "This comment has a tip associated with it which cannot be reverted.",
|
||||
"Recent Comments": "Recent Comments",
|
||||
"%title% by %channelTitle%": "%title% by %channelTitle%",
|
||||
"%title% by %channelTitle% %ariaDate%": "%title% by %channelTitle% %ariaDate%",
|
||||
"%title% by %channelTitle% %ariaDate%, %mediaDuration%": "%title% by %channelTitle% %ariaDate%, %mediaDuration%",
|
||||
"Collapse Thread": "Collapse Thread",
|
||||
"Collapse": "Collapse",
|
||||
"Expand Comments": "Expand Comments",
|
||||
"Expand": "Expand",
|
||||
"Load More": "Load More",
|
||||
"%formattedSubCount% Followers": "%formattedSubCount% Followers",
|
||||
"1 Follower": "1 Follower",
|
||||
"Collection": "Collection",
|
||||
"%channelName% isn't live right now, but the chat is! Check back later to watch the stream.": "%channelName% isn't live right now, but the chat is! Check back later to watch the stream.",
|
||||
"Review": "Review",
|
||||
"Account History": "Account History",
|
||||
"Payment History": "Payment History",
|
||||
"There was an error from the server, please try again later": "There was an error from the server, please try again later",
|
||||
"There was an error getting your card setup, please try again later": "There was an error getting your card setup, please try again later",
|
||||
"View Transactions": "View Transactions",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hi</h1>
|
||||
<script>parent.postMessage(location.href, location.origin)</script>
|
||||
</body>
|
||||
</html>
|
||||
+37
-175
@@ -9,17 +9,14 @@ import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
// @endif
|
||||
import { MATOMO_ID, MATOMO_URL } from 'config';
|
||||
import { MATOMO_ID, MATOMO_URL, LBRY_WEB_BUFFER_API } from 'config';
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.includes('dev');
|
||||
const devInternalApis = process.env.LBRY_API_URL;
|
||||
|
||||
export const SHARE_INTERNAL = 'shareInternal';
|
||||
const SHARE_THIRD_PARTY = 'shareThirdParty';
|
||||
|
||||
const WATCHMAN_BACKEND_ENDPOINT = 'https://watchman.na-backend.odysee.com/reports/playback';
|
||||
const SEND_DATA_TO_WATCHMAN_INTERVAL = 10; // in seconds
|
||||
|
||||
// @if TARGET='app'
|
||||
if (isProduction) {
|
||||
ElectronCookies.enable({
|
||||
@@ -40,8 +37,7 @@ type Analytics = {
|
||||
tagFollowEvent: (string, boolean, ?string) => void,
|
||||
playerLoadedEvent: (?boolean) => void,
|
||||
playerStartedEvent: (?boolean) => void,
|
||||
videoStartEvent: (string, number, string, number, string, any) => void,
|
||||
videoIsPlaying: (boolean, any) => void,
|
||||
videoStartEvent: (string, number) => void,
|
||||
videoBufferEvent: (
|
||||
StreamClaim,
|
||||
{
|
||||
@@ -53,7 +49,7 @@ type Analytics = {
|
||||
playerPoweredBy: string,
|
||||
readyState: number,
|
||||
}
|
||||
) => Promise<any>,
|
||||
) => void,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
@@ -80,174 +76,7 @@ if (window.localStorage.getItem(SHARE_INTERNAL) === 'true') internalAnalyticsEna
|
||||
// if (window.localStorage.getItem(SHARE_THIRD_PARTY) === 'true') thirdPartyAnalyticsEnabled = true;
|
||||
// @endif
|
||||
|
||||
/**
|
||||
* Determine the mobile device type viewing the data
|
||||
* This function returns one of 'and' (Android), 'ios', or 'web'.
|
||||
*
|
||||
* @returns {String}
|
||||
*/
|
||||
function getDeviceType() {
|
||||
// We may not care what the device is if it's in a web browser. Commenting out for now.
|
||||
// if (!IS_WEB) {
|
||||
// return 'elt';
|
||||
// }
|
||||
// const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
||||
//
|
||||
// if (/android/i.test(userAgent)) {
|
||||
// return 'adr';
|
||||
// }
|
||||
//
|
||||
// // iOS detection from: http://stackoverflow.com/a/9039885/177710
|
||||
// if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
|
||||
// return 'ios';
|
||||
// }
|
||||
|
||||
// default as web, this can be optimized
|
||||
if (!IS_WEB) {
|
||||
return 'dsk';
|
||||
}
|
||||
return 'web';
|
||||
}
|
||||
// variables initialized for watchman
|
||||
let amountOfBufferEvents = 0;
|
||||
let amountOfBufferTimeInMS = 0;
|
||||
let videoType, userId, claimUrl, playerPoweredBy, videoPlayer;
|
||||
let lastSentTime;
|
||||
|
||||
// calculate data for backend, send them, and reset buffer data for next interval
|
||||
async function sendAndResetWatchmanData() {
|
||||
if (!userId) {
|
||||
return 'Can only be used with a user id';
|
||||
}
|
||||
|
||||
let timeSinceLastIntervalSend = new Date() - lastSentTime;
|
||||
lastSentTime = new Date();
|
||||
|
||||
let protocol;
|
||||
if (videoType === 'application/x-mpegURL') {
|
||||
protocol = 'hls';
|
||||
} else {
|
||||
protocol = 'stb';
|
||||
}
|
||||
|
||||
// current position in video in MS
|
||||
const positionInVideo = Math.round(videoPlayer.currentTime()) * 1000;
|
||||
|
||||
// get the duration marking the time in the video for relative position calculation
|
||||
const totalDurationInSeconds = Math.round(videoPlayer.duration());
|
||||
|
||||
// build object for watchman backend
|
||||
const objectToSend = {
|
||||
rebuf_count: amountOfBufferEvents,
|
||||
rebuf_duration: amountOfBufferTimeInMS,
|
||||
url: claimUrl.replace('lbry://', ''),
|
||||
device: getDeviceType(),
|
||||
duration: timeSinceLastIntervalSend,
|
||||
protocol,
|
||||
player: playerPoweredBy,
|
||||
user_id: userId.toString(),
|
||||
position: Math.round(positionInVideo),
|
||||
rel_position: Math.round((positionInVideo / (totalDurationInSeconds * 1000)) * 100),
|
||||
};
|
||||
|
||||
// post to watchman
|
||||
await sendWatchmanData(objectToSend);
|
||||
|
||||
// reset buffer data
|
||||
amountOfBufferEvents = 0;
|
||||
amountOfBufferTimeInMS = 0;
|
||||
}
|
||||
|
||||
let watchmanInterval;
|
||||
// clear watchman interval and mark it as null (when video paused)
|
||||
function stopWatchmanInterval() {
|
||||
clearInterval(watchmanInterval);
|
||||
watchmanInterval = null;
|
||||
}
|
||||
|
||||
// creates the setInterval that will run send to watchman on recurring basis
|
||||
function startWatchmanIntervalIfNotRunning() {
|
||||
if (!watchmanInterval) {
|
||||
// instantiate the first time to calculate duration from
|
||||
lastSentTime = new Date();
|
||||
|
||||
// only set an interval if analytics are enabled and is prod
|
||||
if (isProduction && IS_WEB) {
|
||||
watchmanInterval = setInterval(sendAndResetWatchmanData, 1000 * SEND_DATA_TO_WATCHMAN_INTERVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// post data to the backend
|
||||
async function sendWatchmanData(body) {
|
||||
try {
|
||||
const response = await fetch(WATCHMAN_BACKEND_ENDPOINT, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
return response;
|
||||
} catch (err) {
|
||||
console.log('ERROR FROM WATCHMAN BACKEND');
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
const analytics: Analytics = {
|
||||
// receive buffer events from tracking plugin and jklj
|
||||
videoBufferEvent: async (claim, data) => {
|
||||
amountOfBufferEvents = amountOfBufferEvents + 1;
|
||||
amountOfBufferTimeInMS = amountOfBufferTimeInMS + data.bufferDuration;
|
||||
},
|
||||
onDispose: () => {
|
||||
stopWatchmanInterval();
|
||||
},
|
||||
/**
|
||||
* Is told whether video is being started or paused, and adjusts interval accordingly
|
||||
* @param {boolean} isPlaying - Whether video was started or paused
|
||||
* @param {object} passedPlayer - VideoJS Player object
|
||||
*/
|
||||
videoIsPlaying: (isPlaying, passedPlayer) => {
|
||||
let playerIsSeeking = false;
|
||||
// have to use this because videojs pauses/unpauses during seek
|
||||
// sometimes the seeking function isn't populated yet so check for it as well
|
||||
if (passedPlayer && passedPlayer.seeking) {
|
||||
playerIsSeeking = passedPlayer.seeking();
|
||||
}
|
||||
|
||||
// if being paused, and not seeking, send existing data and stop interval
|
||||
if (!isPlaying && !playerIsSeeking) {
|
||||
sendAndResetWatchmanData();
|
||||
stopWatchmanInterval();
|
||||
// if being told to pause, and seeking, send and restart interval
|
||||
} else if (!isPlaying && playerIsSeeking) {
|
||||
sendAndResetWatchmanData();
|
||||
stopWatchmanInterval();
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
// is being told to play, and seeking, don't do anything,
|
||||
// assume it's been started already from pause
|
||||
} else if (isPlaying && playerIsSeeking) {
|
||||
// start but not a seek, assuming a start from paused content
|
||||
} else if (isPlaying && !playerIsSeeking) {
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
}
|
||||
},
|
||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, passedPlayer) => {
|
||||
// populate values for watchman when video starts
|
||||
userId = passedUserId;
|
||||
claimUrl = canonicalUrl;
|
||||
playerPoweredBy = poweredBy;
|
||||
|
||||
videoType = passedPlayer.currentSource().type;
|
||||
videoPlayer = passedPlayer;
|
||||
|
||||
sendPromMetric('time_to_start', duration);
|
||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||
},
|
||||
error: (message) => {
|
||||
return new Promise((resolve) => {
|
||||
if (internalAnalyticsEnabled && isProduction) {
|
||||
@@ -366,6 +195,39 @@ const analytics: Analytics = {
|
||||
Lbryio.call('content_tags', 'sync', params);
|
||||
}
|
||||
},
|
||||
|
||||
videoStartEvent: (claimId, duration) => {
|
||||
sendPromMetric('time_to_start', duration);
|
||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||
},
|
||||
|
||||
videoBufferEvent: (claim, data) => {
|
||||
sendMatomoEvent('Media', 'BufferTimestamp', claim.claim_id, data.timeAtBuffer);
|
||||
|
||||
if (LBRY_WEB_BUFFER_API) {
|
||||
fetch(LBRY_WEB_BUFFER_API, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
device: 'web',
|
||||
type: 'buffering',
|
||||
client: data.userId,
|
||||
data: {
|
||||
url: claim.canonical_url,
|
||||
position: data.timeAtBuffer,
|
||||
duration: data.bufferDuration,
|
||||
player: data.playerPoweredBy,
|
||||
readyState: data.readyState,
|
||||
stream_duration: data.duration,
|
||||
stream_bitrate: data.bitRate,
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
},
|
||||
adsFetchedEvent: () => {
|
||||
sendMatomoEvent('Media', 'AdsFetched');
|
||||
},
|
||||
|
||||
+2
-12
@@ -4,13 +4,6 @@ import { COMMENT_SERVER_API } from 'config';
|
||||
const Comments = {
|
||||
url: COMMENT_SERVER_API,
|
||||
enabled: Boolean(COMMENT_SERVER_API),
|
||||
isCustomServer: false,
|
||||
|
||||
setServerUrl: (customUrl: ?string) => {
|
||||
Comments.url = customUrl === undefined ? COMMENT_SERVER_API : customUrl;
|
||||
Comments.enabled = Boolean(Comments.url);
|
||||
Comments.isCustomServer = Comments.url !== COMMENT_SERVER_API;
|
||||
},
|
||||
|
||||
moderation_block: (params: ModerationBlockParams) => fetchCommentsApi('moderation.Block', params),
|
||||
moderation_unblock: (params: ModerationBlockParams) => fetchCommentsApi('moderation.UnBlock', params),
|
||||
@@ -34,15 +27,12 @@ const Comments = {
|
||||
setting_unblock_word: (params: BlockWordParams) => fetchCommentsApi('setting.UnBlockWord', params),
|
||||
setting_list_blocked_words: (params: SettingsParams) => fetchCommentsApi('setting.ListBlockedWords', params),
|
||||
setting_update: (params: UpdateSettingsParams) => fetchCommentsApi('setting.Update', params),
|
||||
setting_get: (params: SettingsParams) => fetchCommentsApi('setting.Get', params),
|
||||
super_list: (params: SuperListParams) => fetchCommentsApi('comment.SuperChatList', params),
|
||||
};
|
||||
|
||||
function fetchCommentsApi(method: string, params: {}) {
|
||||
if (!Comments.url) {
|
||||
return Promise.reject(new Error('Commenting server is not set.'));
|
||||
} else if (!Comments.enabled) {
|
||||
return Promise.reject('Comments are not currently enabled.'); // eslint-disable-line
|
||||
if (!Comments.enabled) {
|
||||
return Promise.reject('Comments are not currently enabled'); // eslint-disable-line
|
||||
}
|
||||
|
||||
const url = `${Comments.url}?m=${method}`;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import analytics from 'analytics';
|
||||
import { buildURI, parseURI } from 'lbry-redux';
|
||||
import { SIMPLE_SITE, ENABLE_PREROLL_ADS } from 'config';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import Router from 'component/router/index';
|
||||
import ReactModal from 'react-modal';
|
||||
import { openContextMenu } from 'util/context-menu';
|
||||
@@ -29,8 +29,6 @@ import {
|
||||
STATUS_FAILING,
|
||||
STATUS_DOWN,
|
||||
} from 'web/effects/use-degraded-performance';
|
||||
import { useKeycloak } from '@react-keycloak/web';
|
||||
|
||||
// @endif
|
||||
import LANGUAGE_MIGRATIONS from 'constants/language-migrations';
|
||||
|
||||
@@ -50,11 +48,9 @@ const NagDegradedPerformance = lazyImport(() =>
|
||||
import('web/component/nag-degraded-performance' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
const NagNoUser = lazyImport(() => import('web/component/nag-no-user' /* webpackChunkName: "nag-no-user" */));
|
||||
const NagSunset = lazyImport(() => import('web/component/nag-sunset' /* webpackChunkName: "nag-no-user" */));
|
||||
const YoutubeWelcome = lazyImport(() =>
|
||||
import('web/component/youtubeReferralWelcome' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
|
||||
// @endif
|
||||
|
||||
const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* webpackChunkName: "syncFatalError" */));
|
||||
@@ -158,7 +154,6 @@ function App(props: Props) {
|
||||
const isRewardApproved = user && user.is_reward_approved;
|
||||
const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail);
|
||||
const previousRewardApproved = usePrevious(isRewardApproved);
|
||||
const { authenticated } = useKeycloak();
|
||||
// @if TARGET='web'
|
||||
const [showAnalyticsNag, setShowAnalyticsNag] = usePersistedState('analytics-nag', true);
|
||||
const [lbryTvApiStatus, setLbryTvApiStatus] = useState(STATUS_OK);
|
||||
@@ -167,17 +162,14 @@ function App(props: Props) {
|
||||
const [upgradeNagClosed, setUpgradeNagClosed] = useState(false);
|
||||
const [resolvedSubscriptions, setResolvedSubscriptions] = useState(false);
|
||||
const [sidebarOpen] = usePersistedState('sidebar', true);
|
||||
const [seenSunsestMessage, setSeenSunsetMessage] = usePersistedState('lbrytv-sunset', false);
|
||||
const showUpgradeButton =
|
||||
(autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable)) && !upgradeNagClosed;
|
||||
// referral claiming
|
||||
const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const rawReferrerParam = urlParams.get('r');
|
||||
const fromLbrytvParam = urlParams.get('sunset');
|
||||
const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#');
|
||||
const shouldHideNag = pathname.startsWith(`/$/${PAGES.EMBED}`) || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`);
|
||||
// KC
|
||||
const userId = user && user.id;
|
||||
const useCustomScrollbar = !IS_MAC;
|
||||
const hasMyChannels = myChannelUrls && myChannelUrls.length > 0;
|
||||
@@ -198,13 +190,7 @@ function App(props: Props) {
|
||||
setShowAnalyticsNag(false);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (authenticated) {
|
||||
console.log('IS KC AUTHED');
|
||||
}
|
||||
}, [authenticated]);
|
||||
// @endif
|
||||
// TODO KC HOWTO SETUSER
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
analytics.setUser(userId);
|
||||
@@ -299,11 +285,6 @@ function App(props: Props) {
|
||||
}
|
||||
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
document.documentElement.setAttribute('lang', language);
|
||||
}, [language]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!languages.includes(language)) {
|
||||
setLanguage(language);
|
||||
@@ -327,7 +308,7 @@ function App(props: Props) {
|
||||
if (previousHasVerifiedEmail === false && hasVerifiedEmail) {
|
||||
analytics.emailVerifiedEvent();
|
||||
}
|
||||
}, [previousHasVerifiedEmail, hasVerifiedEmail]);
|
||||
}, [previousHasVerifiedEmail, hasVerifiedEmail, signIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (previousRewardApproved === false && isRewardApproved) {
|
||||
@@ -368,14 +349,12 @@ function App(props: Props) {
|
||||
// We know someone is logging in or not when we get their user object
|
||||
// We'll use this to determine when it's time to pull preferences
|
||||
// This will no longer work if desktop users no longer get a user object from lbryinc
|
||||
// KC TODO KEYCLOAK
|
||||
useEffect(() => {
|
||||
if (user) {
|
||||
setReadyForPrefs(true);
|
||||
}
|
||||
}, [user, setReadyForPrefs]);
|
||||
|
||||
// TODO KEYCLOAK ISAUTHENTICATED
|
||||
useEffect(() => {
|
||||
if (syncError && isAuthenticated && !pathname.includes(PAGES.AUTH_WALLET_PASSWORD) && !currentModal) {
|
||||
history.push(`/$/${PAGES.AUTH_WALLET_PASSWORD}?redirect=${pathname}`);
|
||||
@@ -476,9 +455,6 @@ function App(props: Props) {
|
||||
<YoutubeWelcome />
|
||||
{!SIMPLE_SITE && !shouldHideNag && <OpenInAppLink uri={uri} />}
|
||||
{!shouldHideNag && <NagContinueFirstRun />}
|
||||
{fromLbrytvParam && !seenSunsestMessage && !shouldHideNag && (
|
||||
<NagSunset email={hasVerifiedEmail} onClose={() => setSeenSunsetMessage(true)} />
|
||||
)}
|
||||
{(lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) && !shouldHideNag && (
|
||||
<NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />
|
||||
)}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { Redirect, useLocation } from 'react-router-dom';
|
||||
|
||||
import { useKeycloak } from '@react-keycloak/web';
|
||||
|
||||
const LoginPage = () => {
|
||||
const location = useLocation();
|
||||
const currentLocationState = location.state || {
|
||||
from: { pathname: '/home' },
|
||||
};
|
||||
|
||||
const { keycloak } = useKeycloak();
|
||||
|
||||
const login = useCallback(() => {
|
||||
keycloak && keycloak.login().then((x) => console.log('cb', x));
|
||||
}, [keycloak]);
|
||||
|
||||
if (keycloak && keycloak.authenticated) {
|
||||
return <Redirect to={currentLocationState.from} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button type="button" onClick={login}>
|
||||
Login
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default LoginPage;
|
||||
@@ -97,9 +97,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
const combinedRef = useCombinedRefs(ref, innerRef, myref);
|
||||
const size = iconSize || (!label && !children) ? 18 : undefined; // Fall back to default
|
||||
|
||||
// Label can be a string or object ( use title instead )
|
||||
const ariaLabel = description || (typeof label === 'string' ? label : title);
|
||||
|
||||
const content = (
|
||||
<span className="button__content">
|
||||
{icon && <Icon icon={icon} iconColor={iconColor} size={iconSize} />}
|
||||
@@ -153,7 +150,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
className={combinedClassName}
|
||||
title={title}
|
||||
onClick={onClick}
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
@@ -200,7 +196,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
disabled={disable}
|
||||
className={combinedClassName}
|
||||
activeClassName={activeClass}
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
{content}
|
||||
</NavLink>
|
||||
@@ -221,7 +216,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
}}
|
||||
className={combinedClassName}
|
||||
activeClassName={activeClass}
|
||||
aria-label={ariaLabel}
|
||||
{...otherProps}
|
||||
>
|
||||
{content}
|
||||
@@ -230,7 +224,7 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
<button
|
||||
ref={combinedRef}
|
||||
title={title || defaultTooltip}
|
||||
aria-label={ariaLabel}
|
||||
aria-label={description || label || title}
|
||||
className={combinedClassName}
|
||||
onClick={(e) => {
|
||||
if (onClick) {
|
||||
|
||||
@@ -81,7 +81,7 @@ function ChannelContent(props: Props) {
|
||||
!showMature ? '&nsfw=false&size=50&from=0' : ''
|
||||
}`
|
||||
)
|
||||
.then(({ body: results }) => {
|
||||
.then((results) => {
|
||||
const urls = results.map(({ name, claimId }) => {
|
||||
return `lbry://${name}#${claimId}`;
|
||||
});
|
||||
|
||||
@@ -17,8 +17,6 @@ import {
|
||||
} from 'lbry-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doUpdateBlockListForPublishedChannel } from 'redux/actions/comments';
|
||||
import { doClaimInitialRewards } from 'redux/actions/rewards';
|
||||
import { selectIsClaimingInitialRewards, selectHasClaimedInitialRewards } from 'redux/selectors/rewards';
|
||||
import ChannelForm from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
@@ -38,8 +36,6 @@ const select = (state, props) => ({
|
||||
createError: selectCreateChannelError(state),
|
||||
creatingChannel: selectCreatingChannel(state),
|
||||
balance: selectBalance(state),
|
||||
isClaimingInitialRewards: selectIsClaimingInitialRewards(state),
|
||||
hasClaimedInitialRewards: selectHasClaimedInitialRewards(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
@@ -54,7 +50,6 @@ const perform = (dispatch) => ({
|
||||
);
|
||||
},
|
||||
clearChannelErrors: () => dispatch(doClearChannelErrors()),
|
||||
claimInitialRewards: () => dispatch(doClaimInitialRewards()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ChannelForm);
|
||||
@@ -48,7 +48,6 @@ type Props = {
|
||||
createError: string,
|
||||
creatingChannel: boolean,
|
||||
clearChannelErrors: () => void,
|
||||
claimInitialRewards: () => void,
|
||||
onDone: () => void,
|
||||
openModal: (
|
||||
id: string,
|
||||
@@ -56,8 +55,6 @@ type Props = {
|
||||
) => void,
|
||||
uri: string,
|
||||
disabled: boolean,
|
||||
isClaimingInitialRewards: boolean,
|
||||
hasClaimedInitialRewards: boolean,
|
||||
};
|
||||
|
||||
function ChannelForm(props: Props) {
|
||||
@@ -82,11 +79,8 @@ function ChannelForm(props: Props) {
|
||||
creatingChannel,
|
||||
createError,
|
||||
clearChannelErrors,
|
||||
claimInitialRewards,
|
||||
openModal,
|
||||
disabled,
|
||||
isClaimingInitialRewards,
|
||||
hasClaimedInitialRewards,
|
||||
} = props;
|
||||
const [nameError, setNameError] = React.useState(undefined);
|
||||
const [bidError, setBidError] = React.useState('');
|
||||
@@ -100,22 +94,6 @@ function ChannelForm(props: Props) {
|
||||
const languageParam = params.languages;
|
||||
const primaryLanguage = Array.isArray(languageParam) && languageParam.length && languageParam[0];
|
||||
const secondaryLanguage = Array.isArray(languageParam) && languageParam.length >= 2 && languageParam[1];
|
||||
const submitLabel = React.useMemo(() => {
|
||||
if (isClaimingInitialRewards) {
|
||||
return __('Claiming credits...');
|
||||
}
|
||||
return creatingChannel || updatingChannel ? __('Submitting') : __('Submit');
|
||||
}, [isClaimingInitialRewards, creatingChannel, updatingChannel]);
|
||||
const submitDisabled = React.useMemo(() => {
|
||||
return (
|
||||
isClaimingInitialRewards ||
|
||||
creatingChannel ||
|
||||
updatingChannel ||
|
||||
nameError ||
|
||||
bidError ||
|
||||
(isNewChannel && !params.name)
|
||||
);
|
||||
}, [isClaimingInitialRewards, creatingChannel, updatingChannel, nameError, bidError, isNewChannel, params]);
|
||||
|
||||
function getChannelParams() {
|
||||
// fill this in with sdk data
|
||||
@@ -241,12 +219,6 @@ function ChannelForm(props: Props) {
|
||||
clearChannelErrors();
|
||||
}, [clearChannelErrors]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!hasClaimedInitialRewards) {
|
||||
claimInitialRewards();
|
||||
}
|
||||
}, [hasClaimedInitialRewards, claimInitialRewards]);
|
||||
|
||||
// TODO clear and bail after submit
|
||||
return (
|
||||
<>
|
||||
@@ -481,7 +453,14 @@ function ChannelForm(props: Props) {
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button button="primary" disabled={submitDisabled} label={submitLabel} onClick={handleSubmit} />
|
||||
<Button
|
||||
button="primary"
|
||||
disabled={
|
||||
creatingChannel || updatingChannel || nameError || bidError || (isNewChannel && !params.name)
|
||||
}
|
||||
label={creatingChannel || updatingChannel ? __('Submitting') : __('Submit')}
|
||||
onClick={handleSubmit}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={onDone} />
|
||||
</div>
|
||||
{errorMsg ? (
|
||||
|
||||
@@ -5,21 +5,13 @@ import ClaimPreview from 'component/claimPreview';
|
||||
type Props = {
|
||||
channelUri: string,
|
||||
hideActions?: boolean,
|
||||
channelSubCount?: number,
|
||||
};
|
||||
|
||||
function ClaimAuthor(props: Props) {
|
||||
const { channelUri, hideActions, channelSubCount } = props;
|
||||
const { channelUri, hideActions } = props;
|
||||
|
||||
return channelUri ? (
|
||||
<ClaimPreview
|
||||
uri={channelUri}
|
||||
type="inline"
|
||||
properties={false}
|
||||
hideMenu
|
||||
hideActions={hideActions}
|
||||
channelSubCount={channelSubCount}
|
||||
/>
|
||||
<ClaimPreview uri={channelUri} type="inline" properties={false} hideMenu hideActions={hideActions} />
|
||||
) : (
|
||||
<div className="claim-preview--inline claim-preview__title">{__('Anonymous')}</div>
|
||||
);
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import CollectionAddButton from './view';
|
||||
import { makeSelectClaimForUri, makeSelectClaimUrlInCollection } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
|
||||
return {
|
||||
claim,
|
||||
isSaved: makeSelectClaimUrlInCollection(permanentUrl)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doOpenModal,
|
||||
|
||||
@@ -11,11 +11,10 @@ type Props = {
|
||||
fileAction?: boolean,
|
||||
type?: boolean,
|
||||
claim: Claim,
|
||||
isSaved: boolean,
|
||||
};
|
||||
|
||||
export default function CollectionAddButton(props: Props) {
|
||||
const { doOpenModal, uri, fileAction, type = 'playlist', claim, isSaved } = props;
|
||||
const { doOpenModal, uri, fileAction, type = 'playlist', claim } = props;
|
||||
|
||||
// $FlowFixMe
|
||||
const streamType = (claim && claim.value && claim.value.stream_type) || '';
|
||||
@@ -26,9 +25,9 @@ export default function CollectionAddButton(props: Props) {
|
||||
<Button
|
||||
button={fileAction ? undefined : 'alt'}
|
||||
className={classnames({ 'button--file-action': fileAction })}
|
||||
icon={fileAction ? (!isSaved ? ICONS.ADD : ICONS.STACK) : ICONS.LIBRARY}
|
||||
icon={fileAction ? ICONS.ADD : ICONS.LIBRARY}
|
||||
iconSize={fileAction ? 22 : undefined}
|
||||
label={uri ? (!isSaved ? __('Save') : __('Saved')) : __('New List')}
|
||||
label={uri ? __('Save') : __('New List')}
|
||||
requiresAuth={IS_WEB}
|
||||
title={__('Add this claim to a list')}
|
||||
onClick={(e) => {
|
||||
|
||||
@@ -47,7 +47,6 @@ type Props = {
|
||||
searchOptions?: any,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
onClick?: (e: any, index?: number) => void,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
@@ -56,7 +55,6 @@ export default function ClaimList(props: Props) {
|
||||
uris,
|
||||
headerAltControls,
|
||||
loading,
|
||||
id,
|
||||
persistedStorageKey,
|
||||
empty,
|
||||
defaultSort,
|
||||
@@ -82,7 +80,6 @@ export default function ClaimList(props: Props) {
|
||||
searchOptions,
|
||||
collectionId,
|
||||
showNoSourceClaims,
|
||||
onClick,
|
||||
} = props;
|
||||
|
||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||
@@ -110,12 +107,6 @@ export default function ClaimList(props: Props) {
|
||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||
}
|
||||
|
||||
function handleClaimClicked(e, index) {
|
||||
if (onClick) {
|
||||
onClick(e, index);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = debounce((e) => {
|
||||
if (page && pageSize && onScrollBottom) {
|
||||
@@ -200,8 +191,6 @@ export default function ClaimList(props: Props) {
|
||||
{injectedItem && index === 4 && <li>{injectedItem}</li>}
|
||||
<ClaimPreview
|
||||
uri={uri}
|
||||
containerId={id}
|
||||
indexInContainer={index}
|
||||
type={type}
|
||||
active={activeUri && uri === activeUri}
|
||||
hideMenu={hideMenu}
|
||||
@@ -220,7 +209,6 @@ export default function ClaimList(props: Props) {
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
}}
|
||||
live={resolveLive(index)}
|
||||
onClick={handleClaimClicked}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
||||
@@ -106,7 +106,7 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType,
|
||||
pageSize,
|
||||
defaultClaimType,
|
||||
streamType = SIMPLE_SITE ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
streamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined,
|
||||
defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE
|
||||
freshness,
|
||||
defaultFreshness = CS.FRESH_WEEK,
|
||||
@@ -141,6 +141,7 @@ function ClaimListDiscover(props: Props) {
|
||||
const { search } = location;
|
||||
const [page, setPage] = React.useState(1);
|
||||
const [forceRefresh, setForceRefresh] = React.useState();
|
||||
const [finalUris, setFinalUris] = React.useState([]);
|
||||
const isLargeScreen = useIsLargeScreen();
|
||||
const [orderParamEntry, setOrderParamEntry] = usePersistedState(`entry-${location.pathname}`, CS.ORDER_BY_TRENDING);
|
||||
const [orderParamUser, setOrderParamUser] = usePersistedState(`orderUser-${location.pathname}`, CS.ORDER_BY_TRENDING);
|
||||
@@ -318,7 +319,7 @@ function ClaimListDiscover(props: Props) {
|
||||
}
|
||||
|
||||
if (streamTypeParam && streamTypeParam !== CS.CONTENT_ALL && claimType !== CS.CLAIM_CHANNEL) {
|
||||
options.stream_types = typeof streamTypeParam === 'string' ? [streamTypeParam] : streamTypeParam;
|
||||
options.stream_types = [streamTypeParam];
|
||||
}
|
||||
|
||||
if (claimTypeParam) {
|
||||
@@ -386,9 +387,6 @@ function ClaimListDiscover(props: Props) {
|
||||
: undefined;
|
||||
const livestreamSearchResult = livestreamSearchKey && claimSearchByQuery[livestreamSearchKey];
|
||||
|
||||
const [finalUris, setFinalUris] = React.useState(
|
||||
getFinalUrisInitialState(history.action === 'POP', claimSearchResult)
|
||||
);
|
||||
const [prevOptions, setPrevOptions] = React.useState(null);
|
||||
|
||||
if (!isJustScrollingToNewPage(prevOptions, options)) {
|
||||
@@ -450,10 +448,6 @@ function ClaimListDiscover(props: Props) {
|
||||
</div>
|
||||
);
|
||||
|
||||
// **************************************************************************
|
||||
// Helpers
|
||||
// **************************************************************************
|
||||
|
||||
// Returns true if the change in 'options' indicate that we are simply scrolling
|
||||
// down to a new page; false otherwise.
|
||||
function isJustScrollingToNewPage(prevOptions, options) {
|
||||
@@ -506,17 +500,6 @@ function ClaimListDiscover(props: Props) {
|
||||
return prev.length === next.length && prev.every((value, index) => value === next[index]);
|
||||
}
|
||||
|
||||
function getFinalUrisInitialState(isNavigatingBack, claimSearchResult) {
|
||||
if (isNavigatingBack && claimSearchResult && claimSearchResult.length > 0) {
|
||||
return claimSearchResult;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
React.useEffect(() => {
|
||||
if (shouldPerformSearch) {
|
||||
const searchOptions = JSON.parse(optionsStringForEffect);
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
makeSelectCollectionIsMine,
|
||||
COLLECTIONS_CONSTS,
|
||||
makeSelectEditedCollectionForId,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
|
||||
@@ -25,6 +24,7 @@ import {
|
||||
makeSelectChannelIsAdminBlocked,
|
||||
} from 'redux/selectors/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { makeSelectSigningIsMine } from 'redux/selectors/content';
|
||||
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -45,18 +45,12 @@ const select = (state, props) => {
|
||||
contentClaim,
|
||||
contentSigningChannel,
|
||||
contentChannelUri,
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(
|
||||
COLLECTIONS_CONSTS.WATCH_LATER_ID,
|
||||
contentPermanentUri
|
||||
)(state),
|
||||
hasClaimInFavorites: makeSelectCollectionForIdHasClaimUrl(
|
||||
COLLECTIONS_CONSTS.FAVORITES_ID,
|
||||
contentPermanentUri
|
||||
)(state),
|
||||
claimIsMine: makeSelectSigningIsMine(props.uri)(state),
|
||||
hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.WATCH_LATER_ID, contentPermanentUri)(state),
|
||||
hasClaimInCustom: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.FAVORITES_ID, contentPermanentUri)(state),
|
||||
channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
isSubscribed: makeSelectIsSubscribed(contentChannelUri, true)(state),
|
||||
channelIsAdminBlocked: makeSelectChannelIsAdminBlocked(props.uri)(state),
|
||||
isAdmin: selectHasAdminChannel(state),
|
||||
@@ -84,7 +78,8 @@ const perform = (dispatch) => ({
|
||||
doChannelUnmute: (channelUri) => dispatch(doChannelUnmute(channelUri)),
|
||||
doCommentModBlock: (channelUri) => dispatch(doCommentModBlock(channelUri)),
|
||||
doCommentModUnBlock: (channelUri) => dispatch(doCommentModUnBlock(channelUri)),
|
||||
doCommentModBlockAsAdmin: (commenterUri, blockerId) => dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)),
|
||||
doCommentModBlockAsAdmin: (commenterUri, blockerId) =>
|
||||
dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)),
|
||||
doCommentModUnBlockAsAdmin: (commenterUri, blockerId) =>
|
||||
dispatch(doCommentModUnBlockAsAdmin(commenterUri, blockerId)),
|
||||
doChannelSubscribe: (subscription) => dispatch(doChannelSubscribe(subscription)),
|
||||
|
||||
@@ -12,7 +12,7 @@ import { useHistory } from 'react-router';
|
||||
import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
|
||||
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
||||
const PAGE_VIEW_QUERY = 'view';
|
||||
const PAGE_VIEW_QUERY = `view`;
|
||||
const EDIT_PAGE = 'edit';
|
||||
|
||||
type SubscriptionArgs = {
|
||||
@@ -42,7 +42,7 @@ type Props = {
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
hasClaimInWatchLater: boolean,
|
||||
hasClaimInFavorites: boolean,
|
||||
hasClaimInCustom: boolean,
|
||||
claimInCollection: boolean,
|
||||
collectionId: string,
|
||||
isMyCollection: boolean,
|
||||
@@ -80,7 +80,7 @@ function ClaimMenuList(props: Props) {
|
||||
doCommentModUnBlockAsAdmin,
|
||||
doCollectionEdit,
|
||||
hasClaimInWatchLater,
|
||||
hasClaimInFavorites,
|
||||
hasClaimInCustom,
|
||||
collectionId,
|
||||
isMyCollection,
|
||||
doToast,
|
||||
@@ -105,6 +105,8 @@ function ClaimMenuList(props: Props) {
|
||||
: isSubscribed
|
||||
? __('Unfollow')
|
||||
: __('Follow');
|
||||
const lastCollectionName = 'Favorites';
|
||||
const lastCollectionId = COLLECTIONS_CONSTS.FAVORITES_ID;
|
||||
|
||||
const { push, replace } = useHistory();
|
||||
if (!claim) {
|
||||
@@ -280,23 +282,21 @@ function ClaimMenuList(props: Props) {
|
||||
{/* WATCH LATER */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() =>
|
||||
handleAdd(hasClaimInWatchLater, __('Watch Later'), COLLECTIONS_CONSTS.WATCH_LATER_ID)
|
||||
}
|
||||
onSelect={() => handleAdd(hasClaimInWatchLater, 'Watch Later', COLLECTIONS_CONSTS.WATCH_LATER_ID)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={hasClaimInWatchLater ? ICONS.DELETE : ICONS.TIME} />
|
||||
{hasClaimInWatchLater ? __('In Watch Later') : __('Watch Later')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{/* FAVORITES LIST */}
|
||||
{/* CUSTOM LIST */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => handleAdd(hasClaimInFavorites, __('Favorites'), COLLECTIONS_CONSTS.FAVORITES_ID)}
|
||||
onSelect={() => handleAdd(hasClaimInCustom, lastCollectionName, lastCollectionId)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={hasClaimInFavorites ? ICONS.DELETE : ICONS.STAR} />
|
||||
{hasClaimInFavorites ? __('In Favorites') : __('Favorites')}
|
||||
<Icon aria-hidden icon={hasClaimInCustom ? ICONS.DELETE : ICONS.STAR} />
|
||||
{hasClaimInCustom ? __(`In ${lastCollectionName}`) : __(`${lastCollectionName}`)}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
|
||||
@@ -378,30 +378,22 @@ function ClaimMenuList(props: Props) {
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
{showDelete && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDelete}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{showDelete && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDelete}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<hr className="menu__separator" />
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{isChannelPage && IS_WEB && rssUrl && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyRssLink}>
|
||||
<div className="menu__link">
|
||||
@@ -411,6 +403,13 @@ function ClaimMenuList(props: Props) {
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHARE} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{!claimIsMine && !isMyCollection && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
||||
<div className="menu__link">
|
||||
|
||||
@@ -15,8 +15,6 @@ import {
|
||||
doCollectionEdit,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectIndexForUrlInCollection,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectDateForUri,
|
||||
} from 'lbry-redux';
|
||||
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
@@ -24,43 +22,32 @@ import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
|
||||
import ClaimPreview from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
||||
|
||||
return {
|
||||
claim,
|
||||
mediaDuration,
|
||||
date: props.uri && makeSelectDateForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||
obscureNsfw: selectShowMatureContent(state) === false,
|
||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
||||
repostClaim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||
obscureNsfw: selectShowMatureContent(state) === false,
|
||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
||||
repostClaim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
import type { Node } from 'react';
|
||||
import React, { useEffect, forwardRef } from 'react';
|
||||
import { NavLink, withRouter } from 'react-router-dom';
|
||||
import { isEmpty } from 'util/object';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import { parseURI, COLLECTIONS_CONSTS, isURIEqual } from 'lbry-redux';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { isEmpty } from 'util/object';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
@@ -29,7 +28,6 @@ import ClaimPreviewNoContent from './claim-preview-no-content';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { CONTAINER_ID } from 'constants/navigation';
|
||||
|
||||
const AbandonedChannelPreview = lazyImport(() =>
|
||||
import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */)
|
||||
@@ -46,7 +44,7 @@ type Props = {
|
||||
reflectingProgress?: any, // fxme
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
history: { push: (string | any) => void },
|
||||
history: { push: (string) => void },
|
||||
title: string,
|
||||
nsfw: boolean,
|
||||
placeholder: string,
|
||||
@@ -66,7 +64,7 @@ type Props = {
|
||||
actions: boolean | Node | string | number,
|
||||
properties: boolean | Node | string | number | ((Claim) => Node),
|
||||
empty?: Node,
|
||||
onClick?: (e: any, index?: number) => any,
|
||||
onClick?: (any) => any,
|
||||
streamingUrl: ?string,
|
||||
getFile: (string) => void,
|
||||
customShouldHide?: (Claim) => boolean,
|
||||
@@ -87,11 +85,6 @@ type Props = {
|
||||
collectionUris: Array<Collection>,
|
||||
collectionIndex?: number,
|
||||
disableNavigation?: boolean,
|
||||
mediaDuration?: string,
|
||||
date?: any,
|
||||
containerId?: string, // ID or name of the container (e.g. ClaimList, HOC, etc.) that this is in.
|
||||
indexInContainer?: number, // The index order of this component within 'containerId'.
|
||||
channelSubCount?: number,
|
||||
};
|
||||
|
||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
@@ -106,11 +99,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
// claim properties
|
||||
// is the claim consider nsfw?
|
||||
nsfw,
|
||||
date,
|
||||
title,
|
||||
claimIsMine,
|
||||
streamingUrl,
|
||||
mediaDuration,
|
||||
// user properties
|
||||
channelIsBlocked,
|
||||
hasVisitedUri,
|
||||
@@ -153,9 +143,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
isCollectionMine,
|
||||
collectionUris,
|
||||
disableNavigation,
|
||||
containerId,
|
||||
indexInContainer,
|
||||
channelSubCount,
|
||||
} = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
@@ -168,17 +155,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
const shouldHideActions = hideActions || isMyCollection || type === 'small' || type === 'tooltip';
|
||||
const canonicalUrl = claim && claim.canonical_url;
|
||||
const lastCollectionIndex = collectionUris ? collectionUris.length - 1 : 0;
|
||||
const channelSubscribers = React.useMemo(() => {
|
||||
if (channelSubCount === undefined) {
|
||||
return <span />;
|
||||
}
|
||||
const formattedSubCount = Number(channelSubCount).toLocaleString();
|
||||
return (
|
||||
<span className="claim-preview__channel-sub-count">
|
||||
{channelSubCount === 1 ? __('1 Follower') : __('%formattedSubCount% Followers', { formattedSubCount })}
|
||||
</span>
|
||||
);
|
||||
}, [channelSubCount]);
|
||||
let isValid = false;
|
||||
if (uri) {
|
||||
try {
|
||||
@@ -199,42 +175,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
const isChannelUri = isValid ? parseURI(uri).isChannel : false;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
|
||||
// Get channel title ( use name as fallback )
|
||||
let channelTitle = null;
|
||||
if (signingChannel) {
|
||||
const { value, name } = signingChannel;
|
||||
if (value && value.title) {
|
||||
channelTitle = value.title;
|
||||
} else {
|
||||
channelTitle = name;
|
||||
}
|
||||
}
|
||||
|
||||
// Aria-label value for claim preview
|
||||
let ariaLabelData = isChannelUri ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
||||
|
||||
let navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
|
||||
let navigateSearch = new URLSearchParams();
|
||||
if (listId) {
|
||||
navigateSearch.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
|
||||
const handleNavLinkClick = (e) => {
|
||||
if (onClick) {
|
||||
onClick(e, indexInContainer);
|
||||
}
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const navLinkProps = {
|
||||
to: {
|
||||
pathname: navigateUrl,
|
||||
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
},
|
||||
onClick: (e) => handleNavLinkClick(e),
|
||||
onAuxClick: (e) => handleNavLinkClick(e),
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
};
|
||||
|
||||
// do not block abandoned and nsfw claims if showUserBlocked is passed
|
||||
@@ -280,15 +229,11 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
||||
function handleOnClick(e) {
|
||||
if (onClick) {
|
||||
onClick(e, indexInContainer);
|
||||
onClick(e);
|
||||
}
|
||||
|
||||
if (claim && !pending && !disableNavigation) {
|
||||
history.push({
|
||||
pathname: navigateUrl,
|
||||
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
});
|
||||
history.push(navigateUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,29 +313,31 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
})}
|
||||
>
|
||||
{isChannelUri && claim ? (
|
||||
<UriIndicator focusable={false} uri={uri} link>
|
||||
<UriIndicator uri={uri} link>
|
||||
<ChannelThumbnail uri={uri} small={type === 'inline'} />
|
||||
</UriIndicator>
|
||||
) : (
|
||||
<>
|
||||
{!pending ? (
|
||||
<NavLink aria-hidden tabIndex={-1} {...navLinkProps}>
|
||||
<NavLink {...navLinkProps}>
|
||||
<FileThumbnail thumbnail={thumbnailUrl}>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
|
||||
</div>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{/* @if TARGET='app' */}
|
||||
{claim && !isCollection && (
|
||||
<FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||
)}
|
||||
{/* @endif */}
|
||||
</div>
|
||||
{/* @if TARGET='app' */}
|
||||
{claim && !isCollection && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||
</div>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{!isLivestream && (
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
|
||||
</div>
|
||||
)}
|
||||
{isPlayable && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileWatchLaterLink uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
</FileThumbnail>
|
||||
</NavLink>
|
||||
) : (
|
||||
@@ -405,14 +352,13 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
{pending ? (
|
||||
<ClaimPreviewTitle uri={uri} />
|
||||
) : (
|
||||
<NavLink aria-label={ariaLabelData} aria-current={active ? 'page' : null} {...navLinkProps}>
|
||||
<NavLink aria-current={active && 'page'} {...navLinkProps}>
|
||||
<ClaimPreviewTitle uri={uri} />
|
||||
</NavLink>
|
||||
)}
|
||||
</div>
|
||||
<ClaimPreviewSubtitle uri={uri} type={type} />
|
||||
{(pending || !!reflectingProgress) && <PublishPending uri={uri} />}
|
||||
{channelSubscribers}
|
||||
</div>
|
||||
{type !== 'small' && (
|
||||
<div className="claim-preview__actions">
|
||||
@@ -505,7 +451,9 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{!hideMenu && <ClaimMenuList uri={uri} collectionId={listId} />}
|
||||
{!hideMenu && (
|
||||
<ClaimMenuList uri={uri} collectionId={listId} />
|
||||
)}
|
||||
</>
|
||||
</WrapperElement>
|
||||
);
|
||||
|
||||
@@ -9,35 +9,25 @@ import {
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectDateForUri,
|
||||
} from 'lbry-redux';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import ClaimPreviewTile from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
||||
|
||||
return {
|
||||
claim,
|
||||
mediaDuration,
|
||||
date: props.uri && makeSelectDateForUri(props.uri)(state),
|
||||
channel: props.uri && makeSelectChannelForClaimUri(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
channel: props.uri && makeSelectChannelForClaimUri(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
|
||||
@@ -10,7 +10,6 @@ import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import useGetThumbnail from 'effects/use-get-thumbnail';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { parseURI, COLLECTIONS_CONSTS, isURIEqual } from 'lbry-redux';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
@@ -23,9 +22,7 @@ import PlaceholderTx from 'static/img/placeholderTx.gif';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
date?: any,
|
||||
claim: ?Claim,
|
||||
mediaDuration?: string,
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
history: { push: (string) => void },
|
||||
@@ -57,7 +54,6 @@ function ClaimPreviewTile(props: Props) {
|
||||
const {
|
||||
history,
|
||||
uri,
|
||||
date,
|
||||
isResolvingUri,
|
||||
thumbnail,
|
||||
title,
|
||||
@@ -77,7 +73,6 @@ function ClaimPreviewTile(props: Props) {
|
||||
showNoSourceClaims,
|
||||
isLivestream,
|
||||
collectionId,
|
||||
mediaDuration,
|
||||
} = props;
|
||||
const isRepost = claim && claim.repost_channel_url;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
@@ -120,10 +115,6 @@ function ClaimPreviewTile(props: Props) {
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
const channelUri = !isChannel ? signingChannel && signingChannel.permanent_url : claim && claim.permanent_url;
|
||||
const channelTitle = signingChannel && ((signingChannel.value && signingChannel.value.title) || signingChannel.name);
|
||||
|
||||
// Aria-label value for claim preview
|
||||
let ariaLabelData = isChannel ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
||||
|
||||
function handleClick(e) {
|
||||
if (navigateUrl) {
|
||||
@@ -198,28 +189,30 @@ function ClaimPreviewTile(props: Props) {
|
||||
|
||||
return (
|
||||
<li
|
||||
role="link"
|
||||
onClick={handleClick}
|
||||
className={classnames('card claim-preview--tile', {
|
||||
'claim-preview__wrapper--channel': isChannel,
|
||||
'claim-preview__live': live,
|
||||
})}
|
||||
>
|
||||
<NavLink {...navLinkProps} role="none" tabIndex={-1} aria-hidden>
|
||||
<NavLink {...navLinkProps}>
|
||||
<FileThumbnail thumbnail={thumbnailUrl} allowGifs>
|
||||
{!isChannel && (
|
||||
<React.Fragment>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isPlayable && (
|
||||
<FileWatchLaterLink focusable={false} uri={uri} />
|
||||
)}
|
||||
</div>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{/* @if TARGET='app' */}
|
||||
{isStream && (
|
||||
<FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />
|
||||
)}
|
||||
{/* @endif */}
|
||||
</div>
|
||||
{/* @if TARGET='app' */}
|
||||
{isStream && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton />
|
||||
</div>
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
{isPlayable && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileWatchLaterLink uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
||||
@@ -235,19 +228,17 @@ function ClaimPreviewTile(props: Props) {
|
||||
)}
|
||||
</FileThumbnail>
|
||||
</NavLink>
|
||||
<div className="claim-tile__header">
|
||||
<NavLink aria-label={ariaLabelData} {...navLinkProps}>
|
||||
<h2 className="claim-tile__title">
|
||||
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
||||
{isChannel && (
|
||||
<div className="claim-tile__about">
|
||||
<UriIndicator uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
</h2>
|
||||
</NavLink>
|
||||
<ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} />
|
||||
</div>
|
||||
<NavLink {...navLinkProps}>
|
||||
<h2 className="claim-tile__title">
|
||||
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
||||
{isChannel && (
|
||||
<div className="claim-tile__about">
|
||||
<UriIndicator uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
<ClaimMenuList uri={uri} collectionId={listId} />
|
||||
</h2>
|
||||
</NavLink>
|
||||
<div>
|
||||
<div className="claim-tile__info">
|
||||
{isChannel ? (
|
||||
@@ -256,7 +247,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
</div>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<UriIndicator focusable={false} uri={uri} link hideAnonymous>
|
||||
<UriIndicator uri={uri} link hideAnonymous>
|
||||
<ChannelThumbnail uri={channelUri} xsmall />
|
||||
</UriIndicator>
|
||||
|
||||
|
||||
@@ -159,12 +159,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
new Set(mutedUris.concat(blockedUris).map((uri) => splitBySeparator(uri)[1]))
|
||||
);
|
||||
const liveUris = [];
|
||||
let streamTypesParam;
|
||||
if (streamTypes) {
|
||||
streamTypesParam = streamTypes;
|
||||
} else if (SIMPLE_SITE && !hasNoSource && streamTypes !== null) {
|
||||
streamTypesParam = [CS.FILE_VIDEO, CS.FILE_AUDIO];
|
||||
}
|
||||
|
||||
const [prevUris, setPrevUris] = React.useState([]);
|
||||
|
||||
@@ -198,7 +192,8 @@ function ClaimTilesDiscover(props: Props) {
|
||||
channel_ids: channelIds || [],
|
||||
not_channel_ids: mutedAndBlockedChannelIds,
|
||||
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
||||
stream_types: streamTypesParam,
|
||||
stream_types:
|
||||
streamTypes === null ? undefined : SIMPLE_SITE && !hasNoSource ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
|
||||
@@ -7,14 +7,9 @@ import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
selectPlayingUri,
|
||||
} from 'redux/selectors/content';
|
||||
|
||||
const select = (state, props) => {
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const playingUrl = playingUri && playingUri.uri;
|
||||
const claim = makeSelectClaimForUri(playingUrl)(state);
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const url = claim && claim.permanent_url;
|
||||
|
||||
return {
|
||||
|
||||
@@ -9,7 +9,7 @@ import CollectionsListMine from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
builtinCollections: selectBuiltinCollections(state),
|
||||
publishedCollections: selectMyPublishedPlaylistCollections(state),
|
||||
publishedPlaylists: selectMyPublishedPlaylistCollections(state),
|
||||
unpublishedCollections: selectMyUnpublishedCollections(state),
|
||||
// savedCollections: selectSavedCollections(state),
|
||||
});
|
||||
|
||||
@@ -8,78 +8,48 @@ import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import Card from 'component/common/card';
|
||||
import classnames from 'classnames';
|
||||
import { FormField, Form } from 'component/common/form';
|
||||
|
||||
type Props = {
|
||||
builtinCollections: CollectionGroup,
|
||||
publishedCollections: CollectionGroup,
|
||||
publishedCollections: CollectionGroup,
|
||||
publishedPlaylists: CollectionGroup,
|
||||
unpublishedCollections: CollectionGroup,
|
||||
// savedCollections: CollectionGroup,
|
||||
};
|
||||
|
||||
const ALL = 'All';
|
||||
const PRIVATE = 'Private';
|
||||
const PUBLIC = 'Public';
|
||||
const COLLECTION_FILTERS = [ALL, PRIVATE, PUBLIC];
|
||||
|
||||
export default function CollectionsListMine(props: Props) {
|
||||
const {
|
||||
builtinCollections,
|
||||
publishedCollections,
|
||||
publishedPlaylists,
|
||||
unpublishedCollections,
|
||||
// savedCollections, these are resolved on startup from sync'd claimIds or urls
|
||||
} = props;
|
||||
|
||||
const builtinCollectionsList = (Object.values(builtinCollections || {}): any);
|
||||
const unpublishedCollectionsList = (Object.keys(unpublishedCollections || {}): any);
|
||||
const publishedList = (Object.keys(publishedCollections || {}): any);
|
||||
const publishedList = (Object.keys(publishedPlaylists || {}): any);
|
||||
const hasCollections = unpublishedCollectionsList.length || publishedList.length;
|
||||
const [filterType, setFilterType] = React.useState(ALL);
|
||||
const [searchText, setSearchText] = React.useState('');
|
||||
|
||||
let collectionsToShow = [];
|
||||
if (filterType === ALL) {
|
||||
collectionsToShow = unpublishedCollectionsList.concat(publishedList);
|
||||
} else if (filterType === PRIVATE) {
|
||||
collectionsToShow = unpublishedCollectionsList;
|
||||
} else if (filterType === PUBLIC) {
|
||||
collectionsToShow = publishedList;
|
||||
}
|
||||
|
||||
let filteredCollections;
|
||||
if (searchText && collectionsToShow) {
|
||||
filteredCollections = collectionsToShow.filter((id) => {
|
||||
return (
|
||||
(unpublishedCollections[id] &&
|
||||
unpublishedCollections[id].name.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) ||
|
||||
(publishedCollections[id] &&
|
||||
publishedCollections[id].name.toLocaleLowerCase().includes(searchText.toLocaleLowerCase()))
|
||||
);
|
||||
});
|
||||
} else {
|
||||
filteredCollections = collectionsToShow || [];
|
||||
}
|
||||
|
||||
const watchLater = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID);
|
||||
const favorites = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.FAVORITES_ID);
|
||||
const builtin = [watchLater, favorites];
|
||||
function escapeListener(e: SyntheticKeyboardEvent<*>) {
|
||||
const KEYCODE_ESCAPE = 27;
|
||||
if (e.keyCode === KEYCODE_ESCAPE) {
|
||||
e.preventDefault();
|
||||
setSearchText('');
|
||||
}
|
||||
}
|
||||
const [showHelp, setShowHelp] = usePersistedState('livestream-help-seen', true);
|
||||
|
||||
function onTextareaFocus() {
|
||||
window.addEventListener('keydown', escapeListener);
|
||||
}
|
||||
const helpText = (
|
||||
<div className="section__subtitle">
|
||||
<p>{__(`Everyone starts with 2 private lists - Watch Later and Favorites.`)}</p>
|
||||
<p>{__(`Add content to existing lists or new lists from content pages or content previews.`)}</p>
|
||||
<p>
|
||||
{__(
|
||||
`By default, lists are private. You can edit them and later publish them from the Lists page or the Publish context menu on this page. Similar to uploads, small blockchain fees apply.`
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
function onTextareaBlur() {
|
||||
window.removeEventListener('keydown', escapeListener);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{builtin.map((list: Collection) => {
|
||||
@@ -98,14 +68,9 @@ export default function CollectionsListMine(props: Props) {
|
||||
<span className="claim-grid__title-span">
|
||||
{__(`${list.name}`)}
|
||||
<div className="claim-grid__title--empty">
|
||||
<Icon
|
||||
className="icon--margin-right"
|
||||
icon={
|
||||
(list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID && ICONS.TIME) ||
|
||||
(list.id === COLLECTIONS_CONSTS.FAVORITES_ID && ICONS.STAR) ||
|
||||
ICONS.STACK
|
||||
}
|
||||
/>
|
||||
<Icon className="icon--margin-right"
|
||||
icon={(list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID && ICONS.TIME) ||
|
||||
(list.id === COLLECTIONS_CONSTS.FAVORITES_ID && ICONS.STAR) || ICONS.STACK} />
|
||||
{itemUrls.length}
|
||||
</div>
|
||||
</span>
|
||||
@@ -126,57 +91,52 @@ export default function CollectionsListMine(props: Props) {
|
||||
);
|
||||
})}
|
||||
<div className="claim-grid__wrapper">
|
||||
<div className="claim-grid__header section">
|
||||
<div className="claim-grid__header claim-grid__header--between section">
|
||||
<h1 className="claim-grid__title">
|
||||
{__('Playlists')}
|
||||
{!hasCollections && (
|
||||
<div className="claim-grid__title--empty">{__('(Empty) --[indicates empty playlist]--')}</div>
|
||||
)}
|
||||
</h1>
|
||||
<Button button="link" onClick={() => setShowHelp(!showHelp)} label={__('How does this work?')} />
|
||||
</div>
|
||||
<div className="section__header--actions">
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__menu-group">
|
||||
{COLLECTION_FILTERS.map((value) => (
|
||||
<Button
|
||||
label={__(value)}
|
||||
key={value}
|
||||
button="alt"
|
||||
onClick={() => setFilterType(value)}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': filterType === value,
|
||||
})}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
className="wunderbar__input--inline"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
</Form>
|
||||
</div>
|
||||
{showHelp && (
|
||||
<Card
|
||||
titleActions={<Button button="close" icon={ICONS.REMOVE} onClick={() => setShowHelp(false)} />}
|
||||
title={__('Introducing Lists')}
|
||||
actions={helpText}
|
||||
/>
|
||||
)}
|
||||
{Boolean(hasCollections) && (
|
||||
<div>
|
||||
<div
|
||||
className={classnames({
|
||||
section: showHelp,
|
||||
})}
|
||||
>
|
||||
{/* TODO: fix above spacing hack */}
|
||||
<div className="claim-grid">
|
||||
{filteredCollections &&
|
||||
filteredCollections.length > 0 &&
|
||||
filteredCollections.map((key) => <CollectionPreviewTile tileLayout collectionId={key} key={key} />)}
|
||||
{!filteredCollections.length && <div className="empty main--empty">{__('No matching collections')}</div>}
|
||||
{unpublishedCollectionsList &&
|
||||
unpublishedCollectionsList.length > 0 &&
|
||||
unpublishedCollectionsList.map((key) => (
|
||||
<CollectionPreviewTile tileLayout collectionId={key} key={key} />
|
||||
))}
|
||||
{publishedList &&
|
||||
publishedList.length > 0 &&
|
||||
publishedList.map((key) => <CollectionPreviewTile tileLayout collectionId={key} key={key} />)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!hasCollections && (
|
||||
<div className="main--empty">
|
||||
<Yrbl type={'sad'} title={__('You have no lists yet. Better start hoarding!')} />
|
||||
<Yrbl
|
||||
type={'sad'}
|
||||
title={__('You have no lists yet. Better start hoarding!')}
|
||||
// actions={
|
||||
// <div className="section__actions">
|
||||
// <Button button="primary" label={__('View Content')} onClick={() => setViewBlockedChannel(true)} />
|
||||
// </div>
|
||||
// }
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,6 @@ import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import Expandable from 'component/expandable';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { Menu, MenuButton } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
@@ -60,9 +59,7 @@ type Props = {
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
numDirectReplies: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
isFiat: boolean
|
||||
};
|
||||
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
@@ -95,8 +92,6 @@ function Comment(props: Props) {
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
numDirectReplies,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
} = props;
|
||||
|
||||
@@ -230,22 +225,6 @@ function Comment(props: Props) {
|
||||
<div className="comment__body-container">
|
||||
<div className="comment__meta">
|
||||
<div className="comment__meta-information">
|
||||
{isGlobalMod && (
|
||||
<Tooltip label={__('Admin')}>
|
||||
<span className="comment__badge comment__badge--global-mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={20} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<Tooltip label={__('Moderator')}>
|
||||
<span className="comment__badge comment__badge--mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={20} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{!author ? (
|
||||
<span className="comment__author">{__('Anonymous')}</span>
|
||||
) : (
|
||||
@@ -291,7 +270,6 @@ function Comment(props: Props) {
|
||||
authorUri={authorUri}
|
||||
commentIsMine={commentIsMine}
|
||||
handleEditComment={handleEditComment}
|
||||
supportAmount={supportAmount}
|
||||
/>
|
||||
</Menu>
|
||||
</div>
|
||||
|
||||
@@ -7,42 +7,30 @@ import {
|
||||
doSendTip,
|
||||
} from 'lbry-redux';
|
||||
import { doOpenModal, doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doCommentCreate, doFetchCreatorSettings } from 'redux/actions/comments';
|
||||
import { doCommentCreate } from 'redux/actions/comments';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
import { makeSelectCommentsDisabledForUri } from 'redux/selectors/comments';
|
||||
import { CommentCreate } from './view';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
|
||||
const select = (state, props) => ({
|
||||
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
commentsDisabledBySettings: makeSelectCommentsDisabledForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
isFetchingChannels: selectFetchingMyChannels(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
createComment: (comment, claimId, parentId, txid, payment_intent_id, environment) =>
|
||||
dispatch(
|
||||
doCommentCreate(
|
||||
comment,
|
||||
claimId,
|
||||
parentId,
|
||||
ownProps.uri,
|
||||
ownProps.livestream,
|
||||
txid,
|
||||
payment_intent_id,
|
||||
environment
|
||||
)
|
||||
),
|
||||
dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri, ownProps.livestream, txid, payment_intent_id, environment)),
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
||||
sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
doFetchCreatorSettings: (channelClaimId) => dispatch(doFetchCreatorSettings(channelClaimId)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentCreate);
|
||||
@@ -1,12 +1,11 @@
|
||||
// @flow
|
||||
import type { ElementRef } from 'react';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { SIMPLE_SITE, STRIPE_PUBLIC_KEY } from 'config';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { FormField, Form } from 'component/common/form';
|
||||
import Icon from 'component/common/icon';
|
||||
import Button from 'component/button';
|
||||
import SelectChannel from 'component/selectChannel';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
@@ -15,14 +14,16 @@ import { useHistory } from 'react-router';
|
||||
import WalletTipAmountSelector from 'component/walletTipAmountSelector';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import Empty from 'component/common/empty';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
|
||||
import { getStripeEnvironment } from 'util/stripe';
|
||||
let stripeEnvironment = getStripeEnvironment();
|
||||
let stripeEnvironment = 'test';
|
||||
// if the key contains pk_live it's a live key
|
||||
// update the environment for the calls to the backend to indicate which environment to hit
|
||||
if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) {
|
||||
stripeEnvironment = 'live';
|
||||
}
|
||||
|
||||
const TAB_FIAT = 'TabFiat';
|
||||
const TAB_LBC = 'TabLBC';
|
||||
@@ -31,6 +32,7 @@ type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
createComment: (string, string, string, ?string, ?string, ?string) => Promise<any>,
|
||||
commentsDisabledBySettings: boolean,
|
||||
channels: ?Array<ChannelClaim>,
|
||||
onDoneReplying?: () => void,
|
||||
onCancelReplying?: () => void,
|
||||
@@ -41,19 +43,20 @@ type Props = {
|
||||
activeChannel: string,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
bottom: boolean,
|
||||
livestream?: boolean,
|
||||
onSubmit: (string, string) => void,
|
||||
livestream: boolean,
|
||||
embed?: boolean,
|
||||
toast: (string) => void,
|
||||
claimIsMine: boolean,
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
doFetchCreatorSettings: (channelId: string) => Promise<any>,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
disabled: boolean,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
const {
|
||||
createComment,
|
||||
commentsDisabledBySettings,
|
||||
claim,
|
||||
channels,
|
||||
onDoneReplying,
|
||||
@@ -63,16 +66,17 @@ export function CommentCreate(props: Props) {
|
||||
isReply,
|
||||
parentId,
|
||||
activeChannelClaim,
|
||||
onSubmit,
|
||||
bottom,
|
||||
livestream,
|
||||
embed,
|
||||
toast,
|
||||
claimIsMine,
|
||||
sendTip,
|
||||
doToast,
|
||||
doFetchCreatorSettings,
|
||||
settingsByChannelId,
|
||||
} = props;
|
||||
const buttonRef: ElementRef<any> = React.useRef();
|
||||
const buttonref: ElementRef<any> = React.useRef();
|
||||
|
||||
const {
|
||||
push,
|
||||
location: { pathname },
|
||||
@@ -88,44 +92,13 @@ export function CommentCreate(props: Props) {
|
||||
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const hasChannels = channels && channels.length;
|
||||
const charCount = commentValue.length;
|
||||
|
||||
const [activeTab, setActiveTab] = React.useState('');
|
||||
|
||||
const [tipError, setTipError] = React.useState();
|
||||
const disabled = isSubmitting || isFetchingChannels || !commentValue.length;
|
||||
|
||||
const disabled = isSubmitting || !activeChannelClaim || !commentValue.length;
|
||||
const [shouldDisableReviewButton, setShouldDisableReviewButton] = React.useState();
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
||||
const minSuper = (channelSettings && channelSettings.min_tip_amount_super_chat) || 0;
|
||||
const minTip = (channelSettings && channelSettings.min_tip_amount_comment) || 0;
|
||||
const minAmount = minTip || minSuper || 0;
|
||||
const minAmountMet = minAmount === 0 || tipAmount >= minAmount;
|
||||
|
||||
const minAmountRef = React.useRef(minAmount);
|
||||
minAmountRef.current = minAmount;
|
||||
|
||||
const MinAmountNotice = minAmount ? (
|
||||
<div className="help--notice comment--min-amount-notice">
|
||||
<I18nMessage tokens={{ lbc: <CreditAmount noFormat amount={minAmount} /> }}>
|
||||
{minTip ? 'Comment min: %lbc%' : minSuper ? 'HyperChat min: %lbc%' : ''}
|
||||
</I18nMessage>
|
||||
<Icon
|
||||
customTooltipText={
|
||||
minTip
|
||||
? __('This channel requires a minimum tip for each comment.')
|
||||
: minSuper
|
||||
? __('This channel requires a minimum amount for HyperChats to be visible.')
|
||||
: ''
|
||||
}
|
||||
className="icon--help"
|
||||
icon={ICONS.HELP}
|
||||
tooltip
|
||||
size={16}
|
||||
/>
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
// **************************************************************************
|
||||
// Functions
|
||||
// **************************************************************************
|
||||
|
||||
function handleCommentChange(event) {
|
||||
let commentValue;
|
||||
@@ -142,7 +115,7 @@ export function CommentCreate(props: Props) {
|
||||
const KEYCODE_ENTER = 13;
|
||||
if ((livestream || e.ctrlKey || e.metaKey) && e.keyCode === KEYCODE_ENTER) {
|
||||
e.preventDefault();
|
||||
buttonRef.current.click();
|
||||
buttonref.current.click();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,15 +138,6 @@ export function CommentCreate(props: Props) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!channelId) {
|
||||
doToast({
|
||||
message: __('Unable to verify channel settings. Try refreshing the page.'),
|
||||
isError: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// if comment post didn't work, but tip was already made, try again to create comment
|
||||
if (commentFailure && tipAmount === successTip.tipAmount) {
|
||||
handleCreateComment(successTip.txid);
|
||||
return;
|
||||
@@ -181,29 +145,6 @@ export function CommentCreate(props: Props) {
|
||||
setSuccessTip({ txid: undefined, tipAmount: undefined });
|
||||
}
|
||||
|
||||
// !! Beware of stale closure when editing the then-block, including doSubmitTip().
|
||||
doFetchCreatorSettings(channelId).then(() => {
|
||||
const lockedMinAmount = minAmount; // value during closure.
|
||||
const currentMinAmount = minAmountRef.current; // value from latest doFetchCreatorSettings().
|
||||
|
||||
if (lockedMinAmount !== currentMinAmount) {
|
||||
doToast({
|
||||
message: __('The creator just updated the minimum setting. Please revise or double-check your tip amount.'),
|
||||
isError: true,
|
||||
});
|
||||
setIsReviewingSupportComment(false);
|
||||
return;
|
||||
}
|
||||
|
||||
doSubmitTip();
|
||||
});
|
||||
}
|
||||
|
||||
function doSubmitTip() {
|
||||
if (!activeChannelClaim) {
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
amount: tipAmount,
|
||||
claim_id: claimId,
|
||||
@@ -213,18 +154,7 @@ export function CommentCreate(props: Props) {
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||
|
||||
// setup variables for tip API
|
||||
let channelClaimId, tipChannelName;
|
||||
// if there is a signing channel it's on a file
|
||||
if (claim.signing_channel) {
|
||||
channelClaimId = claim.signing_channel.claim_id;
|
||||
tipChannelName = claim.signing_channel.name;
|
||||
|
||||
// otherwise it's on the channel page
|
||||
} else {
|
||||
channelClaimId = claim.claim_id;
|
||||
tipChannelName = claim.name;
|
||||
}
|
||||
console.log(activeChannelClaim);
|
||||
|
||||
setIsSubmitting(true);
|
||||
|
||||
@@ -239,17 +169,6 @@ export function CommentCreate(props: Props) {
|
||||
setTimeout(() => {
|
||||
handleCreateComment(txid);
|
||||
}, 1500);
|
||||
|
||||
doToast({
|
||||
message: __(
|
||||
"You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
{
|
||||
tipAmount: tipAmount, // force show decimal places
|
||||
tipChannelName,
|
||||
}
|
||||
),
|
||||
});
|
||||
|
||||
setSuccessTip({ txid, tipAmount });
|
||||
},
|
||||
() => {
|
||||
@@ -258,15 +177,28 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// setup variables for tip API
|
||||
let channelClaimId, tipChannelName;
|
||||
// if there is a signing channel it's on a file
|
||||
if (claim.signing_channel) {
|
||||
channelClaimId = claim.signing_channel.claim_id;
|
||||
tipChannelName = claim.signing_channel.name;
|
||||
|
||||
// otherwise it's on the channel page
|
||||
} else {
|
||||
channelClaimId = claim.claim_id;
|
||||
tipChannelName = claim.name;
|
||||
}
|
||||
|
||||
const sourceClaimId = claim.claim_id;
|
||||
const roundedAmount = Math.round(tipAmount * 100) / 100;
|
||||
|
||||
var roundedAmount = Math.round(tipAmount * 100) / 100;
|
||||
|
||||
Lbryio.call(
|
||||
'customer',
|
||||
'tip',
|
||||
{
|
||||
// round to deal with floating point precision
|
||||
amount: Math.round(100 * roundedAmount), // convert from dollars to cents
|
||||
amount: 100 * roundedAmount, // convert from dollars to cents
|
||||
creator_channel_name: tipChannelName, // creator_channel_name
|
||||
creator_channel_claim_id: channelClaimId,
|
||||
tipper_channel_name: activeChannelName,
|
||||
@@ -279,6 +211,8 @@ export function CommentCreate(props: Props) {
|
||||
'post'
|
||||
)
|
||||
.then((customerTipResponse) => {
|
||||
console.log(customerTipResponse);
|
||||
|
||||
const paymentIntendId = customerTipResponse.payment_intent_id;
|
||||
|
||||
handleCreateComment(null, paymentIntendId, stripeEnvironment);
|
||||
@@ -298,14 +232,14 @@ export function CommentCreate(props: Props) {
|
||||
|
||||
// handleCreateComment(null);
|
||||
})
|
||||
.catch((error) => {
|
||||
doToast({
|
||||
message:
|
||||
error.message !== 'payment intent failed to confirm'
|
||||
? error.message
|
||||
: 'Sorry, there was an error in processing your payment!',
|
||||
isError: true,
|
||||
});
|
||||
.catch(function (error) {
|
||||
var displayError = 'Sorry, there was an error in processing your payment!';
|
||||
|
||||
if (error.message !== 'payment intent failed to confirm') {
|
||||
displayError = error.message;
|
||||
}
|
||||
|
||||
doToast({ message: displayError, isError: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -329,20 +263,18 @@ export function CommentCreate(props: Props) {
|
||||
setIsSupportComment(false);
|
||||
setCommentFailure(false);
|
||||
|
||||
if (onSubmit) {
|
||||
onSubmit(commentValue, activeChannelClaim.name);
|
||||
}
|
||||
|
||||
if (onDoneReplying) {
|
||||
onDoneReplying();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e) => {
|
||||
setIsSubmitting(false);
|
||||
setCommentFailure(true);
|
||||
|
||||
if (channelId) {
|
||||
// It could be that the creator added a minimum tip setting.
|
||||
// Manually update for now until a websocket msg is available.
|
||||
doFetchCreatorSettings(channelId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -350,26 +282,11 @@ export function CommentCreate(props: Props) {
|
||||
setAdvancedEditor(!advancedEditor);
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// Effects
|
||||
// **************************************************************************
|
||||
|
||||
// Fetch channel constraints if not already.
|
||||
React.useEffect(() => {
|
||||
if (!channelSettings && channelId) {
|
||||
doFetchCreatorSettings(channelId);
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// **************************************************************************
|
||||
// Render
|
||||
// **************************************************************************
|
||||
|
||||
if (channelSettings && !channelSettings.comments_enabled) {
|
||||
if (commentsDisabledBySettings) {
|
||||
return <Empty padded text={__('This channel has disabled comments on their page.')} />;
|
||||
}
|
||||
|
||||
if (!isFetchingChannels && !hasChannels) {
|
||||
if (!hasChannels) {
|
||||
return (
|
||||
<div
|
||||
role="button"
|
||||
@@ -387,7 +304,12 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<FormField type="textarea" name={'comment_signup_prompt'} placeholder={__('Say something about this...')} />
|
||||
<FormField
|
||||
type="textarea"
|
||||
name={'comment_signup_prompt'}
|
||||
placeholder={__('Say something about this...')}
|
||||
label={isFetchingChannels ? __('Comment') : undefined}
|
||||
/>
|
||||
<div className="section__actions--no-margin">
|
||||
<Button disabled button="primary" label={__('Post --[button to submit something]--')} requiresAuth={IS_WEB} />
|
||||
</div>
|
||||
@@ -400,7 +322,7 @@ export function CommentCreate(props: Props) {
|
||||
<div className="comment__create">
|
||||
<div className="comment__sc-preview">
|
||||
<CreditAmount
|
||||
className="comment__sc-preview-amount"
|
||||
className="comment__scpreview-amount"
|
||||
isFiat={activeTab === TAB_FIAT}
|
||||
amount={tipAmount}
|
||||
size={activeTab === TAB_LBC ? 18 : 2}
|
||||
@@ -416,7 +338,7 @@ export function CommentCreate(props: Props) {
|
||||
<Button
|
||||
autoFocus
|
||||
button="primary"
|
||||
disabled={disabled || !minAmountMet}
|
||||
disabled={disabled}
|
||||
label={
|
||||
isSubmitting
|
||||
? __('Sending...')
|
||||
@@ -426,13 +348,7 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
onClick={handleSupportComment}
|
||||
/>
|
||||
<Button
|
||||
disabled={isSubmitting}
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={() => setIsReviewingSupportComment(false)}
|
||||
/>
|
||||
{MinAmountNotice}
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setIsReviewingSupportComment(false)} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -448,7 +364,7 @@ export function CommentCreate(props: Props) {
|
||||
})}
|
||||
>
|
||||
<FormField
|
||||
disabled={isFetchingChannels}
|
||||
disabled={!activeChannelClaim}
|
||||
type={SIMPLE_SITE ? 'textarea' : advancedEditor && !isReply ? 'markdown' : 'textarea'}
|
||||
name={isReply ? 'content_reply' : 'content_description'}
|
||||
label={
|
||||
@@ -486,37 +402,34 @@ export function CommentCreate(props: Props) {
|
||||
{isSupportComment ? (
|
||||
<>
|
||||
<Button
|
||||
disabled={disabled || tipError || shouldDisableReviewButton || !minAmountMet}
|
||||
disabled={disabled || tipError || shouldDisableReviewButton}
|
||||
type="button"
|
||||
button="primary"
|
||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
||||
label={__('Review')}
|
||||
onClick={() => setIsReviewingSupportComment(true)}
|
||||
requiresAuth={IS_WEB}
|
||||
/>
|
||||
|
||||
<Button disabled={disabled} button="link" label={__('Cancel')} onClick={() => setIsSupportComment(false)} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{(!minTip || claimIsMine) && (
|
||||
<Button
|
||||
ref={buttonRef}
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
type="submit"
|
||||
label={
|
||||
isReply
|
||||
? isSubmitting
|
||||
? __('Replying...')
|
||||
: __('Reply')
|
||||
: isSubmitting
|
||||
? __('Commenting...')
|
||||
: __('Comment --[button to submit something]--')
|
||||
}
|
||||
requiresAuth={IS_WEB}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
ref={buttonref}
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
type="submit"
|
||||
label={
|
||||
isReply
|
||||
? isSubmitting
|
||||
? __('Replying...')
|
||||
: __('Reply')
|
||||
: isSubmitting
|
||||
? __('Commenting...')
|
||||
: __('Comment --[button to submit something]--')
|
||||
}
|
||||
requiresAuth={IS_WEB}
|
||||
/>
|
||||
{!claimIsMine && (
|
||||
<Button
|
||||
disabled={disabled}
|
||||
@@ -529,8 +442,7 @@ export function CommentCreate(props: Props) {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* @if TARGET='web' */}
|
||||
{!claimIsMine && stripeEnvironment && (
|
||||
{!claimIsMine && (
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="alt"
|
||||
@@ -542,8 +454,7 @@ export function CommentCreate(props: Props) {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{isReply && !minTip && (
|
||||
{isReply && (
|
||||
<Button
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
@@ -556,7 +467,6 @@ export function CommentCreate(props: Props) {
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{MinAmountNotice}
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import {
|
||||
doCommentAbandon,
|
||||
doCommentPin,
|
||||
doCommentModBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
} from 'redux/actions/comments';
|
||||
import { doChannelMute } from 'redux/actions/blocked';
|
||||
// import { doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
@@ -26,8 +26,8 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
deleteComment: (commentId, creatorChannelUrl) => dispatch(doCommentAbandon(commentId, creatorChannelUrl)),
|
||||
muteChannel: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
pinComment: (commentId, claimId, remove) => dispatch(doCommentPin(commentId, claimId, remove)),
|
||||
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React from 'react';
|
||||
import { MenuList, MenuItem } from '@reach/menu-button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
@@ -13,6 +12,7 @@ type Props = {
|
||||
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
|
||||
commentId: string, // sha256 digest identifying the comment
|
||||
commentIsMine: boolean, // if this comment was signed by an owned channel
|
||||
deleteComment: (string, ?string) => void,
|
||||
isPinned: boolean,
|
||||
pinComment: (string, string, boolean) => Promise<any>,
|
||||
muteChannel: (string) => void,
|
||||
@@ -28,8 +28,6 @@ type Props = {
|
||||
disableEdit?: boolean,
|
||||
disableRemove?: boolean,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
openModal: (id: string, {}) => void,
|
||||
supportAmount?: any,
|
||||
};
|
||||
|
||||
function CommentMenuList(props: Props) {
|
||||
@@ -38,6 +36,7 @@ function CommentMenuList(props: Props) {
|
||||
authorUri,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
deleteComment,
|
||||
muteChannel,
|
||||
pinComment,
|
||||
clearPlayingUri,
|
||||
@@ -54,8 +53,6 @@ function CommentMenuList(props: Props) {
|
||||
disableEdit,
|
||||
disableRemove,
|
||||
moderationDelegatorsById,
|
||||
openModal,
|
||||
supportAmount,
|
||||
} = props;
|
||||
|
||||
const contentChannelClaim = !claim
|
||||
@@ -83,7 +80,7 @@ function CommentMenuList(props: Props) {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, { commentId, commentIsMine, contentChannelPermanentUrl, supportAmount });
|
||||
deleteComment(commentId, commentIsMine ? undefined : contentChannelPermanentUrl);
|
||||
}
|
||||
|
||||
function handleCommentBlock() {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
selectFetchingMyChannels,
|
||||
selectMyChannelClaims,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectClaimIsMine, selectFetchingMyChannels, selectMyChannelClaims } from 'lbry-redux';
|
||||
import {
|
||||
makeSelectTopLevelCommentsForUri,
|
||||
makeSelectTopLevelTotalPagesForUri,
|
||||
@@ -12,12 +7,12 @@ import {
|
||||
selectIsFetchingReacts,
|
||||
makeSelectTotalCommentsCountForUri,
|
||||
selectOthersReactsById,
|
||||
makeSelectCommentsDisabledForUri,
|
||||
selectMyReactionsByCommentId,
|
||||
makeSelectCommentIdsForUri,
|
||||
selectSettingsByChannelId,
|
||||
makeSelectPinnedCommentsForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
import { doCommentReset, doCommentList, doCommentById, doCommentReactList } from 'redux/actions/comments';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import CommentsList from './view';
|
||||
|
||||
@@ -26,16 +21,15 @@ const select = (state, props) => {
|
||||
return {
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
allCommentIds: makeSelectCommentIdsForUri(props.uri)(state),
|
||||
pinnedComments: makeSelectPinnedCommentsForUri(props.uri)(state),
|
||||
topLevelComments: makeSelectTopLevelCommentsForUri(props.uri)(state),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state),
|
||||
totalComments: makeSelectTotalCommentsCountForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
isFetchingComments: selectIsFetchingComments(state),
|
||||
isFetchingReacts: selectIsFetchingReacts(state),
|
||||
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
commentsDisabledBySettings: makeSelectCommentsDisabledForUri(props.uri)(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
myReactsByCommentId: selectMyReactionsByCommentId(state),
|
||||
othersReactsById: selectOthersReactsById(state),
|
||||
activeChannelId: activeChannelClaim && activeChannelClaim.claim_id,
|
||||
|
||||
@@ -13,8 +13,6 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import Empty from 'component/common/empty';
|
||||
import debounce from 'util/debounce';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
|
||||
@@ -28,15 +26,14 @@ function scaleToDevicePixelRatio(value) {
|
||||
|
||||
type Props = {
|
||||
allCommentIds: any,
|
||||
pinnedComments: Array<Comment>,
|
||||
topLevelComments: Array<Comment>,
|
||||
topLevelTotalPages: number,
|
||||
commentsDisabledBySettings: boolean,
|
||||
fetchTopLevelComments: (string, number, number, number) => void,
|
||||
fetchComment: (string) => void,
|
||||
fetchReacts: (Array<string>) => Promise<any>,
|
||||
resetComments: (string) => void,
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
isFetchingComments: boolean,
|
||||
@@ -47,7 +44,6 @@ type Props = {
|
||||
myReactsByCommentId: ?{ [string]: Array<string> }, // "CommentId:MyChannelId" -> reaction array (note the ID concatenation)
|
||||
othersReactsById: ?{ [string]: { [REACTION_TYPES.LIKE | REACTION_TYPES.DISLIKE]: number } },
|
||||
activeChannelId: ?string,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
};
|
||||
|
||||
function CommentList(props: Props) {
|
||||
@@ -58,10 +54,9 @@ function CommentList(props: Props) {
|
||||
fetchReacts,
|
||||
resetComments,
|
||||
uri,
|
||||
pinnedComments,
|
||||
topLevelComments,
|
||||
topLevelTotalPages,
|
||||
claim,
|
||||
commentsDisabledBySettings,
|
||||
claimIsMine,
|
||||
myChannels,
|
||||
isFetchingComments,
|
||||
@@ -72,7 +67,6 @@ function CommentList(props: Props) {
|
||||
myReactsByCommentId,
|
||||
othersReactsById,
|
||||
activeChannelId,
|
||||
settingsByChannelId,
|
||||
} = props;
|
||||
|
||||
const commentRef = React.useRef();
|
||||
@@ -80,11 +74,7 @@ function CommentList(props: Props) {
|
||||
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
|
||||
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
|
||||
const [page, setPage] = React.useState(0);
|
||||
const isMobile = useIsMobile();
|
||||
const [expandedComments, setExpandedComments] = React.useState(!isMobile);
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
||||
|
||||
// Display comments immediately if not fetching reactions
|
||||
// If not, wait to show comments until reactions are fetched
|
||||
@@ -113,34 +103,6 @@ function CommentList(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function getCommentElems(comments) {
|
||||
return comments.map((comment) => {
|
||||
return (
|
||||
<CommentView
|
||||
isTopLevel
|
||||
threadDepth={3}
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
linkedCommentId={linkedCommentId}
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Reset comments
|
||||
useEffect(() => {
|
||||
if (page === 0) {
|
||||
@@ -229,7 +191,7 @@ function CommentList(props: Props) {
|
||||
}
|
||||
|
||||
const handleCommentScroll = debounce(() => {
|
||||
if (!isMobile && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
if (shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
||||
@@ -243,7 +205,6 @@ function CommentList(props: Props) {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
isMobile,
|
||||
page,
|
||||
moreBelow,
|
||||
spinnerRef,
|
||||
@@ -253,6 +214,8 @@ function CommentList(props: Props) {
|
||||
topLevelTotalPages,
|
||||
]);
|
||||
|
||||
const displayedComments = readyToDisplayComments ? topLevelComments : [];
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={
|
||||
@@ -312,51 +275,39 @@ function CommentList(props: Props) {
|
||||
<>
|
||||
<CommentCreate uri={uri} />
|
||||
|
||||
{channelSettings && channelSettings.comments_enabled && !isFetchingComments && hasNoComments && (
|
||||
{!commentsDisabledBySettings && !isFetchingComments && hasNoComments && (
|
||||
<Empty padded text={__('That was pretty deep. What do you think?')} />
|
||||
)}
|
||||
|
||||
<ul
|
||||
className={classnames({
|
||||
comments: expandedComments,
|
||||
'comments--contracted': !expandedComments,
|
||||
})}
|
||||
ref={commentRef}
|
||||
>
|
||||
{readyToDisplayComments && pinnedComments && getCommentElems(pinnedComments)}
|
||||
{readyToDisplayComments && topLevelComments && getCommentElems(topLevelComments)}
|
||||
<ul className="comments" ref={commentRef}>
|
||||
{topLevelComments &&
|
||||
displayedComments &&
|
||||
displayedComments.map((comment) => {
|
||||
return (
|
||||
<CommentView
|
||||
isTopLevel
|
||||
threadDepth={3}
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
linkedCommentId={linkedCommentId}
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{isMobile && (
|
||||
<div className="card__bottom-actions--comments">
|
||||
{(!expandedComments || moreBelow) && (
|
||||
<Button
|
||||
button="link"
|
||||
title={!expandedComments ? __('Expand Comments') : __('Load More')}
|
||||
label={!expandedComments ? __('Expand') : __('More')}
|
||||
onClick={() => {
|
||||
if (!expandedComments) {
|
||||
setExpandedComments(true);
|
||||
} else {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{expandedComments && (
|
||||
<Button
|
||||
button="link"
|
||||
title={__('Collapse Thread')}
|
||||
label={__('Collapse')}
|
||||
onClick={() => {
|
||||
setExpandedComments(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(isFetchingComments || (!isMobile && moreBelow)) && (
|
||||
{(isFetchingComments || moreBelow) && (
|
||||
<div className="main--empty" ref={spinnerRef}>
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
|
||||
@@ -97,8 +97,6 @@ function CommentsReplies(props: Props) {
|
||||
commentingEnabled={commentingEnabled}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -44,15 +44,7 @@ const buildIcon = (iconStrokes: React$Node, customSvgValues = {}) =>
|
||||
export const icons = {
|
||||
// The LBRY icon is different from the base icon set so don't use buildIcon()
|
||||
[ICONS.LBRY]: (props: IconProps) => (
|
||||
<svg
|
||||
{...props}
|
||||
stroke="currentColor"
|
||||
fill="currentColor"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 322 254"
|
||||
className="icon lbry-icon"
|
||||
>
|
||||
<svg stroke="currentColor" fill="currentColor" x="0px" y="0px" viewBox="0 0 322 254" className="icon lbry-icon">
|
||||
<path d="M296,85.9V100l-138.8,85.3L52.6,134l0.2-7.9l104,51.2L289,96.1v-5.8L164.2,30.1L25,116.2v38.5l131.8,65.2 l137.6-84.4l3.9,6l-141.1,86.4L18.1,159.1v-46.8l145.8-90.2C163.9,22.1,296,85.9,296,85.9z" />
|
||||
<path d="M294.3,150.9l2-12.6l-12.2-2.1l0.8-4.9l17.1,2.9l-2.8,17.5L294.3,150.9L294.3,150.9z" />
|
||||
</svg>
|
||||
@@ -2331,37 +2323,4 @@ export const icons = {
|
||||
<path d="M4.954 14.753l3.535 3.535-1.768 1.768-3.535-3.535z" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.BADGE_MOD]: (props: IconProps) => (
|
||||
<svg
|
||||
{...props}
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlnsXlink="http://www.w3.org/1999/xlink"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
xmlSpace="preserve"
|
||||
>
|
||||
<style type="text/css">{'.st0{fill:FF3850}.st1{fill:#181021}.st2{fill:#FFFFFF}'}</style>
|
||||
<g>
|
||||
<g>
|
||||
<path
|
||||
className="st0"
|
||||
d="M11.69,6.77c4.86,0,7.55,0.9,8.52,1.31c1.29-1.46,3.28-4.14,3.28-6.76c0,0-4.17,4.86-6.92,5.12 c-1.25-0.87-2.77-1.38-4.41-1.38c0,0-3.21-0.06-4.63,1.31C4.81,6.44,0.51,1.32,0.51,1.32c0,2.61,1.97,5.27,3.25,6.74 C4.71,7.59,7.03,6.77,11.69,6.77z M19.87,19.38c0.02-0.13,0.04-0.27,0.04-0.4V12.8c0-1.03-0.21-2.02-0.58-2.92 c-0.83-0.33-3.25-1.11-7.64-1.11c-4.29,0-6.33,0.75-7,1.06c-0.38,0.91-0.6,1.91-0.6,2.97v6.18c0,0.13,0.02,0.26,0.04,0.39 C1.6,19.73,0,22.54,0,22.54L12,24l12-1.46C24,22.54,22.36,19.79,19.87,19.38z"
|
||||
/>
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
className="st1"
|
||||
d="M13,18.57H11c-2.27,0-4.12-0.82-4.12-2.88v-2.46c0-2.77,2.17-3.94,5.11-3.94s5.11,1.17,5.11,3.94v2.46 C17.11,17.75,15.27,18.57,13,18.57z"
|
||||
/>
|
||||
<path
|
||||
className="st2"
|
||||
d="M15.06,15.25c-0.28,0-0.5-0.22-0.5-0.5v-1.42c0-0.32,0-1.31-1.63-1.31c-0.28,0-0.5-0.22-0.5-0.5 s0.22-0.5,0.5-0.5c1.65,0,2.63,0.86,2.63,2.31v1.42C15.56,15.02,15.33,15.25,15.06,15.25z"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
};
|
||||
@@ -73,7 +73,6 @@ class IconComponent extends React.PureComponent<Props> {
|
||||
size={size || (sectionIcon ? 20 : 16)}
|
||||
className={classnames(`icon icon--${icon}`, className, { 'color-override': iconColor })}
|
||||
color={color}
|
||||
aria-hidden
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ import { useRect } from '@reach/rect';
|
||||
// </TabPanels>
|
||||
// </Tabs>
|
||||
//
|
||||
// the base @reach/tabs components handle all the focus/accessibility labels
|
||||
// the base @reach/tabs components handle all the focus/accessibilty labels
|
||||
// We're just adding some styling
|
||||
|
||||
type TabsProps = {
|
||||
|
||||
@@ -11,7 +11,6 @@ type Props = {
|
||||
claimIsMine: boolean,
|
||||
downloading: boolean,
|
||||
loading: boolean,
|
||||
focusable: boolean,
|
||||
fileInfo: ?FileListItem,
|
||||
openModal: (id: string, { path: string }) => void,
|
||||
pause: () => void,
|
||||
@@ -36,7 +35,6 @@ function FileDownloadLink(props: Props) {
|
||||
uri,
|
||||
claim,
|
||||
buttonType,
|
||||
focusable = true,
|
||||
showLabel = false,
|
||||
hideOpenButton = false,
|
||||
hideDownloadStatus = false,
|
||||
@@ -93,8 +91,6 @@ function FileDownloadLink(props: Props) {
|
||||
pause();
|
||||
openModal(MODALS.CONFIRM_EXTERNAL_RESOURCE, { path: fileInfo.download_path, isMine: claimIsMine });
|
||||
}}
|
||||
aria-hidden={!focusable}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -109,8 +105,6 @@ function FileDownloadLink(props: Props) {
|
||||
icon={ICONS.DOWNLOAD}
|
||||
label={showLabel ? label : null}
|
||||
onClick={handleDownload}
|
||||
aria-hidden={!focusable}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ type Props = {
|
||||
index: number,
|
||||
length: number,
|
||||
location: { pathname: string },
|
||||
push: (string) => void,
|
||||
push: string => void,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ function FileDrop(props: Props) {
|
||||
const navigationTimer = React.useRef(null);
|
||||
|
||||
// Gets respective icon given a mimetype
|
||||
const getFileIcon = (type) => {
|
||||
const getFileIcon = type => {
|
||||
// Not all files have a type
|
||||
if (!type) return ICONS.FILE;
|
||||
// Detect common types
|
||||
@@ -77,13 +77,10 @@ function FileDrop(props: Props) {
|
||||
}, [navigateToPublish]);
|
||||
|
||||
// Handle file selection
|
||||
const handleFileSelected = React.useCallback(
|
||||
(selectedFile) => {
|
||||
updatePublishForm({ filePath: selectedFile });
|
||||
hideDropArea();
|
||||
},
|
||||
[updatePublishForm, hideDropArea]
|
||||
);
|
||||
const handleFileSelected = React.useCallback((selectedFile) => {
|
||||
updatePublishForm({ filePath: selectedFile });
|
||||
hideDropArea();
|
||||
}, [updatePublishForm, hideDropArea]);
|
||||
|
||||
// Clear timers when unmounted
|
||||
React.useEffect(() => {
|
||||
@@ -117,12 +114,12 @@ function FileDrop(props: Props) {
|
||||
React.useEffect(() => {
|
||||
if (dropData && !files.length && (!modal || modal.id !== MODALS.FILE_SELECTION)) {
|
||||
getTree(dropData)
|
||||
.then((entries) => {
|
||||
.then(entries => {
|
||||
if (entries && entries.length) {
|
||||
setFiles(entries);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
setError(error || true);
|
||||
});
|
||||
}
|
||||
@@ -149,7 +146,7 @@ function FileDrop(props: Props) {
|
||||
const show = files.length === 1 || (!target && drag && (!modal || modal.id !== MODALS.FILE_SELECTION));
|
||||
|
||||
return (
|
||||
<div aria-hidden={!show} className={classnames('file-drop', show && 'file-drop--show')}>
|
||||
<div className={classnames('file-drop', show && 'file-drop--show')}>
|
||||
<div className={classnames('card', 'file-drop__area')}>
|
||||
<Icon size={64} icon={icon} className={'main-icon'} />
|
||||
<p>{target ? target.name : __(`Drop here to publish!`)} </p>
|
||||
|
||||
@@ -6,7 +6,6 @@ import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import { formatNumberWithCommas } from 'util/number';
|
||||
import NudgeFloating from 'component/nudgeFloating';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
@@ -32,16 +31,9 @@ function FileReactions(props: Props) {
|
||||
dislikeCount,
|
||||
livestream,
|
||||
} = props;
|
||||
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channel = claim && claim.signing_channel && claim.signing_channel.name;
|
||||
const isCollection = claim && claim.value_type === 'collection'; // hack because nudge gets cut off by card on cols.
|
||||
const likeIcon = SIMPLE_SITE ? (myReaction === REACTION_TYPES.LIKE ? ICONS.FIRE_ACTIVE : ICONS.FIRE) : ICONS.UPVOTE;
|
||||
const dislikeIcon = SIMPLE_SITE
|
||||
? myReaction === REACTION_TYPES.DISLIKE
|
||||
? ICONS.SLIME_ACTIVE
|
||||
: ICONS.SLIME
|
||||
: ICONS.DOWNVOTE;
|
||||
React.useEffect(() => {
|
||||
function fetchReactions() {
|
||||
doFetchReactions(claimId);
|
||||
@@ -79,7 +71,7 @@ function FileReactions(props: Props) {
|
||||
className={classnames('button--file-action', { 'button--fire': myReaction === REACTION_TYPES.LIKE })}
|
||||
label={
|
||||
<>
|
||||
{myReaction === REACTION_TYPES.LIKE && SIMPLE_SITE && (
|
||||
{myReaction === REACTION_TYPES.LIKE && (
|
||||
<>
|
||||
<div className="button__fire-glow" />
|
||||
<div className="button__fire-particle1" />
|
||||
@@ -94,7 +86,7 @@ function FileReactions(props: Props) {
|
||||
</>
|
||||
}
|
||||
iconSize={18}
|
||||
icon={likeIcon}
|
||||
icon={myReaction === REACTION_TYPES.LIKE ? ICONS.FIRE_ACTIVE : ICONS.FIRE}
|
||||
onClick={() => doReactionLike(uri)}
|
||||
/>
|
||||
<Button
|
||||
@@ -104,7 +96,7 @@ function FileReactions(props: Props) {
|
||||
className={classnames('button--file-action', { 'button--slime': myReaction === REACTION_TYPES.DISLIKE })}
|
||||
label={
|
||||
<>
|
||||
{myReaction === REACTION_TYPES.DISLIKE && SIMPLE_SITE && (
|
||||
{myReaction === REACTION_TYPES.DISLIKE && (
|
||||
<>
|
||||
<div className="button__slime-stain" />
|
||||
<div className="button__slime-drop1" />
|
||||
@@ -115,7 +107,7 @@ function FileReactions(props: Props) {
|
||||
</>
|
||||
}
|
||||
iconSize={18}
|
||||
icon={dislikeIcon}
|
||||
icon={myReaction === REACTION_TYPES.DISLIKE ? ICONS.SLIME_ACTIVE : ICONS.SLIME}
|
||||
onClick={() => doReactionDislike(uri)}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -6,16 +6,14 @@ import useLazyLoading from 'effects/use-lazy-loading';
|
||||
|
||||
type Props = {
|
||||
thumb: string,
|
||||
fallback: ?string,
|
||||
children?: Node,
|
||||
className?: string,
|
||||
};
|
||||
|
||||
const Thumb = (props: Props) => {
|
||||
const { thumb, fallback, children, className } = props;
|
||||
const { thumb, children, className } = props;
|
||||
const thumbnailRef = React.useRef(null);
|
||||
|
||||
useLazyLoading(thumbnailRef, fallback || '');
|
||||
useLazyLoading(thumbnailRef);
|
||||
|
||||
return (
|
||||
<div ref={thumbnailRef} data-background-image={thumb} className={classnames('media__thumb', className)}>
|
||||
|
||||
@@ -4,7 +4,6 @@ import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
import React from 'react';
|
||||
import FreezeframeWrapper from './FreezeframeWrapper';
|
||||
import Placeholder from './placeholder.png';
|
||||
import { MISSING_THUMB_DEFAULT } from 'config';
|
||||
import classnames from 'classnames';
|
||||
import Thumb from './thumb';
|
||||
|
||||
@@ -43,8 +42,6 @@ function FileThumbnail(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
const fallback = MISSING_THUMB_DEFAULT ? getThumbnailCdnUrl({ thumbnail: MISSING_THUMB_DEFAULT }) : undefined;
|
||||
|
||||
let url = thumbnail || (hasResolvedClaim ? Placeholder : '');
|
||||
// @if TARGET='web'
|
||||
// Pass image urls through a compression proxy
|
||||
@@ -57,7 +54,7 @@ function FileThumbnail(props: Props) {
|
||||
|
||||
if (hasResolvedClaim || thumbnailUrl) {
|
||||
return (
|
||||
<Thumb thumb={thumbnailUrl} fallback={fallback} className={className}>
|
||||
<Thumb thumb={thumbnailUrl} className={className}>
|
||||
{children}
|
||||
</Thumb>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
|
||||
import { makeSelectTitleForUri, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||
import { makeSelectViewersForId } from 'redux/selectors/livestream';
|
||||
@@ -8,21 +7,11 @@ import FileTitleSection from './view';
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const viewers = claim && makeSelectViewersForId(claim.claim_id)(state);
|
||||
const channelClaimId = claim && claim.signing_channel ? claim.signing_channel.claim_id : undefined;
|
||||
const channelUri = claim && claim.signing_channel ? claim.signing_channel.canonical_url : undefined;
|
||||
const subCount = channelUri && makeSelectSubCountForUri(channelUri)(state);
|
||||
|
||||
return {
|
||||
viewers,
|
||||
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
channelClaimId,
|
||||
subCount,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FileTitleSection);
|
||||
export default connect(select)(FileTitleSection);
|
||||
@@ -23,32 +23,12 @@ type Props = {
|
||||
livestream?: boolean,
|
||||
isLive?: boolean,
|
||||
viewers?: number,
|
||||
subCount: number,
|
||||
channelClaimId?: string,
|
||||
fetchSubCount: (string) => void,
|
||||
};
|
||||
|
||||
function FileTitleSection(props: Props) {
|
||||
const {
|
||||
title,
|
||||
uri,
|
||||
nsfw,
|
||||
isNsfwBlocked,
|
||||
livestream = false,
|
||||
isLive = false,
|
||||
viewers,
|
||||
subCount,
|
||||
channelClaimId,
|
||||
fetchSubCount,
|
||||
} = props;
|
||||
const { title, uri, nsfw, isNsfwBlocked, livestream = false, isLive = false, viewers } = props;
|
||||
const [hasAcknowledgedSec, setHasAcknowledgedSec] = usePersistedState('sec-nag', false);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (channelClaimId) {
|
||||
fetchSubCount(channelClaimId);
|
||||
}
|
||||
}, [channelClaimId, fetchSubCount]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{!hasAcknowledgedSec && (
|
||||
@@ -128,7 +108,7 @@ function FileTitleSection(props: Props) {
|
||||
</div>
|
||||
) : (
|
||||
<div className="section">
|
||||
<ClaimAuthor channelSubCount={subCount} uri={uri} />
|
||||
<ClaimAuthor uri={uri} />
|
||||
<FileDescription uri={uri} />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -8,14 +8,13 @@ import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
focusable: boolean,
|
||||
hasClaimInWatchLater: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
};
|
||||
|
||||
function FileWatchLaterLink(props: Props) {
|
||||
const { claim, hasClaimInWatchLater, doToast, doCollectionEdit, focusable = true } = props;
|
||||
const { claim, hasClaimInWatchLater, doToast, doCollectionEdit } = props;
|
||||
const buttonRef = useRef();
|
||||
let isHovering = useHover(buttonRef);
|
||||
|
||||
@@ -52,8 +51,6 @@ function FileWatchLaterLink(props: Props) {
|
||||
(isHovering ? ICONS.COMPLETED : ICONS.TIME)
|
||||
}
|
||||
onClick={(e) => handleWatchLater(e)}
|
||||
aria-hidden={!focusable}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import { useIsMobile } from 'effects/use-screensize';
|
||||
import NotificationBubble from 'component/notificationBubble';
|
||||
import NotificationHeaderButton from 'component/notificationHeaderButton';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import SkipNavigationButton from 'component/skipNavigationButton';
|
||||
import Logo from 'component/logo';
|
||||
// @if TARGET='app'
|
||||
import { remote } from 'electron';
|
||||
@@ -236,7 +235,6 @@ const Header = (props: Props) => {
|
||||
) : (
|
||||
<>
|
||||
<div className="header__navigation">
|
||||
<SkipNavigationButton />
|
||||
{!authHeader && (
|
||||
<span style={{ position: 'relative' }}>
|
||||
<Button
|
||||
@@ -247,7 +245,6 @@ const Header = (props: Props) => {
|
||||
}
|
||||
className="header__navigation-item menu__title header__navigation-item--icon"
|
||||
icon={ICONS.MENU}
|
||||
aria-expanded={sidebarOpen}
|
||||
onClick={() => setSidebarOpen(!sidebarOpen)}
|
||||
>
|
||||
{isAbsoluteSideNavHidden && isMobile && notificationsEnabled && <NotificationBubble />}
|
||||
@@ -255,7 +252,6 @@ const Header = (props: Props) => {
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
aria-label={__('Home')}
|
||||
className="header__navigation-item header__navigation-item--lbry"
|
||||
onClick={() => {
|
||||
if (history.location.pathname === '/') window.location.reload();
|
||||
|
||||
@@ -3,7 +3,6 @@ import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { Menu, MenuButton } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
@@ -21,27 +20,11 @@ type Props = {
|
||||
commentIsMine: boolean,
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
isPinned: boolean,
|
||||
};
|
||||
|
||||
function LivestreamComment(props: Props) {
|
||||
const {
|
||||
claim,
|
||||
uri,
|
||||
authorUri,
|
||||
message,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
isPinned,
|
||||
} = props;
|
||||
const { claim, uri, authorUri, message, commentIsMine, commentId, stakedLevel, supportAmount, isFiat } = props;
|
||||
const [mouseIsHovering, setMouseHover] = React.useState(false);
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const { claimName } = parseURI(authorUri);
|
||||
@@ -64,22 +47,6 @@ function LivestreamComment(props: Props) {
|
||||
<div className="livestream-comment__body">
|
||||
{supportAmount > 0 && <ChannelThumbnail uri={authorUri} xsmall />}
|
||||
<div className="livestream-comment__info">
|
||||
{isGlobalMod && (
|
||||
<Tooltip label={__('Admin')}>
|
||||
<span className="comment__badge comment__badge--global-mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{isModerator && (
|
||||
<Tooltip label={__('Moderator')}>
|
||||
<span className="comment__badge comment__badge--mod">
|
||||
<Icon icon={ICONS.BADGE_MOD} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Button
|
||||
className={classnames('button--uri-indicator comment__author', {
|
||||
'comment__author--creator': commentByOwnerOfContent,
|
||||
@@ -90,13 +57,6 @@ function LivestreamComment(props: Props) {
|
||||
{claimName}
|
||||
</Button>
|
||||
|
||||
{isPinned && (
|
||||
<span className="comment__pin">
|
||||
<Icon icon={ICONS.PIN} size={14} />
|
||||
{__('Pinned')}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="livestream-comment__text">
|
||||
<MarkdownPreview content={message} promptLinks stakedLevel={stakedLevel} />
|
||||
</div>
|
||||
@@ -118,8 +78,6 @@ function LivestreamComment(props: Props) {
|
||||
authorUri={authorUri}
|
||||
commentIsMine={commentIsMine}
|
||||
disableEdit
|
||||
isTopLevel
|
||||
isPinned={isPinned}
|
||||
disableRemove={supportAmount > 0}
|
||||
/>
|
||||
</Menu>
|
||||
|
||||
@@ -7,14 +7,12 @@ import {
|
||||
selectIsFetchingComments,
|
||||
makeSelectSuperChatsForUri,
|
||||
makeSelectSuperChatTotalAmountForUri,
|
||||
makeSelectPinnedCommentsForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
import LivestreamComments from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
comments: makeSelectTopLevelCommentsForUri(props.uri)(state).slice(0, 75),
|
||||
pinnedComments: makeSelectPinnedCommentsForUri(props.uri)(state),
|
||||
fetchingComments: selectIsFetchingComments(state),
|
||||
superChats: makeSelectSuperChatsForUri(props.uri)(state),
|
||||
superChatsTotalAmount: makeSelectSuperChatTotalAmountForUri(props.uri)(state),
|
||||
|
||||
@@ -19,15 +19,16 @@ type Props = {
|
||||
doCommentSocketDisconnect: (string) => void,
|
||||
doCommentList: (string, string, number, number) => void,
|
||||
comments: Array<Comment>,
|
||||
pinnedComments: Array<Comment>,
|
||||
fetchingComments: boolean,
|
||||
doSuperChatList: (string) => void,
|
||||
superChats: Array<Comment>,
|
||||
superChatsTotalAmount: number,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
};
|
||||
|
||||
const VIEW_MODE_CHAT = 'view_chat';
|
||||
const VIEW_MODE_SUPER_CHAT = 'view_superchat';
|
||||
const COMMENT_SCROLL_OFFSET = 100;
|
||||
const COMMENT_SCROLL_TIMEOUT = 25;
|
||||
|
||||
export default function LivestreamComments(props: Props) {
|
||||
@@ -37,32 +38,36 @@ export default function LivestreamComments(props: Props) {
|
||||
embed,
|
||||
doCommentSocketConnect,
|
||||
doCommentSocketDisconnect,
|
||||
comments: commentsByChronologicalOrder,
|
||||
pinnedComments,
|
||||
comments,
|
||||
doCommentList,
|
||||
fetchingComments,
|
||||
doSuperChatList,
|
||||
superChats,
|
||||
superChatsTotalAmount,
|
||||
myChannels,
|
||||
superChats: superChatsByTipAmount,
|
||||
} = props;
|
||||
|
||||
let superChatsFiatAmount, superChatsTotalAmount;
|
||||
|
||||
const commentsRef = React.createRef();
|
||||
const [scrollBottom, setScrollBottom] = React.useState(true);
|
||||
const [viewMode, setViewMode] = React.useState(VIEW_MODE_CHAT);
|
||||
const [scrollPos, setScrollPos] = React.useState(0);
|
||||
const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false);
|
||||
const claimId = claim && claim.claim_id;
|
||||
const commentsLength = commentsByChronologicalOrder && commentsByChronologicalOrder.length;
|
||||
const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? commentsByChronologicalOrder : superChatsByTipAmount;
|
||||
const commentsLength = comments && comments.length;
|
||||
const commentsToDisplay = viewMode === VIEW_MODE_CHAT ? comments : superChats;
|
||||
|
||||
const discussionElement = document.querySelector('.livestream__comments');
|
||||
const commentElement = document.querySelector('.livestream-comment');
|
||||
|
||||
const pinnedComment = pinnedComments.length > 0 ? pinnedComments[0] : null;
|
||||
|
||||
function restoreScrollPos() {
|
||||
if (discussionElement) {
|
||||
discussionElement.scrollTop = 0;
|
||||
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
|
||||
function isMyComment(channelId: string) {
|
||||
if (myChannels != null && channelId != null) {
|
||||
for (let i = 0; i < myChannels.length; i++) {
|
||||
if (myChannels[i].claim_id === channelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
@@ -79,142 +84,87 @@ export default function LivestreamComments(props: Props) {
|
||||
};
|
||||
}, [claimId, uri, doCommentList, doSuperChatList, doCommentSocketConnect, doCommentSocketDisconnect]);
|
||||
|
||||
// Register scroll handler (TODO: Should throttle/debounce)
|
||||
React.useEffect(() => {
|
||||
function handleScroll() {
|
||||
if (discussionElement) {
|
||||
const scrollTop = discussionElement.scrollTop;
|
||||
if (scrollTop !== scrollPos) {
|
||||
setScrollPos(scrollTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
const handleScroll = React.useCallback(() => {
|
||||
if (discussionElement) {
|
||||
const negativeCommentHeight = commentElement && -1 * commentElement.offsetHeight;
|
||||
const isAtRecent = negativeCommentHeight && discussionElement.scrollTop >= negativeCommentHeight;
|
||||
|
||||
setScrollBottom(isAtRecent);
|
||||
}
|
||||
}, [commentElement, discussionElement]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (discussionElement) {
|
||||
discussionElement.addEventListener('scroll', handleScroll);
|
||||
|
||||
if (commentsLength > 0) {
|
||||
// Only update comment scroll if the user hasn't scrolled up to view old comments
|
||||
// If they have, do nothing
|
||||
if (!performedInitialScroll) {
|
||||
setTimeout(
|
||||
() =>
|
||||
(discussionElement.scrollTop =
|
||||
discussionElement.scrollHeight - discussionElement.offsetHeight + COMMENT_SCROLL_OFFSET),
|
||||
COMMENT_SCROLL_TIMEOUT
|
||||
);
|
||||
setPerformedInitialScroll(true);
|
||||
}
|
||||
}
|
||||
|
||||
return () => discussionElement.removeEventListener('scroll', handleScroll);
|
||||
}
|
||||
}, [discussionElement, scrollPos]);
|
||||
|
||||
// Retain scrollPos=0 when receiving new messages.
|
||||
React.useEffect(() => {
|
||||
if (discussionElement && commentsLength > 0) {
|
||||
// Only update comment scroll if the user hasn't scrolled up to view old comments
|
||||
if (scrollPos >= 0) {
|
||||
// +ve scrollPos: not scrolled (Usually, there'll be a few pixels beyond 0).
|
||||
// -ve scrollPos: user scrolled.
|
||||
const timer = setTimeout(() => {
|
||||
// Use a timer here to ensure we reset after the new comment has been rendered.
|
||||
discussionElement.scrollTop = 0;
|
||||
}, COMMENT_SCROLL_TIMEOUT);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [commentsLength]); // (Just respond to 'commentsLength' updates and nothing else)
|
||||
|
||||
// sum total amounts for fiat tips and lbc tips
|
||||
if (superChatsByTipAmount) {
|
||||
let fiatAmount = 0;
|
||||
let LBCAmount = 0;
|
||||
for (const superChat of superChatsByTipAmount) {
|
||||
if (superChat.is_fiat) {
|
||||
fiatAmount = fiatAmount + superChat.support_amount;
|
||||
} else {
|
||||
LBCAmount = LBCAmount + superChat.support_amount;
|
||||
}
|
||||
}
|
||||
|
||||
superChatsFiatAmount = fiatAmount;
|
||||
superChatsTotalAmount = LBCAmount;
|
||||
}
|
||||
|
||||
let superChatsReversed;
|
||||
// array of superchats organized by fiat or not first, then support amount
|
||||
if (superChatsByTipAmount) {
|
||||
const clonedSuperchats = JSON.parse(JSON.stringify(superChatsByTipAmount));
|
||||
|
||||
// sort by fiat first then by support amount
|
||||
superChatsReversed = clonedSuperchats
|
||||
.sort((a, b) => {
|
||||
// if both are fiat, organize by support
|
||||
if (a.is_fiat === b.is_fiat) {
|
||||
return b.support_amount - a.support_amount;
|
||||
// otherwise, if they are not both fiat, put the fiat transaction first
|
||||
} else {
|
||||
return a.is_fiat === b.is_fiat ? 0 : a.is_fiat ? -1 : 1;
|
||||
}
|
||||
})
|
||||
.reverse();
|
||||
}
|
||||
|
||||
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
|
||||
function isMyComment(channelId: string) {
|
||||
if (myChannels != null && channelId != null) {
|
||||
for (let i = 0; i < myChannels.length; i++) {
|
||||
if (myChannels[i].claim_id === channelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, [commentsLength, discussionElement, handleScroll, performedInitialScroll, setPerformedInitialScroll]);
|
||||
|
||||
if (!claim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function scrollBack() {
|
||||
if (discussionElement) {
|
||||
discussionElement.scrollTop = 0;
|
||||
setScrollBottom(true);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card livestream__discussion">
|
||||
<div className="card__header--between livestream-discussion__header">
|
||||
<div className="livestream-discussion__title">{__('Live discussion')}</div>
|
||||
{(superChatsTotalAmount || 0) > 0 && (
|
||||
{superChatsTotalAmount > 0 && (
|
||||
<div className="recommended-content__toggles">
|
||||
{/* the superchats in chronological order button */}
|
||||
<Button
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': viewMode === VIEW_MODE_CHAT,
|
||||
})}
|
||||
label={__('Chat')}
|
||||
onClick={() => {
|
||||
setViewMode(VIEW_MODE_CHAT);
|
||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||
livestreamCommentsDiv.scrollTop = livestreamCommentsDiv.scrollHeight;
|
||||
}}
|
||||
onClick={() => setViewMode(VIEW_MODE_CHAT)}
|
||||
/>
|
||||
|
||||
{/* the button to show superchats listed by most to least support amount */}
|
||||
<Button
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': viewMode === VIEW_MODE_SUPER_CHAT,
|
||||
})}
|
||||
label={
|
||||
<>
|
||||
<CreditAmount amount={superChatsTotalAmount || 0} size={8} /> /
|
||||
<CreditAmount amount={superChatsFiatAmount || 0} size={8} isFiat /> {__('Tipped')}
|
||||
<CreditAmount amount={superChatsTotalAmount} size={8} /> {__('Tipped')}
|
||||
</>
|
||||
}
|
||||
onClick={() => {
|
||||
setViewMode(VIEW_MODE_SUPER_CHAT);
|
||||
const livestreamCommentsDiv = document.getElementsByClassName('livestream__comments')[0];
|
||||
const divHeight = livestreamCommentsDiv.scrollHeight;
|
||||
livestreamCommentsDiv.scrollTop = divHeight * -1;
|
||||
}}
|
||||
onClick={() => setViewMode(VIEW_MODE_SUPER_CHAT)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<>
|
||||
{fetchingComments && !commentsByChronologicalOrder && (
|
||||
{fetchingComments && !comments && (
|
||||
<div className="main--empty">
|
||||
<Spinner />
|
||||
</div>
|
||||
)}
|
||||
<div ref={commentsRef} className="livestream__comments-wrapper">
|
||||
{viewMode === VIEW_MODE_CHAT && superChatsByTipAmount && (superChatsTotalAmount || 0) > 0 && (
|
||||
{viewMode === VIEW_MODE_CHAT && superChatsTotalAmount > 0 && superChats && (
|
||||
<div className="livestream-superchats__wrapper">
|
||||
<div className="livestream-superchats__inner">
|
||||
{superChatsByTipAmount.map((superChat: Comment) => (
|
||||
{superChats.map((superChat: Comment) => (
|
||||
<Tooltip key={superChat.comment_id} label={superChat.comment}>
|
||||
<div className="livestream-superchat">
|
||||
<div className="livestream-superchat__thumbnail">
|
||||
@@ -237,75 +187,36 @@ export default function LivestreamComments(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{pinnedComment && (
|
||||
<div className="livestream-pinned__wrapper">
|
||||
<LivestreamComment
|
||||
key={pinnedComment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={pinnedComment.channel_url}
|
||||
commentId={pinnedComment.comment_id}
|
||||
message={pinnedComment.comment}
|
||||
supportAmount={pinnedComment.support_amount}
|
||||
isModerator={pinnedComment.is_moderator}
|
||||
isGlobalMod={pinnedComment.is_global_mod}
|
||||
isFiat={pinnedComment.is_fiat}
|
||||
isPinned={pinnedComment.is_pinned}
|
||||
commentIsMine={pinnedComment.channel_id && isMyComment(pinnedComment.channel_id)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* top to bottom comment display */}
|
||||
{!fetchingComments && commentsByChronologicalOrder.length > 0 ? (
|
||||
{!fetchingComments && comments.length > 0 ? (
|
||||
<div className="livestream__comments">
|
||||
{viewMode === VIEW_MODE_CHAT &&
|
||||
commentsToDisplay.map((comment) => (
|
||||
<LivestreamComment
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
supportAmount={comment.support_amount}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
/>
|
||||
))}
|
||||
|
||||
{viewMode === VIEW_MODE_SUPER_CHAT &&
|
||||
superChatsReversed &&
|
||||
superChatsReversed.map((comment) => (
|
||||
<LivestreamComment
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
supportAmount={comment.support_amount}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
/>
|
||||
))}
|
||||
{commentsToDisplay.map((comment) => (
|
||||
<LivestreamComment
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
supportAmount={comment.support_amount}
|
||||
isFiat={comment.is_fiat}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="main--empty" style={{ flex: 1 }} />
|
||||
)}
|
||||
|
||||
{scrollPos < 0 && (
|
||||
{!scrollBottom && (
|
||||
<Button
|
||||
button="alt"
|
||||
className="livestream__comments-scroll__down"
|
||||
label={__('Recent Comments')}
|
||||
onClick={restoreScrollPos}
|
||||
onClick={scrollBack}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="livestream__comment-create">
|
||||
<CommentCreate livestream bottom embed={embed} uri={uri} onDoneReplying={restoreScrollPos} />
|
||||
<CommentCreate livestream bottom embed={embed} uri={uri} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -18,16 +18,11 @@ export default function LivestreamLink(props: Props) {
|
||||
const [livestreamClaim, setLivestreamClaim] = React.useState(false);
|
||||
const [isLivestreaming, setIsLivestreaming] = React.useState(false);
|
||||
const livestreamChannelId = (channelClaim && channelClaim.claim_id) || ''; // TODO: fail in a safer way, probably
|
||||
const isChannelEmpty = !channelClaim || !channelClaim.meta || !channelClaim.meta.claims_in_channel;
|
||||
|
||||
React.useEffect(() => {
|
||||
// Don't search empty channels
|
||||
if (livestreamChannelId && !isChannelEmpty) {
|
||||
if (livestreamChannelId) {
|
||||
Lbry.claim_search({
|
||||
channel_ids: [livestreamChannelId],
|
||||
page: 1,
|
||||
page_size: 1,
|
||||
no_totals: true,
|
||||
has_no_source: true,
|
||||
claim_type: ['stream'],
|
||||
order_by: CS.ORDER_BY_NEW_VALUE,
|
||||
@@ -40,7 +35,7 @@ export default function LivestreamLink(props: Props) {
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
}, [livestreamChannelId, isChannelEmpty]);
|
||||
}, [livestreamChannelId]);
|
||||
|
||||
React.useEffect(() => {
|
||||
function fetchIsStreaming() {
|
||||
@@ -58,23 +53,17 @@ export default function LivestreamLink(props: Props) {
|
||||
}
|
||||
|
||||
let interval;
|
||||
// Only call livestream api if channel has livestream claims
|
||||
if (livestreamChannelId && livestreamClaim) {
|
||||
if (livestreamChannelId) {
|
||||
if (!interval) fetchIsStreaming();
|
||||
interval = setInterval(fetchIsStreaming, 10 * 1000);
|
||||
}
|
||||
// Prevent any more api calls on update
|
||||
if (!livestreamChannelId || !livestreamClaim) {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
};
|
||||
}, [livestreamChannelId, livestreamClaim]);
|
||||
}, [livestreamChannelId]);
|
||||
|
||||
if (!livestreamClaim || !isLivestreaming) {
|
||||
return null;
|
||||
|
||||
@@ -26,22 +26,12 @@ export default function Logo(props: Props) {
|
||||
);
|
||||
|
||||
if (type === 'small' || (isMobile && type !== 'embed')) {
|
||||
return LOGO ? <img className={'header__navigation-logo'} src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
|
||||
return LOGO ? <img src={LOGO} /> : <Icon icon={ICONS.LBRY} />;
|
||||
} else if (type === 'embed') {
|
||||
if (LOGO_TEXT_LIGHT) {
|
||||
return (
|
||||
<>
|
||||
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return defaultWithLabel;
|
||||
}
|
||||
} else if (type === 'embed-ended') {
|
||||
if (LOGO_TEXT_LIGHT) {
|
||||
return (
|
||||
<>
|
||||
<img className={'embed__overlay-logo'} src={LOGO_TEXT_LIGHT} />
|
||||
<img src={LOGO_TEXT_LIGHT} />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
@@ -51,10 +41,7 @@ export default function Logo(props: Props) {
|
||||
if (LOGO_TEXT_LIGHT && LOGO_TEXT_DARK) {
|
||||
return (
|
||||
<>
|
||||
<img
|
||||
className={'header__navigation-logo'}
|
||||
src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT}
|
||||
/>
|
||||
<img src={currentTheme === 'light' ? LOGO_TEXT_DARK : LOGO_TEXT_LIGHT} />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -16,8 +16,6 @@ import FileThumbnail from 'component/fileThumbnail';
|
||||
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
|
||||
import NotificationContentChannelMenu from 'component/notificationContentChannelMenu';
|
||||
import LbcMessage from 'component/common/lbc-message';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
type Props = {
|
||||
notification: WebNotification,
|
||||
@@ -31,12 +29,13 @@ export default function Notification(props: Props) {
|
||||
const { notification, menuButton = false, doReadNotifications, doDeleteNotification } = props;
|
||||
const { push } = useHistory();
|
||||
const { notification_rule, notification_parameters, is_read, id } = notification;
|
||||
|
||||
const isCommentNotification =
|
||||
notification_rule === RULE.COMMENT ||
|
||||
notification_rule === RULE.COMMENT_REPLY ||
|
||||
notification_rule === RULE.CREATOR_COMMENT;
|
||||
const commentText = isCommentNotification && notification_parameters.dynamic.comment;
|
||||
const channelUrl =
|
||||
(notification_rule === RULE.NEW_CONTENT && notification.notification_parameters.dynamic.channel_url) || '';
|
||||
|
||||
let notificationTarget;
|
||||
switch (notification_rule) {
|
||||
@@ -52,14 +51,21 @@ export default function Notification(props: Props) {
|
||||
notificationTarget = notification_parameters.device.target;
|
||||
}
|
||||
|
||||
const creatorIcon = (channelUrl) => {
|
||||
return (
|
||||
<UriIndicator uri={channelUrl} link>
|
||||
<ChannelThumbnail small uri={channelUrl} />
|
||||
</UriIndicator>
|
||||
);
|
||||
};
|
||||
let channelUrl;
|
||||
let notificationLink = formatLbryUrlForWeb(notificationTarget);
|
||||
let urlParams = new URLSearchParams();
|
||||
if (isCommentNotification && notification_parameters.dynamic.hash) {
|
||||
urlParams.append('lc', notification_parameters.dynamic.hash);
|
||||
}
|
||||
|
||||
try {
|
||||
const { isChannel } = parseURI(notificationTarget);
|
||||
if (isChannel) {
|
||||
urlParams.append(PAGE_VIEW_QUERY, DISCUSSION_PAGE);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
notificationLink += `?${urlParams.toString()}`;
|
||||
|
||||
let icon;
|
||||
switch (notification_rule) {
|
||||
case RULE.CREATOR_SUBSCRIBER:
|
||||
@@ -67,20 +73,16 @@ export default function Notification(props: Props) {
|
||||
break;
|
||||
case RULE.COMMENT:
|
||||
case RULE.CREATOR_COMMENT:
|
||||
channelUrl = notification_parameters.dynamic.comment_author;
|
||||
icon = creatorIcon(channelUrl);
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.comment_author} />;
|
||||
break;
|
||||
case RULE.COMMENT_REPLY:
|
||||
channelUrl = notification_parameters.dynamic.reply_author;
|
||||
icon = creatorIcon(channelUrl);
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.reply_author} />;
|
||||
break;
|
||||
case RULE.NEW_CONTENT:
|
||||
channelUrl = notification_parameters.dynamic.channel_url;
|
||||
icon = creatorIcon(channelUrl);
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.channel_url} />;
|
||||
break;
|
||||
case RULE.NEW_LIVESTREAM:
|
||||
channelUrl = notification_parameters.dynamic.channel_url;
|
||||
icon = creatorIcon(channelUrl);
|
||||
icon = <ChannelThumbnail small uri={notification_parameters.dynamic.channel_url} />;
|
||||
break;
|
||||
case RULE.DAILY_WATCH_AVAILABLE:
|
||||
case RULE.DAILY_WATCH_REMIND:
|
||||
@@ -95,54 +97,12 @@ export default function Notification(props: Props) {
|
||||
icon = <Icon icon={ICONS.NOTIFICATION} sectionIcon />;
|
||||
}
|
||||
|
||||
let notificationLink = formatLbryUrlForWeb(notificationTarget);
|
||||
let urlParams = new URLSearchParams();
|
||||
if (isCommentNotification && notification_parameters.dynamic.hash) {
|
||||
urlParams.append('lc', notification_parameters.dynamic.hash);
|
||||
}
|
||||
|
||||
let channelName = channelUrl && '@' + channelUrl.split('@')[1].split('#')[0];
|
||||
|
||||
const notificationTitle = notification_parameters.device.title;
|
||||
const titleSplit = notificationTitle.split(' ');
|
||||
let fullTitle = [' '];
|
||||
let uriIndicator;
|
||||
const title = titleSplit.map((message, index) => {
|
||||
if (channelName === message) {
|
||||
uriIndicator = <UriIndicator uri={channelUrl} link />;
|
||||
fullTitle.push(' ');
|
||||
const resultTitle = fullTitle;
|
||||
fullTitle = [' '];
|
||||
|
||||
return [resultTitle.join(' '), uriIndicator];
|
||||
} else {
|
||||
fullTitle.push(message);
|
||||
|
||||
if (index === titleSplit.length - 1) {
|
||||
return <LbcMessage>{fullTitle.join(' ')}</LbcMessage>;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const { isChannel } = parseURI(notificationTarget);
|
||||
if (isChannel) {
|
||||
urlParams.append(PAGE_VIEW_QUERY, DISCUSSION_PAGE);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
notificationLink += `?${urlParams.toString()}`;
|
||||
const navLinkProps = {
|
||||
to: notificationLink,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
};
|
||||
|
||||
function handleNotificationClick() {
|
||||
if (!is_read) {
|
||||
doReadNotifications([id]);
|
||||
}
|
||||
|
||||
if (menuButton && notificationLink) {
|
||||
if (notificationLink) {
|
||||
push(notificationLink);
|
||||
}
|
||||
}
|
||||
@@ -160,11 +120,9 @@ export default function Notification(props: Props) {
|
||||
)
|
||||
: notificationLink
|
||||
? (props: { children: any }) => (
|
||||
<NavLink {...navLinkProps}>
|
||||
<a className="menu__link--notification" onClick={handleNotificationClick}>
|
||||
{props.children}
|
||||
</a>
|
||||
</NavLink>
|
||||
<a className="menu__link--notification" onClick={handleNotificationClick}>
|
||||
{props.children}
|
||||
</a>
|
||||
)
|
||||
: (props: { children: any }) => (
|
||||
<span
|
||||
@@ -187,11 +145,17 @@ export default function Notification(props: Props) {
|
||||
<div className="notification__content-wrapper">
|
||||
<div className="notification__content">
|
||||
<div className="notification__text-wrapper">
|
||||
{!isCommentNotification && <div className="notification__title">{title}</div>}
|
||||
{!isCommentNotification && (
|
||||
<div className="notification__title">
|
||||
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isCommentNotification && commentText ? (
|
||||
<>
|
||||
<div className="notification__title">{title}</div>
|
||||
<div className="notification__title">
|
||||
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
|
||||
</div>
|
||||
<div title={commentText} className="notification__text mobile-hidden">
|
||||
{commentText}
|
||||
</div>
|
||||
@@ -229,13 +193,7 @@ export default function Notification(props: Props) {
|
||||
|
||||
<div className="notification__menu">
|
||||
<Menu>
|
||||
<MenuButton
|
||||
className={'menu__button notification__menu-button'}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<MenuButton onClick={(e) => e.stopPropagation()}>
|
||||
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
|
||||
@@ -109,7 +109,6 @@ function Page(props: Props) {
|
||||
/>
|
||||
)}
|
||||
<main
|
||||
id={'main-content'}
|
||||
className={classnames(MAIN_CLASS, className, {
|
||||
'main--full-width': fullWidthPage,
|
||||
'main--auth-page': authPage,
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function PreviewOverlayProperties(props: Props) {
|
||||
} = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
// $FlowFixMe
|
||||
const claimLength = claim && claim.value && claim.value.claims && claim.value.claims.length;
|
||||
const claimLength = claim && claim.value.claims && claim.value.claims.length;
|
||||
|
||||
const claimCount = editedCollection ? editedCollection.items.length : claimLength;
|
||||
const isStream = claim && claim.value_type === 'stream';
|
||||
|
||||
@@ -20,7 +20,7 @@ const perform = dispatch => ({
|
||||
setShareDataThirdParty: share => dispatch(doToggle3PAnalytics(share)),
|
||||
signOut: () => dispatch(doSignOut()),
|
||||
authenticateIfSharingData: () =>
|
||||
dispatch(doAuthenticate(appVersion, undefined, undefined, true)),
|
||||
dispatch(doAuthenticate(appVersion, undefined, undefined, true, undefined, undefined, DOMAIN)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(PrivacyAgreement);
|
||||
@@ -3,25 +3,23 @@ import {
|
||||
makeSelectPublishFormValue,
|
||||
selectMyClaimForUri,
|
||||
selectIsResolvingPublishUris,
|
||||
selectTakeOverAmount,
|
||||
doUpdatePublishForm,
|
||||
doPrepareEdit,
|
||||
selectBalance,
|
||||
} from 'lbry-redux';
|
||||
import PublishPage from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
const select = state => ({
|
||||
name: makeSelectPublishFormValue('name')(state),
|
||||
bid: makeSelectPublishFormValue('bid')(state),
|
||||
uri: makeSelectPublishFormValue('uri')(state),
|
||||
isResolvingUri: selectIsResolvingPublishUris(state),
|
||||
balance: selectBalance(state),
|
||||
myClaimForUri: selectMyClaimForUri(state),
|
||||
amountNeededForTakeover: selectTakeOverAmount(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
updatePublishForm: (value) => dispatch(doUpdatePublishForm(value)),
|
||||
const perform = dispatch => ({
|
||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||
prepareEdit: (claim, uri) => dispatch(doPrepareEdit(claim, uri)),
|
||||
});
|
||||
|
||||
|
||||
@@ -18,12 +18,7 @@ import {
|
||||
} from 'lbry-redux';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import { doPublishDesktop } from 'redux/actions/publish';
|
||||
import { doClaimInitialRewards } from 'redux/actions/rewards';
|
||||
import {
|
||||
selectUnclaimedRewardValue,
|
||||
selectIsClaimingInitialRewards,
|
||||
selectHasClaimedInitialRewards,
|
||||
} from 'redux/selectors/rewards';
|
||||
import { selectUnclaimedRewardValue } from 'redux/selectors/rewards';
|
||||
import {
|
||||
selectModal,
|
||||
selectActiveChannelClaim,
|
||||
@@ -32,8 +27,8 @@ import {
|
||||
} from 'redux/selectors/app';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
import PublishPage from './view';
|
||||
import { selectUser } from 'redux/selectors/user';
|
||||
|
||||
const select = (state) => {
|
||||
const myClaimForUri = selectMyClaimForUri(state);
|
||||
@@ -64,8 +59,6 @@ const select = (state) => {
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
incognito: selectIncognito(state),
|
||||
activeChannelStakedLevel: selectActiveChannelStakedLevel(state),
|
||||
isClaimingInitialRewards: selectIsClaimingInitialRewards(state),
|
||||
hasClaimedInitialRewards: selectHasClaimedInitialRewards(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -77,7 +70,6 @@ const perform = (dispatch) => ({
|
||||
prepareEdit: (claim, uri) => dispatch(doPrepareEdit(claim, uri)),
|
||||
resetThumbnailStatus: () => dispatch(doResetThumbnailStatus()),
|
||||
checkAvailability: (name) => dispatch(doCheckPublishNameAvailability(name)),
|
||||
claimInitialRewards: () => dispatch(doClaimInitialRewards()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(PublishPage);
|
||||
@@ -90,9 +90,6 @@ type Props = {
|
||||
isPostClaim: boolean,
|
||||
permanentUrl: ?string,
|
||||
remoteUrl: ?string,
|
||||
isClaimingInitialRewards: boolean,
|
||||
claimInitialRewards: () => void,
|
||||
hasClaimedInitialRewards: boolean,
|
||||
};
|
||||
|
||||
function PublishForm(props: Props) {
|
||||
@@ -131,9 +128,6 @@ function PublishForm(props: Props) {
|
||||
isPostClaim,
|
||||
permanentUrl,
|
||||
remoteUrl,
|
||||
isClaimingInitialRewards,
|
||||
claimInitialRewards,
|
||||
hasClaimedInitialRewards,
|
||||
} = props;
|
||||
|
||||
const { replace, location } = useHistory();
|
||||
@@ -269,12 +263,6 @@ function PublishForm(props: Props) {
|
||||
}
|
||||
}, [activeChannelClaimStr, setSignedMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasClaimedInitialRewards) {
|
||||
claimInitialRewards();
|
||||
}
|
||||
}, [hasClaimedInitialRewards, claimInitialRewards]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!modal) {
|
||||
setTimeout(() => {
|
||||
@@ -310,10 +298,7 @@ function PublishForm(props: Props) {
|
||||
|
||||
const isLivestreamMode = mode === PUBLISH_MODES.LIVESTREAM;
|
||||
let submitLabel;
|
||||
|
||||
if (isClaimingInitialRewards) {
|
||||
submitLabel = __('Claiming credits...');
|
||||
} else if (publishing) {
|
||||
if (publishing) {
|
||||
if (isStillEditing) {
|
||||
submitLabel = __('Saving...');
|
||||
} else if (isLivestreamMode) {
|
||||
@@ -547,15 +532,6 @@ function PublishForm(props: Props) {
|
||||
}
|
||||
}, [autoSwitchMode, editingURI, fileMimeType, myClaimForUri, mode, setMode, setAutoSwitchMode]);
|
||||
|
||||
// When accessing to publishing, make sure to reset file input attributes
|
||||
// since we can't restore from previous user selection (like we do
|
||||
// with other properties such as name, title, etc.) for security reasons.
|
||||
useEffect(() => {
|
||||
if (mode === PUBLISH_MODES.FILE) {
|
||||
updatePublishForm({ filePath: '', fileDur: 0, fileSize: 0 });
|
||||
}
|
||||
}, [mode, updatePublishForm]);
|
||||
|
||||
if (publishing) {
|
||||
return (
|
||||
<div className="main--empty">
|
||||
@@ -647,7 +623,6 @@ function PublishForm(props: Props) {
|
||||
onClick={handlePublish}
|
||||
label={submitLabel}
|
||||
disabled={
|
||||
isClaimingInitialRewards ||
|
||||
formDisabled ||
|
||||
!formValid ||
|
||||
uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS ||
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
makeSelectPublishFormValue,
|
||||
selectIsStillEditing,
|
||||
selectMyClaimForUri,
|
||||
selectTakeOverAmount,
|
||||
doUpdatePublishForm,
|
||||
doPrepareEdit,
|
||||
} from 'lbry-redux';
|
||||
@@ -18,7 +17,6 @@ const select = (state) => ({
|
||||
myClaimForUri: selectMyClaimForUri(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
incognito: selectIncognito(state),
|
||||
amountNeededForTakeover: selectTakeOverAmount(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsNsfw, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doRecommendationUpdate, doRecommendationClicked } from 'redux/actions/content';
|
||||
import { doFetchRecommendedContent } from 'redux/actions/search';
|
||||
import { makeSelectRecommendedContentForUri, selectIsSearching } from 'redux/selectors/search';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -18,9 +17,6 @@ const select = (state, props) => ({
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doFetchRecommendedContent: (uri, mature) => dispatch(doFetchRecommendedContent(uri, mature)),
|
||||
doRecommendationUpdate: (claimId, urls, id, parentId) =>
|
||||
dispatch(doRecommendationUpdate(claimId, urls, id, parentId)),
|
||||
doRecommendationClicked: (claimId, index) => dispatch(doRecommendationClicked(claimId, index)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(RecommendedContent);
|
||||
@@ -1,8 +1,6 @@
|
||||
// @flow
|
||||
import { SHOW_ADS } from 'config';
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import ClaimList from 'component/claimList';
|
||||
import ClaimListDiscover from 'component/claimListDiscover';
|
||||
import Ads from 'web/component/ads';
|
||||
@@ -10,7 +8,6 @@ import Card from 'component/common/card';
|
||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
import { CONTAINER_ID } from 'constants/navigation';
|
||||
|
||||
const VIEW_ALL_RELATED = 'view_all_related';
|
||||
const VIEW_MORE_FROM = 'view_more_from';
|
||||
@@ -24,8 +21,6 @@ type Props = {
|
||||
mature: boolean,
|
||||
isAuthenticated: boolean,
|
||||
claim: ?StreamClaim,
|
||||
doRecommendationUpdate: (claimId: string, urls: Array<string>, id: string, parentId: string) => void,
|
||||
doRecommendationClicked: (claimId: string, index: number) => void,
|
||||
};
|
||||
|
||||
export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
@@ -38,70 +33,33 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
isSearching,
|
||||
isAuthenticated,
|
||||
claim,
|
||||
doRecommendationUpdate,
|
||||
doRecommendationClicked,
|
||||
} = props;
|
||||
const [viewMode, setViewMode] = React.useState(VIEW_ALL_RELATED);
|
||||
const [recommendationId, setRecommendationId] = React.useState('');
|
||||
const [recommendationUrls, setRecommendationUrls] = React.useState();
|
||||
const history = useHistory();
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const channelName = signingChannel ? signingChannel.name : null;
|
||||
const isMobile = useIsMobile();
|
||||
const isMedium = useIsMediumScreen();
|
||||
|
||||
React.useEffect(() => {
|
||||
function moveAutoplayNextItemToTop(recommendedContent) {
|
||||
let newList = recommendedContent;
|
||||
if (newList) {
|
||||
const index = newList.indexOf(nextRecommendedUri);
|
||||
if (index > 0) {
|
||||
const a = newList[0];
|
||||
newList[0] = nextRecommendedUri;
|
||||
newList[index] = a;
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
function listEq(prev, next) {
|
||||
if (prev && next) {
|
||||
return prev.length === next.length && prev.every((value, index) => value === next[index]);
|
||||
} else {
|
||||
return prev === next;
|
||||
function reorderList(recommendedContent) {
|
||||
let newList = recommendedContent;
|
||||
if (newList) {
|
||||
const index = newList.indexOf(nextRecommendedUri);
|
||||
if (index === -1) {
|
||||
// This would be weird. Shouldn't happen since it is derived from the same list.
|
||||
} else if (index !== 0) {
|
||||
// Swap the "next" item to the top of the list
|
||||
const a = newList[0];
|
||||
newList[0] = nextRecommendedUri;
|
||||
newList[index] = a;
|
||||
}
|
||||
}
|
||||
|
||||
const newRecommendationUrls = moveAutoplayNextItemToTop(recommendedContent);
|
||||
|
||||
if (claim && !listEq(recommendationUrls, newRecommendationUrls)) {
|
||||
const parentId = (history.location.state && history.location.state[CONTAINER_ID]) || '';
|
||||
const id = uuidv4();
|
||||
setRecommendationId(id);
|
||||
setRecommendationUrls(newRecommendationUrls);
|
||||
|
||||
doRecommendationUpdate(claim.claim_id, newRecommendationUrls, id, parentId);
|
||||
}
|
||||
}, [
|
||||
recommendedContent,
|
||||
nextRecommendedUri,
|
||||
recommendationUrls,
|
||||
setRecommendationUrls,
|
||||
claim,
|
||||
doRecommendationUpdate,
|
||||
history.location.state,
|
||||
]);
|
||||
return newList;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
doFetchRecommendedContent(uri, mature);
|
||||
}, [uri, mature, doFetchRecommendedContent]);
|
||||
|
||||
function handleRecommendationClicked(e: any, index: number) {
|
||||
if (claim) {
|
||||
doRecommendationClicked(claim.claim_id, index);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
isBodyList
|
||||
@@ -133,14 +91,12 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||
<div>
|
||||
{viewMode === VIEW_ALL_RELATED && (
|
||||
<ClaimList
|
||||
id={recommendationId}
|
||||
type="small"
|
||||
loading={isSearching}
|
||||
uris={recommendationUrls}
|
||||
uris={reorderList(recommendedContent)}
|
||||
hideMenu={isMobile}
|
||||
injectedItem={SHOW_ADS && IS_WEB && !isAuthenticated && <Ads small type={'video'} />}
|
||||
empty={__('No related content found')}
|
||||
onClick={handleRecommendationClicked}
|
||||
/>
|
||||
)}
|
||||
{viewMode === VIEW_MORE_FROM && signingChannel && (
|
||||
|
||||
@@ -15,7 +15,6 @@ import ClaimPreview from 'component/claimPreview';
|
||||
import { URL as SITE_URL, URL_LOCAL, URL_DEV } from 'config';
|
||||
import HelpLink from 'component/common/help-link';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import BidHelpText from 'component/publishBid/bid-help-text';
|
||||
import Spinner from 'component/spinner';
|
||||
|
||||
type Props = {
|
||||
@@ -78,6 +77,7 @@ function RepostCreate(props: Props) {
|
||||
|
||||
const [repostBid, setRepostBid] = React.useState(0.01);
|
||||
const [repostBidError, setRepostBidError] = React.useState(undefined);
|
||||
const [takeoverAmount, setTakeoverAmount] = React.useState(0);
|
||||
const [enteredRepostName, setEnteredRepostName] = React.useState(defaultName);
|
||||
const [available, setAvailable] = React.useState(true);
|
||||
const [enteredContent, setEnteredContentUri] = React.useState(undefined);
|
||||
@@ -189,9 +189,10 @@ function RepostCreate(props: Props) {
|
||||
: Number(passedRepostAmount) + 0.01;
|
||||
|
||||
if (repostTakeoverAmount) {
|
||||
setTakeoverAmount(Number(repostTakeoverAmount.toFixed(2)));
|
||||
setAutoRepostBid(repostTakeoverAmount);
|
||||
}
|
||||
}, [enteredRepostAmount, passedRepostAmount]);
|
||||
}, [setTakeoverAmount, enteredRepostAmount, passedRepostAmount]);
|
||||
|
||||
// repost bid error
|
||||
React.useEffect(() => {
|
||||
@@ -380,11 +381,9 @@ function RepostCreate(props: Props) {
|
||||
error={repostBidError}
|
||||
helper={
|
||||
<>
|
||||
<BidHelpText
|
||||
uri={'lbry://' + enteredRepostName}
|
||||
amountNeededForTakeover={enteredRepostAmount}
|
||||
isResolvingUri={isResolvingEnteredRepost}
|
||||
/>
|
||||
{__('Winning amount: %amount%', {
|
||||
amount: Number(takeoverAmount).toFixed(2),
|
||||
})}
|
||||
<WalletSpendableBalanceHelp inline />
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -13,12 +13,11 @@ type Props = {
|
||||
label: ?string,
|
||||
reward: Reward,
|
||||
button: ?boolean,
|
||||
disabled: boolean,
|
||||
claimReward: (Reward) => void,
|
||||
};
|
||||
|
||||
const RewardLink = (props: Props) => {
|
||||
const { reward, claimReward, label, isPending, button, disabled = false } = props;
|
||||
const { reward, claimReward, label, isPending, button } = props;
|
||||
let displayLabel = label;
|
||||
if (isPending) {
|
||||
displayLabel = __('Claiming...');
|
||||
@@ -35,7 +34,7 @@ const RewardLink = (props: Props) => {
|
||||
return !reward ? null : (
|
||||
<Button
|
||||
button={button ? 'primary' : 'link'}
|
||||
disabled={disabled || isPending}
|
||||
disabled={isPending}
|
||||
label={<LbcMessage>{displayLabel}</LbcMessage>}
|
||||
aria-label={displayLabel}
|
||||
onClick={() => {
|
||||
|
||||
@@ -23,11 +23,10 @@ type Props = {
|
||||
claim_code: string,
|
||||
},
|
||||
user: User,
|
||||
disabled: boolean,
|
||||
};
|
||||
|
||||
const RewardTile = (props: Props) => {
|
||||
const { reward, openRewardCodeModal, openSetReferrerModal, user, disabled = false } = props;
|
||||
const { reward, openRewardCodeModal, openSetReferrerModal, user } = props;
|
||||
const referrerSet = user && user.invited_by_id;
|
||||
const claimed = !!reward.transaction_id;
|
||||
const customActionsRewards = [rewards.TYPE_REFERRAL, rewards.TYPE_REFEREE];
|
||||
@@ -39,25 +38,18 @@ const RewardTile = (props: Props) => {
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
{reward.reward_type === rewards.TYPE_GENERATED_CODE && (
|
||||
<Button button="primary" onClick={openRewardCodeModal} label={__('Enter Code')} disabled={disabled} />
|
||||
<Button button="primary" onClick={openRewardCodeModal} label={__('Enter Code')} />
|
||||
)}
|
||||
{reward.reward_type === rewards.TYPE_REFERRAL && (
|
||||
<Button
|
||||
button="primary"
|
||||
navigate="/$/invite"
|
||||
label={__('Go To Invites')}
|
||||
aria-hidden={disabled}
|
||||
tabIndex={disabled ? -1 : 0}
|
||||
/>
|
||||
<Button button="primary" navigate="/$/invite" label={__('Go To Invites')} />
|
||||
)}
|
||||
{reward.reward_type === rewards.TYPE_REFEREE && (
|
||||
<>
|
||||
{referrerSet && <RewardLink button reward_type={reward.reward_type} disabled={disabled} />}
|
||||
{referrerSet && <RewardLink button reward_type={reward.reward_type} />}
|
||||
<Button
|
||||
button={referrerSet ? 'link' : 'primary'}
|
||||
onClick={openSetReferrerModal}
|
||||
label={referrerSet ? __('Change Inviter') : __('Set Inviter')}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -67,7 +59,7 @@ const RewardTile = (props: Props) => {
|
||||
<Icon icon={ICONS.COMPLETED} /> {__('Reward claimed.')}
|
||||
</span>
|
||||
) : (
|
||||
<RewardLink button claim_code={reward.claim_code} disabled={disabled} />
|
||||
<RewardLink button claim_code={reward.claim_code} />
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -9,9 +9,8 @@ import { parseURI, isURIValid } from 'lbry-redux';
|
||||
import { SITE_TITLE, WELCOME_VERSION, SIMPLE_SITE } from 'config';
|
||||
import LoadingBarOneOff from 'component/loadingBarOneOff';
|
||||
import { GetLinksData } from 'util/buildHomepage';
|
||||
import { useKeycloak } from '@react-keycloak/web';
|
||||
|
||||
import HomePage from 'page/home';
|
||||
import Login from 'component/auth/login';
|
||||
|
||||
// @if TARGET='app'
|
||||
const BackupPage = lazyImport(() => import('page/backup' /* webpackChunkName: "backup" */));
|
||||
@@ -22,7 +21,7 @@ const Code2257Page = lazyImport(() => import('web/page/code2257' /* webpackChunk
|
||||
// @endif
|
||||
|
||||
// Chunk: "secondary"
|
||||
// const SignInPage = lazyImport(() => import('page/signIn' /* webpackChunkName: "secondary" */));
|
||||
const SignInPage = lazyImport(() => import('page/signIn' /* webpackChunkName: "secondary" */));
|
||||
const SignInWalletPasswordPage = lazyImport(() =>
|
||||
import('page/signInWalletPassword' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
@@ -70,9 +69,7 @@ const RewardsVerifyPage = lazyImport(() => import('page/rewardsVerify' /* webpac
|
||||
const SearchPage = lazyImport(() => import('page/search' /* webpackChunkName: "secondary" */));
|
||||
const SettingsAdvancedPage = lazyImport(() => import('page/settingsAdvanced' /* webpackChunkName: "secondary" */));
|
||||
const SettingsStripeCard = lazyImport(() => import('page/settingsStripeCard' /* webpackChunkName: "secondary" */));
|
||||
const SettingsStripeAccount = lazyImport(() =>
|
||||
import('page/settingsStripeAccount' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
const SettingsStripeAccount = lazyImport(() => import('page/settingsStripeAccount' /* webpackChunkName: "secondary" */));
|
||||
const SettingsCreatorPage = lazyImport(() => import('page/settingsCreator' /* webpackChunkName: "secondary" */));
|
||||
const SettingsNotificationsPage = lazyImport(() =>
|
||||
import('page/settingsNotifications' /* webpackChunkName: "secondary" */)
|
||||
@@ -86,6 +83,7 @@ const TagsFollowingPage = lazyImport(() => import('page/tagsFollowing' /* webpac
|
||||
const TopPage = lazyImport(() => import('page/top' /* webpackChunkName: "secondary" */));
|
||||
const Welcome = lazyImport(() => import('page/welcome' /* webpackChunkName: "secondary" */));
|
||||
const YoutubeSyncPage = lazyImport(() => import('page/youtubeSync' /* webpackChunkName: "secondary" */));
|
||||
|
||||
// Tell the browser we are handling scroll restoration
|
||||
if ('scrollRestoration' in history) {
|
||||
history.scrollRestoration = 'manual';
|
||||
@@ -127,20 +125,14 @@ function PrivateRoute(props: PrivateRouteProps) {
|
||||
const { component: Component, isAuthenticated, ...rest } = props;
|
||||
const urlSearchParams = new URLSearchParams(props.location.search);
|
||||
const redirectUrl = urlSearchParams.get('redirect');
|
||||
const { keycloak } = useKeycloak();
|
||||
return (
|
||||
<Route
|
||||
{...rest}
|
||||
render={(props) =>
|
||||
(keycloak && keycloak.authenticated) || !IS_WEB ? (
|
||||
isAuthenticated || !IS_WEB ? (
|
||||
<Component {...props} />
|
||||
) : (
|
||||
<Redirect
|
||||
to={{
|
||||
pathname: `/$/${PAGES.AUTH}?redirect=${redirectUrl || props.location.pathname}`,
|
||||
state: { from: props.location },
|
||||
}}
|
||||
/>
|
||||
<Redirect to={`/$/${PAGES.AUTH}?redirect=${redirectUrl || props.location.pathname}`} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
@@ -267,10 +259,10 @@ function AppRouter(props: Props) {
|
||||
/>
|
||||
))}
|
||||
|
||||
<Route path={`/$/${PAGES.AUTH_SIGNIN}`} exact component={Login} />
|
||||
<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={Login} />
|
||||
<Route path={`/$/${PAGES.AUTH}`} exact component={SignUpPage} />
|
||||
<Route path={`/$/${PAGES.AUTH}/*`} exact component={SignUpPage} />
|
||||
<Route path={`/$/${PAGES.WELCOME}`} exact component={Welcome} />
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import SettingCommentsServer from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
customServerEnabled: makeSelectClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_ENABLED)(state),
|
||||
customServerUrl: makeSelectClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setCustomServerEnabled: (val) => dispatch(doSetClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_ENABLED, val, true)),
|
||||
setCustomServerUrl: (url) => dispatch(doSetClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL, url, true)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SettingCommentsServer);
|
||||
@@ -1,70 +0,0 @@
|
||||
// @flow
|
||||
import { COMMENT_SERVER_NAME } from 'config';
|
||||
import React from 'react';
|
||||
import Comments from 'comments';
|
||||
import { FormField } from 'component/common/form';
|
||||
|
||||
const DEBOUNCE_TEXT_INPUT_MS = 500;
|
||||
|
||||
type Props = {
|
||||
customServerEnabled: boolean,
|
||||
customServerUrl: string,
|
||||
setCustomServerEnabled: (boolean) => void,
|
||||
setCustomServerUrl: (string) => void,
|
||||
};
|
||||
|
||||
function SettingCommentsServer(props: Props) {
|
||||
const { customServerEnabled, customServerUrl, setCustomServerEnabled, setCustomServerUrl } = props;
|
||||
const [customUrl, setCustomUrl] = React.useState(customServerUrl);
|
||||
|
||||
React.useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
setCustomServerUrl(customUrl);
|
||||
Comments.url = customUrl;
|
||||
}, DEBOUNCE_TEXT_INPUT_MS);
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [customUrl, setCustomServerUrl]);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<fieldset-section>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="use_default_comments_server"
|
||||
label={__('Default comments server (%name%)', { name: COMMENT_SERVER_NAME })}
|
||||
checked={!customServerEnabled}
|
||||
onChange={(e) => {
|
||||
if (e.target.checked) {
|
||||
setCustomServerEnabled(false);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="use_custom_comments_server"
|
||||
label={__('Custom comments server')}
|
||||
checked={customServerEnabled}
|
||||
onChange={(e) => {
|
||||
if (e.target.checked) {
|
||||
setCustomServerEnabled(true);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
{customServerEnabled && (
|
||||
<div className="section__body">
|
||||
<FormField
|
||||
type="text"
|
||||
placeholder="https://comment.mysite.com"
|
||||
value={customUrl}
|
||||
onChange={(e) => setCustomUrl(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</fieldset-section>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default SettingCommentsServer;
|
||||
@@ -331,7 +331,6 @@ function SideNavigation(props: Props) {
|
||||
>
|
||||
{!isOnFilePage && (
|
||||
<nav
|
||||
aria-label={'Sidebar'}
|
||||
className={classnames('navigation', {
|
||||
'navigation--micro': microNavigation,
|
||||
// @if TARGET='app'
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
// Allow screen reader users ( or keyboard navigation )
|
||||
// to jump to main content
|
||||
export default function SkipNavigationButton() {
|
||||
const skipNavigation = (e) => {
|
||||
// Match any focusable element
|
||||
const focusableElementQuery = `
|
||||
#main-content [tabindex]:not([tabindex="-1"]):not(:disabled),
|
||||
#main-content a:not([aria-hidden]):not([tabindex="-1"]):not(:disabled),
|
||||
#main-content button:not([aria-hidden]):not([tabindex="-1"]):not(:disabled)
|
||||
`;
|
||||
// Find first focusable element
|
||||
const element = document.querySelector(focusableElementQuery);
|
||||
// Trigger focus to skip navigation
|
||||
if (element && element.focus) {
|
||||
element.focus();
|
||||
}
|
||||
};
|
||||
return <Button className={'skip-button'} onClick={skipNavigation} label={__('Skip Navigation')} button={'link'} />;
|
||||
}
|
||||
@@ -9,15 +9,12 @@ import { useIsMobile } from 'effects/use-screensize';
|
||||
import { FormField } from 'component/common/form';
|
||||
import { hmsToSeconds, secondsToHms } from 'util/time';
|
||||
import { generateLbryContentUrl, generateLbryWebUrl, generateEncodedLbryURL, generateShareUrl } from 'util/url';
|
||||
import { URL, TWITTER_ACCOUNT, SHARE_DOMAIN_URL } from 'config';
|
||||
import { URL, SHARE_DOMAIN_URL } from 'config';
|
||||
|
||||
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
||||
const IOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
||||
const SUPPORTS_SHARE_API = typeof navigator.share !== 'undefined';
|
||||
|
||||
// Twitter share
|
||||
const TWITTER_INTENT_API = 'https://twitter.com/intent/tweet?';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
title: ?string,
|
||||
@@ -71,21 +68,6 @@ function SocialShare(props: Props) {
|
||||
);
|
||||
const downloadUrl = `${generateDownloadUrl(name, claimId)}`;
|
||||
|
||||
// Tweet params
|
||||
let tweetIntentParams = {
|
||||
url: shareUrl,
|
||||
text: title || claim.name,
|
||||
hashtags: 'LBRY',
|
||||
};
|
||||
|
||||
if (TWITTER_ACCOUNT) {
|
||||
// $FlowFixMe
|
||||
tweetIntentParams.via = TWITTER_ACCOUNT;
|
||||
}
|
||||
|
||||
// Generate twitter web intent url
|
||||
const tweetIntent = TWITTER_INTENT_API + new URLSearchParams(tweetIntentParams).toString();
|
||||
|
||||
function handleWebShareClick() {
|
||||
if (navigator.share) {
|
||||
navigator.share({
|
||||
@@ -133,7 +115,7 @@ function SocialShare(props: Props) {
|
||||
iconSize={24}
|
||||
icon={ICONS.TWITTER}
|
||||
title={__('Share on Twitter')}
|
||||
href={tweetIntent}
|
||||
href={`https://twitter.com/intent/tweet?text=${encodedLbryURL}`}
|
||||
/>
|
||||
<Button
|
||||
className="share"
|
||||
|
||||
@@ -19,7 +19,6 @@ type Props = {
|
||||
inline: boolean,
|
||||
external?: boolean,
|
||||
className?: string,
|
||||
focusable: boolean,
|
||||
};
|
||||
|
||||
class UriIndicator extends React.PureComponent<Props> {
|
||||
@@ -46,9 +45,8 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||
claim,
|
||||
children,
|
||||
inline,
|
||||
focusable = true,
|
||||
external = false,
|
||||
hideAnonymous = false,
|
||||
external = false,
|
||||
className,
|
||||
} = this.props;
|
||||
|
||||
@@ -88,13 +86,7 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||
|
||||
if (children) {
|
||||
return (
|
||||
<Button
|
||||
aria-hidden={!focusable}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
className={className}
|
||||
target={external ? '_blank' : undefined}
|
||||
navigate={channelLink}
|
||||
>
|
||||
<Button className={className} target={external ? '_blank' : undefined} navigate={channelLink}>
|
||||
{children}
|
||||
</Button>
|
||||
);
|
||||
@@ -104,8 +96,6 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||
className={classnames(className, 'button--uri-indicator')}
|
||||
navigate={channelLink}
|
||||
target={external ? '_blank' : undefined}
|
||||
aria-hidden={!focusable}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
>
|
||||
{inner}
|
||||
</Button>
|
||||
|
||||
@@ -28,9 +28,6 @@ function UserChannelFollowIntro(props: Props) {
|
||||
channelIds = PRIMARY_CONTENT.channelIds;
|
||||
}
|
||||
const followingCount = (subscribedChannels && subscribedChannels.length) || 0;
|
||||
const followingCountIgnoringAutoFollows = (subscribedChannels || []).filter(
|
||||
(channel) => !channelsToSubscribe.includes(channel.uri)
|
||||
).length;
|
||||
|
||||
// subscribe to lbry
|
||||
useEffect(() => {
|
||||
@@ -77,13 +74,9 @@ function UserChannelFollowIntro(props: Props) {
|
||||
<Nag
|
||||
type="helpful"
|
||||
message={
|
||||
followingCountIgnoringAutoFollows === 1
|
||||
? __('Nice! You are currently following %followingCount% creator', {
|
||||
followingCount: followingCountIgnoringAutoFollows,
|
||||
})
|
||||
: __('Nice! You are currently following %followingCount% creators', {
|
||||
followingCount: followingCountIgnoringAutoFollows,
|
||||
})
|
||||
followingCount === 1
|
||||
? __('Nice! You are currently following %followingCount% creator', { followingCount })
|
||||
: __('Nice! You are currently following %followingCount% creators', { followingCount })
|
||||
}
|
||||
actionText={__('Continue')}
|
||||
onClick={onContinue}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
type Props = {
|
||||
claim: ?StreamClaim,
|
||||
className?: string,
|
||||
@@ -9,11 +9,19 @@ type Props = {
|
||||
function VideoDuration(props: Props) {
|
||||
const { claim, className } = props;
|
||||
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const video = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
let duration;
|
||||
if (media && media.duration) {
|
||||
if (video && video.duration) {
|
||||
// $FlowFixMe
|
||||
duration = formatMediaDuration(media.duration);
|
||||
let date = new Date(null);
|
||||
date.setSeconds(video.duration);
|
||||
let timeString = date.toISOString().substr(11, 8);
|
||||
|
||||
if (timeString.startsWith('00:')) {
|
||||
timeString = timeString.substr(3);
|
||||
}
|
||||
|
||||
duration = timeString;
|
||||
}
|
||||
|
||||
return duration ? <span className={className}>{duration}</span> : null;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { makeSelectContentPositionForUri } from 'redux/selectors/content';
|
||||
import VideoViewer from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
||||
import { selectDaemonSettings, makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
|
||||
import { makeSelectClientSetting, selectHomepageData } from 'redux/selectors/settings';
|
||||
import { toggleVideoTheaterMode, doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||
|
||||
@@ -15,7 +15,6 @@ const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const autoplay = urlParams.get('autoplay');
|
||||
// TODO: eventually this should be received from DB and not local state (https://github.com/lbryio/lbry-desktop/issues/6796)
|
||||
const position = urlParams.get('t') !== null ? urlParams.get('t') : makeSelectContentPositionForUri(props.uri)(state);
|
||||
const userId = selectUser(state) && selectUser(state).id;
|
||||
|
||||
@@ -32,7 +31,6 @@ const select = (state, props) => {
|
||||
homepageData: selectHomepageData(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
userId: userId,
|
||||
shareTelemetry: IS_WEB || selectDaemonSettings(state).share_usage_data,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class AniviewPlugin extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
videojs.registerComponent('aniview', AniviewPlugin);
|
||||
videojs.registerComponent('recsys', AniviewPlugin);
|
||||
|
||||
const onPlayerReady = (player, options) => {
|
||||
player.aniview = new AniviewPlugin(player, options);
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
// Created by xander on 6/21/2021
|
||||
import videojs from 'video.js';
|
||||
import {
|
||||
makeSelectRecommendationId,
|
||||
makeSelectRecommendationParentId,
|
||||
makeSelectRecommendedClaimIds,
|
||||
makeSelectRecommendationClicks,
|
||||
} from 'redux/selectors/content';
|
||||
import { makeSelectRecommendedRecsysIdForClaimId } from 'redux/selectors/search';
|
||||
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
const VERSION = '0.0.1';
|
||||
|
||||
const recsysEndpoint = 'https://clickstream.odysee.com/log/video/view';
|
||||
@@ -24,28 +17,23 @@ const RecsysData = {
|
||||
};
|
||||
|
||||
function createRecsys(claimId, userId, events, loadedAt, isEmbed) {
|
||||
// TODO: use a UUID generator
|
||||
const uuid = uuidV4();
|
||||
const pageLoadedAt = loadedAt;
|
||||
const pageExitedAt = Date.now();
|
||||
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
|
||||
return {
|
||||
uuid: makeSelectRecommendationId(claimId)(state),
|
||||
parentUuid: makeSelectRecommendationParentId(claimId)(state),
|
||||
uid: userId,
|
||||
claimId: claimId,
|
||||
pageLoadedAt: pageLoadedAt,
|
||||
pageExitedAt: pageExitedAt,
|
||||
recsysId: makeSelectRecommendedRecsysIdForClaimId(claimId)(state) || recsysId,
|
||||
recClaimIds: makeSelectRecommendedClaimIds(claimId)(state),
|
||||
recClickedVideoIdx: makeSelectRecommendationClicks(claimId)(state),
|
||||
events: events,
|
||||
isEmbed: isEmbed,
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
return {
|
||||
uuid: uuid,
|
||||
parentUuid: null,
|
||||
uid: userId,
|
||||
claimId: claimId,
|
||||
pageLoadedAt: pageLoadedAt,
|
||||
pageExitedAt: pageExitedAt,
|
||||
recsysId: recsysId,
|
||||
recClaimIds: null,
|
||||
recClickedVideoIdx: null,
|
||||
events: events,
|
||||
isEmbed: isEmbed,
|
||||
};
|
||||
}
|
||||
|
||||
function newRecsysEvent(eventType, offset, arg) {
|
||||
@@ -142,10 +130,7 @@ class RecsysPlugin extends Component {
|
||||
this.loadedAt,
|
||||
false
|
||||
);
|
||||
|
||||
if (event) {
|
||||
sendRecsysEvents(event);
|
||||
}
|
||||
sendRecsysEvents(event);
|
||||
}
|
||||
|
||||
onPlay(event) {
|
||||
@@ -241,7 +226,7 @@ const onPlayerReady = (player, options) => {
|
||||
* @function plugin
|
||||
* @param {Object} [options={}]
|
||||
*/
|
||||
const plugin = function (options) {
|
||||
const plugin = function(options) {
|
||||
this.ready(() => {
|
||||
onPlayerReady(this, videojs.mergeOptions(defaults, options));
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
// import { SIMPLE_SITE } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import classnames from 'classnames';
|
||||
@@ -13,9 +13,8 @@ import hlsQualitySelector from './plugins/videojs-hls-quality-selector/plugin';
|
||||
import recsys from './plugins/videojs-recsys/plugin';
|
||||
import qualityLevels from 'videojs-contrib-quality-levels';
|
||||
import isUserTyping from 'util/detect-typing';
|
||||
// @if TARGET='web'
|
||||
import './plugins/videojs-aniview/plugin';
|
||||
// @endif
|
||||
// import './plugins/videojs-aniview/plugin';
|
||||
|
||||
const isDev = process.env.NODE_ENV !== 'production';
|
||||
|
||||
export type Player = {
|
||||
@@ -57,7 +56,6 @@ type Props = {
|
||||
claimId: ?string,
|
||||
userId: ?number,
|
||||
allowPreRoll: ?boolean,
|
||||
shareTelemetry: boolean,
|
||||
};
|
||||
|
||||
// type VideoJSOptions = {
|
||||
@@ -194,8 +192,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
adUrl,
|
||||
claimId,
|
||||
userId,
|
||||
allowPreRoll,
|
||||
shareTelemetry,
|
||||
// allowPreRoll,
|
||||
} = props;
|
||||
|
||||
const [reload, setReload] = useState('initial');
|
||||
@@ -567,12 +564,11 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
});
|
||||
|
||||
// Add recsys plugin
|
||||
if (shareTelemetry) {
|
||||
player.recsys({
|
||||
videoId: claimId,
|
||||
userId: userId,
|
||||
});
|
||||
}
|
||||
// TODO: Add an if(odysee.com) around this function to only use recsys on odysee
|
||||
player.recsys({
|
||||
videoId: claimId,
|
||||
userId: userId,
|
||||
});
|
||||
|
||||
// set playsinline for mobile
|
||||
// TODO: make this better
|
||||
@@ -586,11 +582,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
// This must be initialized earlier than everything else
|
||||
// otherwise a race condition occurs if we place this in the onReady call back
|
||||
// allow if isDev because otherwise you'll never see ads when basing to master
|
||||
// @if TARGET='web'
|
||||
if ((allowPreRoll && SIMPLE_SITE) || isDev) {
|
||||
vjs.aniview();
|
||||
}
|
||||
// @endif
|
||||
// if ((allowPreRoll && SIMPLE_SITE) || isDev) {
|
||||
// vjs.aniview();
|
||||
// }
|
||||
|
||||
// fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498)
|
||||
// summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar
|
||||
@@ -624,8 +618,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
|
||||
const player = playerRef.current;
|
||||
if (player) {
|
||||
player.dispose();
|
||||
window.player = undefined;
|
||||
player.dispose();
|
||||
}
|
||||
};
|
||||
}, [isAudio]);
|
||||
@@ -664,6 +658,21 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||
});
|
||||
}, [source, reload]);
|
||||
|
||||
// Load IMA3 SDK for aniview
|
||||
// disabled for now
|
||||
// useEffect(() => {
|
||||
// const script = document.createElement('script');
|
||||
// script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`;
|
||||
// script.async = true;
|
||||
// // $FlowFixMe
|
||||
// document.body.appendChild(script);
|
||||
//
|
||||
// return () => {
|
||||
// // $FlowFixMe
|
||||
// document.body.removeChild(script);
|
||||
// };
|
||||
// });
|
||||
|
||||
return (
|
||||
// $FlowFixMe
|
||||
<div className={classnames('video-js-parent', { 'video-js-parent--ios': IS_IOS })} ref={containerRef}>
|
||||
|
||||
@@ -51,7 +51,6 @@ type Props = {
|
||||
authenticated: boolean,
|
||||
userId: number,
|
||||
homepageData?: { [string]: HomepageCat },
|
||||
shareTelemetry: boolean,
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -85,7 +84,6 @@ function VideoViewer(props: Props) {
|
||||
homepageData,
|
||||
authenticated,
|
||||
userId,
|
||||
shareTelemetry,
|
||||
} = props;
|
||||
|
||||
const adApprovedChannelIds = homepageData ? getAllIds(homepageData) : [];
|
||||
@@ -127,7 +125,7 @@ function VideoViewer(props: Props) {
|
||||
}, [embedded, videoPlaybackRate]);
|
||||
|
||||
function doTrackingBuffered(e: Event, data: any) {
|
||||
fetch(source, { method: 'HEAD', cache: 'no-store' }).then((response) => {
|
||||
fetch(source, { method: 'HEAD' }).then((response) => {
|
||||
data.playerPoweredBy = response.headers.get('x-powered-by');
|
||||
doAnalyticsBuffer(uri, data);
|
||||
});
|
||||
@@ -141,20 +139,13 @@ function VideoViewer(props: Props) {
|
||||
timeToStart += differenceToAdd;
|
||||
}
|
||||
analytics.playerStartedEvent(embedded);
|
||||
|
||||
fetch(source, { method: 'HEAD', cache: 'no-store' }).then((response) => {
|
||||
let playerPoweredBy = response.headers.get('x-powered-by') || '';
|
||||
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim.canonical_url, this);
|
||||
});
|
||||
|
||||
analytics.videoStartEvent(claimId, timeToStart);
|
||||
doAnalyticsView(uri, timeToStart).then(() => {
|
||||
claimRewards();
|
||||
});
|
||||
}
|
||||
|
||||
const onEnded = React.useCallback(() => {
|
||||
analytics.videoIsPlaying(false);
|
||||
|
||||
if (adUrl) {
|
||||
setAdUrl(null);
|
||||
return;
|
||||
@@ -174,18 +165,15 @@ function VideoViewer(props: Props) {
|
||||
setIsPlaying(true);
|
||||
setShowAutoplayCountdown(false);
|
||||
setIsEndededEmbed(false);
|
||||
analytics.videoIsPlaying(true, player);
|
||||
}
|
||||
|
||||
function onPause(event, player) {
|
||||
setIsPlaying(false);
|
||||
handlePosition(player);
|
||||
analytics.videoIsPlaying(false, player);
|
||||
}
|
||||
|
||||
function onDispose(event, player) {
|
||||
handlePosition(player);
|
||||
analytics.videoIsPlaying(false, player);
|
||||
}
|
||||
|
||||
function handlePosition(player) {
|
||||
@@ -239,16 +227,12 @@ function VideoViewer(props: Props) {
|
||||
// re-factoring.
|
||||
player.on('loadedmetadata', () => restorePlaybackRate(player));
|
||||
|
||||
// used for tracking buffering for watchman
|
||||
player.on('tracking:buffered', doTrackingBuffered);
|
||||
|
||||
// first play tracking, used for initializing the watchman api
|
||||
player.on('tracking:firstplay', doTrackingFirstPlay);
|
||||
player.on('ended', onEnded);
|
||||
player.on('play', onPlay);
|
||||
player.on('pause', (event) => onPause(event, player));
|
||||
player.on('dispose', (event) => onDispose(event, player));
|
||||
|
||||
player.on('error', () => {
|
||||
const error = player.error();
|
||||
if (error) {
|
||||
@@ -335,7 +319,6 @@ function VideoViewer(props: Props) {
|
||||
claimId={claimId}
|
||||
userId={userId}
|
||||
allowPreRoll={!embedded && !authenticated}
|
||||
shareTelemetry={shareTelemetry}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import FiatAccountHistory from './view';
|
||||
|
||||
export default FiatAccountHistory;
|
||||
@@ -1,88 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import moment from 'moment';
|
||||
|
||||
type Props = {
|
||||
accountDetails: any,
|
||||
transactions: any,
|
||||
};
|
||||
|
||||
const WalletBalance = (props: Props) => {
|
||||
// receive transactions from parent component
|
||||
const { transactions } = props;
|
||||
|
||||
let accountTransactions;
|
||||
|
||||
// reverse so most recent payments come first
|
||||
if (transactions && transactions.length) {
|
||||
accountTransactions = transactions.reverse();
|
||||
}
|
||||
|
||||
// if there are more than 10 transactions, limit it to 10 for the frontend
|
||||
if (accountTransactions && accountTransactions.length > 10) {
|
||||
accountTransactions.length = 10;
|
||||
}
|
||||
|
||||
return (
|
||||
<><Card
|
||||
title={'Tip History'}
|
||||
body={(
|
||||
<>
|
||||
<div className="table__wrapper">
|
||||
<table className="table table--transactions">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="date-header">{__('Date')}</th>
|
||||
<th>{<>{__('Receiving Channel Name')}</>}</th>
|
||||
<th>{__('Tip Location')}</th>
|
||||
<th>{__('Amount (USD)')} </th>
|
||||
<th>{__('Processing Fee')}</th>
|
||||
<th>{__('Odysee Fee')}</th>
|
||||
<th>{__('Received Amount')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{accountTransactions &&
|
||||
accountTransactions.map((transaction) => (
|
||||
<tr key={transaction.name + transaction.created_at}>
|
||||
<td>{moment(transaction.created_at).format('LLL')}</td>
|
||||
<td>
|
||||
<Button
|
||||
className=""
|
||||
navigate={'/' + transaction.channel_name + ':' + transaction.channel_claim_id}
|
||||
label={transaction.channel_name}
|
||||
button="link"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<Button
|
||||
className=""
|
||||
navigate={'/' + transaction.channel_name + ':' + transaction.source_claim_id}
|
||||
label={
|
||||
transaction.channel_claim_id === transaction.source_claim_id
|
||||
? 'Channel Page'
|
||||
: 'Content Page'
|
||||
}
|
||||
button="link"
|
||||
/>
|
||||
</td>
|
||||
<td>${transaction.tipped_amount / 100}</td>
|
||||
<td>${transaction.transaction_fee / 100}</td>
|
||||
<td>${transaction.application_fee / 100}</td>
|
||||
<td>${transaction.received_amount / 100}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{!accountTransactions && <p style={{textAlign: 'center', marginTop: '20px', fontSize: '13px', color: 'rgb(171, 171, 171)'}}>No Transactions</p>}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default WalletBalance;
|
||||
@@ -1,3 +0,0 @@
|
||||
import WalletFiatBalance from './view';
|
||||
|
||||
export default WalletFiatBalance;
|
||||
@@ -1,94 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import Icon from 'component/common/icon';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
|
||||
type Props = {
|
||||
accountDetails: any,
|
||||
};
|
||||
|
||||
const WalletBalance = (props: Props) => {
|
||||
const {
|
||||
accountDetails,
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<>{<Card
|
||||
title={<><Icon size={18} icon={ICONS.FINANCE} />{(accountDetails && ((accountDetails.total_received_unpaid - accountDetails.total_paid_out) / 100)) || 0} USD</>}
|
||||
subtitle={accountDetails && accountDetails.total_received_unpaid > 0 &&
|
||||
<I18nMessage>
|
||||
This is your pending balance that will be automatically sent to your bank account
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<h2 className="section__title--small">
|
||||
${(accountDetails && (accountDetails.total_received_unpaid / 100)) || 0} Total Received Tips
|
||||
</h2>
|
||||
|
||||
<h2 className="section__title--small">
|
||||
${(accountDetails && (accountDetails.total_paid_out / 100)) || 0} Withdrawn
|
||||
{/* <Button */}
|
||||
{/* button="link" */}
|
||||
{/* label={detailsExpanded ? __('View less') : __('View more')} */}
|
||||
{/* iconRight={detailsExpanded ? ICONS.UP : ICONS.DOWN} */}
|
||||
{/* onClick={() => setDetailsExpanded(!detailsExpanded)} */}
|
||||
{/* /> */}
|
||||
</h2>
|
||||
|
||||
{/* view more section */}
|
||||
{/* commenting out because not implemented, but could be used in the future */}
|
||||
{/* {detailsExpanded && ( */}
|
||||
{/* <div className="section__subtitle"> */}
|
||||
{/* <dl> */}
|
||||
{/* <dt> */}
|
||||
{/* <span className="dt__text">{__('Earned from uploads')}</span> */}
|
||||
{/* /!* <span className="help--dt">({__('Earned from channel page')})</span> *!/ */}
|
||||
{/* </dt> */}
|
||||
{/* <dd> */}
|
||||
{/* <span className="dd__text"> */}
|
||||
{/* {Boolean(1) && ( */}
|
||||
{/* <Button */}
|
||||
{/* button="link" */}
|
||||
{/* className="dd__button" */}
|
||||
{/* icon={ICONS.UNLOCK} */}
|
||||
{/* /> */}
|
||||
{/* )} */}
|
||||
{/* <CreditAmount amount={1} precision={4} /> */}
|
||||
{/* </span> */}
|
||||
{/* </dd> */}
|
||||
|
||||
{/* <dt> */}
|
||||
{/* <span className="dt__text">{__('Earned from channel page')}</span> */}
|
||||
{/* /!* <span className="help--dt">({__('Delete or edit past content to spend')})</span> *!/ */}
|
||||
{/* </dt> */}
|
||||
{/* <dd> */}
|
||||
{/* <CreditAmount amount={1} precision={4} /> */}
|
||||
{/* </dd> */}
|
||||
|
||||
{/* /!* <dt> *!/ */}
|
||||
{/* /!* <span className="dt__text">{__('...supporting content')}</span> *!/ */}
|
||||
{/* /!* <span className="help--dt">({__('Delete supports to spend')})</span> *!/ */}
|
||||
{/* /!* </dt> *!/ */}
|
||||
{/* /!* <dd> *!/ */}
|
||||
{/* /!* <CreditAmount amount={1} precision={4} /> *!/ */}
|
||||
{/* /!* </dd> *!/ */}
|
||||
{/* </dl> */}
|
||||
{/* </div> */}
|
||||
{/* )} */}
|
||||
|
||||
<div className="section__actions">
|
||||
{/* <Button button="primary" label={__('Receive Payout')} icon={ICONS.SEND} /> */}
|
||||
<Button button="secondary" label={__('Account Configuration')} icon={ICONS.SETTINGS} navigate={`/$/${PAGES.SETTINGS_STRIPE_ACCOUNT}`} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>}</>
|
||||
);
|
||||
};
|
||||
|
||||
export default WalletBalance;
|
||||
@@ -1,3 +0,0 @@
|
||||
import WalletFiatPaymentBalance from './view';
|
||||
|
||||
export default WalletFiatPaymentBalance;
|
||||
@@ -1,76 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
|
||||
type Props = {
|
||||
totalTippedAmount: number,
|
||||
accountDetails: any,
|
||||
transactions: any,
|
||||
};
|
||||
|
||||
const WalletBalance = (props: Props) => {
|
||||
const {
|
||||
// accountDetails,
|
||||
transactions,
|
||||
} = props;
|
||||
|
||||
// let cardDetails = {
|
||||
// brand: card.brand,
|
||||
// expiryYear: card.exp_year,
|
||||
// expiryMonth: card.exp_month,
|
||||
// lastFour: card.last4,
|
||||
// topOfDisplay: topOfDisplay,
|
||||
// bottomOfDisplay: bottomOfDisplay,
|
||||
// };
|
||||
|
||||
// const [detailsExpanded, setDetailsExpanded] = React.useState(false);
|
||||
const [totalCreatorsSupported, setTotalCreatorsSupported] = React.useState(false);
|
||||
|
||||
// calculate how many unique users tipped
|
||||
React.useEffect(() => {
|
||||
if (transactions) {
|
||||
let channelNames = [];
|
||||
|
||||
for (const transaction of transactions) {
|
||||
channelNames.push(transaction.channel_name);
|
||||
}
|
||||
|
||||
let unique = [...new Set(channelNames)];
|
||||
setTotalCreatorsSupported(unique.length);
|
||||
}
|
||||
}, [transactions]);
|
||||
|
||||
return (
|
||||
<>{<Card
|
||||
// TODO: implement hasActiveCard and show the current card the user would charge to
|
||||
// subtitle={hasActiveCard && <h2>Hello</h2>
|
||||
// // <Plastic
|
||||
// // type={userCardDetails.brand}
|
||||
// // name={userCardDetails.topOfDisplay + ' ' + userCardDetails.bottomOfDisplay}
|
||||
// // expiry={userCardDetails.expiryMonth + '/' + userCardDetails.expiryYear}
|
||||
// // number={'____________' + userCardDetails.lastFour}
|
||||
// // />
|
||||
// }
|
||||
actions={
|
||||
<>
|
||||
<h2 className="section__title--small">
|
||||
{(transactions && transactions.length) || 0} Total Tips
|
||||
</h2>
|
||||
|
||||
<h2 className="section__title--small">
|
||||
{totalCreatorsSupported || 0} Creators Supported
|
||||
</h2>
|
||||
|
||||
<div className="section__actions">
|
||||
<Button button="secondary" label={__('Manage Cards')} icon={ICONS.SETTINGS} navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>}</>
|
||||
);
|
||||
};
|
||||
|
||||
export default WalletBalance;
|
||||
@@ -1,3 +0,0 @@
|
||||
import WalletFiatPaymentHistory from './view';
|
||||
|
||||
export default WalletFiatPaymentHistory;
|
||||
@@ -1,113 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import moment from 'moment';
|
||||
import { getStripeEnvironment } from 'util/stripe';
|
||||
let stripeEnvironment = getStripeEnvironment();
|
||||
|
||||
type Props = {
|
||||
accountDetails: any,
|
||||
transactions: any,
|
||||
};
|
||||
|
||||
const WalletBalance = (props: Props) => {
|
||||
// receive transactions from parent component
|
||||
const { transactions: accountTransactions } = props;
|
||||
|
||||
// const [accountStatusResponse, setAccountStatusResponse] = React.useState();
|
||||
|
||||
// const [subscriptions, setSubscriptions] = React.useState();
|
||||
|
||||
const [lastFour, setLastFour] = React.useState();
|
||||
|
||||
function getCustomerStatus() {
|
||||
return Lbryio.call(
|
||||
'customer',
|
||||
'status',
|
||||
{
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
);
|
||||
}
|
||||
|
||||
// TODO: this is actually incorrect, last4 should be populated based on the transaction not the current customer details
|
||||
React.useEffect(() => {
|
||||
(async function () {
|
||||
const customerStatusResponse = await getCustomerStatus();
|
||||
|
||||
const lastFour =
|
||||
customerStatusResponse.PaymentMethods &&
|
||||
customerStatusResponse.PaymentMethods.length &&
|
||||
customerStatusResponse.PaymentMethods[0].card.last4;
|
||||
|
||||
setLastFour(lastFour);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
title={__('Payment History')}
|
||||
body={
|
||||
<>
|
||||
<div className="table__wrapper">
|
||||
<table className="table table--transactions">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="date-header">{__('Date')}</th>
|
||||
<th>{<>{__('Receiving Channel Name')}</>}</th>
|
||||
<th>{__('Tip Location')}</th>
|
||||
<th>{__('Amount (USD)')} </th>
|
||||
<th>{__('Card Last 4')}</th>
|
||||
<th>{__('Anonymous')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{accountTransactions &&
|
||||
accountTransactions.map((transaction) => (
|
||||
<tr key={transaction.name + transaction.created_at}>
|
||||
<td>{moment(transaction.created_at).format('LLL')}</td>
|
||||
<td>
|
||||
<Button
|
||||
className=""
|
||||
navigate={'/' + transaction.channel_name + ':' + transaction.channel_claim_id}
|
||||
label={transaction.channel_name}
|
||||
button="link"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<Button
|
||||
className=""
|
||||
navigate={'/' + transaction.channel_name + ':' + transaction.source_claim_id}
|
||||
label={
|
||||
transaction.channel_claim_id === transaction.source_claim_id
|
||||
? 'Channel Page'
|
||||
: 'Content Page'
|
||||
}
|
||||
button="link"
|
||||
/>
|
||||
</td>
|
||||
<td>${transaction.tipped_amount / 100}</td>
|
||||
<td>{lastFour}</td>
|
||||
<td>{transaction.private_tip ? 'Yes' : 'No'}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
{(!accountTransactions || accountTransactions.length === 0) && (
|
||||
<p style={{ textAlign: 'center', marginTop: '20px', fontSize: '13px', color: 'rgb(171, 171, 171)' }}>
|
||||
No Transactions
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default WalletBalance;
|
||||
+236
-312
@@ -15,8 +15,14 @@ import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import { getStripeEnvironment } from 'util/stripe';
|
||||
let stripeEnvironment = getStripeEnvironment();
|
||||
import { STRIPE_PUBLIC_KEY } from 'config';
|
||||
|
||||
let stripeEnvironment = 'test';
|
||||
// if the key contains pk_live it's a live key
|
||||
// update the environment for the calls to the backend to indicate which environment to hit
|
||||
if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) {
|
||||
stripeEnvironment = 'live';
|
||||
}
|
||||
|
||||
const DEFAULT_TIP_AMOUNTS = [1, 5, 25, 100];
|
||||
const MINIMUM_FIAT_TIP = 1;
|
||||
@@ -94,7 +100,7 @@ function WalletSendTip(props: Props) {
|
||||
|
||||
// check if creator has a payment method saved
|
||||
React.useEffect(() => {
|
||||
if (channelClaimId && isAuthenticated && stripeEnvironment) {
|
||||
if (channelClaimId && isAuthenticated) {
|
||||
Lbryio.call(
|
||||
'customer',
|
||||
'status',
|
||||
@@ -112,18 +118,16 @@ function WalletSendTip(props: Props) {
|
||||
setHasSavedCard(Boolean(defaultPaymentMethodId));
|
||||
});
|
||||
}
|
||||
}, [channelClaimId, isAuthenticated, stripeEnvironment]);
|
||||
}, [channelClaimId, isAuthenticated]);
|
||||
|
||||
// check if creator has an account saved
|
||||
React.useEffect(() => {
|
||||
const tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) {
|
||||
tipInputElement.focus();
|
||||
}
|
||||
var tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) { tipInputElement.focus() }
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (channelClaimId && stripeEnvironment) {
|
||||
if (channelClaimId) {
|
||||
Lbryio.call(
|
||||
'account',
|
||||
'check',
|
||||
@@ -137,22 +141,20 @@ function WalletSendTip(props: Props) {
|
||||
.then((accountCheckResponse) => {
|
||||
if (accountCheckResponse === true && canReceiveFiatTip !== true) {
|
||||
setCanReceiveFiatTip(true);
|
||||
} else {
|
||||
setCanReceiveFiatTip(false);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
// console.log(error);
|
||||
});
|
||||
}
|
||||
}, [channelClaimId, stripeEnvironment]);
|
||||
}, [channelClaimId]);
|
||||
|
||||
const noBalance = balance === 0;
|
||||
const tipAmount = useCustomTip ? customTipAmount : presetTipAmount;
|
||||
|
||||
const [activeTab, setActiveTab] = React.useState(claimIsMine ? TAB_BOOST : TAB_LBC);
|
||||
|
||||
function getClaimTypeText() {
|
||||
function setClaimTypeText() {
|
||||
if (claim.value_type === 'stream') {
|
||||
return __('Content');
|
||||
} else if (claim.value_type === 'channel') {
|
||||
@@ -165,24 +167,21 @@ function WalletSendTip(props: Props) {
|
||||
return __('Claim');
|
||||
}
|
||||
}
|
||||
const claimTypeText = getClaimTypeText();
|
||||
const claimTypeText = setClaimTypeText();
|
||||
|
||||
let iconToUse;
|
||||
let explainerText = '';
|
||||
let iconToUse, explainerText;
|
||||
if (activeTab === TAB_BOOST) {
|
||||
iconToUse = ICONS.LBC;
|
||||
explainerText = __('This refundable boost will improve the discoverability of this %claimTypeText% while active.', {
|
||||
claimTypeText,
|
||||
});
|
||||
explainerText = __('This refundable boost will improve the discoverability of this %claimTypeText% while active.', {claimTypeText});
|
||||
} else if (activeTab === TAB_FIAT) {
|
||||
iconToUse = ICONS.FINANCE;
|
||||
explainerText = __('Show this channel your appreciation by sending a donation in USD.');
|
||||
explainerText = __('Show this channel your appreciation by sending a donation in USD. ');
|
||||
// if (!hasCardSaved) {
|
||||
// explainerText += __('You must add a card to use this functionality.');
|
||||
// }
|
||||
} else if (activeTab === TAB_LBC) {
|
||||
iconToUse = ICONS.LBC;
|
||||
explainerText = __('Show this channel your appreciation by sending a donation of Credits.');
|
||||
explainerText = __('Show this channel your appreciation by sending a donation of Credits. ');
|
||||
}
|
||||
|
||||
const isSupport = claimIsMine || activeTab === TAB_BOOST;
|
||||
@@ -214,7 +213,7 @@ function WalletSendTip(props: Props) {
|
||||
} else if (tipAmount < MINIMUM_PUBLISH_BID) {
|
||||
tipError = __('Amount must be higher');
|
||||
}
|
||||
// if tip fiat tab
|
||||
// if tip fiat tab
|
||||
} else {
|
||||
regexp = RegExp(/^(\d*([.]\d{0,2})?)$/);
|
||||
const validTipInput = regexp.test(String(tipAmount));
|
||||
@@ -275,8 +274,7 @@ function WalletSendTip(props: Props) {
|
||||
'customer',
|
||||
'tip',
|
||||
{
|
||||
// round to fix issues with floating point numbers
|
||||
amount: Math.round(100 * tipAmount), // convert from dollars to cents
|
||||
amount: 100 * tipAmount, // convert from dollars to cents
|
||||
creator_channel_name: tipChannelName, // creator_channel_name
|
||||
creator_channel_claim_id: channelClaimId,
|
||||
tipper_channel_name: sendAnonymously ? '' : activeChannelName,
|
||||
@@ -296,8 +294,8 @@ function WalletSendTip(props: Props) {
|
||||
}),
|
||||
});
|
||||
})
|
||||
.catch(function (error) {
|
||||
let displayError = 'Sorry, there was an error in processing your payment!';
|
||||
.catch(function(error) {
|
||||
var displayError = 'Sorry, there was an error in processing your payment!';
|
||||
|
||||
if (error.message !== 'payment intent failed to confirm') {
|
||||
displayError = error.message;
|
||||
@@ -315,53 +313,10 @@ function WalletSendTip(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
const countDecimals = function (value) {
|
||||
const text = value.toString();
|
||||
const index = text.indexOf('.');
|
||||
return text.length - index - 1;
|
||||
};
|
||||
|
||||
function handleCustomPriceChange(event: SyntheticInputEvent<*>) {
|
||||
let tipAmountAsString = event.target.value;
|
||||
const tipAmount = parseFloat(event.target.value);
|
||||
|
||||
let tipAmount = parseFloat(tipAmountAsString);
|
||||
|
||||
const howManyDecimals = countDecimals(tipAmountAsString);
|
||||
|
||||
// fiat tip input
|
||||
if (activeTab === TAB_FIAT) {
|
||||
if (Number.isNaN(tipAmount)) {
|
||||
setCustomTipAmount('');
|
||||
}
|
||||
|
||||
// allow maximum of two decimal places
|
||||
if (howManyDecimals > 2) {
|
||||
tipAmount = Math.floor(tipAmount * 100) / 100;
|
||||
}
|
||||
|
||||
// remove decimals, and then get number of digits
|
||||
const howManyDigits = Math.trunc(tipAmount).toString().length;
|
||||
|
||||
if (howManyDigits > 4 && tipAmount !== 1000) {
|
||||
setTipError('Amount cannot be over 1000 dollars');
|
||||
setCustomTipAmount(tipAmount);
|
||||
} else if (tipAmount > 1000) {
|
||||
setTipError('Amount cannot be over 1000 dollars');
|
||||
setCustomTipAmount(tipAmount);
|
||||
} else {
|
||||
setCustomTipAmount(tipAmount);
|
||||
}
|
||||
// LBC tip input
|
||||
} else {
|
||||
// TODO: this is a bit buggy, needs a touchup
|
||||
// if (howManyDecimals > 9) {
|
||||
// // only allows up to 8 decimal places
|
||||
// tipAmount = Number(tipAmount.toString().match(/^-?\d+(?:\.\d{0,8})?/)[0]);
|
||||
//
|
||||
// setTipError('Please only use up to 8 decimals');
|
||||
// }
|
||||
setCustomTipAmount(tipAmount);
|
||||
}
|
||||
setCustomTipAmount(tipAmount);
|
||||
}
|
||||
|
||||
function buildButtonText() {
|
||||
@@ -376,19 +331,11 @@ function WalletSendTip(props: Props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function convertToTwoDecimals(number) {
|
||||
return (Math.round(number * 100) / 100).toFixed(2);
|
||||
}
|
||||
|
||||
const amountToShow = activeTab === TAB_FIAT ? convertToTwoDecimals(tipAmount) : tipAmount;
|
||||
|
||||
// if it's a valid number display it, otherwise do an empty string
|
||||
const displayAmount = !isNan(tipAmount) ? amountToShow : '';
|
||||
const displayAmount = !isNan(tipAmount) ? tipAmount : '';
|
||||
|
||||
if (activeTab === TAB_BOOST) {
|
||||
return claimIsMine
|
||||
? __('Boost Your %claimTypeText%', { claimTypeText })
|
||||
: __('Boost This %claimTypeText%', { claimTypeText });
|
||||
return (claimIsMine ? __('Boost Your %claimTypeText%', {claimTypeText}) : __('Boost This %claimTypeText%', {claimTypeText}));
|
||||
} else if (activeTab === TAB_FIAT) {
|
||||
return __('Send a $%displayAmount% Tip', { displayAmount });
|
||||
} else if (activeTab === TAB_LBC) {
|
||||
@@ -415,263 +362,240 @@ function WalletSendTip(props: Props) {
|
||||
return (
|
||||
<Form onSubmit={handleSubmit}>
|
||||
{/* if there is no LBC balance, show user frontend to get credits */}
|
||||
{/* if there is lbc, the main tip/boost gui with the 3 tabs at the top */}
|
||||
<Card
|
||||
title={
|
||||
<LbcSymbol
|
||||
postfix={
|
||||
claimIsMine
|
||||
? __('Boost Your %claimTypeText%', { claimTypeText })
|
||||
: __('Support This %claimTypeText%', { claimTypeText })
|
||||
}
|
||||
size={22}
|
||||
/>
|
||||
}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{!claimIsMine && (
|
||||
<div className="section">
|
||||
{/* tip LBC tab button */}
|
||||
<Button
|
||||
key="tip"
|
||||
icon={ICONS.LBC}
|
||||
label={__('Tip')}
|
||||
button="alt"
|
||||
onClick={() => {
|
||||
const tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) {
|
||||
tipInputElement.focus();
|
||||
}
|
||||
if (!isConfirming) {
|
||||
setActiveTab(TAB_LBC);
|
||||
}
|
||||
}}
|
||||
className={classnames('button-toggle', { 'button-toggle--active': activeTab === TAB_LBC })}
|
||||
/>
|
||||
{/* tip fiat tab button */}
|
||||
{/* @if TARGET='web' */}
|
||||
{stripeEnvironment && (
|
||||
{noBalance ? (
|
||||
<Card
|
||||
title={<I18nMessage tokens={{ lbc: <LbcSymbol size={22} /> }}>Supporting content requires %lbc%</I18nMessage>}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>
|
||||
With %lbc%, you can send tips to your favorite creators, or help boost their content for more people to
|
||||
see.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
icon={ICONS.REWARDS}
|
||||
button="primary"
|
||||
label={__('Earn Rewards')}
|
||||
navigate={`/$/${PAGES.REWARDS}`}
|
||||
/>
|
||||
<Button icon={ICONS.BUY} button="secondary" label={__('Buy/Swap Credits')} navigate={`/$/${PAGES.BUY}`} />
|
||||
<Button button="link" label={__('Nevermind')} onClick={closeModal} />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
// if there is lbc, the main tip/boost gui with the 3 tabs at the top
|
||||
<Card
|
||||
title={<LbcSymbol postfix={claimIsMine ? __('Boost Your %claimTypeText%', {claimTypeText}) : __('Support This %claimTypeText%', {claimTypeText})} size={22} />}
|
||||
subtitle={
|
||||
<React.Fragment>
|
||||
{!claimIsMine && (
|
||||
<div className="section">
|
||||
{/* tip LBC tab button */}
|
||||
<Button
|
||||
key="tip"
|
||||
icon={ICONS.LBC}
|
||||
label={__('Tip')}
|
||||
button="alt"
|
||||
onClick={() => {
|
||||
var tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) { tipInputElement.focus() }
|
||||
if (!isConfirming) {
|
||||
setActiveTab(TAB_LBC);
|
||||
}
|
||||
}}
|
||||
className={classnames('button-toggle', { 'button-toggle--active': activeTab === TAB_LBC })}
|
||||
/>
|
||||
{/* tip fiat tab button */}
|
||||
{/* @if TARGET='web' */}
|
||||
<Button
|
||||
key="tip-fiat"
|
||||
icon={ICONS.FINANCE}
|
||||
label={__('Tip')}
|
||||
button="alt"
|
||||
onClick={() => {
|
||||
const tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) {
|
||||
tipInputElement.focus();
|
||||
}
|
||||
var tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) { tipInputElement.focus() }
|
||||
if (!isConfirming) {
|
||||
setActiveTab(TAB_FIAT);
|
||||
}
|
||||
}}
|
||||
className={classnames('button-toggle', { 'button-toggle--active': activeTab === TAB_FIAT })}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{/* tip LBC tab button */}
|
||||
<Button
|
||||
key="boost"
|
||||
icon={ICONS.TRENDING}
|
||||
label={__('Boost')}
|
||||
button="alt"
|
||||
onClick={() => {
|
||||
const tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) {
|
||||
tipInputElement.focus();
|
||||
}
|
||||
if (!isConfirming) {
|
||||
setActiveTab(TAB_BOOST);
|
||||
}
|
||||
}}
|
||||
className={classnames('button-toggle', { 'button-toggle--active': activeTab === TAB_BOOST })}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* short explainer under the button */}
|
||||
<div className="section__subtitle">
|
||||
{explainerText + ' '}
|
||||
{/* {activeTab === TAB_FIAT && !hasCardSaved && <Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add A Card')} button="link" />} */}
|
||||
{<Button label={__('Learn more')} button="link" href="https://lbry.com/faq/tipping" />}
|
||||
</div>
|
||||
</React.Fragment>
|
||||
}
|
||||
actions={
|
||||
// confirmation modal, allow user to confirm or cancel transaction
|
||||
isConfirming ? (
|
||||
<>
|
||||
<div className="section section--padded card--inline confirm__wrapper">
|
||||
<div className="section">
|
||||
<div className="confirm__label">{__('To --[the tip recipient]--')}</div>
|
||||
<div className="confirm__value">{channelName || title}</div>
|
||||
<div className="confirm__label">{__('From --[the tip sender]--')}</div>
|
||||
<div className="confirm__value">
|
||||
{activeChannelClaim && !incognito ? activeChannelClaim.name : __('Anonymous')}
|
||||
</div>
|
||||
<div className="confirm__label">{setConfirmLabel()}</div>
|
||||
<div className="confirm__value">
|
||||
{activeTab === TAB_FIAT ? (
|
||||
<p>$ {(Math.round(tipAmount * 100) / 100).toFixed(2)}</p>
|
||||
) : (
|
||||
<LbcSymbol postfix={tipAmount} size={22} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="section__actions">
|
||||
<Button autoFocus onClick={handleSubmit} button="primary" disabled={isPending} label={__('Confirm')} />
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setIsConfirming(false)} />
|
||||
</div>
|
||||
</>
|
||||
) : !((activeTab === TAB_LBC || activeTab === TAB_BOOST) && noBalance) ? (
|
||||
<>
|
||||
<div className="section">
|
||||
<ChannelSelector />
|
||||
</div>
|
||||
|
||||
{activeTab === TAB_FIAT && !hasCardSaved && (
|
||||
<h3 className="add-card-prompt">
|
||||
<Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card')} button="link" />{' '}
|
||||
{__('To Tip Creators')}
|
||||
</h3>
|
||||
)}
|
||||
|
||||
{/* section to pick tip/boost amount */}
|
||||
<div className="section">
|
||||
{DEFAULT_TIP_AMOUNTS.map((amount) => (
|
||||
{/* @endif */}
|
||||
{/* tip LBC tab button */}
|
||||
<Button
|
||||
key={amount}
|
||||
disabled={shouldDisableAmountSelector(amount)}
|
||||
key="boost"
|
||||
icon={ICONS.TRENDING}
|
||||
label={__('Boost')}
|
||||
button="alt"
|
||||
className={classnames('button-toggle button-toggle--expandformobile', {
|
||||
'button-toggle--active': tipAmount === amount && !useCustomTip,
|
||||
'button-toggle--disabled': amount > balance,
|
||||
})}
|
||||
label={amount}
|
||||
icon={iconToUse}
|
||||
onClick={() => {
|
||||
setPresetTipAmount(amount);
|
||||
setUseCustomTip(false);
|
||||
var tipInputElement = document.getElementById('tip-input');
|
||||
if (tipInputElement) { tipInputElement.focus() }
|
||||
if (!isConfirming) {
|
||||
setActiveTab(TAB_BOOST);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
|
||||
<Button
|
||||
button="alt"
|
||||
className={classnames('button-toggle button-toggle--expandformobile', {
|
||||
'button-toggle--active': useCustomTip, // set as active
|
||||
})}
|
||||
icon={iconToUse}
|
||||
label={__('Custom')}
|
||||
onClick={() => setUseCustomTip(true)}
|
||||
// disabled if it's receive fiat and there is no card or creator can't receive tips
|
||||
disabled={activeTab === TAB_FIAT && (!hasCardSaved || !canReceiveFiatTip)}
|
||||
/>
|
||||
|
||||
{DEFAULT_TIP_AMOUNTS.some((val) => val > balance) && activeTab !== TAB_FIAT && (
|
||||
<Button
|
||||
button="secondary"
|
||||
className="button-toggle-group-action"
|
||||
icon={ICONS.BUY}
|
||||
title={__('Buy or swap more LBRY Credits')}
|
||||
navigate={`/$/${PAGES.BUY}`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{useCustomTip && (
|
||||
<div className="section">
|
||||
<FormField
|
||||
autoFocus
|
||||
name="tip-input"
|
||||
label={
|
||||
<React.Fragment>
|
||||
{__('Custom support amount')}{' '}
|
||||
{activeTab !== TAB_FIAT ? (
|
||||
<I18nMessage
|
||||
tokens={{ lbc_balance: <CreditAmount precision={4} amount={balance} showLBC={false} /> }}
|
||||
>
|
||||
(%lbc_balance% Credits available)
|
||||
</I18nMessage>
|
||||
) : (
|
||||
'in USD'
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
error={tipError}
|
||||
min="0"
|
||||
step="any"
|
||||
type="number"
|
||||
style={{
|
||||
width: activeTab === TAB_FIAT ? '99px' : '160px',
|
||||
}}
|
||||
placeholder="1.23"
|
||||
value={customTipAmount}
|
||||
onChange={(event) => handleCustomPriceChange(event)}
|
||||
className={classnames('button-toggle', { 'button-toggle--active': activeTab === TAB_BOOST })}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* send tip/boost button */}
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
autoFocus
|
||||
icon={isSupport ? ICONS.TRENDING : ICONS.SUPPORT}
|
||||
button="primary"
|
||||
type="submit"
|
||||
disabled={
|
||||
fetchingChannels ||
|
||||
isPending ||
|
||||
tipError ||
|
||||
!tipAmount ||
|
||||
(activeTab === TAB_FIAT && (!hasCardSaved || !canReceiveFiatTip))
|
||||
}
|
||||
label={buildButtonText()}
|
||||
/>
|
||||
{fetchingChannels && <span className="help">{__('Loading your channels...')}</span>}
|
||||
{/* short explainer under the button */}
|
||||
<div className="section__subtitle">
|
||||
{explainerText}
|
||||
{/* {activeTab === TAB_FIAT && !hasCardSaved && <Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add A Card')} button="link" />} */}
|
||||
{<Button label={__('Learn more')} button="link" href="https://lbry.com/faq/tipping" />}
|
||||
</div>
|
||||
{activeTab !== TAB_FIAT ? (
|
||||
<WalletSpendableBalanceHelp />
|
||||
) : !canReceiveFiatTip ? (
|
||||
<div className="help">{__('Only creators that verify cash accounts can receive tips')}</div>
|
||||
) : (
|
||||
<div className="help">{__('The payment will be made from your saved card')}</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
// if it's LBC and there is no balance, you can prompt to purchase LBC
|
||||
<Card
|
||||
title={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol size={22} /> }}>Supporting content requires %lbc%</I18nMessage>
|
||||
}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>
|
||||
With %lbc%, you can send tips to your favorite creators, or help boost their content for more people
|
||||
to see.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
</React.Fragment>
|
||||
}
|
||||
actions={
|
||||
// confirmation modal, allow user to confirm or cancel transaction
|
||||
isConfirming ? (
|
||||
<>
|
||||
<div className="section section--padded card--inline confirm__wrapper">
|
||||
<div className="section">
|
||||
<div className="confirm__label">{__('To --[the tip recipient]--')}</div>
|
||||
<div className="confirm__value">{channelName || title}</div>
|
||||
<div className="confirm__label">{__('From --[the tip sender]--')}</div>
|
||||
<div className="confirm__value">
|
||||
{activeChannelClaim && !incognito ? activeChannelClaim.name : __('Anonymous')}
|
||||
</div>
|
||||
<div className="confirm__label">{setConfirmLabel()}</div>
|
||||
<div className="confirm__value">
|
||||
{activeTab === TAB_FIAT ? <p>$ {tipAmount}</p> : <LbcSymbol postfix={tipAmount} size={22} />}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
icon={ICONS.REWARDS}
|
||||
autoFocus
|
||||
onClick={handleSubmit}
|
||||
button="primary"
|
||||
label={__('Earn Rewards')}
|
||||
navigate={`/$/${PAGES.REWARDS}`}
|
||||
disabled={isPending}
|
||||
label={__('Confirm')}
|
||||
/>
|
||||
<Button
|
||||
icon={ICONS.BUY}
|
||||
button="secondary"
|
||||
label={__('Buy/Swap Credits')}
|
||||
navigate={`/$/${PAGES.BUY}`}
|
||||
/>
|
||||
<Button button="link" label={__('Nevermind')} onClick={closeModal} />
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setIsConfirming(false)} />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<div className="section">
|
||||
<ChannelSelector />
|
||||
</div>
|
||||
|
||||
{activeTab === TAB_FIAT && !hasCardSaved && (
|
||||
<h3 className="add-card-prompt">
|
||||
<Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card')} button="link" />
|
||||
{' '}{__('To Tip Creators')}
|
||||
</h3>
|
||||
)}
|
||||
|
||||
{/* section to pick tip/boost amount */}
|
||||
<div className="section">
|
||||
{DEFAULT_TIP_AMOUNTS.map((amount) => (
|
||||
<Button
|
||||
key={amount}
|
||||
disabled={shouldDisableAmountSelector(amount)}
|
||||
button="alt"
|
||||
className={classnames('button-toggle button-toggle--expandformobile', {
|
||||
'button-toggle--active': tipAmount === amount && !useCustomTip,
|
||||
'button-toggle--disabled': amount > balance,
|
||||
})}
|
||||
label={amount}
|
||||
icon={iconToUse}
|
||||
onClick={() => {
|
||||
setPresetTipAmount(amount);
|
||||
setUseCustomTip(false);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
|
||||
<Button
|
||||
button="alt"
|
||||
className={classnames('button-toggle button-toggle--expandformobile', {
|
||||
'button-toggle--active': useCustomTip, // set as active
|
||||
})}
|
||||
icon={iconToUse}
|
||||
label={__('Custom')}
|
||||
onClick={() => setUseCustomTip(true)}
|
||||
// disabled if it's receive fiat and there is no card or creator can't receive tips
|
||||
disabled={activeTab === TAB_FIAT && (!hasCardSaved || !canReceiveFiatTip)}
|
||||
/>
|
||||
|
||||
{DEFAULT_TIP_AMOUNTS.some((val) => val > balance) && activeTab !== TAB_FIAT && (
|
||||
<Button
|
||||
button="secondary"
|
||||
className="button-toggle-group-action"
|
||||
icon={ICONS.BUY}
|
||||
title={__('Buy or swap more LBRY Credits')}
|
||||
navigate={`/$/${PAGES.BUY}`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{useCustomTip && (
|
||||
<div className="section">
|
||||
<FormField
|
||||
autoFocus
|
||||
name="tip-input"
|
||||
label={
|
||||
<React.Fragment>
|
||||
{__('Custom support amount')}{' '}
|
||||
{activeTab !== TAB_FIAT ? (
|
||||
<I18nMessage
|
||||
tokens={{ lbc_balance: <CreditAmount precision={4} amount={balance} showLBC={false} /> }}
|
||||
>
|
||||
(%lbc_balance% Credits available)
|
||||
</I18nMessage>
|
||||
) : (
|
||||
'in USD'
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
className="form-field--price-amount"
|
||||
error={tipError}
|
||||
min="0"
|
||||
step="any"
|
||||
type="number"
|
||||
placeholder="1.23"
|
||||
value={customTipAmount}
|
||||
onChange={(event) => handleCustomPriceChange(event)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* send tip/boost button */}
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
autoFocus
|
||||
icon={isSupport ? ICONS.TRENDING : ICONS.SUPPORT}
|
||||
button="primary"
|
||||
type="submit"
|
||||
disabled={
|
||||
fetchingChannels ||
|
||||
isPending ||
|
||||
tipError ||
|
||||
!tipAmount ||
|
||||
(activeTab === TAB_FIAT && (!hasCardSaved || !canReceiveFiatTip))
|
||||
}
|
||||
label={buildButtonText()}
|
||||
/>
|
||||
{fetchingChannels && <span className="help">{__('Loading your channels...')}</span>}
|
||||
</div>
|
||||
{activeTab !== TAB_FIAT ? (
|
||||
<WalletSpendableBalanceHelp />
|
||||
) : !canReceiveFiatTip ? (
|
||||
<div className="help">{__('Only select creators can receive tips at this time')}</div>
|
||||
) : (
|
||||
<div className="help">{__('The payment will be made from your saved card')}</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,14 @@ import classnames from 'classnames';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { getStripeEnvironment } from 'util/stripe';
|
||||
let stripeEnvironment = getStripeEnvironment();
|
||||
import { STRIPE_PUBLIC_KEY } from 'config';
|
||||
|
||||
let stripeEnvironment = 'test';
|
||||
// if the key contains pk_live it's a live key
|
||||
// update the environment for the calls to the backend to indicate which environment to hit
|
||||
if (STRIPE_PUBLIC_KEY.indexOf('pk_live') > -1) {
|
||||
stripeEnvironment = 'live';
|
||||
}
|
||||
|
||||
const DEFAULT_TIP_AMOUNTS = [1, 5, 25, 100];
|
||||
|
||||
@@ -70,49 +76,45 @@ function WalletTipAmountSelector(props: Props) {
|
||||
|
||||
// check if creator has a payment method saved
|
||||
React.useEffect(() => {
|
||||
if (stripeEnvironment) {
|
||||
Lbryio.call(
|
||||
'customer',
|
||||
'status',
|
||||
{
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
).then((customerStatusResponse) => {
|
||||
const defaultPaymentMethodId =
|
||||
customerStatusResponse.Customer &&
|
||||
customerStatusResponse.Customer.invoice_settings &&
|
||||
customerStatusResponse.Customer.invoice_settings.default_payment_method &&
|
||||
customerStatusResponse.Customer.invoice_settings.default_payment_method.id;
|
||||
Lbryio.call(
|
||||
'customer',
|
||||
'status',
|
||||
{
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
).then((customerStatusResponse) => {
|
||||
const defaultPaymentMethodId =
|
||||
customerStatusResponse.Customer &&
|
||||
customerStatusResponse.Customer.invoice_settings &&
|
||||
customerStatusResponse.Customer.invoice_settings.default_payment_method &&
|
||||
customerStatusResponse.Customer.invoice_settings.default_payment_method.id;
|
||||
|
||||
setHasSavedCard(Boolean(defaultPaymentMethodId));
|
||||
});
|
||||
}
|
||||
}, [stripeEnvironment]);
|
||||
setHasSavedCard(Boolean(defaultPaymentMethodId));
|
||||
});
|
||||
}, []);
|
||||
|
||||
//
|
||||
React.useEffect(() => {
|
||||
if (stripeEnvironment) {
|
||||
Lbryio.call(
|
||||
'account',
|
||||
'check',
|
||||
{
|
||||
channel_claim_id: channelClaimId,
|
||||
channel_name: tipChannelName,
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
)
|
||||
.then((accountCheckResponse) => {
|
||||
if (accountCheckResponse === true && canReceiveFiatTip !== true) {
|
||||
setCanReceiveFiatTip(true);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
// console.log(error);
|
||||
});
|
||||
}
|
||||
}, [stripeEnvironment]);
|
||||
Lbryio.call(
|
||||
'account',
|
||||
'check',
|
||||
{
|
||||
channel_claim_id: channelClaimId,
|
||||
channel_name: tipChannelName,
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
)
|
||||
.then((accountCheckResponse) => {
|
||||
if (accountCheckResponse === true && canReceiveFiatTip !== true) {
|
||||
setCanReceiveFiatTip(true);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
// console.log(error);
|
||||
});
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
// setHasSavedCard(false);
|
||||
@@ -212,7 +214,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||
<div className="help">
|
||||
<span className="help--spendable">
|
||||
<Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card ')} button="link" /> To{' '}
|
||||
{__('Tip Creators')}
|
||||
{__(' Tip Creators')}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
@@ -222,7 +224,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||
{useCustomTip && activeTab === TAB_FIAT && hasCardSaved && !canReceiveFiatTip && (
|
||||
<>
|
||||
<div className="help">
|
||||
<span className="help--spendable">Only creators that verify cash accounts can receive tips</span>
|
||||
<span className="help--spendable">Only select creators can receive tips at this time</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -261,6 +263,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||
// </div>
|
||||
// </>
|
||||
}
|
||||
className="form-field--price-amount"
|
||||
error={tipError}
|
||||
min="0"
|
||||
step="any"
|
||||
@@ -280,7 +283,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||
<div className="help">
|
||||
<span className="help--spendable">
|
||||
<Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card ')} button="link" /> To{' '}
|
||||
{__('Tip Creators')}
|
||||
{__(' Tip Creators')}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
@@ -290,7 +293,7 @@ function WalletTipAmountSelector(props: Props) {
|
||||
{!useCustomTip && activeTab === TAB_FIAT && hasCardSaved && !canReceiveFiatTip && (
|
||||
<>
|
||||
<div className="help">
|
||||
<span className="help--spendable">Only creators that verify cash accounts can receive tips</span>
|
||||
<span className="help--spendable">Only select creators can receive tips at this time</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -98,8 +98,6 @@ export const CLEAR_CONTENT_POSITION = 'CLEAR_CONTENT_POSITION';
|
||||
export const SET_CONTENT_LAST_VIEWED = 'SET_CONTENT_LAST_VIEWED';
|
||||
export const CLEAR_CONTENT_HISTORY_URI = 'CLEAR_CONTENT_HISTORY_URI';
|
||||
export const CLEAR_CONTENT_HISTORY_ALL = 'CLEAR_CONTENT_HISTORY_ALL';
|
||||
export const RECOMMENDATION_UPDATED = 'RECOMMENDATION_UPDATED';
|
||||
export const RECOMMENDATION_CLICKED = 'RECOMMENDATION_CLICKED';
|
||||
|
||||
// Files
|
||||
export const FILE_LIST_STARTED = 'FILE_LIST_STARTED';
|
||||
|
||||
@@ -9,7 +9,7 @@ export const PAGE_PARAM = 'page';
|
||||
export const PAGE_SIZE_PARAM = 'page_size';
|
||||
|
||||
export const INVALID_NAME_ERROR =
|
||||
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '(?$#@;:/\\="<>%{}|^~[]`)';
|
||||
__('LBRY names cannot contain spaces or reserved symbols') + ' ' + '(?$#@;:/"<>%{}|^~[]`)';
|
||||
|
||||
export const FORCE_CONTENT_TYPE_PLAYER = [
|
||||
'video/quicktime',
|
||||
|
||||
@@ -165,4 +165,3 @@ export const GLOBE = 'globe';
|
||||
export const RSS = 'rss';
|
||||
export const STAR = 'star';
|
||||
export const MUSIC = 'MusicCategory';
|
||||
export const BADGE_MOD = 'BadgeMod';
|
||||
@@ -46,4 +46,3 @@ export const CONFIRM_REMOVE_BTC_SWAP_ADDRESS = 'confirm_remove_btc_swap_address'
|
||||
export const COLLECTION_ADD = 'collection_add';
|
||||
export const COLLECTION_DELETE = 'collection_delete';
|
||||
export const CONFIRM_REMOVE_CARD = 'CONFIRM_REMOVE_CARD';
|
||||
export const CONFIRM_REMOVE_COMMENT = 'CONFIRM_REMOVE_COMMENT';
|
||||
Loaded 100 of 201 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user