Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
339c0fe87f |
No files matched your search
+1
-6
@@ -12,14 +12,13 @@ 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
|
||||
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/
|
||||
@@ -42,7 +41,6 @@ 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 +50,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
|
||||
@@ -111,5 +108,3 @@ ENABLE_UI_NOTIFICATIONS=false
|
||||
#IMAGES_ENABLED=true
|
||||
#FILES_ENABLED=true
|
||||
#MODELS_ENABLED=true
|
||||
|
||||
BRANDED_SITE=odysee
|
||||
@@ -31,7 +31,6 @@ module.name_mapper='^modal\(.*\)$' -> '<PROJECT_ROOT>/ui/modal\1'
|
||||
module.name_mapper='^app\(.*\)$' -> '<PROJECT_ROOT>/ui/app\1'
|
||||
module.name_mapper='^native\(.*\)$' -> '<PROJECT_ROOT>/ui/native\1'
|
||||
module.name_mapper='^analytics\(.*\)$' -> '<PROJECT_ROOT>/ui/analytics\1'
|
||||
module.name_mapper='^recsys\(.*\)$' -> '<PROJECT_ROOT>/ui/recsys\1'
|
||||
module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/ui/rewards\1'
|
||||
module.name_mapper='^i18n\(.*\)$' -> '<PROJECT_ROOT>/ui/i18n\1'
|
||||
module.name_mapper='^effects\(.*\)$' -> '<PROJECT_ROOT>/ui/effects\1'
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
## 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 Checklist
|
||||
|
||||
<!-- For the checkbox formatting to work properly, make sure there are no spaces on either side of the "x" -->
|
||||
|
||||
<details><summary>Toggle...</summary>
|
||||
Please check all that apply to this PR using "x":
|
||||
|
||||
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
|
||||
- [ ] I added a line describing my change to CHANGELOG.md
|
||||
- [ ] 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
|
||||
|
||||
## PR Type
|
||||
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
@@ -31,11 +20,14 @@ What kind of change does this PR introduce?
|
||||
- [ ] Documentation changes
|
||||
- [ ] Other - Please describe:
|
||||
|
||||
Please check all that apply to this PR using "x":
|
||||
## Fixes
|
||||
|
||||
- [ ] I have checked that this PR is not a duplicate of an existing PR (open, closed or merged)
|
||||
- [ ] I added a line describing my change to CHANGELOG.md
|
||||
- [ ] 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
|
||||
Issue Number:
|
||||
|
||||
</details>
|
||||
## 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
-32
@@ -5,32 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased for Desktop]
|
||||
|
||||
### Added
|
||||
- Added direct replying to notifications _community pr!_ ([#6935](https://github.com/lbryio/lbry-desktop/pull/6935))
|
||||
- Added "Replay" option on autoplay countdown ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added "Loop" option on Lists ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added "Shuffle" option on Lists ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added Play Next/Previous buttons (with shortcuts SHIFT+N/SHIFT+P) ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added separate control for autoplay next on video player ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
|
||||
### Changed
|
||||
- Changing the supported language from Filipino to Tagalog _community pr!_ ([#6951](https://github.com/lbryio/lbry-desktop/pull/6951))
|
||||
- Don't show countdown to next item in list ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Changed "View List" popup option to link, so can be opened on a new tab ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
|
||||
### Fixed
|
||||
- Clicking on the title of a floating player will take you back to the list ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Fix floating player stopping on markdown or image files ([#7073](https://github.com/lbryio/lbry-desktop/pull/7073))
|
||||
- Fix list thumbnail upload ([#7074](https://github.com/lbryio/lbry-desktop/pull/7074))
|
||||
|
||||
## [0.51.2] - [2021-08-20]
|
||||
|
||||
### 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))
|
||||
- Open in desktop (web feature) _community pr!_ ([#6667](https://github.com/lbryio/lbry-desktop/pull/6667))
|
||||
- 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))
|
||||
@@ -39,8 +19,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- 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))
|
||||
@@ -51,15 +29,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- 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]
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ You can run the web version (lbry.tv), the electron app, or both at the same tim
|
||||
|
||||
`yarn dev:web`
|
||||
|
||||
- This uses webpack-dev-server and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/lbryio/lbry-desktop/blob/master/web/index.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
- This uses webpack-dev-server and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/lbryio/lbry-desktop/blob/master/src/platforms/web/server.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
|
||||
#### Customize the web app
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ const config = {
|
||||
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,
|
||||
@@ -35,7 +34,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,
|
||||
|
||||
Vendored
+6
-58
@@ -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,
|
||||
};
|
||||
|
||||
@@ -35,13 +32,12 @@ declare type CommentsState = {
|
||||
byId: { [string]: Array<string> }, // ClaimID -> list of fetched comment IDs.
|
||||
totalCommentsById: {}, // ClaimId -> ultimate total (including replies) in commentron.
|
||||
repliesByParentId: { [string]: Array<string> }, // ParentCommentID -> list of fetched replies.
|
||||
repliesTotalPagesByParentId: {}, // ParentCommentID -> total number of reply pages for a parentId in commentron.
|
||||
totalRepliesByParentId: {}, // ParentCommentID -> total replies in commentron.
|
||||
topLevelCommentsById: { [string]: Array<string> }, // ClaimID -> list of fetched top level comments.
|
||||
topLevelTotalPagesById: { [string]: number }, // ClaimID -> total number of top-level pages in commentron. Based on COMMENT_PAGE_SIZE_TOP_LEVEL.
|
||||
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>,
|
||||
@@ -60,10 +56,8 @@ declare type CommentsState = {
|
||||
fetchingModerationDelegators: boolean,
|
||||
blockingByUri: {},
|
||||
unBlockingByUri: {},
|
||||
personalTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
||||
adminTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
||||
moderatorTimeoutMap: { [uri: string]: { blockedAt: string, bannedFor: number, banRemaining: number } },
|
||||
togglingForDelegatorMap: {[string]: Array<string>}, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
commentsDisabledChannelIds: Array<string>,
|
||||
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
||||
fetchingSettings: boolean,
|
||||
fetchingBlockedWords: boolean,
|
||||
@@ -192,43 +186,7 @@ declare type SuperListResponse = {
|
||||
has_hidden_comments: boolean,
|
||||
};
|
||||
|
||||
declare type ModerationBlockParams = {
|
||||
// Publisher, Moderator, or Commentron Admin
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
// Offender being blocked
|
||||
blocked_channel_id: string,
|
||||
blocked_channel_name: string,
|
||||
// Creator that Moderator is delegated from. Used for delegated moderation
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
// Blocks identity from comment universally, requires Admin rights on commentron instance
|
||||
block_all?: boolean,
|
||||
time_out?: number,
|
||||
// If true will delete all comments of the offender, requires Admin rights on commentron for universal delete
|
||||
delete_all?: boolean,
|
||||
// The usual signature stuff
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationBlockResponse = {
|
||||
deleted_comment_ids: Array<string>,
|
||||
banned_channel_id: string,
|
||||
all_blocked: boolean,
|
||||
banned_from: string,
|
||||
};
|
||||
|
||||
declare type BlockedListArgs = {
|
||||
// Publisher, Moderator or Commentron Admin
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
// Creator that Moderator is delegated from. Used for delegated moderation
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
declare type ModerationBlockParams = {};
|
||||
|
||||
declare type ModerationAddDelegateParams = {
|
||||
mod_channel_id: string,
|
||||
@@ -263,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,7 +2,6 @@
|
||||
|
||||
declare type PlayingUri = {
|
||||
uri: string,
|
||||
primaryUri: string,
|
||||
pathname: string,
|
||||
commentId?: string,
|
||||
source?: string,
|
||||
|
||||
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,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+5
-10
@@ -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"
|
||||
@@ -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,23 +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",
|
||||
"humanize-duration": "^3.27.0",
|
||||
"feed": "^4.2.2",
|
||||
"if-env": "^1.0.4",
|
||||
"match-sorter": "^6.3.0",
|
||||
"parse-duration": "^1.0.0",
|
||||
"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",
|
||||
@@ -157,8 +152,8 @@
|
||||
"imagesloaded": "^4.1.4",
|
||||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#32b578707116d45f5b51b7ab523d200e75668676",
|
||||
"lbryinc": "lbryio/lbryinc#97fc74315c89580f9fa2408643b0f4feef42750a",
|
||||
"lbry-redux": "lbryio/lbry-redux#7cc9923ed9ff1940b508842af6be44c8da906a60",
|
||||
"lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
"lodash-es": "^4.17.14",
|
||||
|
||||
+24
-121
@@ -30,9 +30,6 @@
|
||||
"Send a tip": "Send a tip",
|
||||
"Share": "Share",
|
||||
"Play": "Play",
|
||||
"Shuffle Play": "Shuffle Play",
|
||||
"Shuffle": "Shuffle",
|
||||
"Loop": "Loop",
|
||||
"Subscribe": "Subscribe",
|
||||
"Report content": "Report content",
|
||||
"Report Content": "Report Content",
|
||||
@@ -158,12 +155,9 @@
|
||||
"Lost passwords cannot be recovered.": "Lost passwords cannot be recovered.",
|
||||
"Experimental settings": "Experimental settings",
|
||||
"Autoplay media files": "Autoplay media files",
|
||||
"Autoplay video and audio files when navigating to a file.": "Autoplay video and audio files when navigating to a file.",
|
||||
"Autoplay next recommended content": "Autoplay next recommended content",
|
||||
"Autoplay the next related item when a file (video or audio) finishes playing.": "Autoplay the next related item when a file (video or audio) finishes playing.",
|
||||
"Clear application cache": "Clear application cache",
|
||||
"Autoplay video and audio files when navigating to a file, as well as the next related item when a file finishes playing.": "Autoplay video and audio files when navigating to a file, as well as the next related item when a file finishes playing.",
|
||||
"Application cache": "Application cache",
|
||||
"Clear Cache": "Clear Cache",
|
||||
"This might fix issues that you are having. Your wallet will not be affected.": "This might fix issues that you are having. Your wallet will not be affected.",
|
||||
"Currency": "Currency",
|
||||
"US Dollars": "US Dollars",
|
||||
"There's nothing available at this location.": "There's nothing available at this location.",
|
||||
@@ -215,7 +209,7 @@
|
||||
"Your comment": "Your comment",
|
||||
"Post --[button to submit something]--": "Post",
|
||||
"Post --[noun, markdown post tab button]--": "Post",
|
||||
"Livestream --[noun, livestream tab button]--": "Livestream",
|
||||
"Livestream --[noun, livestream tab button]--": "Livestream --[noun, livestream tab button]--",
|
||||
"Posting...": "Posting...",
|
||||
"Incompatible daemon": "Incompatible daemon",
|
||||
"Incompatible daemon running": "Incompatible daemon running",
|
||||
@@ -384,6 +378,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.",
|
||||
@@ -499,7 +495,7 @@
|
||||
"Automatic dark mode": "Automatic dark mode",
|
||||
"24-hour clock": "24-hour clock",
|
||||
"Hide wallet balance in header": "Hide wallet balance in header",
|
||||
"Max connections": "Max connections",
|
||||
"Max Connections": "Max Connections",
|
||||
"For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.": "For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.",
|
||||
"Show All": "Show All",
|
||||
"LBRY names cannot contain spaces or reserved symbols": "LBRY names cannot contain spaces or reserved symbols",
|
||||
@@ -517,7 +513,7 @@
|
||||
"Read more": "Read more",
|
||||
"Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.": "Multi-language support is brand new and incomplete. Switching your language may have unintended consequences, like glossolalia.",
|
||||
"Tailor your experience.": "Tailor your experience.",
|
||||
"Save wallet password": "Save wallet password",
|
||||
"Save Password": "Save Password",
|
||||
"Automatically unlock your wallet on startup": "Automatically unlock your wallet on startup",
|
||||
"Dark": "Dark",
|
||||
"light": "light",
|
||||
@@ -662,6 +658,7 @@
|
||||
"Invalid claim ID %claimId%.": "Invalid claim ID %claimId%.",
|
||||
"Suggested": "Suggested",
|
||||
"Startup preferences": "Startup preferences",
|
||||
"This will clear the application cache, and might fix issues you are having. Your wallet will not be affected. ": "This will clear the application cache, and might fix issues you are having. Your wallet will not be affected. ",
|
||||
"Start minimized": "Start minimized",
|
||||
"Improve view speed and help the LBRY network by allowing the app to cuddle up in your system tray.": "Improve view speed and help the LBRY network by allowing the app to cuddle up in your system tray.",
|
||||
"Content Type": "Content Type",
|
||||
@@ -715,8 +712,7 @@
|
||||
"Failed to copy RSS URL.": "Failed to copy RSS URL.",
|
||||
"Text copied": "Text copied",
|
||||
"Rewards Disabled": "Rewards Disabled",
|
||||
"Wallet server": "Wallet server",
|
||||
"Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%": "Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%",
|
||||
"Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%.": "Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%.",
|
||||
"Your Tags": "Your Tags",
|
||||
"All Content": "All Content",
|
||||
"Accepted": "Accepted",
|
||||
@@ -933,7 +929,6 @@
|
||||
"Community Choice?": "Community Choice?",
|
||||
"Download to your Library": "Download to your Library",
|
||||
"Leave a Comment": "Leave a Comment",
|
||||
"This comment has been deleted.": "This comment has been deleted.",
|
||||
"That was pretty deep. What do you think?": "That was pretty deep. What do you think?",
|
||||
"%repost_total% Reposts": "%repost_total% Reposts",
|
||||
"File Description": "File Description",
|
||||
@@ -1002,8 +997,6 @@
|
||||
"Error unlocking your tip": "Error unlocking your tip",
|
||||
"You deposited %lbc% as a support!": "You deposited %lbc% as a support!",
|
||||
"You deposited %amount% LBRY Credits as a support!": "You deposited %amount% LBRY Credits as a support!",
|
||||
"You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
"You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
"You sent %amount% LBRY Credits as a tip, Mahalo!": "You sent %amount% LBRY Credits as a tip, Mahalo!",
|
||||
"You sent %amount% LBRY Credits": "You sent %amount% LBRY Credits",
|
||||
"No stats found": "No stats found",
|
||||
@@ -1181,11 +1174,7 @@
|
||||
"Tap to unmute": "Tap to unmute",
|
||||
"Retry": "Retry",
|
||||
"Playing in %seconds_left% seconds...": "Playing in %seconds_left% seconds...",
|
||||
"Playing next free content in %seconds_left% seconds...": "Playing next free content in %seconds_left% seconds...",
|
||||
"Autoplay timer paused.": "Autoplay timer paused.",
|
||||
"Play Previous": "Play Previous",
|
||||
"Purchase?": "Purchase?",
|
||||
"Replay?": "Replay?",
|
||||
"0 Bytes": "0 Bytes",
|
||||
"Bytes": "Bytes",
|
||||
"KB": "KB",
|
||||
@@ -1199,7 +1188,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",
|
||||
@@ -1341,7 +1329,6 @@
|
||||
"Mute": "Mute",
|
||||
"Unmute": "Unmute",
|
||||
"Channel muted. You will not see them again.": "Channel muted. You will not see them again.",
|
||||
"Channel unmuted!": "Channel unmuted!",
|
||||
"Manage notifications": "Manage notifications",
|
||||
"Uploads": "Uploads",
|
||||
"All uploads": "All uploads",
|
||||
@@ -1433,9 +1420,7 @@
|
||||
"Transcode": "Transcode",
|
||||
"Estimated transaction fee:": "Estimated transaction fee:",
|
||||
"Est. transaction fee:": "Est. transaction fee:",
|
||||
"Publish confirmation": "Publish confirmation",
|
||||
"Skip preview and confirmation": "Skip preview and confirmation",
|
||||
"Show preview and confirmation dialog before publishing content.": "Show preview and confirmation dialog before publishing content.",
|
||||
"Upload settings": "Upload settings",
|
||||
"Currently Uploading": "Currently Uploading",
|
||||
"Leave the app running until upload is complete": "Leave the app running until upload is complete",
|
||||
@@ -1465,14 +1450,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.",
|
||||
@@ -1626,7 +1610,7 @@
|
||||
"None selected": "None selected",
|
||||
"Secondary Language": "Secondary Language",
|
||||
"Your other content language": "Your other content language",
|
||||
"Search only in the selected language by default": "Search only in the selected language by default",
|
||||
"Search only in this language by default": "Search only in this language by default",
|
||||
"This link leads to an external website.": "This link leads to an external website.",
|
||||
"No Content Found": "No Content Found",
|
||||
"No Lists Found": "No Lists Found",
|
||||
@@ -1636,7 +1620,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.",
|
||||
@@ -1726,10 +1710,6 @@
|
||||
"Level %current_level%": "Level %current_level%",
|
||||
"Creator tools": "Creator tools",
|
||||
"Prevent this channel from interacting with you.": "Prevent this channel from interacting with you.",
|
||||
"Choose a permanent or temporary ban.": "Choose a permanent or temporary ban.",
|
||||
"Personal | Moderator | Admin": "Personal | Moderator | Admin",
|
||||
"Personal | Moderator": "Personal | Moderator",
|
||||
"Personal | Admin": "Personal | Admin",
|
||||
"Hide this channel for you only.": "Hide this channel for you only.",
|
||||
"Interacting as %channelName%": "Interacting as %channelName%",
|
||||
"Page Not Found": "Page Not Found",
|
||||
@@ -1748,7 +1728,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",
|
||||
@@ -1758,24 +1737,14 @@
|
||||
"Moderator Block": "Moderator Block",
|
||||
"Block this channel on behalf of %creator%": "Block this channel on behalf of %creator%",
|
||||
"creator": "creator",
|
||||
"Enter the timeout duration. Examples: %examples%": "Enter the timeout duration. Examples: %examples%",
|
||||
"Wow, banned for more than 100 years?": "Wow, banned for more than 100 years?",
|
||||
"Invalid duration.": "Invalid duration.",
|
||||
"Permanent": "Permanent",
|
||||
"Timeout --[time-based ban instead of permanent]--": "Timeout",
|
||||
"(Remaining: %duration%) --[timeout ban duration]--": "(Remaining: %duration%)",
|
||||
"Create a channel to change this setting.": "Create a channel to change this setting.",
|
||||
"Invalid channel URL \"%url%\"": "Invalid channel URL \"%url%\"",
|
||||
"Delegation": "Delegation",
|
||||
"Add moderator": "Add moderator",
|
||||
"Search channel": "Search channel",
|
||||
"Enter a name, @username or URL": "Enter a name, @username or URL",
|
||||
"Enter full channel name or URL": "Enter full channel name or URL",
|
||||
"Enter a channel name or URL to add as a moderator.\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8": "Enter a channel name or URL to add as a moderator.\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8",
|
||||
"Enter a @username or URL": "Enter a @username or URL",
|
||||
"examples: @channel, @channel#3, https://odysee.com/@Odysee:8, lbry://@Odysee#8": "examples: @channel, @channel#3, https://odysee.com/@Odysee:8, lbry://@Odysee#8",
|
||||
"Moderators": "Moderators",
|
||||
"Moderators can block channels on your behalf. Blocked channels will appear in your \"Blocked and Muted\" list.": "Moderators can block channels on your behalf. Blocked channels will appear in your \"Blocked and Muted\" list.",
|
||||
"Add as moderator": "Add as moderator",
|
||||
"Assign this user to moderate %channel%": "Assign this user to moderate %channel%",
|
||||
"Mute (m)": "Mute (m)",
|
||||
"Playback Rate (<, >)": "Playback Rate (<, >)",
|
||||
"Fullscreen (f)": "Fullscreen (f)",
|
||||
@@ -1783,11 +1752,8 @@
|
||||
"Play (space)": "Play (space)",
|
||||
"Unmute (m)": "Unmute (m)",
|
||||
"Exit Fullscreen (f)": "Exit Fullscreen (f)",
|
||||
"Theater Mode (t)": "Theater Mode (t)",
|
||||
"Default Mode (t)": "Default Mode (t)",
|
||||
"Toggle Theater mode (t)": "Toggle Theater mode (t)",
|
||||
"Quality": "Quality",
|
||||
"Autoplay Next On": "Autoplay Next On",
|
||||
"Autoplay Next Off": "Autoplay Next Off",
|
||||
"Announcements, updates, and rewards specific to users of LBRY Android.": "Announcements, updates, and rewards specific to users of LBRY Android.",
|
||||
"LBRY has special programs and opportunities for people in school.": "LBRY has special programs and opportunities for people in school.",
|
||||
"Creator specific news, automated reports, and other updates.": "Creator specific news, automated reports, and other updates.",
|
||||
@@ -1917,7 +1883,6 @@
|
||||
"e.g. John Doe": "e.g. John Doe",
|
||||
"e.g. john@example.com": "e.g. john@example.com",
|
||||
"e.g. satoshi@example.com": "e.g. satoshi@example.com",
|
||||
"e.g. odysee": "e.g. odysee",
|
||||
"Your channel": "Your channel",
|
||||
"Set to \"Anonymous\" if you do not want to associate your channel in this report.": "Set to \"Anonymous\" if you do not want to associate your channel in this report.",
|
||||
"Send report?": "Send report?",
|
||||
@@ -1967,24 +1932,16 @@
|
||||
"Clarification": "Clarification",
|
||||
"Client name": "Client name",
|
||||
"Creator settings": "Creator settings",
|
||||
"Comments and livestream chat containing these words will be blocked.": "Comments and livestream chat containing these words will be blocked.",
|
||||
"Muted words": "Muted words",
|
||||
"Add words": "Add words",
|
||||
"Suggestions": "Suggestions",
|
||||
"Add words to block": "Add words to block",
|
||||
"Enable comments for channel.": "Enable comments for channel.",
|
||||
"Slow mode": "Slow mode",
|
||||
"Minimum time gap in seconds between comments (affects livestream chat as well).": "Minimum time gap in seconds between comments (affects livestream chat as well).",
|
||||
"Minimum %lbc% tip amount for comments": "Minimum %lbc% tip amount for comments",
|
||||
"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 channel requires a minimum tip for each comment.": "This channel requires a minimum tip for each comment.",
|
||||
"Comment min: %lbc%": "Comment min: %lbc%",
|
||||
"This channel requires a minimum amount for HyperChats to be visible.": "This channel requires a minimum amount for HyperChats to be visible.",
|
||||
"This settings is not applicable if all comments require a tip.": "This settings is not applicable if all comments require a tip.",
|
||||
"HyperChat min: %lbc%": "HyperChat min: %lbc%",
|
||||
"The creator just updated the minimum setting. Please revise or double-check your tip amount.": "The creator just updated the minimum setting. Please revise or double-check your tip amount.",
|
||||
"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)",
|
||||
@@ -1994,6 +1951,7 @@
|
||||
"Learn more and sign petition": "Learn more and sign petition",
|
||||
"View claim details": "View claim details",
|
||||
"Publishing...": "Publishing...",
|
||||
"Enter a name, @username or URL": "Enter a name, @username or URL",
|
||||
"Recipient search": "Recipient search",
|
||||
"Fetch transaction data for export": "Fetch transaction data for export",
|
||||
"Fetching data": "Fetching data",
|
||||
@@ -2017,7 +1975,6 @@
|
||||
"This channel isn't staking enough LBRY Credits for inline image previews.": "This channel isn't staking enough LBRY Credits for inline image previews.",
|
||||
"Latest": "Latest",
|
||||
"Channel Not Found": "Channel Not Found",
|
||||
"Channel not found": "Channel not found",
|
||||
"Probably because you didn't make it.": "Probably because you didn't make it.",
|
||||
"Release date": "Release date",
|
||||
"Set custom release date": "Set custom release date",
|
||||
@@ -2035,7 +1992,6 @@
|
||||
"Edit List": "Edit List",
|
||||
"Delete List": "Delete List",
|
||||
"Private": "Private",
|
||||
"Public": "Public",
|
||||
"View List": "View List",
|
||||
"Publish List": "Publish List",
|
||||
"Info": "Info",
|
||||
@@ -2072,102 +2028,49 @@
|
||||
"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%",
|
||||
"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 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",
|
||||
"System": "System",
|
||||
"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.",
|
||||
"Show this channel your appreciation by sending a donation in USD.": "Show this channel your appreciation by sending a donation in USD.",
|
||||
"This refundable boost will improve the discoverability of this %claimTypeText% while active.": "This refundable boost will improve the discoverability of this %claimTypeText% while active.",
|
||||
"Show this channel your appreciation by sending a donation of Credits.": "Show this channel your appreciation by sending a donation of Credits.",
|
||||
"Add card to tip creators in USD": "Add card to tip creators in USD",
|
||||
"Add a credit card to tip creators in their local currency.": "Add a credit card to tip creators in their local currency.",
|
||||
"Add Card": "Add Card",
|
||||
"Tip History": "Tip History",
|
||||
"Connect a bank account": "Connect a bank account",
|
||||
"Connect your card with Odysee": "Connect your card with Odysee",
|
||||
"Getting your card connection status...": "Getting your card connection status...",
|
||||
"Getting your bank account connection status...": "Getting your bank account connection status...",
|
||||
"Connect your bank account to Odysee to receive donations directly from users": "Connect your bank account to Odysee to receive donations directly from users",
|
||||
"Connect your bank account": "Connect your bank account",
|
||||
"Manage Card": "Manage Card",
|
||||
"Card Details": "Card Details",
|
||||
"Remove Card": "Remove Card",
|
||||
"Congratulations! Your account has been connected with Odysee.": "Congratulations! Your account has been connected with Odysee.",
|
||||
"Your account balance is %balance% USD. Functionality to view your transactions and withdraw your balance will be landing shortly.": "Your account balance is %balance% USD. Functionality to view your transactions and withdraw your balance will be landing shortly.",
|
||||
"Your account balance is $0 USD. When you receive a tip you will see it here.": "Your account balance is $0 USD. When you receive a tip you will see it here.",
|
||||
"Congratulations, you have already begun receiving tips on Odysee!": "Congratulations, you have already begun receiving tips on Odysee!",
|
||||
"Your pending account balance is %balance% USD. Functionality to view and receive your transactions will land soon.": "Your pending account balance is %balance% USD. Functionality to view and receive your transactions will land soon.",
|
||||
"Connect your bank account to be able to cash your pending balance out to your account.": "Connect your bank account to be able to cash your pending balance out to your account.",
|
||||
"You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!": "You sent $%amount% as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
"Tip Creators": "Tip Creators",
|
||||
"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",
|
||||
"When you begin to receive tips your balance will be updated here.": "When you begin to receive tips your balance will be updated here.",
|
||||
"This is your pending balance that will be automatically sent to your bank account.": "This is your pending balance that will be automatically sent to your bank account.",
|
||||
"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...",
|
||||
"Open in Desktop": "Open in Desktop",
|
||||
"Show %count% replies": "Show %count% replies",
|
||||
"Show reply": "Show reply",
|
||||
"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.",
|
||||
"Dismiss pinned comment": "Dismiss pinned comment",
|
||||
"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",
|
||||
"Bank Accounts": "Bank Accounts",
|
||||
"Connect a bank account to receive tips and compensation in your local currency.": "Connect a bank account to receive tips and compensation in your local currency.",
|
||||
"Payment Methods": "Payment Methods",
|
||||
"Incoming": "Incoming",
|
||||
"Outgoing": "Outgoing",
|
||||
"Credits --[transactions tab]--": "Credits",
|
||||
"USD --[transactions tab]--": "USD",
|
||||
"Receiving Channel Name": "Receiving Channel Name",
|
||||
"Tip Location": "Tip Location",
|
||||
"Amount (USD)": "Amount (USD)",
|
||||
"Processing Fee": "Processing Fee",
|
||||
"Odysee Fee": "Odysee Fee",
|
||||
"Received Amount": "Received Amount",
|
||||
"Channel Page": "Channel Page",
|
||||
"Content Page": "Content Page",
|
||||
"Card Last 4": "Card Last 4",
|
||||
"Search blocked channel name": "Search blocked channel name",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>Hi</h1>
|
||||
<script>parent.postMessage(location.href, location.origin)</script>
|
||||
</body>
|
||||
</html>
|
||||
+36
-178
@@ -9,7 +9,7 @@ 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');
|
||||
@@ -17,9 +17,6 @@ const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.inc
|
||||
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,178 +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';
|
||||
}
|
||||
|
||||
if (!videoPlayer) {
|
||||
return 'Video player not initialized';
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -370,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');
|
||||
},
|
||||
|
||||
+3
-13
@@ -4,17 +4,10 @@ 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),
|
||||
moderation_block_list: (params: BlockedListArgs) => fetchCommentsApi('moderation.BlockedList', params),
|
||||
moderation_block_list: (params: ModerationBlockParams) => fetchCommentsApi('moderation.BlockedList', params),
|
||||
moderation_add_delegate: (params: ModerationAddDelegateParams) => fetchCommentsApi('moderation.AddDelegate', params),
|
||||
moderation_remove_delegate: (params: ModerationRemoveDelegateParams) =>
|
||||
fetchCommentsApi('moderation.RemoveDelegate', 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}`;
|
||||
|
||||
@@ -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);
|
||||
@@ -327,7 +313,7 @@ function App(props: Props) {
|
||||
if (previousHasVerifiedEmail === false && hasVerifiedEmail) {
|
||||
analytics.emailVerifiedEvent();
|
||||
}
|
||||
}, [previousHasVerifiedEmail, hasVerifiedEmail]);
|
||||
}, [previousHasVerifiedEmail, hasVerifiedEmail, signIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (previousRewardApproved === false && isRewardApproved) {
|
||||
@@ -335,23 +321,6 @@ function App(props: Props) {
|
||||
}
|
||||
}, [previousRewardApproved, isRewardApproved]);
|
||||
|
||||
// Load IMA3 SDK for aniview: DISABLED FOR NOW
|
||||
// @if TARGET='web'
|
||||
// useEffect(() => {
|
||||
// if (ENABLE_PREROLL_ADS) {
|
||||
// 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);
|
||||
// };
|
||||
// }
|
||||
// });
|
||||
// @endif
|
||||
|
||||
// @if TARGET='app'
|
||||
useEffect(() => {
|
||||
if (updatePreferences && getWalletSyncPref && readyForPrefs) {
|
||||
@@ -385,14 +354,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}`);
|
||||
@@ -493,9 +460,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;
|
||||
@@ -1,45 +0,0 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import { ReactKeycloakProvider, useKeycloak } from '@react-keycloak/web';
|
||||
import keycloak from 'util/keycloak';
|
||||
import type { Node } from 'react';
|
||||
import {
|
||||
getTokens,
|
||||
} from 'util/saved-passwords';
|
||||
|
||||
type Props = {
|
||||
children: Node,
|
||||
};
|
||||
|
||||
export const AuthProvider = (props: Props) => {
|
||||
const { children } = props;
|
||||
const tokens = getTokens();
|
||||
|
||||
const eventLogger = (event, error) => {
|
||||
console.log('onKeycloakEvent', event, error, keycloak);
|
||||
// if (event === 'onReady') {
|
||||
// setKeycloakReady(true);
|
||||
// }
|
||||
};
|
||||
if (keycloak && tokens.access_token) {
|
||||
return (
|
||||
<ReactKeycloakProvider
|
||||
authClient={keycloak}
|
||||
onEvent={eventLogger}
|
||||
initOptions={
|
||||
{ onLoad: 'check-sso',
|
||||
silentCheckSsoFallback: false,
|
||||
redirectUri: 'http://localhost:9090/'}
|
||||
} // from npmjs docs for @react-keycloak/web
|
||||
>
|
||||
{children}
|
||||
</ReactKeycloakProvider>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<>{children}</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default AuthProvider;
|
||||
@@ -1,6 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, SETTINGS, COLLECTIONS_CONSTS, makeSelectNextUrlForCollectionAndUrl } from 'lbry-redux';
|
||||
import { withRouter } from 'react-router';
|
||||
import { makeSelectIsPlayerFloating, makeSelectNextUnplayedRecommended } from 'redux/selectors/content';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { doSetPlayingUri, doPlayUri } from 'redux/actions/content';
|
||||
import AutoplayCountdown from './view';
|
||||
import { selectModal } from 'redux/selectors/app';
|
||||
|
||||
@@ -8,9 +11,32 @@ import { selectModal } from 'redux/selectors/app';
|
||||
AutoplayCountdown does not fetch it's own next content to play, it relies on <RecommendedContent> being rendered.
|
||||
This is dumb but I'm just the guy who noticed -kj
|
||||
*/
|
||||
const select = (state, props) => ({
|
||||
nextRecommendedClaim: makeSelectClaimForUri(props.nextRecommendedUri)(state),
|
||||
modal: selectModal(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const { location } = props;
|
||||
const { search } = location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
||||
|
||||
export default withRouter(connect(select, null)(AutoplayCountdown));
|
||||
let nextRecommendedUri;
|
||||
if (collectionId) {
|
||||
nextRecommendedUri = makeSelectNextUrlForCollectionAndUrl(collectionId, props.uri)(state);
|
||||
} else {
|
||||
nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
|
||||
}
|
||||
|
||||
return {
|
||||
collectionId,
|
||||
nextRecommendedUri,
|
||||
nextRecommendedClaim: makeSelectClaimForUri(nextRecommendedUri)(state),
|
||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
|
||||
modal: selectModal(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(
|
||||
connect(select, {
|
||||
doSetPlayingUri,
|
||||
doPlayUri,
|
||||
})(AutoplayCountdown)
|
||||
);
|
||||
@@ -1,12 +1,12 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import React, { useCallback } from 'react';
|
||||
import Button from 'component/button';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { withRouter } from 'react-router';
|
||||
import debounce from 'util/debounce';
|
||||
import * as ICONS from 'constants/icons';
|
||||
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 150;
|
||||
const CLASSNAME_AUTOPLAY_COUNTDOWN = 'autoplay-countdown';
|
||||
|
||||
@@ -14,25 +14,23 @@ type Props = {
|
||||
history: { push: (string) => void },
|
||||
nextRecommendedClaim: ?StreamClaim,
|
||||
nextRecommendedUri: string,
|
||||
isFloating: boolean,
|
||||
doSetPlayingUri: ({ uri: ?string }) => void,
|
||||
doPlayUri: (string) => void,
|
||||
modal: { id: string, modalProps: {} },
|
||||
skipPaid: boolean,
|
||||
doNavigate: () => void,
|
||||
doReplay: () => void,
|
||||
doPrevious: () => void,
|
||||
onCanceled: () => void,
|
||||
collectionId?: string,
|
||||
};
|
||||
|
||||
function AutoplayCountdown(props: Props) {
|
||||
const {
|
||||
nextRecommendedUri,
|
||||
nextRecommendedClaim,
|
||||
doSetPlayingUri,
|
||||
doPlayUri,
|
||||
isFloating,
|
||||
history: { push },
|
||||
modal,
|
||||
skipPaid,
|
||||
doNavigate,
|
||||
doReplay,
|
||||
doPrevious,
|
||||
onCanceled,
|
||||
collectionId,
|
||||
} = props;
|
||||
const nextTitle = nextRecommendedClaim && nextRecommendedClaim.value && nextRecommendedClaim.value.title;
|
||||
|
||||
@@ -45,19 +43,36 @@ function AutoplayCountdown(props: Props) {
|
||||
const anyModalPresent = modal !== undefined && modal !== null;
|
||||
const isTimerPaused = timerPaused || anyModalPresent;
|
||||
|
||||
let navigateUrl;
|
||||
if (nextTitle) {
|
||||
navigateUrl = formatLbryUrlForWeb(nextRecommendedUri);
|
||||
if (collectionId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
}
|
||||
|
||||
const doNavigate = useCallback(() => {
|
||||
if (!isFloating) {
|
||||
if (navigateUrl) {
|
||||
push(navigateUrl);
|
||||
doSetPlayingUri({ uri: nextRecommendedUri });
|
||||
doPlayUri(nextRecommendedUri);
|
||||
}
|
||||
} else {
|
||||
if (nextRecommendedUri) {
|
||||
doSetPlayingUri({ uri: nextRecommendedUri });
|
||||
doPlayUri(nextRecommendedUri);
|
||||
}
|
||||
}
|
||||
}, [navigateUrl, nextRecommendedUri, isFloating, doSetPlayingUri, doPlayUri, push]);
|
||||
|
||||
function shouldPauseAutoplay() {
|
||||
const elm = document.querySelector(`.${CLASSNAME_AUTOPLAY_COUNTDOWN}`);
|
||||
return elm && elm.getBoundingClientRect().top < 0;
|
||||
}
|
||||
|
||||
function getMsgPlayingNext() {
|
||||
if (skipPaid) {
|
||||
return __('Playing next free content in %seconds_left% seconds...', { seconds_left: timer });
|
||||
} else {
|
||||
return __('Playing in %seconds_left% seconds...', { seconds_left: timer });
|
||||
}
|
||||
}
|
||||
|
||||
// Update 'setTimerPaused'.
|
||||
React.useEffect(() => {
|
||||
// Ensure correct 'setTimerPaused' on initial render.
|
||||
@@ -82,7 +97,6 @@ function AutoplayCountdown(props: Props) {
|
||||
interval = setInterval(() => {
|
||||
const newTime = timer - 1;
|
||||
if (newTime === 0) {
|
||||
if (skipPaid) setTimer(countdownTime);
|
||||
doNavigate();
|
||||
} else {
|
||||
setTimer(timer - 1);
|
||||
@@ -93,7 +107,7 @@ function AutoplayCountdown(props: Props) {
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [timer, doNavigate, push, timerCanceled, isTimerPaused, nextRecommendedUri, skipPaid]);
|
||||
}, [timer, doNavigate, navigateUrl, push, timerCanceled, isTimerPaused, nextRecommendedUri]);
|
||||
|
||||
if (timerCanceled || !nextRecommendedUri) {
|
||||
return null;
|
||||
@@ -120,38 +134,10 @@ function AutoplayCountdown(props: Props) {
|
||||
)}
|
||||
{!isTimerPaused && (
|
||||
<div className="file-viewer__overlay-secondary autoplay-countdown__counter">
|
||||
{getMsgPlayingNext()}{' '}
|
||||
<Button
|
||||
label={__('Cancel')}
|
||||
button="link"
|
||||
onClick={() => {
|
||||
setTimerCanceled(true);
|
||||
if (onCanceled) onCanceled();
|
||||
}}
|
||||
/>
|
||||
{__('Playing in %seconds_left% seconds...', { seconds_left: timer })}{' '}
|
||||
<Button label={__('Cancel')} button="link" onClick={() => setTimerCanceled(true)} />
|
||||
</div>
|
||||
)}
|
||||
{skipPaid && doPrevious && (
|
||||
<div>
|
||||
<Button
|
||||
label={__('Play Previous')}
|
||||
button="link"
|
||||
icon={ICONS.PLAY_PREVIOUS}
|
||||
onClick={() => doPrevious()}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<Button
|
||||
label={skipPaid ? __('Purchase?') : __('Replay?')}
|
||||
button="link"
|
||||
iconRight={skipPaid ? ICONS.WALLET : ICONS.REPLAY}
|
||||
onClick={() => {
|
||||
setTimerCanceled(true);
|
||||
doReplay();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
import BlockList from './view';
|
||||
export default BlockList;
|
||||
@@ -1,205 +0,0 @@
|
||||
// @flow
|
||||
import { Combobox, ComboboxInput, ComboboxPopover, ComboboxList, ComboboxOption } from '@reach/combobox';
|
||||
// import '@reach/combobox/styles.css'; --> 'scss/third-party.scss'
|
||||
import { matchSorter } from 'match-sorter';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Icon from 'component/common/icon';
|
||||
import Paginate from 'component/common/paginate';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import useThrottle from 'effects/use-throttle';
|
||||
|
||||
const PAGE_SIZE = 10;
|
||||
|
||||
function reduceUriToChannelName(uri: string) {
|
||||
// 'parseURI' is too slow to handle a large list. Since our list should be
|
||||
// kosher in the first place, just do a quick substring call. Add a
|
||||
// try-catch just in case.
|
||||
try {
|
||||
return uri.substring(uri.indexOf('@') + 1, uri.indexOf('#'));
|
||||
} catch {
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// BlockList
|
||||
// ****************************************************************************
|
||||
|
||||
type Props = {
|
||||
uris: Array<string>,
|
||||
help: string,
|
||||
titleEmptyList: string,
|
||||
subtitleEmptyList: string,
|
||||
getActionButtons?: (url: string) => React$Node,
|
||||
className: ?string,
|
||||
};
|
||||
|
||||
export default function BlockList(props: Props) {
|
||||
const { uris: list, help, titleEmptyList, subtitleEmptyList, getActionButtons, className } = props;
|
||||
|
||||
// Keep a local list to allow for undoing actions in this component
|
||||
const [localList, setLocalList] = React.useState(undefined);
|
||||
const stringifiedList = JSON.stringify(list);
|
||||
const hasLocalList = localList && localList.length > 0;
|
||||
const justBlocked = list && localList && localList.length < list.length;
|
||||
|
||||
const [page, setPage] = React.useState(1);
|
||||
const [searchList, setSearchList] = React.useState(null); // null: not searching; []: no results;
|
||||
const isShowingSearchResults = searchList !== null;
|
||||
|
||||
let totalPages = 0;
|
||||
let paginatedLocalList;
|
||||
if (localList) {
|
||||
paginatedLocalList = localList.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
||||
totalPages = Math.ceil(localList.length / PAGE_SIZE);
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
function getRenderActions() {
|
||||
if (getActionButtons) {
|
||||
return (claim) => <div className="section__actions">{getActionButtons(claim.permanent_url)}</div>;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function formatSearchSuggestion(suggestion: string) {
|
||||
return reduceUriToChannelName(suggestion);
|
||||
}
|
||||
|
||||
function filterSearchResults(results: ?Array<string>) {
|
||||
setSearchList(results);
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
React.useEffect(() => {
|
||||
const list = stringifiedList && JSON.parse(stringifiedList);
|
||||
if (!hasLocalList) {
|
||||
setLocalList(list && list.length > 0 ? list : []);
|
||||
}
|
||||
}, [stringifiedList, hasLocalList]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (justBlocked && stringifiedList) {
|
||||
setLocalList(JSON.parse(stringifiedList));
|
||||
}
|
||||
}, [stringifiedList, justBlocked, setLocalList]);
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
if (paginatedLocalList === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!hasLocalList) {
|
||||
return (
|
||||
<div className="main--empty">
|
||||
<Yrbl
|
||||
title={titleEmptyList}
|
||||
subtitle={subtitleEmptyList}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<Button button="primary" label={__('Go Home')} navigate="/" />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="help--notice">{help}</div>
|
||||
<div className="section">
|
||||
<SearchList
|
||||
list={localList}
|
||||
placeholder={__('e.g. odysee')}
|
||||
formatter={formatSearchSuggestion}
|
||||
onResultsUpdated={filterSearchResults}
|
||||
/>
|
||||
</div>
|
||||
<div className={classnames('section block-list', className)}>
|
||||
<ClaimList
|
||||
uris={searchList || paginatedLocalList}
|
||||
showUnresolvedClaims
|
||||
showHiddenByUser
|
||||
hideMenu
|
||||
renderActions={getRenderActions()}
|
||||
/>
|
||||
</div>
|
||||
{!isShowingSearchResults && <Paginate totalPages={totalPages} disableHistory onPageChange={(p) => setPage(p)} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// SearchList
|
||||
// ****************************************************************************
|
||||
|
||||
type LsbProps = {
|
||||
list: ?Array<string>,
|
||||
placeholder?: string,
|
||||
formatter?: (suggestion: string) => string,
|
||||
onResultsUpdated?: (?Array<string>) => void,
|
||||
};
|
||||
|
||||
function SearchList(props: LsbProps) {
|
||||
const { list, placeholder, formatter, onResultsUpdated } = props;
|
||||
const [term, setTerm] = React.useState('');
|
||||
const results = useAuthorMatch(term, list);
|
||||
const handleChange = (event) => setTerm(event.target.value);
|
||||
const handleSelect = (e) => setTerm(e);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (onResultsUpdated) {
|
||||
onResultsUpdated(results);
|
||||
}
|
||||
}, [results]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<div className="wunderbar__wrapper">
|
||||
<label>{__('Search blocked channel name')}</label>
|
||||
<Combobox className="wunderbar" onSelect={handleSelect}>
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<ComboboxInput selectOnClick className="wunderbar__input" onChange={handleChange} placeholder={placeholder} />
|
||||
{results && (
|
||||
<ComboboxPopover className="wunderbar__suggestions" portal={false}>
|
||||
{results.length > 0 ? (
|
||||
<ComboboxList>
|
||||
{results.slice(0, 10).map((result, index) => (
|
||||
<ComboboxOption
|
||||
className="wunderbar__more-results"
|
||||
key={index}
|
||||
value={formatter ? formatter(result) : result}
|
||||
/>
|
||||
))}
|
||||
</ComboboxList>
|
||||
) : (
|
||||
<span style={{ display: 'block', margin: 8 }}>{__('No results')}</span>
|
||||
)}
|
||||
</ComboboxPopover>
|
||||
)}
|
||||
</Combobox>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function useAuthorMatch(term, list) {
|
||||
const throttledTerm = useThrottle(term, 200);
|
||||
return React.useMemo(() => {
|
||||
return !throttledTerm || throttledTerm.trim() === ''
|
||||
? null
|
||||
: matchSorter(list, throttledTerm, {
|
||||
keys: [(item) => reduceUriToChannelName(item)],
|
||||
threshold: matchSorter.rankings.CONTAINS,
|
||||
});
|
||||
}, [throttledTerm]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { BLOCK_LEVEL } from 'constants/comment';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -11,7 +12,7 @@ type Props = {
|
||||
isBlockingOrUnBlocking: boolean,
|
||||
isToggling: boolean,
|
||||
doCommentModUnBlock: (string, boolean) => void,
|
||||
doCommentModBlock: (string, ?Number, boolean) => void,
|
||||
doCommentModBlock: (string, boolean) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModUnBlockAsModerator: (string, string, string) => void,
|
||||
@@ -41,16 +42,17 @@ function ChannelBlockButton(props: Props) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri, false);
|
||||
} else {
|
||||
doCommentModBlock(uri, undefined, false);
|
||||
doCommentModBlock(uri, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLOCK_LEVEL.MODERATOR:
|
||||
if (creatorUri) {
|
||||
const { channelClaimId } = parseURI(creatorUri);
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsModerator(uri, creatorUri, '');
|
||||
doCommentModUnBlockAsModerator(uri, channelClaimId, '');
|
||||
} else {
|
||||
doCommentModBlockAsModerator(uri, creatorUri, '');
|
||||
doCommentModBlockAsModerator(uri, channelClaimId, '');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -14,8 +14,6 @@ import { Form, FormField } from 'component/common/form';
|
||||
import { DEBOUNCE_WAIT_DURATION_MS } from 'constants/search';
|
||||
import { lighthouse } from 'redux/actions/search';
|
||||
|
||||
const TYPES_TO_ALLOW_FILTER = ['stream', 'repost'];
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
totalPages: number,
|
||||
@@ -64,11 +62,7 @@ function ChannelContent(props: Props) {
|
||||
} = useHistory();
|
||||
const url = `${pathname}${search}`;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const showFilters =
|
||||
!claimType ||
|
||||
(Array.isArray(claimType)
|
||||
? claimType.every((ct) => TYPES_TO_ALLOW_FILTER.includes(ct))
|
||||
: TYPES_TO_ALLOW_FILTER.includes(claimType));
|
||||
const showFilters = !claimType || claimType === 'stream';
|
||||
|
||||
function handleInputChange(e) {
|
||||
const { value } = e.target;
|
||||
@@ -87,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}`;
|
||||
});
|
||||
@@ -146,7 +140,6 @@ function ChannelContent(props: Props) {
|
||||
defaultFreshness={CS.FRESH_ALL}
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
forceShowReposts
|
||||
fetchViewCount
|
||||
hideFilters={!showFilters}
|
||||
hideAdvancedFilter={!showFilters}
|
||||
tileLayout={tileLayout}
|
||||
|
||||
@@ -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);
|
||||
@@ -22,8 +22,6 @@ import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { sortLanguageMap } from 'util/default-languages';
|
||||
import ThumbnailBrokenImage from 'component/selectThumbnail/thumbnail-broken.png';
|
||||
import Gerbil from 'component/channelThumbnail/gerbil.png';
|
||||
|
||||
const LANG_NONE = 'none';
|
||||
|
||||
@@ -50,16 +48,13 @@ type Props = {
|
||||
createError: string,
|
||||
creatingChannel: boolean,
|
||||
clearChannelErrors: () => void,
|
||||
claimInitialRewards: () => void,
|
||||
onDone: () => void,
|
||||
openModal: (
|
||||
id: string,
|
||||
{ onUpdate: (string, boolean) => void, assetName: string, helpText: string, currentValue: string, title: string }
|
||||
{ onUpdate: (string) => void, assetName: string, helpText: string, currentValue: string, title: string }
|
||||
) => void,
|
||||
uri: string,
|
||||
disabled: boolean,
|
||||
isClaimingInitialRewards: boolean,
|
||||
hasClaimedInitialRewards: boolean,
|
||||
};
|
||||
|
||||
function ChannelForm(props: Props) {
|
||||
@@ -84,17 +79,12 @@ function ChannelForm(props: Props) {
|
||||
creatingChannel,
|
||||
createError,
|
||||
clearChannelErrors,
|
||||
claimInitialRewards,
|
||||
openModal,
|
||||
disabled,
|
||||
isClaimingInitialRewards,
|
||||
hasClaimedInitialRewards,
|
||||
} = props;
|
||||
const [nameError, setNameError] = React.useState(undefined);
|
||||
const [bidError, setBidError] = React.useState('');
|
||||
const [isUpload, setIsUpload] = React.useState({ cover: false, thumbnail: false });
|
||||
const [coverError, setCoverError] = React.useState(false);
|
||||
const [thumbError, setThumbError] = React.useState(false);
|
||||
const { claim_id: claimId } = claim || {};
|
||||
const [params, setParams]: [any, (any) => void] = React.useState(getChannelParams());
|
||||
const { channelName } = parseURI(uri);
|
||||
@@ -104,34 +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 ||
|
||||
thumbError ||
|
||||
coverError ||
|
||||
bidError ||
|
||||
(isNewChannel && !params.name)
|
||||
);
|
||||
}, [
|
||||
isClaimingInitialRewards,
|
||||
creatingChannel,
|
||||
updatingChannel,
|
||||
nameError,
|
||||
thumbError,
|
||||
coverError,
|
||||
bidError,
|
||||
isNewChannel,
|
||||
params.name,
|
||||
]);
|
||||
|
||||
function getChannelParams() {
|
||||
// fill this in with sdk data
|
||||
@@ -211,16 +173,12 @@ function ChannelForm(props: Props) {
|
||||
setParams({ ...params, languages: langs });
|
||||
}
|
||||
|
||||
function handleThumbnailChange(thumbnailUrl: string, uploadSelected: boolean) {
|
||||
function handleThumbnailChange(thumbnailUrl: string) {
|
||||
setParams({ ...params, thumbnailUrl });
|
||||
setIsUpload({ ...isUpload, thumbnail: uploadSelected });
|
||||
setThumbError(false);
|
||||
}
|
||||
|
||||
function handleCoverChange(coverUrl: string, uploadSelected: boolean) {
|
||||
function handleCoverChange(coverUrl: string) {
|
||||
setParams({ ...params, coverUrl });
|
||||
setIsUpload({ ...isUpload, cover: uploadSelected });
|
||||
setCoverError(false);
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
@@ -245,9 +203,6 @@ function ChannelForm(props: Props) {
|
||||
if (errorMsg && errorMsg.includes(LIMIT_ERR_PARTIAL_MSG)) {
|
||||
errorMsg = __('Transaction limit reached. Try reducing the Description length.');
|
||||
}
|
||||
if ((!isUpload.thumbnail && thumbError) || (!isUpload.cover && coverError)) {
|
||||
errorMsg = __('Invalid %error_type%', { error_type: (thumbError && 'thumbnail') || (coverError && 'cover image') });
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
let nameError;
|
||||
@@ -264,23 +219,6 @@ function ChannelForm(props: Props) {
|
||||
clearChannelErrors();
|
||||
}, [clearChannelErrors]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!hasClaimedInitialRewards) {
|
||||
claimInitialRewards();
|
||||
}
|
||||
}, [hasClaimedInitialRewards, claimInitialRewards]);
|
||||
|
||||
const coverSrc = coverError ? ThumbnailBrokenImage : params.coverUrl;
|
||||
|
||||
let thumbnailPreview;
|
||||
if (!params.thumbnailUrl) {
|
||||
thumbnailPreview = Gerbil;
|
||||
} else if (thumbError) {
|
||||
thumbnailPreview = ThumbnailBrokenImage;
|
||||
} else {
|
||||
thumbnailPreview = params.thumbnailUrl;
|
||||
}
|
||||
|
||||
// TODO clear and bail after submit
|
||||
return (
|
||||
<>
|
||||
@@ -292,7 +230,7 @@ function ChannelForm(props: Props) {
|
||||
title={__('Cover')}
|
||||
onClick={() =>
|
||||
openModal(MODALS.IMAGE_UPLOAD, {
|
||||
onUpdate: (coverUrl, isUpload) => handleCoverChange(coverUrl, isUpload),
|
||||
onUpdate: (coverUrl) => handleCoverChange(coverUrl),
|
||||
title: __('Edit Cover Image'),
|
||||
helpText: __('(6.25:1)'),
|
||||
assetName: __('Cover Image'),
|
||||
@@ -304,10 +242,10 @@ function ChannelForm(props: Props) {
|
||||
/>
|
||||
</div>
|
||||
{params.coverUrl &&
|
||||
(coverError && isUpload.cover ? (
|
||||
(coverError ? (
|
||||
<div className="channel-cover__custom--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||
) : (
|
||||
<img className="channel-cover__custom" src={coverSrc} onError={() => setCoverError(true)} />
|
||||
<img className="channel-cover__custom" src={params.coverUrl} onError={() => setCoverError(true)} />
|
||||
))}
|
||||
<div className="channel__primary-info">
|
||||
<div className="channel__edit-thumb">
|
||||
@@ -316,7 +254,7 @@ function ChannelForm(props: Props) {
|
||||
title={__('Edit')}
|
||||
onClick={() =>
|
||||
openModal(MODALS.IMAGE_UPLOAD, {
|
||||
onUpdate: (thumbnailUrl, isUpload) => handleThumbnailChange(thumbnailUrl, isUpload),
|
||||
onUpdate: (v) => handleThumbnailChange(v),
|
||||
title: __('Edit Thumbnail Image'),
|
||||
helpText: __('(1:1)'),
|
||||
assetName: __('Thumbnail'),
|
||||
@@ -330,11 +268,9 @@ function ChannelForm(props: Props) {
|
||||
<ChannelThumbnail
|
||||
className="channel__thumbnail--channel-page"
|
||||
uri={uri}
|
||||
thumbnailPreview={thumbnailPreview}
|
||||
thumbnailPreview={params.thumbnailUrl}
|
||||
allowGifs
|
||||
showDelayedMessage={isUpload.thumbnail}
|
||||
setThumbUploadError={setThumbError}
|
||||
thumbUploadError={thumbError}
|
||||
showDelayedMessage
|
||||
/>
|
||||
<h1 className="channel__title">
|
||||
{params.title || (channelName && '@' + channelName) || (params.name && '@' + params.name)}
|
||||
@@ -517,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 ? (
|
||||
|
||||
@@ -23,10 +23,6 @@ type Props = {
|
||||
showDelayedMessage?: boolean,
|
||||
noLazyLoad?: boolean,
|
||||
hideStakedIndicator?: boolean,
|
||||
xsmall?: boolean,
|
||||
noOptimization?: boolean,
|
||||
setThumbUploadError: (boolean) => void,
|
||||
ThumbUploadError: boolean,
|
||||
};
|
||||
|
||||
function ChannelThumbnail(props: Props) {
|
||||
@@ -45,17 +41,15 @@ function ChannelThumbnail(props: Props) {
|
||||
showDelayedMessage = false,
|
||||
noLazyLoad,
|
||||
hideStakedIndicator = false,
|
||||
setThumbUploadError,
|
||||
ThumbUploadError,
|
||||
} = props;
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const [thumbError, setThumbError] = React.useState(false);
|
||||
const shouldResolve = claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
const thumbnailPreview = rawThumbnailPreview && rawThumbnailPreview.trim().replace(/^http:\/\//i, 'https://');
|
||||
const defaultAvatar = AVATAR_DEFAULT || Gerbil;
|
||||
const channelThumbnail = thumbnailPreview || thumbnail || defaultAvatar;
|
||||
const channelThumbnail = thumbnail || thumbnailPreview;
|
||||
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||
const defaultAvater = AVATAR_DEFAULT || Gerbil;
|
||||
|
||||
// Generate a random color class based on the first letter of the channel name
|
||||
const { channelName } = parseURI(uri);
|
||||
@@ -81,7 +75,6 @@ function ChannelThumbnail(props: Props) {
|
||||
</FreezeframeWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('channel-thumbnail', className, {
|
||||
@@ -91,23 +84,30 @@ function ChannelThumbnail(props: Props) {
|
||||
'channel-thumbnail--resolving': isResolving,
|
||||
})}
|
||||
>
|
||||
{showDelayedMessage ? (
|
||||
<div className="channel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||
) : (
|
||||
{!showThumb && (
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
className="channel-thumbnail__default"
|
||||
src={!thumbError && channelThumbnail ? channelThumbnail : defaultAvater}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
setThumbLoadError(true);
|
||||
}
|
||||
}}
|
||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||
/>
|
||||
)}
|
||||
{showThumb && (
|
||||
<>
|
||||
{showDelayedMessage && thumbError ? (
|
||||
<div className="chanel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||
) : (
|
||||
<OptimizedImage
|
||||
alt={__('Channel profile picture')}
|
||||
className="channel-thumbnail__custom"
|
||||
src={!thumbError && channelThumbnail ? channelThumbnail : defaultAvater}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
@@ -5,7 +5,6 @@ import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import { FormField } from 'component/common/form';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import CollectionSelectItem from 'component/collectionSelectItem';
|
||||
|
||||
type Props = {
|
||||
@@ -47,7 +46,8 @@ const ClaimCollectionAdd = (props: Props) => {
|
||||
}
|
||||
|
||||
function altEnterListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if (e.keyCode === KEYCODES.ENTER) {
|
||||
const KEYCODE_ENTER = 13;
|
||||
if (e.keyCode === KEYCODE_ENTER) {
|
||||
e.preventDefault();
|
||||
buttonref.current.click();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ type Props = {
|
||||
onScrollBottom?: (any) => void,
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
id?: string,
|
||||
// If using the default header, this is a unique ID needed to persist the state of the filter setting
|
||||
persistedStorageKey?: string,
|
||||
showHiddenByUser: boolean,
|
||||
@@ -46,7 +47,7 @@ type Props = {
|
||||
searchOptions?: any,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
onClick?: (e: any, claim?: ?Claim, index?: number) => void,
|
||||
onClick?: (e: any, index?: number) => void,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
@@ -55,6 +56,7 @@ export default function ClaimList(props: Props) {
|
||||
uris,
|
||||
headerAltControls,
|
||||
loading,
|
||||
id,
|
||||
persistedStorageKey,
|
||||
empty,
|
||||
defaultSort,
|
||||
@@ -108,9 +110,9 @@ export default function ClaimList(props: Props) {
|
||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||
}
|
||||
|
||||
function handleClaimClicked(e, claim, index) {
|
||||
function handleClaimClicked(e, index) {
|
||||
if (onClick) {
|
||||
onClick(e, claim, index);
|
||||
onClick(e, index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +200,7 @@ 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}
|
||||
@@ -217,7 +220,7 @@ export default function ClaimList(props: Props) {
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
}}
|
||||
live={resolveLive(index)}
|
||||
onClick={(e, claim, index) => handleClaimClicked(e, claim, index)}
|
||||
onClick={handleClaimClicked}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
selectClaimsByUri,
|
||||
selectClaimSearchByQuery,
|
||||
selectClaimSearchByQueryLastPageReached,
|
||||
selectFetchingClaimSearch,
|
||||
@@ -13,13 +12,11 @@ import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent, selectLanguage } from 'redux/selectors/settings';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import ClaimListDiscover from './view';
|
||||
import { doFetchViewCount } from 'lbryinc';
|
||||
|
||||
const select = (state) => ({
|
||||
followedTags: selectFollowedTags(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
claimSearchByQueryLastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
showNsfw: selectShowMatureContent(state),
|
||||
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
|
||||
@@ -32,7 +29,6 @@ const select = (state) => ({
|
||||
const perform = {
|
||||
doClaimSearch,
|
||||
doToggleTagFollowDesktop,
|
||||
doFetchViewCount,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(ClaimListDiscover);
|
||||
@@ -18,81 +18,65 @@ import { getLivestreamOnlyOptions } from 'util/search';
|
||||
|
||||
type Props = {
|
||||
uris: Array<string>,
|
||||
name?: string,
|
||||
type: string,
|
||||
pageSize?: number,
|
||||
|
||||
fetchViewCount?: boolean,
|
||||
forceShowReposts?: boolean,
|
||||
hasNoSource?: boolean,
|
||||
hasSource?: boolean,
|
||||
hideAdvancedFilter?: boolean,
|
||||
hideFilters?: boolean,
|
||||
includeSupportAction?: boolean,
|
||||
infiniteScroll?: Boolean,
|
||||
isChannel?: boolean,
|
||||
liveLivestreamsFirst?: boolean,
|
||||
personalView: boolean,
|
||||
showHeader: boolean,
|
||||
showHiddenByUser?: boolean,
|
||||
showNoSourceClaims?: boolean,
|
||||
tileLayout: boolean,
|
||||
|
||||
orderBy?: Array<string>, // Trending, New, Top
|
||||
defaultOrderBy?: string,
|
||||
sortBy?: Array<string>, // Newest First, Oldest First
|
||||
freshness?: string,
|
||||
defaultFreshness?: string,
|
||||
|
||||
tags: string, // these are just going to be string. pass a CSV if you want multi
|
||||
defaultTags: string,
|
||||
|
||||
claimType?: string | Array<string>,
|
||||
defaultClaimType?: Array<string>,
|
||||
|
||||
streamType?: string | Array<string>,
|
||||
defaultStreamType?: string | Array<string>,
|
||||
|
||||
empty?: string,
|
||||
feeAmount?: string,
|
||||
releaseTime?: string,
|
||||
repostedClaimId?: string,
|
||||
scrollAnchor?: string,
|
||||
maxPages?: number,
|
||||
limitClaimsPerChannel?: number,
|
||||
|
||||
channelIds?: Array<string>,
|
||||
claimIds?: Array<string>,
|
||||
type: string,
|
||||
subscribedChannels: Array<Subscription>,
|
||||
livestreamMap?: { [string]: any },
|
||||
|
||||
header?: Node,
|
||||
headerLabel?: string | Node,
|
||||
hiddenNsfwMessage?: Node,
|
||||
injectedItem: ?Node,
|
||||
meta?: Node,
|
||||
renderProperties?: (Claim) => Node,
|
||||
|
||||
history: { action: string, push: (string) => void, replace: (string) => void },
|
||||
location: { search: string, pathname: string },
|
||||
|
||||
// --- select ---
|
||||
followedTags?: Array<Tag>,
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
claimSearchByQueryLastPageReached: { [string]: boolean },
|
||||
claimsByUri: { [string]: any },
|
||||
doClaimSearch: ({}) => void,
|
||||
loading: boolean,
|
||||
personalView: boolean,
|
||||
doToggleTagFollowDesktop: (string) => void,
|
||||
meta?: Node,
|
||||
showNsfw: boolean,
|
||||
hideReposts: boolean,
|
||||
languageSetting: string,
|
||||
history: { action: string, push: (string) => void, replace: (string) => void },
|
||||
location: { search: string, pathname: string },
|
||||
claimSearchByQuery: {
|
||||
[string]: Array<string>,
|
||||
},
|
||||
claimSearchByQueryLastPageReached: { [string]: boolean },
|
||||
mutedUris: Array<string>,
|
||||
blockedUris: Array<string>,
|
||||
hiddenNsfwMessage?: Node,
|
||||
channelIds?: Array<string>,
|
||||
claimIds?: Array<string>,
|
||||
tags: string, // these are just going to be string. pass a CSV if you want multi
|
||||
defaultTags: string,
|
||||
orderBy?: Array<string>,
|
||||
defaultOrderBy?: string,
|
||||
freshness?: string,
|
||||
defaultFreshness?: string,
|
||||
header?: Node,
|
||||
headerLabel?: string | Node,
|
||||
name?: string,
|
||||
hideAdvancedFilter?: boolean,
|
||||
claimType?: string | Array<string>,
|
||||
defaultClaimType?: Array<string>,
|
||||
streamType?: string | Array<string>,
|
||||
defaultStreamType?: string | Array<string>,
|
||||
renderProperties?: (Claim) => Node,
|
||||
includeSupportAction?: boolean,
|
||||
repostedClaimId?: string,
|
||||
pageSize?: number,
|
||||
followedTags?: Array<Tag>,
|
||||
injectedItem: ?Node,
|
||||
infiniteScroll?: Boolean,
|
||||
feeAmount?: string,
|
||||
tileLayout: boolean,
|
||||
hideFilters?: boolean,
|
||||
maxPages?: number,
|
||||
forceShowReposts?: boolean,
|
||||
languageSetting: string,
|
||||
searchInLanguage: boolean,
|
||||
|
||||
// --- perform ---
|
||||
doClaimSearch: ({}) => void,
|
||||
doToggleTagFollowDesktop: (string) => void,
|
||||
doFetchViewCount: (claimIdCsv: string) => void,
|
||||
scrollAnchor?: string,
|
||||
showHiddenByUser?: boolean,
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
hasSource?: boolean,
|
||||
limitClaimsPerChannel?: number,
|
||||
releaseTime?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
isChannel?: boolean,
|
||||
empty?: string,
|
||||
};
|
||||
|
||||
function ClaimListDiscover(props: Props) {
|
||||
@@ -109,14 +93,12 @@ function ClaimListDiscover(props: Props) {
|
||||
channelIds,
|
||||
showNsfw,
|
||||
hideReposts,
|
||||
fetchViewCount,
|
||||
history,
|
||||
location,
|
||||
mutedUris,
|
||||
blockedUris,
|
||||
hiddenNsfwMessage,
|
||||
defaultOrderBy,
|
||||
sortBy,
|
||||
orderBy,
|
||||
headerLabel,
|
||||
header,
|
||||
@@ -151,17 +133,15 @@ function ClaimListDiscover(props: Props) {
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
hasSource,
|
||||
hasNoSource,
|
||||
isChannel = false,
|
||||
showNoSourceClaims,
|
||||
empty,
|
||||
claimsByUri,
|
||||
doFetchViewCount,
|
||||
} = props;
|
||||
const didNavigateForward = history.action === 'PUSH';
|
||||
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);
|
||||
@@ -172,7 +152,6 @@ function ClaimListDiscover(props: Props) {
|
||||
(urlParams.get(CS.TAGS_KEY) !== null && urlParams.get(CS.TAGS_KEY)) ||
|
||||
(defaultTags && getParamFromTags(defaultTags));
|
||||
const freshnessParam = freshness || urlParams.get(CS.FRESH_KEY) || defaultFreshness;
|
||||
const sortByParam = sortBy || urlParams.get(CS.SORT_BY_KEY) || CS.SORT_BY.NEWEST.key;
|
||||
const mutedAndBlockedChannelIds = Array.from(
|
||||
new Set(mutedUris.concat(blockedUris).map((uri) => splitBySeparator(uri)[1]))
|
||||
);
|
||||
@@ -252,18 +231,21 @@ function ClaimListDiscover(props: Props) {
|
||||
page_size: dynamicPageSize,
|
||||
page,
|
||||
name,
|
||||
claim_type: claimType || ['stream', 'repost', 'channel'],
|
||||
claim_type: claimType || undefined,
|
||||
// no_totals makes it so the sdk doesn't have to calculate total number pages for pagination
|
||||
// it's faster, but we will need to remove it if we start using total_pages
|
||||
no_totals: true,
|
||||
not_channel_ids: isChannel ? undefined : mutedAndBlockedChannelIds,
|
||||
not_tags: !showNsfw ? MATURE_TAGS : [],
|
||||
order_by: resolveOrderByOption(orderParam, sortByParam),
|
||||
order_by:
|
||||
orderParam === CS.ORDER_BY_TRENDING
|
||||
? CS.ORDER_BY_TRENDING_VALUE
|
||||
: orderParam === CS.ORDER_BY_NEW
|
||||
? CS.ORDER_BY_NEW_VALUE
|
||||
: CS.ORDER_BY_TOP_VALUE, // Sort by top
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
options.has_no_source = true;
|
||||
} else if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream'))) {
|
||||
if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === CS.CLAIM_STREAM))) {
|
||||
options.has_source = true;
|
||||
}
|
||||
|
||||
@@ -405,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)) {
|
||||
@@ -469,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) {
|
||||
@@ -525,48 +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 [];
|
||||
}
|
||||
}
|
||||
|
||||
function fetchViewCountForUris(uris) {
|
||||
const claimIds = [];
|
||||
|
||||
if (uris) {
|
||||
uris.forEach((uri) => {
|
||||
if (claimsByUri[uri]) {
|
||||
claimIds.push(claimsByUri[uri].claim_id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (claimIds.length > 0) {
|
||||
doFetchViewCount(claimIds.join(','));
|
||||
}
|
||||
}
|
||||
|
||||
function resolveOrderByOption(orderBy: string | Array<string>, sortBy: string | Array<string>) {
|
||||
const order_by =
|
||||
orderBy === CS.ORDER_BY_TRENDING
|
||||
? CS.ORDER_BY_TRENDING_VALUE
|
||||
: orderBy === CS.ORDER_BY_NEW
|
||||
? CS.ORDER_BY_NEW_VALUE
|
||||
: CS.ORDER_BY_TOP_VALUE;
|
||||
|
||||
if (orderBy === CS.ORDER_BY_NEW && sortBy === CS.SORT_BY.OLDEST.key) {
|
||||
return order_by.map((x) => `${CS.SORT_BY.OLDEST.opt}${x}`);
|
||||
}
|
||||
|
||||
return order_by;
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
React.useEffect(() => {
|
||||
if (shouldPerformSearch) {
|
||||
const searchOptions = JSON.parse(optionsStringForEffect);
|
||||
@@ -593,12 +526,6 @@ function ClaimListDiscover(props: Props) {
|
||||
}
|
||||
}, [uris, claimSearchResult, finalUris, setFinalUris, liveLivestreamsFirst, livestreamSearchResult]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (fetchViewCount) {
|
||||
fetchViewCountForUris(finalUris);
|
||||
}
|
||||
}, [finalUris]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const headerToUse = header || (
|
||||
<ClaimListHeader
|
||||
channelIds={channelIds}
|
||||
@@ -635,6 +562,7 @@ function ClaimListDiscover(props: Props) {
|
||||
)}
|
||||
<ClaimList
|
||||
tileLayout
|
||||
id={mainSearchKey}
|
||||
loading={loading}
|
||||
uris={finalUris}
|
||||
onScrollBottom={handleScrollBottom}
|
||||
@@ -668,6 +596,7 @@ function ClaimListDiscover(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
<ClaimList
|
||||
id={mainSearchKey}
|
||||
type={type}
|
||||
loading={loading}
|
||||
uris={finalUris}
|
||||
@@ -682,20 +611,13 @@ function ClaimListDiscover(props: Props) {
|
||||
liveLivestreamsFirst={liveLivestreamsFirst}
|
||||
livestreamMap={livestreamMap}
|
||||
searchOptions={options}
|
||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||
showNoSourceClaims={showNoSourceClaims}
|
||||
empty={empty}
|
||||
/>
|
||||
{loading &&
|
||||
new Array(dynamicPageSize)
|
||||
.fill(1)
|
||||
.map((x, i) => (
|
||||
<ClaimPreview
|
||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||
key={i}
|
||||
placeholder="loading"
|
||||
type={type}
|
||||
/>
|
||||
))}
|
||||
.map((x, i) => <ClaimPreview key={i} placeholder="loading" type={type} />)}
|
||||
</div>
|
||||
)}
|
||||
</React.Fragment>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @flow
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import type { Node } from 'react';
|
||||
@@ -20,7 +21,6 @@ type Props = {
|
||||
streamType?: string | Array<string>,
|
||||
defaultStreamType?: string | Array<string>,
|
||||
feeAmount: string,
|
||||
sortBy?: string,
|
||||
orderBy?: Array<string>,
|
||||
defaultOrderBy?: string,
|
||||
hideAdvancedFilter: boolean,
|
||||
@@ -45,7 +45,6 @@ function ClaimListHeader(props: Props) {
|
||||
streamType,
|
||||
defaultStreamType,
|
||||
feeAmount,
|
||||
sortBy,
|
||||
orderBy,
|
||||
defaultOrderBy,
|
||||
hideAdvancedFilter,
|
||||
@@ -72,7 +71,6 @@ function ClaimListHeader(props: Props) {
|
||||
streamType || (CS.FILE_TYPES.includes(contentTypeParam) && contentTypeParam) || defaultStreamType || null;
|
||||
const durationParam = urlParams.get(CS.DURATION_KEY) || null;
|
||||
const languageParam = urlParams.get(CS.LANGUAGE_KEY) || null;
|
||||
const sortByParam = sortBy || urlParams.get(CS.SORT_BY_KEY) || null;
|
||||
const channelIdsInUrl = urlParams.get(CS.CHANNEL_IDS_KEY);
|
||||
const channelIdsParam = channelIdsInUrl ? channelIdsInUrl.split(',') : channelIds;
|
||||
const feeAmountParam = urlParams.get('fee_amount') || feeAmount || CS.FEE_AMOUNT_ANY;
|
||||
@@ -155,13 +153,6 @@ function ClaimListHeader(props: Props) {
|
||||
case CS.ORDER_BY_KEY:
|
||||
newUrlParams.set(CS.ORDER_BY_KEY, delta.value);
|
||||
break;
|
||||
case CS.SORT_BY_KEY:
|
||||
if (delta.value === CS.SORT_BY.NEWEST.key) {
|
||||
newUrlParams.delete(CS.SORT_BY_KEY);
|
||||
} else {
|
||||
newUrlParams.set(CS.SORT_BY_KEY, delta.value);
|
||||
}
|
||||
break;
|
||||
case CS.FRESH_KEY:
|
||||
if (delta.value === defaultFreshness || delta.value === CS.FRESH_DEFAULT) {
|
||||
newUrlParams.delete(CS.FRESH_KEY);
|
||||
@@ -249,7 +240,7 @@ function ClaimListHeader(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
<div className="claim-search__menu-group">
|
||||
{!hideAdvancedFilter && (
|
||||
{!hideAdvancedFilter && !SIMPLE_SITE && (
|
||||
<Button
|
||||
button="alt"
|
||||
aria-label={__('More')}
|
||||
@@ -275,7 +266,7 @@ function ClaimListHeader(props: Props) {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{expanded && (
|
||||
{expanded && !SIMPLE_SITE && (
|
||||
<>
|
||||
<div className={classnames(`card claim-search__menus`)}>
|
||||
{/* FRESHNESS FIELD */}
|
||||
@@ -458,32 +449,6 @@ function ClaimListHeader(props: Props) {
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
{/* SORT FIELD */}
|
||||
{orderParam === CS.ORDER_BY_NEW && (
|
||||
<div className={'claim-search__input-container'}>
|
||||
<FormField
|
||||
className={classnames('claim-search__dropdown', {
|
||||
'claim-search__dropdown--selected': sortByParam,
|
||||
})}
|
||||
label={__('Sort By')}
|
||||
type="select"
|
||||
name="sort_by"
|
||||
value={sortByParam || CS.SORT_BY.NEWEST.key}
|
||||
onChange={(e) => handleChange({ key: CS.SORT_BY_KEY, value: e.target.value })}
|
||||
>
|
||||
{Object.entries(CS.SORT_BY).map(([key, value]) => {
|
||||
return (
|
||||
// $FlowFixMe https://github.com/facebook/flow/issues/2221
|
||||
<option key={value.key} value={value.key}>
|
||||
{/* $FlowFixMe */}
|
||||
{__(value.str)}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</FormField>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{channelIdsInUrl && (
|
||||
<div className={'claim-search__input-container'}>
|
||||
<label>{__('Advanced Filters from URL')}</label>
|
||||
|
||||
@@ -8,9 +8,6 @@ import {
|
||||
makeSelectCollectionIsMine,
|
||||
COLLECTIONS_CONSTS,
|
||||
makeSelectEditedCollectionForId,
|
||||
makeSelectClaimIsMine,
|
||||
doFetchItemsInCollection,
|
||||
makeSelectUrlsForCollectionId,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
|
||||
@@ -27,25 +24,20 @@ 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';
|
||||
import { selectListShuffle } from 'redux/selectors/content';
|
||||
import { doToggleLoopList, doToggleShuffleList } from 'redux/actions/content';
|
||||
import ClaimPreview from './view';
|
||||
import fs from 'fs';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri, false)(state);
|
||||
const collectionId = props.collectionId;
|
||||
const repostedClaim = claim && claim.reposted_claim;
|
||||
const contentClaim = repostedClaim || claim;
|
||||
const contentSigningChannel = contentClaim && contentClaim.signing_channel;
|
||||
const contentPermanentUri = contentClaim && contentClaim.permanent_url;
|
||||
const contentChannelUri = (contentSigningChannel && contentSigningChannel.permanent_url) || contentPermanentUri;
|
||||
const shuffleList = selectListShuffle(state);
|
||||
const shuffle = shuffleList && shuffleList.collectionId === collectionId && shuffleList.newUrls;
|
||||
const playNextUri = shuffle && shuffle[0];
|
||||
|
||||
return {
|
||||
claim,
|
||||
@@ -53,27 +45,19 @@ 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),
|
||||
claimInCollection: makeSelectCollectionForIdHasClaimUrl(collectionId, contentPermanentUri)(state),
|
||||
isMyCollection: makeSelectCollectionIsMine(collectionId)(state),
|
||||
editedCollection: makeSelectEditedCollectionForId(collectionId)(state),
|
||||
claimInCollection: makeSelectCollectionForIdHasClaimUrl(props.collectionId, contentPermanentUri)(state),
|
||||
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
editedCollection: makeSelectEditedCollectionForId(props.collectionId)(state),
|
||||
isAuthenticated: Boolean(selectUserVerifiedEmail(state)),
|
||||
resolvedList: makeSelectUrlsForCollectionId(collectionId)(state),
|
||||
playNextUri,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -94,17 +78,13 @@ 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)),
|
||||
doChannelUnsubscribe: (subscription) => dispatch(doChannelUnsubscribe(subscription)),
|
||||
doCollectionEdit: (collection, props) => dispatch(doCollectionEdit(collection, props)),
|
||||
fetchCollectionItems: (collectionId) => dispatch(doFetchItemsInCollection({ collectionId })),
|
||||
doToggleShuffleList: (collectionId) => {
|
||||
dispatch(doToggleLoopList(collectionId, false, true));
|
||||
dispatch(doToggleShuffleList(undefined, collectionId, true, true));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreview);
|
||||
@@ -7,18 +7,13 @@ import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import {
|
||||
generateShareUrl,
|
||||
generateRssUrl,
|
||||
generateLbryContentUrl,
|
||||
formatLbryUrlForWeb,
|
||||
generateListSearchUrlParams,
|
||||
} from 'util/url';
|
||||
import { generateShareUrl, generateRssUrl, generateLbryContentUrl } from 'util/url';
|
||||
import { useHistory } from 'react-router';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
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 = {
|
||||
@@ -48,7 +43,7 @@ type Props = {
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
hasClaimInWatchLater: boolean,
|
||||
hasClaimInFavorites: boolean,
|
||||
hasClaimInCustom: boolean,
|
||||
claimInCollection: boolean,
|
||||
collectionId: string,
|
||||
isMyCollection: boolean,
|
||||
@@ -62,10 +57,6 @@ type Props = {
|
||||
isChannelPage: boolean,
|
||||
editedCollection: Collection,
|
||||
isAuthenticated: boolean,
|
||||
playNextUri: string,
|
||||
resolvedList: boolean,
|
||||
fetchCollectionItems: (string) => void,
|
||||
doToggleShuffleList: (string) => void,
|
||||
};
|
||||
|
||||
function ClaimMenuList(props: Props) {
|
||||
@@ -90,7 +81,7 @@ function ClaimMenuList(props: Props) {
|
||||
doCommentModUnBlockAsAdmin,
|
||||
doCollectionEdit,
|
||||
hasClaimInWatchLater,
|
||||
hasClaimInFavorites,
|
||||
hasClaimInCustom,
|
||||
collectionId,
|
||||
isMyCollection,
|
||||
doToast,
|
||||
@@ -103,12 +94,8 @@ function ClaimMenuList(props: Props) {
|
||||
isChannelPage = false,
|
||||
editedCollection,
|
||||
isAuthenticated,
|
||||
playNextUri,
|
||||
resolvedList,
|
||||
fetchCollectionItems,
|
||||
doToggleShuffleList,
|
||||
} = props;
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const isMobile = useIsMobile();
|
||||
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
|
||||
const isChannel = !incognitoClaim && !contentSigningChannel;
|
||||
const { channelName } = parseURI(contentChannelUri);
|
||||
@@ -120,29 +107,10 @@ function ClaimMenuList(props: Props) {
|
||||
: isSubscribed
|
||||
? __('Unfollow')
|
||||
: __('Follow');
|
||||
const lastCollectionName = 'Favorites';
|
||||
const lastCollectionId = COLLECTIONS_CONSTS.FAVORITES_ID;
|
||||
|
||||
const { push, replace } = useHistory();
|
||||
|
||||
const fetchItems = React.useCallback(() => {
|
||||
if (collectionId) {
|
||||
fetchCollectionItems(collectionId);
|
||||
}
|
||||
}, [collectionId, fetchCollectionItems]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (doShuffle && resolvedList) {
|
||||
doToggleShuffleList(collectionId);
|
||||
if (playNextUri) {
|
||||
const navigateUrl = formatLbryUrlForWeb(playNextUri);
|
||||
push({
|
||||
pathname: navigateUrl,
|
||||
search: generateListSearchUrlParams(collectionId),
|
||||
state: { collectionId, forceAutoplay: true },
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [collectionId, doShuffle, doToggleShuffleList, playNextUri, push, resolvedList]);
|
||||
|
||||
if (!claim) {
|
||||
return null;
|
||||
}
|
||||
@@ -263,7 +231,10 @@ function ClaimMenuList(props: Props) {
|
||||
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
|
||||
}
|
||||
|
||||
const shouldShow = !IS_WEB || (IS_WEB && isAuthenticated);
|
||||
function handleOpenInDesktop() {
|
||||
window.open(claim.permanent_url, '_top');
|
||||
}
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
@@ -276,93 +247,80 @@ function ClaimMenuList(props: Props) {
|
||||
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
<>
|
||||
{/* COLLECTION OPERATIONS */}
|
||||
{collectionId && isCollectionClaim ? (
|
||||
{(!IS_WEB || (IS_WEB && isAuthenticated)) && (
|
||||
<>
|
||||
<>
|
||||
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
|
||||
<a className="menu__link" href={`/$/${PAGES.LIST}/${collectionId}`}>
|
||||
<Icon aria-hidden icon={ICONS.VIEW} />
|
||||
{__('View List')}
|
||||
</a>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
if (!resolvedList) fetchItems();
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{isMyCollection && (
|
||||
{/* COLLECTION OPERATIONS */}
|
||||
{collectionId && isCollectionClaim ? (
|
||||
<>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
|
||||
>
|
||||
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden iconColor={'red'} icon={ICONS.PUBLISH} />
|
||||
{editedCollection ? __('Publish') : __('Edit List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.COLLECTION_DELETE, { collectionId })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete List')}
|
||||
<Icon aria-hidden icon={ICONS.VIEW} />
|
||||
{__('View List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{isMyCollection && (
|
||||
<>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden iconColor={'red'} icon={ICONS.PUBLISH} />
|
||||
{editedCollection ? __('Publish') : __('Edit List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.COLLECTION_DELETE, { collectionId })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
isPlayable && (
|
||||
<>
|
||||
{/* WATCH LATER */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
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>
|
||||
{/* CUSTOM LIST */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => handleAdd(hasClaimInCustom, lastCollectionName, lastCollectionId)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={hasClaimInCustom ? ICONS.DELETE : ICONS.STAR} />
|
||||
{hasClaimInCustom ? __(`In ${lastCollectionName}`) : __(`${lastCollectionName}`)}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.COLLECTION_ADD, { uri, type: 'playlist' })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.STACK} />
|
||||
{__('Add to Lists')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<hr className="menu__separator" />
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
shouldShow &&
|
||||
isPlayable && (
|
||||
<>
|
||||
{/* WATCH LATER */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
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 */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => handleAdd(hasClaimInFavorites, __('Favorites'), COLLECTIONS_CONSTS.FAVORITES_ID)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={hasClaimInFavorites ? ICONS.DELETE : ICONS.STAR} />
|
||||
{hasClaimInFavorites ? __('In Favorites') : __('Favorites')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
{/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.COLLECTION_ADD, { uri, type: 'playlist' })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.STACK} />
|
||||
{__('Add to Lists')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<hr className="menu__separator" />
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
|
||||
{shouldShow && (
|
||||
<>
|
||||
{!isChannelPage && (
|
||||
<>
|
||||
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
|
||||
@@ -426,22 +384,21 @@ 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" />
|
||||
</>
|
||||
)}
|
||||
<hr className="menu__separator" />
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
@@ -459,6 +416,15 @@ function ClaimMenuList(props: Props) {
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{IS_WEB && !isMobile && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DESKTOP} />
|
||||
{__('Open in Desktop')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{!claimIsMine && !isMyCollection && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
||||
<div className="menu__link">
|
||||
|
||||
@@ -29,12 +29,12 @@ 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" */)
|
||||
);
|
||||
|
||||
// preview images used on the landing page and on the channel page
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
@@ -66,7 +66,7 @@ type Props = {
|
||||
actions: boolean | Node | string | number,
|
||||
properties: boolean | Node | string | number | ((Claim) => Node),
|
||||
empty?: Node,
|
||||
onClick?: (e: any, claim?: ?Claim, index?: number) => any,
|
||||
onClick?: (e: any, index?: number) => any,
|
||||
streamingUrl: ?string,
|
||||
getFile: (string) => void,
|
||||
customShouldHide?: (Claim) => boolean,
|
||||
@@ -89,8 +89,8 @@ type Props = {
|
||||
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) => {
|
||||
@@ -152,8 +152,8 @@ 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;
|
||||
@@ -166,17 +166,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 {
|
||||
@@ -195,12 +184,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
claim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
const isChannelUri = claim ? claim.value_type === 'channel' : false;
|
||||
const isChannelUri = isValid ? parseURI(uri).isChannel : false;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const repostedChannelUri =
|
||||
claim && claim.repost_channel_url && claim.value_type === 'channel'
|
||||
? claim.permanent_url || claim.canonical_url
|
||||
: undefined;
|
||||
|
||||
// Get channel title ( use name as fallback )
|
||||
let channelTitle = null;
|
||||
@@ -217,14 +202,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
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, claim, indexInContainer); // not sure indexInContainer is used for anything.
|
||||
onClick(e, indexInContainer);
|
||||
}
|
||||
e.stopPropagation();
|
||||
};
|
||||
@@ -232,10 +218,10 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
const navLinkProps = {
|
||||
to: {
|
||||
pathname: navigateUrl,
|
||||
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
},
|
||||
onClick: handleNavLinkClick,
|
||||
onAuxClick: handleNavLinkClick,
|
||||
onClick: (e) => handleNavLinkClick(e),
|
||||
onAuxClick: (e) => handleNavLinkClick(e),
|
||||
};
|
||||
|
||||
// do not block abandoned and nsfw claims if showUserBlocked is passed
|
||||
@@ -281,13 +267,13 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
||||
function handleOnClick(e) {
|
||||
if (onClick) {
|
||||
onClick(e, claim, indexInContainer);
|
||||
onClick(e, indexInContainer);
|
||||
}
|
||||
|
||||
if (claim && !pending && !disableNavigation) {
|
||||
history.push({
|
||||
pathname: navigateUrl,
|
||||
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
|
||||
state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -376,21 +362,23 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
{!pending ? (
|
||||
<NavLink aria-hidden tabIndex={-1} {...navLinkProps}>
|
||||
<FileThumbnail thumbnail={thumbnailUrl}>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
|
||||
</div>
|
||||
{/* @if TARGET='app' */}
|
||||
<div className="claim-preview__hover-actions">
|
||||
{claim && !isCollection && (
|
||||
{claim && !isCollection && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||
)}
|
||||
</div>
|
||||
</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 focusable={false} uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
</FileThumbnail>
|
||||
</NavLink>
|
||||
) : (
|
||||
@@ -412,7 +400,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
</div>
|
||||
<ClaimPreviewSubtitle uri={uri} type={type} />
|
||||
{(pending || !!reflectingProgress) && <PublishPending uri={uri} />}
|
||||
{channelSubscribers}
|
||||
</div>
|
||||
{type !== 'small' && (
|
||||
<div className="claim-preview__actions">
|
||||
@@ -482,9 +469,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
|
||||
{isChannelUri && !channelIsBlocked && !claimIsMine && (
|
||||
<SubscribeButton
|
||||
uri={repostedChannelUri || (uri.startsWith('lbry://') ? uri : `lbry://${uri}`)}
|
||||
/>
|
||||
<SubscribeButton uri={uri.startsWith('lbry://') ? uri : `lbry://${uri}`} />
|
||||
)}
|
||||
|
||||
{includeSupportAction && <ClaimSupportButton uri={uri} />}
|
||||
|
||||
@@ -4,7 +4,6 @@ import React from 'react';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import FileViewCountInline from 'component/fileViewCountInline';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
|
||||
type Props = {
|
||||
@@ -38,14 +37,7 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||
`${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||
|
||||
{!isChannel &&
|
||||
(isLivestream && ENABLE_NO_SOURCE_CLAIMS ? (
|
||||
__('Livestream')
|
||||
) : (
|
||||
<>
|
||||
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
||||
<DateTime timeAgo uri={uri} />
|
||||
</>
|
||||
))}
|
||||
(isLivestream && ENABLE_NO_SOURCE_CLAIMS ? __('Livestream') : <DateTime timeAgo uri={uri} />)}
|
||||
</>
|
||||
)}
|
||||
</React.Fragment>
|
||||
|
||||
@@ -7,12 +7,11 @@ import UriIndicator from 'component/uriIndicator';
|
||||
import TruncatedText from 'component/common/truncated-text';
|
||||
import DateTime from 'component/dateTime';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import FileViewCountInline from 'component/fileViewCountInline';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import useGetThumbnail from 'effects/use-get-thumbnail';
|
||||
import { formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { parseURI, isURIEqual } from 'lbry-redux';
|
||||
import { parseURI, COLLECTIONS_CONSTS, isURIEqual } from 'lbry-redux';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
||||
@@ -54,7 +53,6 @@ type Props = {
|
||||
isLivestream: boolean,
|
||||
};
|
||||
|
||||
// preview image cards used in related video functionality
|
||||
function ClaimPreviewTile(props: Props) {
|
||||
const {
|
||||
history,
|
||||
@@ -97,10 +95,13 @@ function ClaimPreviewTile(props: Props) {
|
||||
const shouldFetch = claim === undefined;
|
||||
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, placeholder) || thumbnail;
|
||||
const canonicalUrl = claim && claim.canonical_url;
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
let navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');
|
||||
const listId = collectionId || collectionClaimId;
|
||||
const navigateUrl =
|
||||
formatLbryUrlForWeb(canonicalUrl || uri || '/') + (listId ? generateListSearchUrlParams(listId) : '');
|
||||
if (listId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
const navLinkProps = {
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
@@ -120,7 +121,6 @@ function ClaimPreviewTile(props: Props) {
|
||||
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);
|
||||
const repostedChannelUri = isRepost && isChannel ? permanentUrl || canonicalUrl : undefined;
|
||||
|
||||
// Aria-label value for claim preview
|
||||
let ariaLabelData = isChannel ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
||||
@@ -208,15 +208,20 @@ function ClaimPreviewTile(props: Props) {
|
||||
<FileThumbnail thumbnail={thumbnailUrl} allowGifs>
|
||||
{!isChannel && (
|
||||
<React.Fragment>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
|
||||
</div>
|
||||
{/* @if TARGET='app' */}
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isStream && <FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />}
|
||||
</div>
|
||||
{isStream && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />
|
||||
</div>
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
{isPlayable && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileWatchLaterLink focusable={false} uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
||||
</div>
|
||||
@@ -248,7 +253,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
<div className="claim-tile__info">
|
||||
{isChannel ? (
|
||||
<div className="claim-tile__about--channel">
|
||||
<SubscribeButton uri={repostedChannelUri || uri} />
|
||||
<SubscribeButton uri={uri} />
|
||||
</div>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
@@ -258,10 +263,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
|
||||
<div className="claim-tile__about">
|
||||
<UriIndicator uri={uri} link />
|
||||
<div className="claim-tile__about--counts">
|
||||
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
||||
<DateTime timeAgo uri={uri} />
|
||||
</div>
|
||||
<DateTime timeAgo uri={uri} />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
SETTINGS,
|
||||
selectClaimsByUri,
|
||||
} from 'lbry-redux';
|
||||
import { doFetchViewCount } from 'lbryinc';
|
||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
@@ -26,7 +25,6 @@ const select = (state) => ({
|
||||
const perform = {
|
||||
doClaimSearch,
|
||||
doToggleTagFollowDesktop,
|
||||
doFetchViewCount,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(ClaimListDiscover);
|
||||
@@ -86,15 +86,18 @@ export function prioritizeActiveLivestreams(
|
||||
|
||||
type Props = {
|
||||
prefixUris?: Array<string>,
|
||||
pinUrls?: Array<string>,
|
||||
uris: Array<string>,
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
showNoSourceClaims?: boolean,
|
||||
renderProperties?: (Claim) => ?Node,
|
||||
fetchViewCount?: boolean,
|
||||
doClaimSearch: ({}) => void,
|
||||
showNsfw: boolean,
|
||||
hideReposts: boolean,
|
||||
history: { action: string, push: (string) => void, replace: (string) => void },
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
fetchingClaimSearchByQuery: { [string]: boolean },
|
||||
claimsByUri: { [string]: any },
|
||||
// claim search options are below
|
||||
tags: Array<string>,
|
||||
blockedUris: Array<string>,
|
||||
mutedUris: Array<string>,
|
||||
claimIds?: Array<string>,
|
||||
channelIds?: Array<string>,
|
||||
pageSize: number,
|
||||
@@ -108,17 +111,11 @@ type Props = {
|
||||
limitClaimsPerChannel?: number,
|
||||
hasSource?: boolean,
|
||||
hasNoSource?: boolean,
|
||||
// --- select ---
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
claimsByUri: { [string]: any },
|
||||
fetchingClaimSearchByQuery: { [string]: boolean },
|
||||
showNsfw: boolean,
|
||||
hideReposts: boolean,
|
||||
mutedUris: Array<string>,
|
||||
blockedUris: Array<string>,
|
||||
// --- perform ---
|
||||
doClaimSearch: ({}) => void,
|
||||
doFetchViewCount: (claimIdCsv: string) => void,
|
||||
renderProperties?: (Claim) => ?Node,
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
pinUrls?: Array<string>,
|
||||
showNoSourceClaims?: boolean,
|
||||
};
|
||||
|
||||
function ClaimTilesDiscover(props: Props) {
|
||||
@@ -128,7 +125,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
claimsByUri,
|
||||
showNsfw,
|
||||
hideReposts,
|
||||
fetchViewCount,
|
||||
// Below are options to pass that are forwarded to claim_search
|
||||
tags,
|
||||
channelIds,
|
||||
@@ -153,7 +149,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
pinUrls,
|
||||
prefixUris,
|
||||
showNoSourceClaims,
|
||||
doFetchViewCount,
|
||||
} = props;
|
||||
|
||||
const { location } = useHistory();
|
||||
@@ -193,7 +188,7 @@ function ClaimTilesDiscover(props: Props) {
|
||||
has_no_source?: boolean,
|
||||
} = {
|
||||
page_size: pageSize,
|
||||
claim_type: claimType || ['stream', 'repost', 'channel'],
|
||||
claim_type: claimType || undefined,
|
||||
// no_totals makes it so the sdk doesn't have to calculate total number pages for pagination
|
||||
// it's faster, but we will need to remove it if we start using total_pages
|
||||
no_totals: true,
|
||||
@@ -274,49 +269,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
const modifiedUris = uris ? uris.slice() : [];
|
||||
const fixUris = pinUrls || [];
|
||||
|
||||
if (pinUrls && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') {
|
||||
fixUris.forEach((fixUri) => {
|
||||
if (modifiedUris.indexOf(fixUri) !== -1) {
|
||||
modifiedUris.splice(modifiedUris.indexOf(fixUri), 1);
|
||||
} else {
|
||||
modifiedUris.pop();
|
||||
}
|
||||
});
|
||||
modifiedUris.splice(2, 0, ...fixUris);
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
function resolveLive(index) {
|
||||
if (liveLivestreamsFirst && livestreamMap && index < liveUris.length) {
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function fetchViewCountForUris(uris) {
|
||||
const claimIds = [];
|
||||
|
||||
if (uris) {
|
||||
uris.forEach((uri) => {
|
||||
if (claimsByUri[uri]) {
|
||||
claimIds.push(claimsByUri[uri].claim_id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (claimIds.length > 0) {
|
||||
doFetchViewCount(claimIds.join(','));
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
React.useEffect(() => {
|
||||
if (shouldPerformSearch) {
|
||||
const searchOptions = JSON.parse(optionsStringForEffect);
|
||||
@@ -330,17 +282,30 @@ function ClaimTilesDiscover(props: Props) {
|
||||
|
||||
React.useEffect(() => {
|
||||
if (JSON.stringify(prevUris) !== JSON.stringify(uris) && !shouldPerformSearch) {
|
||||
// Stash new results for next render cycle:
|
||||
setPrevUris(uris);
|
||||
// Fetch view count:
|
||||
if (fetchViewCount) {
|
||||
fetchViewCountForUris(uris);
|
||||
}
|
||||
}
|
||||
}, [shouldPerformSearch, prevUris, uris]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [shouldPerformSearch, prevUris, uris]);
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
const resolveLive = (index) => {
|
||||
if (liveLivestreamsFirst && livestreamMap && index < liveUris.length) {
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const modifiedUris = uris ? uris.slice() : [];
|
||||
const fixUris = pinUrls || [];
|
||||
|
||||
if (pinUrls && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') {
|
||||
fixUris.forEach((fixUri) => {
|
||||
if (modifiedUris.indexOf(fixUri) !== -1) {
|
||||
modifiedUris.splice(modifiedUris.indexOf(fixUri), 1);
|
||||
} else {
|
||||
modifiedUris.pop();
|
||||
}
|
||||
});
|
||||
modifiedUris.splice(2, 0, ...fixUris);
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="claim-grid">
|
||||
|
||||
@@ -1,49 +1,30 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimForUri,
|
||||
selectMyChannelClaims,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectCollectionIsMine,
|
||||
makeSelectEditedCollectionForId,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectListShuffle } from 'redux/selectors/content';
|
||||
import { doToggleShuffleList, doToggleLoopList } from 'redux/actions/content';
|
||||
import CollectionActions from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
let firstItem;
|
||||
const collectionUrls = props.collectionUrls;
|
||||
if (collectionUrls) {
|
||||
// this will help play the first valid claim in a list
|
||||
// in case the first urls have been deleted
|
||||
collectionUrls.map((url) => {
|
||||
const claim = makeSelectClaimForUri(url)(state);
|
||||
if (firstItem === undefined && claim) {
|
||||
firstItem = claim.permanent_url;
|
||||
}
|
||||
});
|
||||
}
|
||||
const collectionId = props.collectionId;
|
||||
const shuffleList = selectListShuffle(state);
|
||||
const shuffle = shuffleList && shuffleList.collectionId === collectionId && shuffleList.newUrls;
|
||||
const playNextUri = shuffle && shuffle[0];
|
||||
|
||||
return {
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsPending: makeSelectClaimIsPending(props.uri)(state),
|
||||
isMyCollection: makeSelectCollectionIsMine(collectionId)(state),
|
||||
collectionHasEdits: Boolean(makeSelectEditedCollectionForId(collectionId)(state)),
|
||||
firstItem,
|
||||
playNextUri,
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
claimIsPending: makeSelectClaimIsPending(props.uri)(state),
|
||||
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionHasEdits: Boolean(makeSelectEditedCollectionForId(props.collectionId)(state)),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doToggleShuffleList: (collectionId, shuffle) => {
|
||||
dispatch(doToggleLoopList(collectionId, false, true));
|
||||
dispatch(doToggleShuffleList(undefined, collectionId, shuffle, true));
|
||||
},
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionActions);
|
||||
@@ -11,22 +11,19 @@ import { useHistory } from 'react-router';
|
||||
import { EDIT_PAGE, PAGE_VIEW_QUERY } from 'page/collection/view';
|
||||
import classnames from 'classnames';
|
||||
import { ENABLE_FILE_REACTIONS } from 'config';
|
||||
import { formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
openModal: (id: string, {}) => void,
|
||||
openModal: (id: string, { uri: string, claimIsMine?: boolean, isSupport?: boolean }) => void,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
doToast: ({ message: string }) => void,
|
||||
claimIsPending: boolean,
|
||||
isMyCollection: boolean,
|
||||
collectionId: string,
|
||||
showInfo: boolean,
|
||||
setShowInfo: (boolean) => void,
|
||||
collectionHasEdits: boolean,
|
||||
isBuiltin: boolean,
|
||||
doToggleShuffleList: (string, boolean) => void,
|
||||
playNextUri: string,
|
||||
firstItem: string,
|
||||
};
|
||||
|
||||
function CollectionActions(props: Props) {
|
||||
@@ -40,110 +37,61 @@ function CollectionActions(props: Props) {
|
||||
showInfo,
|
||||
setShowInfo,
|
||||
collectionHasEdits,
|
||||
isBuiltin,
|
||||
doToggleShuffleList,
|
||||
playNextUri,
|
||||
firstItem,
|
||||
} = props;
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const { push } = useHistory();
|
||||
const isMobile = useIsMobile();
|
||||
const claimId = claim && claim.claim_id;
|
||||
const webShareable = true; // collections have cost?
|
||||
|
||||
const doPlay = React.useCallback(
|
||||
(playUri) => {
|
||||
const navigateUrl = formatLbryUrlForWeb(playUri);
|
||||
push({
|
||||
pathname: navigateUrl,
|
||||
search: generateListSearchUrlParams(collectionId),
|
||||
state: { forceAutoplay: true },
|
||||
});
|
||||
},
|
||||
[collectionId, push]
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (playNextUri && doShuffle) {
|
||||
setDoShuffle(false);
|
||||
doPlay(playNextUri);
|
||||
}
|
||||
}, [doPlay, doShuffle, playNextUri]);
|
||||
|
||||
const lhsSection = (
|
||||
<>
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.PLAY}
|
||||
label={__('Play')}
|
||||
title={__('Play')}
|
||||
onClick={() => {
|
||||
doToggleShuffleList(collectionId, false);
|
||||
doPlay(firstItem);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.SHUFFLE}
|
||||
label={__('Shuffle Play')}
|
||||
title={__('Shuffle Play')}
|
||||
onClick={() => {
|
||||
doToggleShuffleList(collectionId, true);
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
/>
|
||||
{!isBuiltin && (
|
||||
<>
|
||||
{ENABLE_FILE_REACTIONS && uri && <FileReactions uri={uri} />}
|
||||
{uri && <ClaimSupportButton uri={uri} fileAction />}
|
||||
{/* TODO Add ClaimRepostButton component */}
|
||||
{uri && (
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.SHARE}
|
||||
label={__('Share')}
|
||||
title={__('Share')}
|
||||
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable })}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
{ENABLE_FILE_REACTIONS && uri && <FileReactions uri={uri} />}
|
||||
{uri && <ClaimSupportButton uri={uri} fileAction />}
|
||||
{/* TODO Add ClaimRepostButton component */}
|
||||
{uri && (
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.SHARE}
|
||||
label={__('Share')}
|
||||
title={__('Share')}
|
||||
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable })}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
const rhsSection = (
|
||||
<>
|
||||
{!isBuiltin &&
|
||||
(isMyCollection ? (
|
||||
<>
|
||||
<Button
|
||||
title={uri ? __('Update') : __('Publish')}
|
||||
label={uri ? __('Update') : __('Publish')}
|
||||
className={classnames('button--file-action')}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
|
||||
icon={ICONS.PUBLISH}
|
||||
iconColor={collectionHasEdits && 'red'}
|
||||
iconSize={18}
|
||||
disabled={claimIsPending}
|
||||
/>
|
||||
<Button
|
||||
className={classnames('button--file-action')}
|
||||
title={__('Delete List')}
|
||||
onClick={() => openModal(MODALS.COLLECTION_DELETE, { uri, collectionId, redirect: `/$/${PAGES.LISTS}` })}
|
||||
icon={ICONS.DELETE}
|
||||
iconSize={18}
|
||||
description={__('Delete List')}
|
||||
disabled={claimIsPending}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
title={__('Report content')}
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPORT}
|
||||
navigate={`/$/${PAGES.REPORT_CONTENT}?claimId=${claimId}`}
|
||||
/>
|
||||
))}
|
||||
{isMyCollection && (
|
||||
<Button
|
||||
title={uri ? __('Update') : __('Publish')}
|
||||
label={uri ? __('Update') : __('Publish')}
|
||||
className={classnames('button--file-action')}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
|
||||
icon={ICONS.PUBLISH}
|
||||
iconColor={collectionHasEdits && 'red'}
|
||||
iconSize={18}
|
||||
disabled={claimIsPending}
|
||||
/>
|
||||
)}
|
||||
{isMyCollection && (
|
||||
<Button
|
||||
className={classnames('button--file-action')}
|
||||
title={__('Delete List')}
|
||||
onClick={() => openModal(MODALS.COLLECTION_DELETE, { uri, collectionId, redirect: `/$/${PAGES.LISTS}` })}
|
||||
icon={ICONS.DELETE}
|
||||
iconSize={18}
|
||||
description={__('Delete List')}
|
||||
disabled={claimIsPending}
|
||||
/>
|
||||
)}
|
||||
{!isMyCollection && (
|
||||
<Button
|
||||
title={__('Report content')}
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPORT}
|
||||
navigate={`/$/${PAGES.REPORT_CONTENT}?claimId=${claimId}`}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
|
||||
@@ -7,18 +7,15 @@ import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'lbry-redux';
|
||||
import { selectPlayingUri, selectListLoop, selectListShuffle } from 'redux/selectors/content';
|
||||
import { doToggleLoopList, doToggleShuffleList } from 'redux/actions/content';
|
||||
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 url = claim && claim.permanent_url;
|
||||
const loopList = selectListLoop(state);
|
||||
const loop = loopList && loopList.collectionId === props.id && loopList.loop;
|
||||
const shuffleList = selectListShuffle(state);
|
||||
const shuffle = shuffleList && shuffleList.collectionId === props.id && shuffleList.newUrls;
|
||||
|
||||
return {
|
||||
url,
|
||||
@@ -26,12 +23,7 @@ const select = (state, props) => {
|
||||
collectionUrls: makeSelectUrlsForCollectionId(props.id)(state),
|
||||
collectionName: makeSelectNameForCollectionId(props.id)(state),
|
||||
isMine: makeSelectClaimIsMine(url)(state),
|
||||
loop,
|
||||
shuffle,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, {
|
||||
doToggleLoopList,
|
||||
doToggleShuffleList,
|
||||
})(CollectionContent);
|
||||
export default connect(select)(CollectionContent);
|
||||
@@ -15,52 +15,23 @@ type Props = {
|
||||
collectionUrls: Array<Claim>,
|
||||
collectionName: string,
|
||||
collection: any,
|
||||
loop: boolean,
|
||||
shuffle: boolean,
|
||||
doToggleLoopList: (string, boolean) => void,
|
||||
doToggleShuffleList: (string, string, boolean) => void,
|
||||
createUnpublishedCollection: (string, Array<any>, ?string) => void,
|
||||
};
|
||||
|
||||
export default function CollectionContent(props: Props) {
|
||||
const { collectionUrls, collectionName, id, url, loop, shuffle, doToggleLoopList, doToggleShuffleList } = props;
|
||||
|
||||
const { collectionUrls, collectionName, id, url } = props;
|
||||
return (
|
||||
<Card
|
||||
isBodyList
|
||||
className="file-page__recommended-collection"
|
||||
className="file-page__recommended"
|
||||
title={
|
||||
<>
|
||||
<span className="file-page__recommended-collection__row">
|
||||
<Icon
|
||||
icon={
|
||||
(id === COLLECTIONS_CONSTS.WATCH_LATER_ID && ICONS.TIME) ||
|
||||
(id === COLLECTIONS_CONSTS.FAVORITES_ID && ICONS.STAR) ||
|
||||
ICONS.STACK
|
||||
}
|
||||
className="icon--margin-right"
|
||||
/>
|
||||
{collectionName}
|
||||
</span>
|
||||
<span className="file-page__recommended-collection__row">
|
||||
<Button
|
||||
button="alt"
|
||||
title={__('Loop')}
|
||||
icon={ICONS.REPEAT}
|
||||
iconColor={loop && 'blue'}
|
||||
className="button--file-action"
|
||||
onClick={() => doToggleLoopList(id, !loop)}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
title={__('Shuffle')}
|
||||
icon={ICONS.SHUFFLE}
|
||||
iconColor={shuffle && 'blue'}
|
||||
className="button--file-action"
|
||||
onClick={() => doToggleShuffleList(url, id, !shuffle)}
|
||||
/>
|
||||
</span>
|
||||
</>
|
||||
<span>
|
||||
<Icon
|
||||
icon={(id === COLLECTIONS_CONSTS.WATCH_LATER_ID && ICONS.TIME) ||
|
||||
(id === COLLECTIONS_CONSTS.FAVORITES_ID && ICONS.STAR) || ICONS.STACK}
|
||||
className="icon--margin-right" />
|
||||
{collectionName}
|
||||
</span>
|
||||
}
|
||||
titleActions={
|
||||
<div className="card__title-actions--link">
|
||||
|
||||
@@ -17,10 +17,10 @@ import {
|
||||
makeSelectClaimIdsForCollectionId,
|
||||
ACTIONS as LBRY_REDUX_ACTIONS,
|
||||
} from 'lbry-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
import CollectionForm from './view';
|
||||
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
||||
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
@@ -44,11 +44,10 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
publishCollectionUpdate: (params) => dispatch(doCollectionPublishUpdate(params)),
|
||||
publishCollection: (params, collectionId) => dispatch(doCollectionPublish(params, collectionId)),
|
||||
clearCollectionErrors: () => dispatch({ type: LBRY_REDUX_ACTIONS.CLEAR_COLLECTION_ERRORS }),
|
||||
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
|
||||
setIncognito: (incognito) => dispatch(doSetIncognito(incognito)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionForm);
|
||||
@@ -10,9 +10,9 @@ import ChannelSelector from 'component/channelSelector';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Card from 'component/common/card';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import SelectThumbnail from 'component/selectThumbnail';
|
||||
import ThumbnailPicker from 'component/thumbnailPicker';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { isNameValid, regexInvalidURI, THUMBNAIL_STATUSES } from 'lbry-redux';
|
||||
import { isNameValid, regexInvalidURI } from 'lbry-redux';
|
||||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
||||
import { FormField } from 'component/common/form';
|
||||
import { handleBidChange } from 'util/publish';
|
||||
@@ -21,7 +21,6 @@ import { INVALID_NAME_ERROR } from 'constants/claim';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import analytics from 'analytics';
|
||||
|
||||
const LANG_NONE = 'none';
|
||||
const MAX_TAG_SELECT = 5;
|
||||
|
||||
@@ -40,20 +39,23 @@ type Props = {
|
||||
tags: Array<string>,
|
||||
locations: Array<string>,
|
||||
languages: Array<string>,
|
||||
|
||||
collectionId: string,
|
||||
collection: Collection,
|
||||
collectionClaimIds: Array<string>,
|
||||
collectionUrls: Array<string>,
|
||||
publishCollectionUpdate: (CollectionUpdateParams) => Promise<any>,
|
||||
updatingCollection: boolean,
|
||||
updateError: string,
|
||||
publishCollection: (CollectionPublishParams, string) => Promise<any>,
|
||||
createError: string,
|
||||
creatingCollection: boolean,
|
||||
publishCollectionUpdate: (CollectionUpdateParams) => Promise<any>,
|
||||
publishCollection: (CollectionPublishParams, string) => Promise<any>,
|
||||
clearCollectionErrors: () => void,
|
||||
onDone: (string) => void,
|
||||
setActiveChannel: (string) => void,
|
||||
setIncognito: (boolean) => void,
|
||||
openModal: (
|
||||
id: string,
|
||||
{ onUpdate: (string) => void, assetName: string, helpText: string, currentValue: string, title: string }
|
||||
) => void,
|
||||
};
|
||||
|
||||
function CollectionForm(props: Props) {
|
||||
@@ -70,8 +72,11 @@ function CollectionForm(props: Props) {
|
||||
locations,
|
||||
languages = [],
|
||||
// rest
|
||||
onDone,
|
||||
publishCollectionUpdate,
|
||||
updateError,
|
||||
updatingCollection,
|
||||
publishCollection,
|
||||
creatingCollection,
|
||||
createError,
|
||||
disabled,
|
||||
@@ -81,12 +86,7 @@ function CollectionForm(props: Props) {
|
||||
collection,
|
||||
collectionUrls,
|
||||
collectionClaimIds,
|
||||
publishCollectionUpdate,
|
||||
publishCollection,
|
||||
clearCollectionErrors,
|
||||
setActiveChannel,
|
||||
setIncognito,
|
||||
onDone,
|
||||
} = props;
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
let prefix = IS_WEB ? `${DOMAIN}/` : 'lbry://';
|
||||
@@ -95,27 +95,18 @@ function CollectionForm(props: Props) {
|
||||
}
|
||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||
const collectionName = (claim && claim.name) || (collection && collection.name);
|
||||
const collectionChannel = claim && claim.signing_channel ? claim.signing_channel.claim_id : undefined;
|
||||
const hasClaim = !!claim;
|
||||
const [initialized, setInitialized] = React.useState(false);
|
||||
|
||||
const [nameError, setNameError] = React.useState(undefined);
|
||||
const [bidError, setBidError] = React.useState('');
|
||||
const [thumbStatus, setThumbStatus] = React.useState('');
|
||||
const [thumbError, setThumbError] = React.useState('');
|
||||
const [params, setParams]: [any, (any) => void] = React.useState({});
|
||||
const [params, setParams]: [any, (any) => void] = React.useState(getCollectionParams());
|
||||
const name = params.name;
|
||||
const isNewCollection = !uri;
|
||||
const { replace } = useHistory();
|
||||
const languageParam = params.languages || [];
|
||||
const languageParam = params.languages;
|
||||
const primaryLanguage = Array.isArray(languageParam) && languageParam.length && languageParam[0];
|
||||
const secondaryLanguage = Array.isArray(languageParam) && languageParam.length >= 2 && languageParam[1];
|
||||
const hasClaims = params.claims && params.claims.length;
|
||||
|
||||
const collectionClaimIdsString = JSON.stringify(collectionClaimIds);
|
||||
const itemError = !hasClaims ? __('Cannot publish empty list') : '';
|
||||
const thumbnailError =
|
||||
(thumbError && thumbStatus !== THUMBNAIL_STATUSES.COMPLETE && __('Invalid thumbnail')) ||
|
||||
(thumbStatus === THUMBNAIL_STATUSES.IN_PROGRESS && __('Please wait for thumbnail to finish uploading'));
|
||||
const submitError = nameError || bidError || itemError || updateError || createError || thumbnailError;
|
||||
|
||||
function parseName(newName) {
|
||||
let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu');
|
||||
@@ -126,42 +117,6 @@ function CollectionForm(props: Props) {
|
||||
setParams({ ...params, ...paramObj });
|
||||
}
|
||||
|
||||
function updateParams(paramsObj) {
|
||||
setParams({ ...params, ...paramsObj });
|
||||
}
|
||||
|
||||
// TODO remove this or better decide whether app should delete languages[2+]
|
||||
// This was added because a previous update setting was duplicating language codes
|
||||
function dedupeLanguages(languages) {
|
||||
if (languages.length <= 1) {
|
||||
return languages;
|
||||
} else if (languages.length === 2) {
|
||||
if (languages[0] !== languages[1]) {
|
||||
return languages;
|
||||
} else {
|
||||
return [languages[0]];
|
||||
}
|
||||
} else if (languages.length > 2) {
|
||||
const newLangs = [];
|
||||
languages.forEach((l) => {
|
||||
if (!newLangs.includes(l)) {
|
||||
newLangs.push(l);
|
||||
}
|
||||
});
|
||||
return newLangs;
|
||||
}
|
||||
}
|
||||
|
||||
function handleUpdateThumbnail(update: { [string]: string }) {
|
||||
if (update.thumbnail_url) {
|
||||
setParam(update);
|
||||
} else if (update.thumbnail_status) {
|
||||
setThumbStatus(update.thumbnail_status);
|
||||
} else {
|
||||
setThumbError(update.thumbnail_error);
|
||||
}
|
||||
}
|
||||
|
||||
function getCollectionParams() {
|
||||
const collectionParams: {
|
||||
thumbnail_url?: string,
|
||||
@@ -177,25 +132,41 @@ function CollectionForm(props: Props) {
|
||||
claims: ?Array<string>,
|
||||
} = {
|
||||
thumbnail_url: thumbnailUrl,
|
||||
name: parseName(collectionName),
|
||||
description,
|
||||
title: claim ? title : collectionName,
|
||||
bid: String(amount || 0.001),
|
||||
languages: languages ? dedupeLanguages(languages) : [],
|
||||
languages: languages || [],
|
||||
locations: locations || [],
|
||||
tags: tags
|
||||
? tags.map((tag) => {
|
||||
return { name: tag };
|
||||
})
|
||||
: [],
|
||||
claim_id: claim ? claim.claim_id : undefined,
|
||||
channel_id: claim ? collectionChannel : activeChannelId || undefined,
|
||||
claims: collectionClaimIds,
|
||||
};
|
||||
collectionParams['name'] = parseName(collectionName);
|
||||
|
||||
if (activeChannelId) {
|
||||
collectionParams['channel_id'] = activeChannelId;
|
||||
}
|
||||
|
||||
if (!claim) {
|
||||
collectionParams['title'] = collectionName;
|
||||
}
|
||||
|
||||
if (claim) {
|
||||
collectionParams['claim_id'] = claim.claim_id;
|
||||
collectionParams['title'] = title;
|
||||
}
|
||||
|
||||
return collectionParams;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
const collectionClaimIds = JSON.parse(collectionClaimIdsString);
|
||||
setParams({ ...params, claims: collectionClaimIds });
|
||||
clearCollectionErrors();
|
||||
}, [collectionClaimIdsString, setParams]);
|
||||
|
||||
function handleLanguageChange(index, code) {
|
||||
let langs = [...languageParam];
|
||||
if (index === 0) {
|
||||
@@ -204,9 +175,6 @@ function CollectionForm(props: Props) {
|
||||
langs = [];
|
||||
} else {
|
||||
langs[0] = code;
|
||||
if (langs[0] === langs[1]) {
|
||||
langs.length = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (code === LANG_NONE || code === langs[0]) {
|
||||
@@ -218,6 +186,10 @@ function CollectionForm(props: Props) {
|
||||
setParams({ ...params, languages: langs });
|
||||
}
|
||||
|
||||
function handleThumbnailChange(thumbnailUrl: string) {
|
||||
setParams({ ...params, thumbnail_url: thumbnailUrl });
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (uri) {
|
||||
publishCollectionUpdate(params).then((pendingClaim) => {
|
||||
@@ -238,12 +210,6 @@ function CollectionForm(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
const collectionClaimIds = JSON.parse(collectionClaimIdsString);
|
||||
setParams({ ...params, claims: collectionClaimIds });
|
||||
clearCollectionErrors();
|
||||
}, [collectionClaimIdsString, setParams]);
|
||||
|
||||
React.useEffect(() => {
|
||||
let nameError;
|
||||
if (!name && name !== undefined) {
|
||||
@@ -255,38 +221,19 @@ function CollectionForm(props: Props) {
|
||||
setNameError(nameError);
|
||||
}, [name]);
|
||||
|
||||
// on mount, if we get a collectionChannel, set it.
|
||||
React.useEffect(() => {
|
||||
if (hasClaim && !initialized) {
|
||||
if (collectionChannel) {
|
||||
setActiveChannel(collectionChannel);
|
||||
setIncognito(false);
|
||||
} else if (!collectionChannel && hasClaim) {
|
||||
setIncognito(true);
|
||||
}
|
||||
setInitialized(true);
|
||||
if (incognito) {
|
||||
const newParams = Object.assign({}, params);
|
||||
delete newParams.channel_id;
|
||||
setParams(newParams);
|
||||
} else if (activeChannelId) {
|
||||
setParams({ ...params, channel_id: activeChannelId });
|
||||
}
|
||||
}, [setInitialized, setActiveChannel, collectionChannel, setIncognito, hasClaim, incognito, initialized]);
|
||||
}, [activeChannelId, incognito, setParams]);
|
||||
|
||||
// every time activechannel or incognito changes, set it.
|
||||
React.useEffect(() => {
|
||||
if (initialized) {
|
||||
if (activeChannelId) {
|
||||
setParam({ channel_id: activeChannelId });
|
||||
} else if (incognito) {
|
||||
setParam({ channel_id: undefined });
|
||||
}
|
||||
}
|
||||
}, [activeChannelId, incognito, initialized]);
|
||||
const itemError = !params.claims.length ? __('Cannot publish empty list') : '';
|
||||
const submitError = nameError || bidError || itemError || updateError || createError;
|
||||
|
||||
// setup initial params after we're sure if it's published or not
|
||||
React.useEffect(() => {
|
||||
if (!uri || (uri && hasClaim)) {
|
||||
updateParams(getCollectionParams());
|
||||
}
|
||||
}, [uri, hasClaim]);
|
||||
|
||||
console.log('params', params);
|
||||
return (
|
||||
<>
|
||||
<div className={classnames('main--contained', { 'card--disabled': disabled })}>
|
||||
@@ -305,6 +252,11 @@ function CollectionForm(props: Props) {
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
<fieldset-group className="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="channel_name">{__('Channel')}</label>
|
||||
</fieldset-section>
|
||||
</fieldset-group>
|
||||
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="channel_name">{__('Name')}</label>
|
||||
@@ -334,14 +286,11 @@ function CollectionForm(props: Props) {
|
||||
value={params.title}
|
||||
onChange={(e) => setParams({ ...params, title: e.target.value })}
|
||||
/>
|
||||
<fieldset-section>
|
||||
<SelectThumbnail
|
||||
thumbnailParam={params.thumbnail_url}
|
||||
thumbnailParamError={thumbError}
|
||||
thumbnailParamStatus={thumbStatus}
|
||||
updateThumbnailParams={handleUpdateThumbnail}
|
||||
/>
|
||||
</fieldset-section>
|
||||
<ThumbnailPicker
|
||||
inline
|
||||
thumbnailParam={params.thumbnail_url}
|
||||
updateThumbnailParam={handleThumbnailChange}
|
||||
/>
|
||||
<FormField
|
||||
type="markdown"
|
||||
name="content_description2"
|
||||
@@ -462,9 +411,7 @@ function CollectionForm(props: Props) {
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
disabled={
|
||||
creatingCollection || updatingCollection || nameError || bidError || thumbnailError || !hasClaims
|
||||
}
|
||||
disabled={creatingCollection || updatingCollection || nameError || bidError || !params.claims.length}
|
||||
label={creatingCollection || updatingCollection ? __('Submitting') : __('Submit')}
|
||||
onClick={handleSubmit}
|
||||
/>
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectNameForCollectionId } from 'lbry-redux';
|
||||
import { doCollectionEdit, makeSelectNameForCollectionId, doCollectionDelete } from 'lbry-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectListShuffle } from 'redux/selectors/content';
|
||||
import { doToggleLoopList, doToggleShuffleList } from 'redux/actions/content';
|
||||
import CollectionMenuList from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId;
|
||||
const shuffleList = selectListShuffle(state);
|
||||
const shuffle = shuffleList && shuffleList.collectionId === collectionId && shuffleList.newUrls;
|
||||
const playNextUri = shuffle && shuffle[0];
|
||||
|
||||
return {
|
||||
collectionName: makeSelectNameForCollectionId(props.collectionId)(state),
|
||||
playNextUri,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doToggleShuffleList: (collectionId) => {
|
||||
dispatch(doToggleLoopList(collectionId, false, true));
|
||||
dispatch(doToggleShuffleList(undefined, collectionId, true, true));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionMenuList);
|
||||
export default connect(select, {
|
||||
doCollectionEdit,
|
||||
doOpenModal,
|
||||
doCollectionDelete,
|
||||
})(CollectionMenuList);
|
||||
@@ -7,35 +7,19 @@ import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import { useHistory } from 'react-router';
|
||||
import { formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
||||
|
||||
type Props = {
|
||||
inline?: boolean,
|
||||
doOpenModal: (string, {}) => void,
|
||||
collectionName?: string,
|
||||
collectionId: string,
|
||||
playNextUri: string,
|
||||
doToggleShuffleList: (string) => void,
|
||||
};
|
||||
|
||||
function CollectionMenuList(props: Props) {
|
||||
const { inline = false, collectionId, collectionName, doOpenModal, playNextUri, doToggleShuffleList } = props;
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const { inline = false, collectionId, collectionName, doOpenModal } = props;
|
||||
|
||||
const { push } = useHistory();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (playNextUri && doShuffle) {
|
||||
setDoShuffle(false);
|
||||
const navigateUrl = formatLbryUrlForWeb(playNextUri);
|
||||
push({
|
||||
pathname: navigateUrl,
|
||||
search: generateListSearchUrlParams(collectionId),
|
||||
state: { forceAutoplay: true },
|
||||
});
|
||||
}
|
||||
}, [collectionId, doShuffle, playNextUri, push]);
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
@@ -51,21 +35,9 @@ function CollectionMenuList(props: Props) {
|
||||
{collectionId && collectionName && (
|
||||
<>
|
||||
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
|
||||
<a className="menu__link" href={`/$/${PAGES.LIST}/${collectionId}`}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.VIEW} />
|
||||
{__('View List')}
|
||||
</a>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
doToggleShuffleList(collectionId);
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
|
||||
@@ -7,7 +7,8 @@ import TruncatedText from 'component/common/truncated-text';
|
||||
import CollectionCount from './collectionCount';
|
||||
import CollectionPrivate from './collectionPrivate';
|
||||
import CollectionMenuList from 'component/collectionMenuList';
|
||||
import { formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
|
||||
type Props = {
|
||||
@@ -61,12 +62,16 @@ function CollectionPreviewTile(props: Props) {
|
||||
if (collectionId && hasClaim && resolveCollectionItems) {
|
||||
resolveCollectionItems({ collectionId, page_size: 5 });
|
||||
}
|
||||
}, [collectionId, hasClaim, resolveCollectionItems]);
|
||||
}, [collectionId, hasClaim]);
|
||||
|
||||
// const signingChannel = claim && claim.signing_channel;
|
||||
|
||||
const navigateUrl =
|
||||
formatLbryUrlForWeb(collectionItemUrls[0] || '/') + (collectionId ? generateListSearchUrlParams(collectionId) : '');
|
||||
let navigateUrl = formatLbryUrlForWeb(collectionItemUrls[0] || '/');
|
||||
if (collectionId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
|
||||
function handleClick(e) {
|
||||
if (navigateUrl) {
|
||||
|
||||
@@ -4,16 +4,14 @@ import {
|
||||
selectMyPublishedPlaylistCollections,
|
||||
selectMyUnpublishedCollections, // should probably distinguish types
|
||||
// selectSavedCollections,
|
||||
selectFetchingMyCollections,
|
||||
} from 'lbry-redux';
|
||||
import CollectionsListMine from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
builtinCollections: selectBuiltinCollections(state),
|
||||
publishedCollections: selectMyPublishedPlaylistCollections(state),
|
||||
publishedPlaylists: selectMyPublishedPlaylistCollections(state),
|
||||
unpublishedCollections: selectMyUnpublishedCollections(state),
|
||||
// savedCollections: selectSavedCollections(state),
|
||||
fetchingCollections: selectFetchingMyCollections(state),
|
||||
});
|
||||
|
||||
export default connect(select)(CollectionsListMine);
|
||||
@@ -7,81 +7,49 @@ import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
|
||||
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,
|
||||
publishedPlaylists: CollectionGroup,
|
||||
unpublishedCollections: CollectionGroup,
|
||||
// savedCollections: CollectionGroup,
|
||||
fetchingCollections: boolean,
|
||||
};
|
||||
|
||||
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
|
||||
fetchingCollections,
|
||||
} = 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<*>) {
|
||||
if (e.keyCode === KEYCODES.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) => {
|
||||
@@ -100,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>
|
||||
@@ -128,65 +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 && !fetchingCollections && (
|
||||
<div className="claim-grid__title--empty">{__('(Empty) --[indicates empty playlist]--')}</div>
|
||||
)}
|
||||
{!hasCollections && fetchingCollections && (
|
||||
{!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 && !fetchingCollections && (
|
||||
{!hasCollections && (
|
||||
<div className="main--empty">
|
||||
<Yrbl type={'sad'} title={__('You have no lists yet. Better start hoarding!')} />
|
||||
</div>
|
||||
)}
|
||||
{!hasCollections && fetchingCollections && (
|
||||
<div className="main--empty">
|
||||
<h2 className="main--empty empty">{__('Loading...')}</h2>
|
||||
<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,11 +10,7 @@ import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import {
|
||||
selectLinkedCommentAncestors,
|
||||
makeSelectOthersReactionsForComment,
|
||||
makeSelectTotalReplyPagesForParentId,
|
||||
} from 'redux/selectors/comments';
|
||||
import { selectLinkedCommentAncestors, makeSelectOthersReactionsForComment } from 'redux/selectors/comments';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import Comment from './view';
|
||||
@@ -35,7 +31,6 @@ const select = (state, props) => {
|
||||
playingUri: selectPlayingUri(state),
|
||||
stakedLevel: makeSelectStakedLevelForChannelUri(props.authorUri)(state),
|
||||
linkedCommentAncestors: selectLinkedCommentAncestors(state),
|
||||
totalReplyPages: makeSelectTotalReplyPagesForParentId(props.commentId)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
||||
import { SORT_BY, COMMENT_PAGE_SIZE_REPLIES } from 'constants/comment';
|
||||
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
|
||||
import { SITE_NAME, SIMPLE_SITE, ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
@@ -12,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';
|
||||
@@ -43,7 +40,6 @@ type Props = {
|
||||
commentIsMine: boolean, // if this comment was signed by an owned channel
|
||||
updateComment: (string, string) => void,
|
||||
fetchReplies: (string, string, number, number, number) => void,
|
||||
totalReplyPages: number,
|
||||
commentModBlock: (string) => void,
|
||||
linkedCommentId?: string,
|
||||
linkedCommentAncestors: { [string]: Array<string> },
|
||||
@@ -63,15 +59,11 @@ type Props = {
|
||||
stakedLevel: number,
|
||||
supportAmount: number,
|
||||
numDirectReplies: number,
|
||||
isModerator: boolean,
|
||||
isGlobalMod: boolean,
|
||||
isFiat: boolean,
|
||||
supportDisabled: boolean,
|
||||
setQuickReply: (any) => void,
|
||||
quickReply: any,
|
||||
isFiat: boolean
|
||||
};
|
||||
|
||||
const LENGTH_TO_COLLAPSE = 300;
|
||||
const ESCAPE_KEY = 27;
|
||||
|
||||
function Comment(props: Props) {
|
||||
const {
|
||||
@@ -87,7 +79,6 @@ function Comment(props: Props) {
|
||||
commentId,
|
||||
updateComment,
|
||||
fetchReplies,
|
||||
totalReplyPages,
|
||||
linkedCommentId,
|
||||
linkedCommentAncestors,
|
||||
commentingEnabled,
|
||||
@@ -101,12 +92,7 @@ function Comment(props: Props) {
|
||||
stakedLevel,
|
||||
supportAmount,
|
||||
numDirectReplies,
|
||||
isModerator,
|
||||
isGlobalMod,
|
||||
isFiat,
|
||||
supportDisabled,
|
||||
setQuickReply,
|
||||
quickReply,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
@@ -119,6 +105,8 @@ function Comment(props: Props) {
|
||||
const [isEditing, setEditing] = useState(false);
|
||||
const [editedMessage, setCommentValue] = useState(message);
|
||||
const [charCount, setCharCount] = useState(editedMessage.length);
|
||||
// used for controlling the visibility of the menu icon
|
||||
const [mouseIsHovering, setMouseHover] = useState(false);
|
||||
const [showReplies, setShowReplies] = useState(false);
|
||||
const [page, setPage] = useState(0);
|
||||
const [advancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
@@ -157,7 +145,7 @@ function Comment(props: Props) {
|
||||
|
||||
// a user will try and press the escape key to cancel editing their comment
|
||||
const handleEscape = (event) => {
|
||||
if (event.keyCode === KEYCODES.ESCAPE) {
|
||||
if (event.keyCode === ESCAPE_KEY) {
|
||||
setEditing(false);
|
||||
}
|
||||
};
|
||||
@@ -190,7 +178,6 @@ function Comment(props: Props) {
|
||||
|
||||
function handleSubmit() {
|
||||
updateComment(commentId, editedMessage);
|
||||
if (setQuickReply) setQuickReply({ ...quickReply, comment_id: commentId, comment: editedMessage });
|
||||
setEditing(false);
|
||||
}
|
||||
|
||||
@@ -218,10 +205,12 @@ function Comment(props: Props) {
|
||||
'comment--superchat': supportAmount > 0,
|
||||
})}
|
||||
id={commentId}
|
||||
onMouseOver={() => setMouseHover(true)}
|
||||
onMouseOut={() => setMouseHover(false)}
|
||||
>
|
||||
<div
|
||||
className={classnames('comment__content', {
|
||||
[COMMENT_HIGHLIGHTED]: linkedCommentId && linkedCommentId === commentId,
|
||||
'comment--highlighted': linkedCommentId && linkedCommentId === commentId,
|
||||
'comment--slimed': slimedToDeath && !displayDeadComment,
|
||||
})}
|
||||
>
|
||||
@@ -236,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>
|
||||
) : (
|
||||
@@ -283,7 +256,11 @@ function Comment(props: Props) {
|
||||
<div className="comment__menu">
|
||||
<Menu>
|
||||
<MenuButton className="menu__button">
|
||||
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
|
||||
<Icon
|
||||
size={18}
|
||||
className={mouseIsHovering ? 'comment__menu-icon--hovering' : 'comment__menu-icon'}
|
||||
icon={ICONS.MORE_VERTICAL}
|
||||
/>
|
||||
</MenuButton>
|
||||
<CommentMenuList
|
||||
uri={uri}
|
||||
@@ -294,7 +271,6 @@ function Comment(props: Props) {
|
||||
commentIsMine={commentIsMine}
|
||||
handleEditComment={handleEditComment}
|
||||
supportAmount={supportAmount}
|
||||
setQuickReply={setQuickReply}
|
||||
/>
|
||||
</Menu>
|
||||
</div>
|
||||
@@ -376,19 +352,13 @@ function Comment(props: Props) {
|
||||
setPage(1);
|
||||
}
|
||||
}}
|
||||
icon={ICONS.DOWN}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{numDirectReplies > 0 && showReplies && (
|
||||
<div className="comment__actions">
|
||||
<Button
|
||||
label={__('Hide replies')}
|
||||
button="link"
|
||||
onClick={() => setShowReplies(false)}
|
||||
icon={ICONS.UP}
|
||||
/>
|
||||
<Button label={__('Hide replies')} button="link" onClick={() => setShowReplies(false)} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -404,7 +374,6 @@ function Comment(props: Props) {
|
||||
onCancelReplying={() => {
|
||||
setReplying(false);
|
||||
}}
|
||||
supportDisabled={supportDisabled}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
@@ -421,7 +390,6 @@ function Comment(props: Props) {
|
||||
linkedCommentId={linkedCommentId}
|
||||
numDirectReplies={numDirectReplies}
|
||||
onShowMore={() => setPage(page + 1)}
|
||||
hasMore={page < totalReplyPages}
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
|
||||
@@ -7,43 +7,30 @@ import {
|
||||
doSendTip,
|
||||
} from 'lbry-redux';
|
||||
import { doOpenModal, doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doCommentCreate, doFetchCreatorSettings, doCommentById } 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)),
|
||||
fetchComment: (commentId) => dispatch(doCommentById(commentId, false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentCreate);
|
||||
@@ -1,13 +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 * as KEYCODES from 'constants/keycodes';
|
||||
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';
|
||||
@@ -16,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';
|
||||
@@ -32,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,
|
||||
@@ -48,17 +49,13 @@ type Props = {
|
||||
claimIsMine: boolean,
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
supportDisabled: boolean,
|
||||
doFetchCreatorSettings: (channelId: string) => Promise<any>,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
setQuickReply: (any) => void,
|
||||
fetchComment: (commentId: string) => Promise<any>,
|
||||
shouldFetchComment: boolean,
|
||||
disabled: boolean,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
const {
|
||||
createComment,
|
||||
commentsDisabledBySettings,
|
||||
claim,
|
||||
channels,
|
||||
onDoneReplying,
|
||||
@@ -74,12 +71,6 @@ export function CommentCreate(props: Props) {
|
||||
claimIsMine,
|
||||
sendTip,
|
||||
doToast,
|
||||
doFetchCreatorSettings,
|
||||
settingsByChannelId,
|
||||
supportDisabled,
|
||||
setQuickReply,
|
||||
fetchComment,
|
||||
shouldFetchComment,
|
||||
} = props;
|
||||
const buttonRef: ElementRef<any> = React.useRef();
|
||||
const {
|
||||
@@ -89,7 +80,7 @@ export function CommentCreate(props: Props) {
|
||||
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
||||
const [commentFailure, setCommentFailure] = React.useState(false);
|
||||
const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });
|
||||
const claimId = claim && claim.claim_id;
|
||||
const { claim_id: claimId } = claim;
|
||||
const [isSupportComment, setIsSupportComment] = React.useState();
|
||||
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
|
||||
const [tipAmount, setTipAmount] = React.useState(1);
|
||||
@@ -99,52 +90,8 @@ export function CommentCreate(props: Props) {
|
||||
const charCount = commentValue.length;
|
||||
const [activeTab, setActiveTab] = React.useState('');
|
||||
const [tipError, setTipError] = React.useState();
|
||||
const [deletedComment, setDeletedComment] = React.useState(false);
|
||||
const disabled = deletedComment || 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;
|
||||
|
||||
// Fetch top-level comments to identify if it has been deleted and can reply to it
|
||||
React.useEffect(() => {
|
||||
if (shouldFetchComment && fetchComment) {
|
||||
fetchComment(parentId).then((result) => {
|
||||
setDeletedComment(String(result).includes('Error'));
|
||||
});
|
||||
}
|
||||
}, [fetchComment, shouldFetchComment, parentId]);
|
||||
|
||||
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;
|
||||
@@ -158,7 +105,8 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
|
||||
function altEnterListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if ((livestream || e.ctrlKey || e.metaKey) && e.keyCode === KEYCODES.ENTER) {
|
||||
const KEYCODE_ENTER = 13;
|
||||
if ((livestream || e.ctrlKey || e.metaKey) && e.keyCode === KEYCODE_ENTER) {
|
||||
e.preventDefault();
|
||||
buttonRef.current.click();
|
||||
}
|
||||
@@ -183,15 +131,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;
|
||||
@@ -199,29 +138,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,
|
||||
@@ -231,19 +147,6 @@ 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;
|
||||
}
|
||||
|
||||
setIsSubmitting(true);
|
||||
|
||||
if (activeTab === TAB_LBC) {
|
||||
@@ -257,17 +160,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 });
|
||||
},
|
||||
() => {
|
||||
@@ -276,6 +168,19 @@ 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;
|
||||
|
||||
@@ -283,8 +188,7 @@ export function CommentCreate(props: Props) {
|
||||
'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,
|
||||
@@ -340,7 +244,6 @@ export function CommentCreate(props: Props) {
|
||||
createComment(commentValue, claimId, parentId, txid, payment_intent_id, environment)
|
||||
.then((res) => {
|
||||
setIsSubmitting(false);
|
||||
if (setQuickReply) setQuickReply(res);
|
||||
|
||||
if (res && res.signature) {
|
||||
setCommentValue('');
|
||||
@@ -356,12 +259,6 @@ export function CommentCreate(props: Props) {
|
||||
.catch(() => {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -369,26 +266,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"
|
||||
@@ -406,7 +288,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>
|
||||
@@ -435,7 +322,7 @@ export function CommentCreate(props: Props) {
|
||||
<Button
|
||||
autoFocus
|
||||
button="primary"
|
||||
disabled={disabled || !minAmountMet}
|
||||
disabled={disabled}
|
||||
label={
|
||||
isSubmitting
|
||||
? __('Sending...')
|
||||
@@ -445,13 +332,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>
|
||||
);
|
||||
@@ -467,7 +348,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={
|
||||
@@ -505,71 +386,59 @@ 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={isSubmitting}
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={() => setIsSupportComment(false)}
|
||||
/>
|
||||
<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}
|
||||
/>
|
||||
{!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="alt"
|
||||
className="thatButton"
|
||||
icon={ICONS.LBC}
|
||||
onClick={() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!supportDisabled && !claimIsMine && (
|
||||
<>
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="alt"
|
||||
className="thatButton"
|
||||
icon={ICONS.LBC}
|
||||
onClick={() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
}}
|
||||
/>
|
||||
{/* @if TARGET='web' */}
|
||||
{stripeEnvironment && (
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="alt"
|
||||
className="thisButton"
|
||||
icon={ICONS.FINANCE}
|
||||
onClick={() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
</>
|
||||
{!claimIsMine && (
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="alt"
|
||||
className="thisButton"
|
||||
icon={ICONS.FINANCE}
|
||||
onClick={() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isReply && !minTip && (
|
||||
{isReply && (
|
||||
<Button
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
@@ -582,8 +451,6 @@ export function CommentCreate(props: Props) {
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{deletedComment && <div className="error__text">{__('This comment has been deleted.')}</div>}
|
||||
{MinAmountNotice}
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doCommentPin, doCommentModAddDelegate } from 'redux/actions/comments';
|
||||
import {
|
||||
doCommentPin,
|
||||
doCommentModBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModBlockAsModerator,
|
||||
doCommentModAddDelegate,
|
||||
} from 'redux/actions/comments';
|
||||
import { doChannelMute } from 'redux/actions/blocked';
|
||||
// import { doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
@@ -25,6 +31,10 @@ const perform = (dispatch) => ({
|
||||
muteChannel: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
pinComment: (commentId, claimId, remove) => dispatch(doCommentPin(commentId, claimId, remove)),
|
||||
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
|
||||
commentModBlock: (commenterUri) => dispatch(doCommentModBlock(commenterUri)),
|
||||
commentModBlockAsAdmin: (commenterUri, blockerId) => dispatch(doCommentModBlockAsAdmin(commenterUri, blockerId)),
|
||||
commentModBlockAsModerator: (commenterUri, creatorId, blockerId) =>
|
||||
dispatch(doCommentModBlockAsModerator(commenterUri, creatorId, blockerId)),
|
||||
commentModAddDelegate: (modChanId, modChanName, creatorChannelClaim) =>
|
||||
dispatch(doCommentModAddDelegate(modChanId, modChanName, creatorChannelClaim, true)),
|
||||
});
|
||||
|
||||
@@ -6,38 +6,34 @@ import { MenuList, MenuItem } from '@reach/menu-button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import Icon from 'component/common/icon';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
|
||||
type Props = {
|
||||
uri: ?string,
|
||||
claim: ?Claim,
|
||||
clearPlayingUri: () => void,
|
||||
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
|
||||
commentId: string, // sha256 digest identifying the comment
|
||||
isTopLevel: boolean,
|
||||
isPinned: boolean,
|
||||
commentIsMine: boolean, // if this comment was signed by an owned channel
|
||||
disableEdit?: boolean,
|
||||
disableRemove?: boolean,
|
||||
supportAmount?: any,
|
||||
isPinned: boolean,
|
||||
pinComment: (string, string, boolean) => Promise<any>,
|
||||
muteChannel: (string) => void,
|
||||
handleEditComment: () => void,
|
||||
// --- select ---
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
contentChannelPermanentUrl: any,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
playingUri: ?PlayingUri,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
// --- perform ---
|
||||
openModal: (id: string, {}) => void,
|
||||
clearPlayingUri: () => void,
|
||||
muteChannel: (string) => void,
|
||||
pinComment: (string, string, boolean) => Promise<any>,
|
||||
isTopLevel: boolean,
|
||||
commentModBlock: (string) => void,
|
||||
commentModBlockAsAdmin: (string, string) => void,
|
||||
commentModBlockAsModerator: (string, string, string) => void,
|
||||
commentModAddDelegate: (string, string, ChannelClaim) => void,
|
||||
setQuickReply: (any) => void,
|
||||
playingUri: ?PlayingUri,
|
||||
disableEdit?: boolean,
|
||||
disableRemove?: boolean,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
openModal: (id: string, {}) => void,
|
||||
supportAmount?: any,
|
||||
};
|
||||
|
||||
function CommentMenuList(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
claim,
|
||||
authorUri,
|
||||
commentIsMine,
|
||||
@@ -50,17 +46,26 @@ function CommentMenuList(props: Props) {
|
||||
isTopLevel,
|
||||
isPinned,
|
||||
handleEditComment,
|
||||
commentModBlock,
|
||||
commentModBlockAsAdmin,
|
||||
commentModBlockAsModerator,
|
||||
commentModAddDelegate,
|
||||
playingUri,
|
||||
moderationDelegatorsById,
|
||||
disableEdit,
|
||||
disableRemove,
|
||||
moderationDelegatorsById,
|
||||
openModal,
|
||||
supportAmount,
|
||||
setQuickReply,
|
||||
} = props;
|
||||
|
||||
const contentChannelClaim = getChannelFromClaim(claim);
|
||||
const contentChannelClaim = !claim
|
||||
? null
|
||||
: claim.value_type === 'channel'
|
||||
? claim
|
||||
: claim.signing_channel && claim.is_channel_signature_valid
|
||||
? claim.signing_channel
|
||||
: null;
|
||||
|
||||
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
||||
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
||||
const activeChannelIsAdmin = activeChannelClaim && activeModeratorInfo && activeModeratorInfo.global;
|
||||
@@ -78,17 +83,11 @@ function CommentMenuList(props: Props) {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
}
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, {
|
||||
commentId,
|
||||
commentIsMine,
|
||||
contentChannelPermanentUrl,
|
||||
supportAmount,
|
||||
setQuickReply,
|
||||
});
|
||||
openModal(MODALS.CONFIRM_REMOVE_COMMENT, { commentId, commentIsMine, contentChannelPermanentUrl, supportAmount });
|
||||
}
|
||||
|
||||
function handleCommentBlock() {
|
||||
openModal(MODALS.BLOCK_CHANNEL, { contentUri: uri, commenterUri: authorUri });
|
||||
commentModBlock(authorUri);
|
||||
}
|
||||
|
||||
function handleCommentMute() {
|
||||
@@ -102,57 +101,16 @@ function CommentMenuList(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function getBlockOptionElem() {
|
||||
const isPersonalBlockTheOnlyOption = !activeChannelIsModerator && !activeChannelIsAdmin;
|
||||
const isTimeoutBlockAvailable = (claim && claim.is_my_output) || activeChannelIsModerator;
|
||||
const personalPermanentBlockOnly = isPersonalBlockTheOnlyOption && !isTimeoutBlockAvailable;
|
||||
|
||||
function getSubtitle() {
|
||||
if (personalPermanentBlockOnly) {
|
||||
return {
|
||||
line1: __('Prevent this channel from interacting with you.'),
|
||||
line2: null,
|
||||
};
|
||||
} else {
|
||||
if (activeChannelIsModerator && activeChannelIsAdmin) {
|
||||
return {
|
||||
line1: __('Personal | Moderator | Admin'),
|
||||
line2: __('Choose a permanent or temporary ban.'),
|
||||
};
|
||||
} else if (activeChannelIsModerator && !activeChannelIsAdmin) {
|
||||
return {
|
||||
line1: __('Personal | Moderator'),
|
||||
line2: __('Choose a permanent or temporary ban.'),
|
||||
};
|
||||
} else if (!activeChannelIsModerator && activeChannelIsAdmin) {
|
||||
return {
|
||||
line1: __('Personal | Admin'),
|
||||
line2: __('Choose a permanent or temporary ban.'),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
line1: null,
|
||||
line2: __('Choose a permanent or temporary ban.'),
|
||||
};
|
||||
}
|
||||
}
|
||||
function blockCommentAsModerator() {
|
||||
if (activeChannelClaim && contentChannelClaim) {
|
||||
commentModBlockAsModerator(authorUri, contentChannelClaim.claim_id, activeChannelClaim.claim_id);
|
||||
}
|
||||
}
|
||||
|
||||
const subtitle = getSubtitle();
|
||||
return (
|
||||
<>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.BLOCK} />
|
||||
{__('Block')}
|
||||
</div>
|
||||
{subtitle.line1 && <span className="comment__menu-help">{subtitle.line1}</span>}
|
||||
{subtitle.line2 && (
|
||||
<span className="comment__menu-help">
|
||||
{subtitle.line2} {!personalPermanentBlockOnly && <Icon aria-hidden icon={ICONS.EXTERNAL} />}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
function blockCommentAsAdmin() {
|
||||
if (activeChannelClaim) {
|
||||
commentModBlockAsAdmin(authorUri, activeChannelClaim.claim_id);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -206,7 +164,13 @@ function CommentMenuList(props: Props) {
|
||||
|
||||
{!commentIsMine && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCommentBlock}>
|
||||
{getBlockOptionElem()}
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.BLOCK} />
|
||||
{__('Block')}
|
||||
</div>
|
||||
{activeChannelIsCreator && (
|
||||
<span className="comment__menu-help">{__('Prevent this channel from interacting with you.')}</span>
|
||||
)}
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
@@ -222,6 +186,34 @@ function CommentMenuList(props: Props) {
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{(activeChannelIsAdmin || activeChannelIsModerator) && (
|
||||
<div className="comment__menu-title">{__('Moderator tools')}</div>
|
||||
)}
|
||||
|
||||
{!commentIsMine && activeChannelIsAdmin && (
|
||||
<MenuItem className="comment__menu-option" onSelect={blockCommentAsAdmin}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.GLOBE} />
|
||||
{__('Global Block')}
|
||||
</div>
|
||||
<span className="comment__menu-help">{__('Block this channel as global admin')}</span>
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{!commentIsMine && activeChannelIsModerator && (
|
||||
<MenuItem className="comment__menu-option" onSelect={blockCommentAsModerator}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.BLOCK} />
|
||||
{__('Moderator Block')}
|
||||
</div>
|
||||
<span className="comment__menu-help">
|
||||
{__('Block this channel on behalf of %creator%', {
|
||||
creator: contentChannelClaim ? contentChannelClaim.name : __('creator'),
|
||||
})}
|
||||
</span>
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{activeChannelClaim && (
|
||||
<div className="comment__menu-active">
|
||||
<ChannelThumbnail xsmall noLazyLoad uri={activeChannelClaim.permanent_url} />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import Comment from './view';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri, doResolveUri } from 'lbry-redux';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { makeSelectMyReactionsForComment, makeSelectOthersReactionsForComment } from 'redux/selectors/comments';
|
||||
import { doCommentReact } from 'redux/actions/comments';
|
||||
@@ -21,7 +21,6 @@ const select = (state, props) => {
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolve: (uri) => dispatch(doResolveUri(uri)),
|
||||
react: (commentId, type) => dispatch(doCommentReact(commentId, type)),
|
||||
doToast: (params) => dispatch(doToast(params)),
|
||||
});
|
||||
|
||||
@@ -17,38 +17,16 @@ type Props = {
|
||||
pendingCommentReacts: Array<string>,
|
||||
claimIsMine: boolean,
|
||||
activeChannelId: ?string,
|
||||
uri: string,
|
||||
claim: ?ChannelClaim,
|
||||
doToast: ({ message: string }) => void,
|
||||
hideCreatorLike: boolean,
|
||||
resolve: (string) => void,
|
||||
};
|
||||
|
||||
export default function CommentReactions(props: Props) {
|
||||
const {
|
||||
myReacts,
|
||||
othersReacts,
|
||||
commentId,
|
||||
react,
|
||||
claimIsMine,
|
||||
uri,
|
||||
claim,
|
||||
activeChannelId,
|
||||
doToast,
|
||||
hideCreatorLike,
|
||||
resolve,
|
||||
} = props;
|
||||
const { myReacts, othersReacts, commentId, react, claimIsMine, claim, activeChannelId, doToast } = props;
|
||||
const {
|
||||
push,
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!claim) {
|
||||
resolve(uri);
|
||||
}
|
||||
}, [claim, resolve, uri]);
|
||||
|
||||
const canCreatorReact =
|
||||
claim &&
|
||||
claimIsMine &&
|
||||
@@ -70,7 +48,7 @@ export default function CommentReactions(props: Props) {
|
||||
}
|
||||
return count;
|
||||
};
|
||||
const shouldHide = !canCreatorReact && hideCreatorLike;
|
||||
|
||||
const creatorLiked = getCountForReact(REACTION_TYPES.CREATOR_LIKE) > 0;
|
||||
const likeIcon = SIMPLE_SITE
|
||||
? myReacts.includes(REACTION_TYPES.LIKE)
|
||||
@@ -127,8 +105,9 @@ export default function CommentReactions(props: Props) {
|
||||
label={<span className="comment__reaction-count">{getCountForReact(REACTION_TYPES.DISLIKE)}</span>}
|
||||
/>
|
||||
|
||||
{!shouldHide && ENABLE_CREATOR_REACTIONS && (canCreatorReact || creatorLiked) && (
|
||||
{ENABLE_CREATOR_REACTIONS && (canCreatorReact || creatorLiked) && (
|
||||
<Button
|
||||
iconOnly
|
||||
disabled={!canCreatorReact || !claimIsMine}
|
||||
requiresAuth={IS_WEB}
|
||||
title={claimIsMine ? __('You loved this') : __('Creator loved this')}
|
||||
@@ -137,7 +116,7 @@ export default function CommentReactions(props: Props) {
|
||||
onClick={() => react(commentId, REACTION_TYPES.CREATOR_LIKE)}
|
||||
>
|
||||
{creatorLiked && (
|
||||
<ChannelThumbnail xsmall uri={authorUri} hideStakedIndicator className="comment__creator-like" allowGifs />
|
||||
<ChannelThumbnail xsmall uri={authorUri} hideStakedIndicator className="comment__creator-like" />
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// @flow
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL, SORT_BY } from 'constants/comment';
|
||||
import React, { useEffect } from 'react';
|
||||
import classnames from 'classnames';
|
||||
@@ -15,13 +14,9 @@ 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;
|
||||
|
||||
// "3" due to 2 separate fetches needed + 1 buffer just in case.
|
||||
const MAX_LINKED_COMMENT_SCROLL_ATTEMPTS = 3;
|
||||
|
||||
function scaleToDevicePixelRatio(value) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
if (devicePixelRatio < 1.0) {
|
||||
@@ -32,15 +27,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,
|
||||
@@ -51,7 +45,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) {
|
||||
@@ -62,10 +55,9 @@ function CommentList(props: Props) {
|
||||
fetchReacts,
|
||||
resetComments,
|
||||
uri,
|
||||
pinnedComments,
|
||||
topLevelComments,
|
||||
topLevelTotalPages,
|
||||
claim,
|
||||
commentsDisabledBySettings,
|
||||
claimIsMine,
|
||||
myChannels,
|
||||
isFetchingComments,
|
||||
@@ -76,21 +68,16 @@ function CommentList(props: Props) {
|
||||
myReactsByCommentId,
|
||||
othersReactsById,
|
||||
activeChannelId,
|
||||
settingsByChannelId,
|
||||
} = props;
|
||||
|
||||
const commentRef = React.useRef();
|
||||
const spinnerRef = React.useRef();
|
||||
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 [lcScrollAttempts, setLcScrollAttempts] = React.useState(
|
||||
linkedCommentId ? 0 : MAX_LINKED_COMMENT_SCROLL_ATTEMPTS
|
||||
);
|
||||
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
|
||||
@@ -119,34 +106,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) {
|
||||
@@ -202,19 +161,11 @@ function CommentList(props: Props) {
|
||||
|
||||
// Scroll to linked-comment
|
||||
useEffect(() => {
|
||||
if (lcScrollAttempts < MAX_LINKED_COMMENT_SCROLL_ATTEMPTS && readyToDisplayComments && !isFetchingComments) {
|
||||
const elems = document.getElementsByClassName(COMMENT_HIGHLIGHTED);
|
||||
if (elems.length > 0) {
|
||||
setLcScrollAttempts(MAX_LINKED_COMMENT_SCROLL_ATTEMPTS);
|
||||
const linkedComment = elems[0];
|
||||
linkedComment.scrollIntoView({ block: 'start' });
|
||||
window.scrollBy(0, -125);
|
||||
} else {
|
||||
setLcScrollAttempts(lcScrollAttempts + 1);
|
||||
}
|
||||
if (readyToDisplayComments && linkedCommentId && commentRef && commentRef.current) {
|
||||
commentRef.current.scrollIntoView({ block: 'start' });
|
||||
window.scrollBy(0, -125);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [readyToDisplayComments, isFetchingComments]); // We just want to respond to these, nothing else.
|
||||
}, [readyToDisplayComments, linkedCommentId]);
|
||||
|
||||
// Infinite scroll
|
||||
useEffect(() => {
|
||||
@@ -267,6 +218,8 @@ function CommentList(props: Props) {
|
||||
topLevelTotalPages,
|
||||
]);
|
||||
|
||||
const displayedComments = readyToDisplayComments ? topLevelComments : [];
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={
|
||||
@@ -326,7 +279,7 @@ 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?')} />
|
||||
)}
|
||||
|
||||
@@ -335,14 +288,38 @@ function CommentList(props: Props) {
|
||||
comments: expandedComments,
|
||||
'comments--contracted': !expandedComments,
|
||||
})}
|
||||
ref={commentRef}
|
||||
>
|
||||
{readyToDisplayComments && pinnedComments && getCommentElems(pinnedComments)}
|
||||
{readyToDisplayComments && topLevelComments && getCommentElems(topLevelComments)}
|
||||
{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) && (
|
||||
{moreBelow && (
|
||||
<Button
|
||||
button="link"
|
||||
title={!expandedComments ? __('Expand Comments') : __('Load More')}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsMine, selectMyChannelClaims } from 'lbry-redux';
|
||||
import { selectIsFetchingCommentsByParentId, makeSelectRepliesForParentId } from 'redux/selectors/comments';
|
||||
import {
|
||||
selectIsFetchingCommentsByParentId,
|
||||
makeSelectRepliesForParentId,
|
||||
makeSelectTotalRepliesForParentId,
|
||||
} from 'redux/selectors/comments';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import CommentsReplies from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
fetchedReplies: makeSelectRepliesForParentId(props.parentId)(state),
|
||||
totalReplies: makeSelectTotalRepliesForParentId(props.parentId)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
|
||||
@@ -4,9 +4,11 @@ import React from 'react';
|
||||
import Comment from 'component/comment';
|
||||
import Button from 'component/button';
|
||||
import Spinner from 'component/spinner';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
|
||||
type Props = {
|
||||
fetchedReplies: Array<any>,
|
||||
totalReplies: number,
|
||||
uri: string,
|
||||
parentId: string,
|
||||
claimIsMine: boolean,
|
||||
@@ -14,11 +16,9 @@ type Props = {
|
||||
linkedCommentId?: string,
|
||||
commentingEnabled: boolean,
|
||||
threadDepth: number,
|
||||
numDirectReplies: number, // Total replies for parentId as reported by 'comment[replies]'. Includes blocked items.
|
||||
numDirectReplies: number,
|
||||
isFetchingByParentId: { [string]: boolean },
|
||||
onShowMore?: () => void,
|
||||
hasMore: boolean,
|
||||
supportDisabled: boolean,
|
||||
};
|
||||
|
||||
function CommentsReplies(props: Props) {
|
||||
@@ -26,6 +26,7 @@ function CommentsReplies(props: Props) {
|
||||
uri,
|
||||
parentId,
|
||||
fetchedReplies,
|
||||
totalReplies,
|
||||
claimIsMine,
|
||||
myChannels,
|
||||
linkedCommentId,
|
||||
@@ -34,8 +35,6 @@ function CommentsReplies(props: Props) {
|
||||
numDirectReplies,
|
||||
isFetchingByParentId,
|
||||
onShowMore,
|
||||
hasMore,
|
||||
supportDisabled,
|
||||
} = props;
|
||||
|
||||
const [isExpanded, setExpanded] = React.useState(true);
|
||||
@@ -98,17 +97,31 @@ function CommentsReplies(props: Props) {
|
||||
commentingEnabled={commentingEnabled}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
supportDisabled={supportDisabled}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{!isFetchingByParentId[parentId] && totalReplies < numDirectReplies && (
|
||||
<li className="comment comment--reply">
|
||||
<div className="comment__content">
|
||||
<div className="comment__thumbnail-wrapper">
|
||||
<ChannelThumbnail xsmall className="comment__author-thumbnail" />
|
||||
</div>
|
||||
<div className="comment__body-container comment--blocked">
|
||||
<div className="comment__meta">
|
||||
<em>---</em>
|
||||
</div>
|
||||
<div>
|
||||
<em>{__('Comment(s) blocked.')}</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isExpanded && fetchedReplies && hasMore && (
|
||||
{isExpanded && fetchedReplies && displayedComments.length < totalReplies && (
|
||||
<div className="comment__actions--nested">
|
||||
<Button button="link" label={__('Show more')} onClick={showMore} className="button--uri-indicator" />
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,6 @@ type Props = {
|
||||
title?: string | Node,
|
||||
subtitle?: string | Node,
|
||||
titleActions?: string | Node,
|
||||
id?: string,
|
||||
body?: string | Node,
|
||||
actions?: string | Node,
|
||||
icon?: string,
|
||||
@@ -31,7 +30,6 @@ export default function Card(props: Props) {
|
||||
title,
|
||||
subtitle,
|
||||
titleActions,
|
||||
id,
|
||||
body,
|
||||
actions,
|
||||
icon,
|
||||
@@ -55,7 +53,6 @@ export default function Card(props: Props) {
|
||||
className={classnames(className, 'card', {
|
||||
'card__multi-pane': Boolean(secondPane),
|
||||
})}
|
||||
id={id}
|
||||
onClick={(e) => {
|
||||
if (onClick) {
|
||||
onClick();
|
||||
|
||||
@@ -49,11 +49,6 @@ class CreditAmount extends React.PureComponent<Props> {
|
||||
isFiat,
|
||||
} = this.props;
|
||||
const minimumRenderableAmount = 10 ** (-1 * precision);
|
||||
|
||||
// return null, otherwise it will try and convert undefined to a string
|
||||
if (amount === undefined) {
|
||||
return null;
|
||||
}
|
||||
const fullPrice = formatFullPrice(amount, 2);
|
||||
const isFree = parseFloat(amount) === 0;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { FormField } from 'component/common/form';
|
||||
type Props = {
|
||||
type: string,
|
||||
currentPath?: ?string,
|
||||
onFileChosen: (WebFile) => void,
|
||||
onFileChosen: WebFile => void,
|
||||
label?: string,
|
||||
placeholder?: string,
|
||||
accept?: string,
|
||||
@@ -19,6 +19,17 @@ type Props = {
|
||||
class FileSelector extends React.PureComponent<Props> {
|
||||
static defaultProps = {
|
||||
autoFocus: false,
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps: Props) {
|
||||
// If the form has just been cleared,
|
||||
// clear the file input
|
||||
if (prevProps.currentPath && !this.props.currentPath) {
|
||||
this.fileInput.current.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
type: 'file',
|
||||
};
|
||||
|
||||
@@ -28,7 +39,6 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
super();
|
||||
this.fileInput = React.createRef();
|
||||
this.handleFileInputSelection = this.handleFileInputSelection.bind(this);
|
||||
this.handleDirectoryInputSelection = this.handleDirectoryInputSelection.bind(this);
|
||||
this.fileInputButton = this.fileInputButton.bind(this);
|
||||
}
|
||||
|
||||
@@ -43,7 +53,6 @@ class FileSelector extends React.PureComponent<Props> {
|
||||
if (this.props.onFileChosen) {
|
||||
this.props.onFileChosen(file);
|
||||
}
|
||||
this.fileInput.current.value = null; // clear the file input
|
||||
};
|
||||
|
||||
handleDirectoryInputSelection = () => {
|
||||
|
||||
@@ -201,26 +201,6 @@ export const icons = {
|
||||
[ICONS.SUBSCRIBE]: buildIcon(
|
||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
||||
),
|
||||
[ICONS.SUBSCRIBED]: (props: IconProps) => {
|
||||
const { size = 24, color = 'currentColor', ...otherProps } = props;
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width={size}
|
||||
height={size}
|
||||
fill={color}
|
||||
stroke={color}
|
||||
strokeWidth="1"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
{...otherProps}
|
||||
>
|
||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
|
||||
</svg>
|
||||
);
|
||||
},
|
||||
|
||||
[ICONS.UNSUBSCRIBE]: buildIcon(
|
||||
<path d="M 12,5.67 10.94,4.61 C 5.7533356,-0.57666427 -2.0266644,7.2033357 3.16,12.39 l 1.06,1.06 7.78,7.78 7.78,-7.78 1.06,-1.06 c 2.149101,-2.148092 2.149101,-5.6319078 0,-7.78 -2.148092,-2.1491008 -5.631908,-2.1491008 -7.78,0 L 9.4481298,8.2303201 15.320603,9.2419066 11.772427,13.723825" />
|
||||
),
|
||||
@@ -2338,23 +2318,6 @@ export const icons = {
|
||||
<path d="M.75 19.497a3.75 3.75 0 107.5 0 3.75 3.75 0 10-7.5 0zM.75 8.844a11.328 11.328 0 0114.4 14.4M.75 1.113a18.777 18.777 0 0122.139 22.123" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.APPEARANCE]: buildIcon(
|
||||
<g>
|
||||
<path d="M16.022,15.624c.3,3.856,6.014,1.2,5.562,2.54-2.525,7.481-12.648,5.685-16.966,1.165A10.9,10.9,0,0,1,4.64,4.04C8.868-.188,16.032-.495,19.928,4.018,27.56,12.858,15.758,12.183,16.022,15.624Z" />
|
||||
<path d="M5.670 13.309 A1.520 1.520 0 1 0 8.710 13.309 A1.520 1.520 0 1 0 5.670 13.309 Z" />
|
||||
<path d="M9.430 18.144 A1.520 1.520 0 1 0 12.470 18.144 A1.520 1.520 0 1 0 9.430 18.144 Z" />
|
||||
<path d="M13.066 5.912 A1.520 1.520 0 1 0 16.106 5.912 A1.520 1.520 0 1 0 13.066 5.912 Z" />
|
||||
<path d="M6.620 7.524 A1.520 1.520 0 1 0 9.660 7.524 A1.520 1.520 0 1 0 6.620 7.524 Z" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.CONTENT]: buildIcon(
|
||||
<g>
|
||||
<path d="M15.750 16.500 A1.500 1.500 0 1 0 18.750 16.500 A1.500 1.500 0 1 0 15.750 16.500 Z" />
|
||||
<path d="M18.524,10.7l.442,1.453a.994.994,0,0,0,1.174.681l1.472-.341a1.339,1.339,0,0,1,1.275,2.218l-1.031,1.111a1,1,0,0,0,0,1.362l1.031,1.111a1.339,1.339,0,0,1-1.275,2.218l-1.472-.341a.994.994,0,0,0-1.174.681L18.524,22.3a1.33,1.33,0,0,1-2.548,0l-.442-1.453a.994.994,0,0,0-1.174-.681l-1.472.341a1.339,1.339,0,0,1-1.275-2.218l1.031-1.111a1,1,0,0,0,0-1.362l-1.031-1.111a1.339,1.339,0,0,1,1.275-2.218l1.472.341a.994.994,0,0,0,1.174-.681l.442-1.453A1.33,1.33,0,0,1,18.524,10.7Z" />
|
||||
<path d="M8.25,20.25h-6a1.5,1.5,0,0,1-1.5-1.5V2.25A1.5,1.5,0,0,1,2.25.75H12.879a1.5,1.5,0,0,1,1.06.439l2.872,2.872a1.5,1.5,0,0,1,.439,1.06V6.75" />
|
||||
<path d="M6.241,12.678a.685.685,0,0,1-.991-.613V7.435a.685.685,0,0,1,.991-.613l4.631,2.316a.684.684,0,0,1,0,1.224Z" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.STAR]: buildIcon(
|
||||
<g>
|
||||
<path d="M12.729 1.2l3.346 6.629 6.44.638a.805.805 0 01.5 1.374l-5.3 5.253 1.965 7.138a.813.813 0 01-1.151.935L12 19.934l-6.52 3.229a.813.813 0 01-1.151-.935l1.965-7.138L.99 9.837a.805.805 0 01.5-1.374l6.44-.638L11.271 1.2a.819.819 0 011.458 0z" />
|
||||
@@ -2368,105 +2331,11 @@ 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>
|
||||
),
|
||||
[ICONS.BADGE_STREAMER]: (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="-1182 401 24 24"
|
||||
xmlSpace="preserve"
|
||||
>
|
||||
<style type="text/css">{'.st0{fill:#FF5490}.st1{fill:#81BBB9}.st2{fill:#2E2A2F}.st3{fill:#FFFFFF}'}</style>
|
||||
<path
|
||||
className="st0"
|
||||
d="M-1169.8,406.4c-4.3,0-7.8,3.5-7.8,7.8c0,0.4,0,0.8,0.1,1.1h1c-0.1-0.4-0.1-0.7-0.1-1.1c0-3.7,3-6.8,6.8-6.8 s6.8,3,6.8,6.8c0,0.4,0,0.8-0.1,1.1h1c0.1-0.4,0.1-0.7,0.1-1.1C-1162.1,409.9-1165.5,406.4-1169.8,406.4z"
|
||||
/>
|
||||
<path
|
||||
className="st0"
|
||||
d="M-1180,414.2c0-5.6,4.6-10.2,10.2-10.2c5.6,0,10.2,4.6,10.2,10.2c0,2.2-0.7,4.3-1.9,5.9l0.8,0.6 c1.3-1.8,2.1-4.1,2.1-6.5c0-6.2-5-11.2-11.2-11.2c-6.2,0-11.2,5-11.2,11.2c0,2.1,0.6,4.1,1.6,5.8l1-0.3 C-1179.4,418-1180,416.2-1180,414.2z"
|
||||
/>
|
||||
<path className="st1" d="M-1163.7,419.4" />
|
||||
<path
|
||||
className="st1"
|
||||
d="M-1165.6,418.5c0-0.1,0-3.6,0-3.6c0-1.9-1-4.3-4.4-4.3s-4.4,2.4-4.4,4.3c0,0,0,3.6,0,3.6 c-1.4,0.2-1.8,0.7-1.8,0.7s2.2,2.7,6.2,2.7s6.2-2.7,6.2-2.7S-1164.2,418.7-1165.6,418.5z"
|
||||
/>
|
||||
<path
|
||||
className="st2"
|
||||
d="M-1169.2,418.5h-1.5c-1.7,0-3.1-0.6-3.1-2.2v-1.9c0-2.1,1.6-3,3.9-3s3.9,0.9,3.9,3v1.9 C-1166.1,417.8-1167.5,418.5-1169.2,418.5z"
|
||||
/>
|
||||
<path
|
||||
className="st3"
|
||||
d="M-1167.8,416.2c-0.2,0-0.4-0.2-0.4-0.4v-1.1c0-0.2,0-1-1.2-1c-0.2,0-0.4-0.2-0.4-0.4s0.2-0.4,0.4-0.4 c1.2,0,2,0.6,2,1.7v1.1C-1167.4,416.1-1167.6,416.2-1167.8,416.2z"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
[ICONS.PLAY]: buildIcon(<polygon points="5 3 19 12 5 21 5 3" />),
|
||||
[ICONS.PLAY_PREVIOUS]: buildIcon(
|
||||
[ICONS.DESKTOP]: buildIcon(
|
||||
<g>
|
||||
<polygon points="19 20 9 12 19 4 19 20" />
|
||||
<line x1="5" y1="19" x2="5" y2="5" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.REPLAY]: buildIcon(
|
||||
<g>
|
||||
<polyline points="1 4 1 10 7 10" />
|
||||
<path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.REPEAT]: buildIcon(
|
||||
<g>
|
||||
<polyline points="17 1 21 5 17 9" />
|
||||
<path d="M3 11V9a4 4 0 0 1 4-4h14" />
|
||||
<polyline points="7 23 3 19 7 15" />
|
||||
<path d="M21 13v2a4 4 0 0 1-4 4H3" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.SHUFFLE]: buildIcon(
|
||||
<g>
|
||||
<polyline points="16 3 21 3 21 8" />
|
||||
<line x1="4" y1="20" x2="21" y2="3" />
|
||||
<polyline points="21 16 21 21 16 21" />
|
||||
<line x1="15" y1="15" x2="21" y2="21" />
|
||||
<line x1="4" y1="4" x2="9" y2="9" />
|
||||
<rect x="2" y="3" width="20" height="14" rx="2" ry="2" />
|
||||
<line x1="8" y1="21" x2="16" y2="21" />
|
||||
<line x1="12" y1="17" x2="12" y2="21" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
@@ -10,18 +10,16 @@ const PAGINATE_PARAM = 'page';
|
||||
type Props = {
|
||||
totalPages: number,
|
||||
location: { search: string },
|
||||
history: { push: (string) => void },
|
||||
onPageChange?: (number) => void,
|
||||
disableHistory?: boolean, // Disables the use of '&page=' param and history stack.
|
||||
history: { push: string => void },
|
||||
onPageChange?: number => void,
|
||||
};
|
||||
|
||||
function Paginate(props: Props) {
|
||||
const { totalPages = 1, location, history, onPageChange, disableHistory } = props;
|
||||
const { totalPages = 1, location, history, onPageChange } = props;
|
||||
const { search } = location;
|
||||
const [textValue, setTextValue] = React.useState('');
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const initialPage = disableHistory ? 1 : Number(urlParams.get(PAGINATE_PARAM)) || 1;
|
||||
const [currentPage, setCurrentPage] = React.useState(initialPage);
|
||||
const currentPage = Number(urlParams.get(PAGINATE_PARAM)) || 1;
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
function handleChangePage(newPageNumber: number) {
|
||||
@@ -30,13 +28,9 @@ function Paginate(props: Props) {
|
||||
}
|
||||
|
||||
if (currentPage !== newPageNumber) {
|
||||
setCurrentPage(newPageNumber);
|
||||
|
||||
if (!disableHistory) {
|
||||
const params = new URLSearchParams(search);
|
||||
params.set(PAGINATE_PARAM, newPageNumber.toString());
|
||||
history.push('?' + params.toString());
|
||||
}
|
||||
const params = new URLSearchParams(search);
|
||||
params.set(PAGINATE_PARAM, newPageNumber.toString());
|
||||
history.push('?' + params.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +58,7 @@ function Paginate(props: Props) {
|
||||
nextClassName="pagination__item pagination__item--next"
|
||||
breakClassName="pagination__item pagination__item--break"
|
||||
marginPagesDisplayed={2}
|
||||
onPageChange={(e) => handleChangePage(e.selected + 1)}
|
||||
onPageChange={e => handleChangePage(e.selected + 1)}
|
||||
forcePage={currentPage - 1}
|
||||
initialPage={currentPage - 1}
|
||||
containerClassName="pagination"
|
||||
@@ -73,7 +67,7 @@ function Paginate(props: Props) {
|
||||
{!isMobile && (
|
||||
<FormField
|
||||
value={textValue}
|
||||
onChange={(e) => setTextValue(e.target.value)}
|
||||
onChange={e => setTextValue(e.target.value)}
|
||||
className="paginate-channel"
|
||||
label={__('Go to page:')}
|
||||
type="text"
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -12,12 +12,12 @@ type Props = {
|
||||
uri: string,
|
||||
thumbnail: string,
|
||||
claim: ?Claim,
|
||||
doResolveUri: (string) => void,
|
||||
doFetchCostInfoForUri: (string) => void,
|
||||
doResolveUri: string => void,
|
||||
doFetchCostInfoForUri: string => void,
|
||||
costInfo: ?{ cost: number },
|
||||
floatingPlayerEnabled: boolean,
|
||||
doPlayUri: (string, ?boolean, ?boolean, (GetResponse) => void) => void,
|
||||
doAnaltyicsPurchaseEvent: (GetResponse) => void,
|
||||
doAnaltyicsPurchaseEvent: GetResponse => void,
|
||||
parentCommentId?: string,
|
||||
isMarkdownPost: boolean,
|
||||
doSetPlayingUri: ({}) => void,
|
||||
@@ -69,8 +69,8 @@ export default function EmbedPlayButton(props: Props) {
|
||||
const formattedUrl = formatLbryUrlForWeb(uri);
|
||||
push(formattedUrl);
|
||||
} else {
|
||||
doPlayUri(uri, undefined, undefined, (fileInfo) => {
|
||||
let playingOptions = { uri, pathname, source: undefined, commentId: undefined };
|
||||
doPlayUri(uri, undefined, undefined, fileInfo => {
|
||||
let playingOptions: PlayingUri = { uri, pathname };
|
||||
if (parentCommentId) {
|
||||
playingOptions.source = 'comment';
|
||||
playingOptions.commentId = parentCommentId;
|
||||
|
||||
@@ -99,7 +99,6 @@ function FileActions(props: Props) {
|
||||
React.useEffect(() => {
|
||||
if (downloadClicked && streamingUrl) {
|
||||
webDownloadClaim(streamingUrl, fileName);
|
||||
setDownloadClicked(false);
|
||||
}
|
||||
}, [downloadClicked, streamingUrl, fileName]);
|
||||
// @endif
|
||||
@@ -114,6 +113,10 @@ function FileActions(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleOpenInDesktop() {
|
||||
window.open(claim.permanent_url, '_top');
|
||||
}
|
||||
|
||||
const lhsSection = (
|
||||
<>
|
||||
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} livestream={isLivestreamClaim} />}
|
||||
@@ -189,6 +192,14 @@ function FileActions(props: Props) {
|
||||
</MenuItem>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{IS_WEB && !isMobile && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleOpenInDesktop}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DESKTOP} />
|
||||
{__('Open in Desktop')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
{!claimIsMine && (
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
|
||||
@@ -12,7 +12,7 @@ import { makeSelectFileRenderModeForUri, makeSelectFileExtensionForUri } from 'r
|
||||
import FileRender from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const autoplay = props.embedded ? false : makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state);
|
||||
const autoplay = props.embedded ? false : makeSelectClientSetting(SETTINGS.AUTOPLAY)(state);
|
||||
return {
|
||||
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
|
||||
@@ -4,7 +4,6 @@ import React from 'react';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import VideoViewer from 'component/viewers/videoViewer';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import fs from 'fs';
|
||||
@@ -58,7 +57,7 @@ class FileRender extends React.PureComponent<Props> {
|
||||
}
|
||||
|
||||
escapeListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if (e.keyCode === KEYCODES.ESCAPE) {
|
||||
if (e.keyCode === 27) {
|
||||
e.preventDefault();
|
||||
|
||||
this.exitFullscreen();
|
||||
|
||||
@@ -4,9 +4,6 @@ import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimWasPurchased,
|
||||
makeSelectNextUrlForCollectionAndUrl,
|
||||
makeSelectPreviousUrlForCollectionAndUrl,
|
||||
SETTINGS,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
@@ -16,10 +13,8 @@ import {
|
||||
makeSelectFileRenderModeForUri,
|
||||
} from 'redux/selectors/content';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { doPlayUri, doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doFetchRecommendedContent } from 'redux/actions/search';
|
||||
import { doAnaltyicsPurchaseEvent } from 'redux/actions/app';
|
||||
import { withRouter } from 'react-router';
|
||||
import FileRenderFloating from './view';
|
||||
|
||||
@@ -27,7 +22,6 @@ const select = (state, props) => {
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const primaryUri = selectPrimaryUri(state);
|
||||
const uri = playingUri && playingUri.uri;
|
||||
const collectionId = playingUri && playingUri.collectionId;
|
||||
|
||||
return {
|
||||
uri,
|
||||
@@ -35,36 +29,18 @@ const select = (state, props) => {
|
||||
playingUri,
|
||||
title: makeSelectTitleForUri(uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
||||
mature: makeSelectClaimIsNsfw(uri)(state),
|
||||
mature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
||||
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
||||
videoTheaterMode: makeSelectClientSetting(SETTINGS.VIDEO_THEATER_MODE)(state),
|
||||
costInfo: makeSelectCostInfoForUri(uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
|
||||
nextListUri: collectionId && makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state),
|
||||
previousListUri: collectionId && makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state),
|
||||
collectionId,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
closeFloatingPlayer: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
doFetchRecommendedContent: (uri, mature) => dispatch(doFetchRecommendedContent(uri, mature)),
|
||||
doPlayUri: (uri, collectionId, hideFailModal) =>
|
||||
dispatch(
|
||||
doPlayUri(
|
||||
uri,
|
||||
false,
|
||||
false,
|
||||
(fileInfo) => {
|
||||
dispatch(doAnaltyicsPurchaseEvent(fileInfo));
|
||||
},
|
||||
hideFailModal
|
||||
),
|
||||
dispatch(doSetPlayingUri({ uri, collectionId }))
|
||||
),
|
||||
});
|
||||
|
||||
export default withRouter(connect(select, perform)(FileRenderFloating));
|
||||
@@ -11,12 +11,10 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import { PRIMARY_PLAYER_WRAPPER_CLASS } from 'page/file/view';
|
||||
import Draggable from 'react-draggable';
|
||||
import { onFullscreenChange } from 'util/full-screen';
|
||||
import { generateListSearchUrlParams, formatLbryUrlForWeb } from 'util/url';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import debounce from 'util/debounce';
|
||||
import { useHistory } from 'react-router';
|
||||
import { isURIEqual } from 'lbry-redux';
|
||||
import AutoplayCountdown from 'component/autoplayCountdown';
|
||||
|
||||
const IS_DESKTOP_MAC = typeof process === 'object' ? process.platform === 'darwin' : false;
|
||||
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 60;
|
||||
@@ -36,12 +34,6 @@ type Props = {
|
||||
primaryUri: ?string,
|
||||
videoTheaterMode: boolean,
|
||||
doFetchRecommendedContent: (string, boolean) => void,
|
||||
doPlayUri: (string, string, boolean) => void,
|
||||
collectionId: string,
|
||||
costInfo: any,
|
||||
claimWasPurchased: boolean,
|
||||
nextListUri: string,
|
||||
previousListUri: string,
|
||||
};
|
||||
|
||||
export default function FileRenderFloating(props: Props) {
|
||||
@@ -59,23 +51,15 @@ export default function FileRenderFloating(props: Props) {
|
||||
primaryUri,
|
||||
videoTheaterMode,
|
||||
doFetchRecommendedContent,
|
||||
doPlayUri,
|
||||
collectionId,
|
||||
costInfo,
|
||||
claimWasPurchased,
|
||||
nextListUri,
|
||||
previousListUri,
|
||||
} = props;
|
||||
const { location, push } = useHistory();
|
||||
const hideFloatingPlayer = location.state && location.state.hideFloatingPlayer;
|
||||
const {
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
const isMobile = useIsMobile();
|
||||
const mainFilePlaying = !isFloating && isURIEqual(uri, primaryUri);
|
||||
const mainFilePlaying = playingUri && isURIEqual(playingUri.uri, primaryUri);
|
||||
const [fileViewerRect, setFileViewerRect] = useState();
|
||||
const [desktopPlayStartTime, setDesktopPlayStartTime] = useState();
|
||||
const [wasDragging, setWasDragging] = useState(false);
|
||||
const [doNavigate, setDoNavigate] = useState(false);
|
||||
const [playNextUrl, setPlayNextUrl] = useState(true);
|
||||
const [countdownCanceled, setCountdownCanceled] = useState(false);
|
||||
const [position, setPosition] = usePersistedState('floating-file-viewer:position', {
|
||||
x: -25,
|
||||
y: window.innerHeight - 400,
|
||||
@@ -85,11 +69,6 @@ export default function FileRenderFloating(props: Props) {
|
||||
y: 0,
|
||||
});
|
||||
|
||||
const navigateUrl =
|
||||
playingUri && playingUri.primaryUri + (collectionId ? generateListSearchUrlParams(collectionId) : '');
|
||||
|
||||
const isFree = costInfo && costInfo.cost === 0;
|
||||
const canViewFile = isFree || claimWasPurchased;
|
||||
const playingUriSource = playingUri && playingUri.source;
|
||||
const isPlayable = RENDER_MODES.FLOATING_MODES.includes(renderMode);
|
||||
const isReadyToPlay = isPlayable && (streamingUrl || (fileInfo && fileInfo.completed));
|
||||
@@ -114,7 +93,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
const clampToScreen = React.useCallback((pos) => {
|
||||
function clampToScreen(pos) {
|
||||
const ESTIMATED_SCROLL_BAR_PX = 50;
|
||||
const FLOATING_PLAYER_CLASS = 'content__viewer--floating';
|
||||
const fpPlayerElem = document.querySelector(`.${FLOATING_PLAYER_CLASS}`);
|
||||
@@ -127,7 +106,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
pos.y = getScreenHeight() - fpPlayerElem.getBoundingClientRect().height;
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
|
||||
// Updated 'relativePos' based on persisted 'position':
|
||||
const stringifiedPosition = JSON.stringify(position);
|
||||
@@ -151,11 +130,11 @@ export default function FileRenderFloating(props: Props) {
|
||||
setPosition({ x: pos.x, y: pos.y });
|
||||
}
|
||||
}
|
||||
}, [clampToScreen, isFloating, position.x, position.y, setPosition, stringifiedPosition]);
|
||||
}, [isFloating, stringifiedPosition]);
|
||||
|
||||
// Listen to main-window resizing and adjust the fp position accordingly:
|
||||
useEffect(() => {
|
||||
const handleMainWindowResize = debounce(() => {
|
||||
const handleMainWindowResize = debounce((e) => {
|
||||
let newPos = {
|
||||
x: Math.round(relativePos.x * getScreenWidth()),
|
||||
y: Math.round(relativePos.y * getScreenHeight()),
|
||||
@@ -169,18 +148,20 @@ export default function FileRenderFloating(props: Props) {
|
||||
|
||||
// 'relativePos' is needed in the dependency list to avoid stale closure.
|
||||
// Otherwise, this could just be changed to a one-time effect.
|
||||
}, [clampToScreen, relativePos.x, relativePos.y, setPosition]);
|
||||
}, [relativePos]);
|
||||
|
||||
const handleResize = React.useCallback(() => {
|
||||
function handleResize() {
|
||||
const element = mainFilePlaying
|
||||
? document.querySelector(`.${PRIMARY_PLAYER_WRAPPER_CLASS}`)
|
||||
: document.querySelector(`.${INLINE_PLAYER_WRAPPER_CLASS}`);
|
||||
|
||||
if (!element) return;
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rect = element.getBoundingClientRect();
|
||||
|
||||
// getBoundingClientRect returns a DomRect, not an object
|
||||
// getBoundingCLientRect returns a DomRect, not an object
|
||||
const objectRect = {
|
||||
top: rect.top,
|
||||
right: rect.right,
|
||||
@@ -194,14 +175,13 @@ export default function FileRenderFloating(props: Props) {
|
||||
|
||||
// $FlowFixMe
|
||||
setFileViewerRect({ ...objectRect, windowOffset: window.pageYOffset });
|
||||
}, [mainFilePlaying]);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (playingUri && playingUri.primaryUri) {
|
||||
if (streamingUrl) {
|
||||
handleResize();
|
||||
setCountdownCanceled(false);
|
||||
}
|
||||
}, [handleResize, playingUri, videoTheaterMode]);
|
||||
}, [streamingUrl, pathname, playingUriSource, isFloating, mainFilePlaying]);
|
||||
|
||||
useEffect(() => {
|
||||
handleResize();
|
||||
@@ -212,7 +192,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
window.removeEventListener('resize', handleResize);
|
||||
onFullscreenChange(window, 'remove', handleResize);
|
||||
};
|
||||
}, [handleResize]);
|
||||
}, [setFileViewerRect, isFloating, playingUriSource, mainFilePlaying, videoTheaterMode]);
|
||||
|
||||
useEffect(() => {
|
||||
// @if TARGET='app'
|
||||
@@ -230,46 +210,13 @@ export default function FileRenderFloating(props: Props) {
|
||||
if (isFloating) {
|
||||
doFetchRecommendedContent(uri, mature);
|
||||
}
|
||||
}, [doFetchRecommendedContent, isFloating, mature, uri]);
|
||||
}, [uri, mature, isFloating]);
|
||||
|
||||
const doPlay = React.useCallback(
|
||||
(playUri) => {
|
||||
setDoNavigate(false);
|
||||
if (!isFloating) {
|
||||
const navigateUrl = formatLbryUrlForWeb(playUri);
|
||||
push({
|
||||
pathname: navigateUrl,
|
||||
search: collectionId && generateListSearchUrlParams(collectionId),
|
||||
state: { collectionId, forceAutoplay: true, hideFloatingPlayer: true },
|
||||
});
|
||||
} else {
|
||||
doPlayUri(playUri, collectionId, true);
|
||||
}
|
||||
},
|
||||
[collectionId, doPlayUri, isFloating, push]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!doNavigate) return;
|
||||
|
||||
if (playNextUrl && nextListUri) {
|
||||
doPlay(nextListUri);
|
||||
} else if (previousListUri) {
|
||||
doPlay(previousListUri);
|
||||
}
|
||||
setPlayNextUrl(true);
|
||||
}, [doNavigate, doPlay, nextListUri, playNextUrl, previousListUri]);
|
||||
|
||||
if (
|
||||
!isPlayable ||
|
||||
!uri ||
|
||||
(isFloating && (isMobile || !floatingPlayerEnabled || hideFloatingPlayer)) ||
|
||||
(collectionId && !isFloating && ((!canViewFile && !nextListUri) || countdownCanceled))
|
||||
) {
|
||||
if (!isPlayable || !uri || (isFloating && (isMobile || !floatingPlayerEnabled))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function handleDragStart() {
|
||||
function handleDragStart(e, ui) {
|
||||
// Not really necessary, but reset just in case 'handleStop' didn't fire.
|
||||
setWasDragging(false);
|
||||
}
|
||||
@@ -285,7 +232,7 @@ export default function FileRenderFloating(props: Props) {
|
||||
});
|
||||
}
|
||||
|
||||
function handleDragStop(e) {
|
||||
function handleDragStop(e, ui) {
|
||||
if (wasDragging) {
|
||||
e.stopPropagation();
|
||||
setWasDragging(false);
|
||||
@@ -351,30 +298,12 @@ export default function FileRenderFloating(props: Props) {
|
||||
// @endif
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{collectionId && !canViewFile ? (
|
||||
<div className="content__loading">
|
||||
<AutoplayCountdown
|
||||
nextRecommendedUri={nextListUri}
|
||||
doNavigate={() => setDoNavigate(true)}
|
||||
doReplay={() => doPlayUri(uri, collectionId, false)}
|
||||
doPrevious={() => {
|
||||
setPlayNextUrl(false);
|
||||
setDoNavigate(true);
|
||||
}}
|
||||
onCanceled={() => setCountdownCanceled(true)}
|
||||
skipPaid
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<LoadingScreen status={loadingMessage} />
|
||||
)}
|
||||
</>
|
||||
<LoadingScreen status={loadingMessage} />
|
||||
)}
|
||||
{isFloating && (
|
||||
<div className="draggable content__info">
|
||||
<div className="claim-preview__title" title={title || uri}>
|
||||
<Button label={title || uri} navigate={navigateUrl} button="link" className="content__floating-link" />
|
||||
<Button label={title || uri} navigate={uri} button="link" className="content__floating-link" />
|
||||
</div>
|
||||
<UriIndicator link uri={uri} />
|
||||
</div>
|
||||
|
||||
@@ -4,9 +4,9 @@ import {
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectClaimWasPurchased,
|
||||
SETTINGS,
|
||||
COLLECTIONS_CONSTS,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -15,37 +15,34 @@ import { withRouter } from 'react-router';
|
||||
import {
|
||||
makeSelectIsPlaying,
|
||||
makeSelectShouldObscurePreview,
|
||||
selectPlayingUri,
|
||||
makeSelectInsufficientCreditsForUri,
|
||||
makeSelectFileRenderModeForUri,
|
||||
} from 'redux/selectors/content';
|
||||
import FileRenderInitiator from './view';
|
||||
import { doAnaltyicsPurchaseEvent } from 'redux/actions/app';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
||||
|
||||
return {
|
||||
claimThumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
|
||||
isPlaying: makeSelectIsPlaying(props.uri)(state),
|
||||
insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY_MEDIA)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
collectionId,
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claimThumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
obscurePreview: makeSelectShouldObscurePreview(props.uri)(state),
|
||||
isPlaying: makeSelectIsPlaying(props.uri)(state),
|
||||
playingUri: selectPlayingUri(state),
|
||||
insufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
|
||||
hasCostInfo: Boolean(makeSelectCostInfoForUri(props.uri)(state)),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
play: (uri, collectionId, isPlayable) => {
|
||||
play: (uri) => {
|
||||
dispatch(doSetPrimaryUri(uri));
|
||||
if (isPlayable) dispatch(doSetPlayingUri({ uri, collectionId }));
|
||||
dispatch(doSetPlayingUri({ uri }));
|
||||
dispatch(doPlayUri(uri, undefined, undefined, (fileInfo) => dispatch(doAnaltyicsPurchaseEvent(fileInfo))));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -7,7 +7,6 @@ import React, { useEffect, useCallback } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
import Button from 'component/button';
|
||||
import isUserTyping from 'util/detect-typing';
|
||||
import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
@@ -15,17 +14,21 @@ import Nag from 'component/common/nag';
|
||||
// $FlowFixMe cannot resolve ...
|
||||
import FileRenderPlaceholder from 'static/img/fileRenderPlaceholder.png';
|
||||
|
||||
const SPACE_BAR_KEYCODE = 32;
|
||||
|
||||
type Props = {
|
||||
play: (string, string, boolean) => void,
|
||||
play: (string) => void,
|
||||
isLoading: boolean,
|
||||
isPlaying: boolean,
|
||||
fileInfo: FileListItem,
|
||||
uri: string,
|
||||
history: { push: (string) => void },
|
||||
location: { search: ?string, pathname: string, href: string, state: { forceAutoplay: boolean } },
|
||||
location: { search: ?string, pathname: string },
|
||||
obscurePreview: boolean,
|
||||
insufficientCredits: boolean,
|
||||
claimThumbnail?: string,
|
||||
autoplay: boolean,
|
||||
hasCostInfo: boolean,
|
||||
costInfo: any,
|
||||
inline: boolean,
|
||||
renderMode: string,
|
||||
@@ -33,7 +36,6 @@ type Props = {
|
||||
claimWasPurchased: boolean,
|
||||
authenticated: boolean,
|
||||
videoTheaterMode: boolean,
|
||||
collectionId: string,
|
||||
};
|
||||
|
||||
export default function FileRenderInitiator(props: Props) {
|
||||
@@ -48,27 +50,31 @@ export default function FileRenderInitiator(props: Props) {
|
||||
location,
|
||||
claimThumbnail,
|
||||
renderMode,
|
||||
hasCostInfo,
|
||||
costInfo,
|
||||
claimWasPurchased,
|
||||
authenticated,
|
||||
videoTheaterMode,
|
||||
collectionId,
|
||||
} = props;
|
||||
|
||||
// check if there is a time or autoplay parameter, if so force autoplay
|
||||
const urlTimeParam = location && location.href && location.href.indexOf('t=') > -1;
|
||||
const forceAutoplayParam = location && location.state && location.state.forceAutoplay;
|
||||
const autoplay = forceAutoplayParam || urlTimeParam || props.autoplay;
|
||||
// force autoplay if a timestamp is present
|
||||
let autoplay = props.autoplay;
|
||||
// get current url
|
||||
const url = window.location.href;
|
||||
// check if there is a time parameter, if so force autoplay
|
||||
if (url.indexOf('t=') > -1) {
|
||||
autoplay = true;
|
||||
}
|
||||
|
||||
const isFree = costInfo && costInfo.cost === 0;
|
||||
const canViewFile = isFree || claimWasPurchased;
|
||||
const cost = costInfo && costInfo.cost;
|
||||
const isFree = hasCostInfo && cost === 0;
|
||||
const fileStatus = fileInfo && fileInfo.status;
|
||||
const isPlayable = RENDER_MODES.FLOATING_MODES.includes(renderMode);
|
||||
const isText = RENDER_MODES.TEXT_MODES.includes(renderMode);
|
||||
const [thumbnail, setThumbnail] = React.useState(FileRenderPlaceholder);
|
||||
const containerRef = React.useRef<any>();
|
||||
|
||||
useEffect(() => {
|
||||
React.useEffect(() => {
|
||||
if (claimThumbnail) {
|
||||
setTimeout(() => {
|
||||
let newThumbnail = claimThumbnail;
|
||||
@@ -89,7 +95,7 @@ export default function FileRenderInitiator(props: Props) {
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}, [claimThumbnail, thumbnail]);
|
||||
}, [claimThumbnail]);
|
||||
|
||||
function doAuthRedirect() {
|
||||
history.push(`/$/${PAGES.AUTH}?redirect=${encodeURIComponent(location.pathname)}`);
|
||||
@@ -103,16 +109,16 @@ export default function FileRenderInitiator(props: Props) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
play(uri, collectionId, isPlayable);
|
||||
play(uri);
|
||||
},
|
||||
[play, uri, isPlayable, collectionId]
|
||||
[play, uri]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// This is just for beginning to download a file
|
||||
// Play/Pause/Fullscreen will be handled by the respective viewers because not every file type should behave the same
|
||||
function handleKeyDown(e: KeyboardEvent) {
|
||||
if (!isUserTyping() && e.keyCode === KEYCODES.SPACEBAR) {
|
||||
if (!isUserTyping() && e.keyCode === SPACE_BAR_KEYCODE) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!isPlaying || fileStatus === 'stopped') {
|
||||
@@ -130,20 +136,19 @@ export default function FileRenderInitiator(props: Props) {
|
||||
useEffect(() => {
|
||||
const videoOnPage = document.querySelector('video');
|
||||
if (
|
||||
(canViewFile || forceAutoplayParam) &&
|
||||
((autoplay && (!videoOnPage || forceAutoplayParam) && isPlayable) ||
|
||||
RENDER_MODES.AUTO_RENDER_MODES.includes(renderMode))
|
||||
(isFree || claimWasPurchased) &&
|
||||
((autoplay && !videoOnPage && isPlayable) || RENDER_MODES.AUTO_RENDER_MODES.includes(renderMode))
|
||||
) {
|
||||
viewFile();
|
||||
}
|
||||
}, [autoplay, canViewFile, forceAutoplayParam, isPlayable, renderMode, viewFile]);
|
||||
}, [autoplay, viewFile, isFree, renderMode, isPlayable, claimWasPurchased]);
|
||||
|
||||
/*
|
||||
once content is playing, let the appropriate <FileRender> take care of it...
|
||||
but for playables, always render so area can be used to fill with floating player
|
||||
*/
|
||||
if (isPlaying && !isPlayable) {
|
||||
if (canViewFile && !collectionId) {
|
||||
if (isFree || claimWasPurchased) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ $transition-duration: 300ms;
|
||||
|
||||
// Classnames must line up with classes in classes.js
|
||||
.ff-container {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
|
||||
.ff-image {
|
||||
z-index: $base-zindex;
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectViewCountForUri } from 'lbryinc';
|
||||
import { selectLanguage } from 'redux/selectors/settings';
|
||||
import FileViewCountInline from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
viewCount: makeSelectViewCountForUri(props.uri)(state),
|
||||
lang: selectLanguage(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, null)(FileViewCountInline);
|
||||
@@ -1,41 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
isLivestream?: boolean,
|
||||
// --- select ---
|
||||
claim: ?StreamClaim,
|
||||
viewCount: string,
|
||||
lang: ?string,
|
||||
};
|
||||
|
||||
export default function FileViewCountInline(props: Props) {
|
||||
const { isLivestream, claim, viewCount, lang } = props;
|
||||
let formattedViewCount;
|
||||
|
||||
try {
|
||||
formattedViewCount = Number(viewCount).toLocaleString(lang || 'en', {
|
||||
compactDisplay: 'short',
|
||||
notation: 'compact',
|
||||
});
|
||||
} catch (err) {
|
||||
// No soup for you!
|
||||
formattedViewCount = Number(viewCount).toLocaleString();
|
||||
}
|
||||
|
||||
if (!viewCount || (claim && claim.repost_url) || isLivestream) {
|
||||
// (1) Currently, makeSelectViewCountForUri doesn't differentiate between
|
||||
// un-fetched view-count vs zero view-count. But since it's probably not
|
||||
// ideal to highlight that a view has 0 count, let's just not show anything.
|
||||
// (2) No idea how to get the repost source's claim ID from the repost claim,
|
||||
// so hiding it for now.
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="view_count">
|
||||
{viewCount !== 1 ? __('%view_count% views', { view_count: formattedViewCount }) : __('1 view')}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -37,10 +37,7 @@ function FileWatchLaterLink(props: Props) {
|
||||
});
|
||||
}
|
||||
|
||||
// text that will show if you keep cursor over button
|
||||
const title = hasClaimInWatchLater ? __('Remove from Watch Later') : __('Add to Watch Later');
|
||||
|
||||
// label that is shown after hover
|
||||
const label = !hasClaimInWatchLater ? __('Add') : __('Added');
|
||||
|
||||
return (
|
||||
@@ -55,6 +52,7 @@ function FileWatchLaterLink(props: Props) {
|
||||
(isHovering ? ICONS.COMPLETED : ICONS.TIME)
|
||||
}
|
||||
onClick={(e) => handleWatchLater(e)}
|
||||
aria-hidden={!focusable}
|
||||
tabIndex={focusable ? 0 : -1}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ import { getDefaultHomepageKey } from 'util/default-languages';
|
||||
|
||||
type Props = {
|
||||
homepage: string,
|
||||
setHomepage: (string) => void,
|
||||
setHomepage: string => void,
|
||||
};
|
||||
|
||||
function SelectHomepage(props: Props) {
|
||||
@@ -26,10 +26,12 @@ function SelectHomepage(props: Props) {
|
||||
<FormField
|
||||
name="homepage_select"
|
||||
type="select"
|
||||
label={__('Homepage')}
|
||||
onChange={handleSetHomepage}
|
||||
value={homepage || getDefaultHomepageKey()}
|
||||
helper={__('Tailor your experience.')}
|
||||
>
|
||||
{Object.keys(homepages).map((hp) => (
|
||||
{Object.keys(homepages).map(hp => (
|
||||
<option key={'hp' + hp} value={hp}>
|
||||
{`${LANGUAGES[hp][1]}`}
|
||||
</option>
|
||||
|
||||
@@ -11,7 +11,7 @@ import LbcSymbol from 'component/common/lbc-symbol';
|
||||
|
||||
type Props = {
|
||||
errorMessage: ?string,
|
||||
inviteNew: (string) => void,
|
||||
inviteNew: string => void,
|
||||
isPending: boolean,
|
||||
referralLink: string,
|
||||
referralCode: string,
|
||||
@@ -35,10 +35,10 @@ function InviteNew(props: Props) {
|
||||
const [referralSource, setReferralSource] = useState(referralCode);
|
||||
|
||||
const handleReferralChange = React.useCallback(
|
||||
(code) => {
|
||||
code => {
|
||||
setReferralSource(code);
|
||||
// TODO: keep track of this in an array?
|
||||
const matchingChannel = channels && channels.find((ch) => ch.name === code);
|
||||
const matchingChannel = channels && channels.find(ch => ch.name === code);
|
||||
if (matchingChannel) {
|
||||
analytics.apiLogPublish(matchingChannel);
|
||||
}
|
||||
@@ -68,85 +68,80 @@ function InviteNew(props: Props) {
|
||||
}, [topChannel, handleReferralChange]);
|
||||
|
||||
function lookupUrlByClaimName(name, channels) {
|
||||
const claim = channels.find((channel) => channel.name === name);
|
||||
const claim = channels.find(channel => channel.name === name);
|
||||
return claim && claim.canonical_url ? claim.canonical_url.replace('lbry://', '') : name;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={'columns'}>
|
||||
<div className="column">
|
||||
<Card
|
||||
title={__('Invites')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ SITE_NAME, lbc: <LbcSymbol /> }}>
|
||||
Earn %lbc% for inviting subscribers, followers, fans, friends, etc. to join and follow you on %SITE_NAME%.
|
||||
You can use invites just like affiliate links.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<CopyableText label={__('Your invite link')} copyable={referral} />
|
||||
{channels && channels.length > 0 && (
|
||||
<FormField
|
||||
type="select"
|
||||
label={__('Customize link')}
|
||||
value={referralSource}
|
||||
onChange={(e) => handleReferralChange(e.target.value)}
|
||||
>
|
||||
{channels.map((channel) => (
|
||||
<option key={channel.claim_id} value={channel.name}>
|
||||
{channel.name}
|
||||
</option>
|
||||
))}
|
||||
<option value={referralCode}>{referralCode}</option>
|
||||
</FormField>
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="column">
|
||||
<Card
|
||||
title={__('Invite by email')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ SITE_NAME, lbc: <LbcSymbol /> }}>
|
||||
Invite someone you know by email and earn %lbc% when they join %SITE_NAME%.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormField
|
||||
type="text"
|
||||
label={__('Email')}
|
||||
placeholder="youremail@example.org"
|
||||
name="email"
|
||||
value={email}
|
||||
error={errorMessage}
|
||||
inputButton={
|
||||
<Button button="secondary" type="submit" label={__('Invite')} disabled={isPending || !email} />
|
||||
}
|
||||
onChange={(event) => {
|
||||
handleEmailChanged(event);
|
||||
<Card
|
||||
title={__('Invites')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ SITE_NAME, lbc: <LbcSymbol /> }}>
|
||||
Earn %lbc% for inviting subscribers, followers, fans, friends, etc. to join and follow you on %SITE_NAME%.
|
||||
You can use invites just like affiliate links.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<CopyableText label={__('Your invite link')} copyable={referral} />
|
||||
{channels && channels.length > 0 && (
|
||||
<FormField
|
||||
type="select"
|
||||
label={__('Customize link')}
|
||||
value={referralSource}
|
||||
onChange={e => handleReferralChange(e.target.value)}
|
||||
>
|
||||
{channels.map(channel => (
|
||||
<option key={channel.claim_id} value={channel.name}>
|
||||
{channel.name}
|
||||
</option>
|
||||
))}
|
||||
<option value={referralCode}>{referralCode}</option>
|
||||
</FormField>
|
||||
)}
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
|
||||
<Card
|
||||
title={__('Invite by email')}
|
||||
subtitle={
|
||||
<I18nMessage tokens={{ SITE_NAME, lbc: <LbcSymbol /> }}>
|
||||
Invite someone you know by email and earn %lbc% when they join %SITE_NAME%.
|
||||
</I18nMessage>
|
||||
}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormField
|
||||
type="text"
|
||||
label={__('Email')}
|
||||
placeholder="youremail@example.org"
|
||||
name="email"
|
||||
value={email}
|
||||
error={errorMessage}
|
||||
inputButton={
|
||||
<Button button="secondary" type="submit" label={__('Invite')} disabled={isPending || !email} />
|
||||
}
|
||||
onChange={event => {
|
||||
handleEmailChanged(event);
|
||||
}}
|
||||
/>
|
||||
<p className="help">
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />,
|
||||
referral_faq_link: <Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />,
|
||||
}}
|
||||
/>
|
||||
<p className="help">
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />,
|
||||
referral_faq_link: (
|
||||
<Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />
|
||||
),
|
||||
}}
|
||||
>
|
||||
Read our %referral_faq_link% to learn more about rewards.
|
||||
</I18nMessage>
|
||||
</p>
|
||||
</Form>
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
>
|
||||
Read our %referral_faq_link% to learn more about rewards.
|
||||
</I18nMessage>
|
||||
</p>
|
||||
</Form>
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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,28 +20,12 @@ 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);
|
||||
|
||||
@@ -51,6 +34,8 @@ function LivestreamComment(props: Props) {
|
||||
className={classnames('livestream-comment', {
|
||||
'livestream-comment--superchat': supportAmount > 0,
|
||||
})}
|
||||
onMouseOver={() => setMouseHover(true)}
|
||||
onMouseOut={() => setMouseHover(false)}
|
||||
>
|
||||
{supportAmount > 0 && (
|
||||
<div className="super-chat livestream-superchat__banner">
|
||||
@@ -62,30 +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>
|
||||
)}
|
||||
|
||||
{commentByOwnerOfContent && (
|
||||
<Tooltip label={__('Streamer')}>
|
||||
<span className="comment__badge">
|
||||
<Icon icon={ICONS.BADGE_STREAMER} size={16} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Button
|
||||
className={classnames('button--uri-indicator comment__author', {
|
||||
'comment__author--creator': commentByOwnerOfContent,
|
||||
@@ -96,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>
|
||||
@@ -112,7 +66,11 @@ function LivestreamComment(props: Props) {
|
||||
<div className="livestream-comment__menu">
|
||||
<Menu>
|
||||
<MenuButton className="menu__button">
|
||||
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
|
||||
<Icon
|
||||
size={18}
|
||||
className={mouseIsHovering ? 'comment__menu-icon--hovering' : 'comment__menu-icon'}
|
||||
icon={ICONS.MORE_VERTICAL}
|
||||
/>
|
||||
</MenuButton>
|
||||
<CommentMenuList
|
||||
uri={uri}
|
||||
@@ -120,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),
|
||||
|
||||
@@ -9,7 +9,6 @@ import UriIndicator from 'component/uriIndicator';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import Tooltip from 'component/common/tooltip';
|
||||
import * as ICONS from 'constants/icons';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -20,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) {
|
||||
@@ -38,35 +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 [showPinned, setShowPinned] = React.useState(true);
|
||||
const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false);
|
||||
const claimId = claim && claim.claim_id;
|
||||
const commentsLength = commentsByChronologicalOrder && commentsByChronologicalOrder.length;
|
||||
|
||||
// which kind of superchat to display, either
|
||||
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(() => {
|
||||
@@ -83,134 +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);
|
||||
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));
|
||||
|
||||
// for top to bottom display, oldest superchat on top most recent on bottom
|
||||
superChatsReversed = clonedSuperchats
|
||||
.sort((a, b) => {
|
||||
return b.timestamp - a.timestamp;
|
||||
}); }
|
||||
|
||||
// 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;
|
||||
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);
|
||||
}
|
||||
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">
|
||||
@@ -233,84 +187,36 @@ export default function LivestreamComments(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{pinnedComment && showPinned && viewMode === VIEW_MODE_CHAT && (
|
||||
<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)}
|
||||
/>
|
||||
<Button
|
||||
title={__('Dismiss pinned comment')}
|
||||
button="inverse"
|
||||
className="close-button"
|
||||
onClick={() => setShowPinned(false)}
|
||||
icon={ICONS.REMOVE}
|
||||
/>
|
||||
</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)}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/* listing comments on top of eachother */}
|
||||
{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 && viewMode === VIEW_MODE_CHAT && (
|
||||
{!scrollBottom && (
|
||||
<Button
|
||||
button="secondary"
|
||||
className="livestream__comments__scroll-to-recent"
|
||||
button="alt"
|
||||
className="livestream__comments-scroll__down"
|
||||
label={__('Recent Comments')}
|
||||
onClick={restoreScrollPos}
|
||||
iconRight={ICONS.DOWN}
|
||||
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>
|
||||
</>
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function LivestreamLayout(props: Props) {
|
||||
{Boolean(chatDisabled) && (
|
||||
<div className="help--notice">
|
||||
{channelName
|
||||
? __('%channel% has disabled chat for this stream. Enjoy the stream!', { channel: channelName })
|
||||
? __('%channelName% has disabled chat for this stream. Enjoy the stream!', { channelName })
|
||||
: __('This channel has disabled chat for this stream. Enjoy the stream!')}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting } from 'redux/actions/settings';
|
||||
import { selectDaemonSettings } from 'redux/selectors/settings';
|
||||
import MaxPurchasePrice from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
daemonSettings: selectDaemonSettings(state),
|
||||
});
|
||||
const perform = (dispatch) => ({
|
||||
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(MaxPurchasePrice);
|
||||
@@ -1,72 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { FormField, FormFieldPrice } from 'component/common/form';
|
||||
|
||||
type Price = {
|
||||
currency: string,
|
||||
amount: number,
|
||||
};
|
||||
|
||||
type DaemonSettings = {
|
||||
download_dir: string,
|
||||
share_usage_data: boolean,
|
||||
max_key_fee?: Price,
|
||||
max_connections_per_download?: number,
|
||||
save_files: boolean,
|
||||
save_blobs: boolean,
|
||||
ffmpeg_path: string,
|
||||
};
|
||||
|
||||
type SetDaemonSettingArg = boolean | string | number | Price;
|
||||
|
||||
type Props = {
|
||||
daemonSettings: DaemonSettings,
|
||||
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
|
||||
};
|
||||
|
||||
export default function MaxPurchasePrice(props: Props) {
|
||||
const { daemonSettings, setDaemonSetting } = props;
|
||||
|
||||
const defaultMaxKeyFee = { currency: 'USD', amount: 50 };
|
||||
const disableMaxKeyFee = !(daemonSettings && daemonSettings.max_key_fee);
|
||||
|
||||
function onKeyFeeDisableChange(isDisabled: boolean) {
|
||||
if (isDisabled) {
|
||||
setDaemonSetting('max_key_fee');
|
||||
}
|
||||
}
|
||||
|
||||
function onKeyFeeChange(newValue: Price) {
|
||||
setDaemonSetting('max_key_fee', newValue);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="no_max_purchase_no_limit"
|
||||
checked={disableMaxKeyFee}
|
||||
label={__('No Limit')}
|
||||
onChange={() => onKeyFeeDisableChange(true)}
|
||||
/>
|
||||
<FormField
|
||||
type="radio"
|
||||
name="max_purchase_limit"
|
||||
checked={!disableMaxKeyFee}
|
||||
onChange={() => {
|
||||
onKeyFeeDisableChange(false);
|
||||
onKeyFeeChange(defaultMaxKeyFee);
|
||||
}}
|
||||
label={__('Choose limit')}
|
||||
/>
|
||||
|
||||
<FormFieldPrice
|
||||
name="max_key_fee"
|
||||
min={0}
|
||||
onChange={onKeyFeeChange}
|
||||
price={daemonSettings.max_key_fee ? daemonSettings.max_key_fee : defaultMaxKeyFee}
|
||||
disabled={disableMaxKeyFee}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -16,11 +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';
|
||||
import CommentReactions from 'component/commentReactions';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import CommentsReplies from 'component/commentsReplies';
|
||||
|
||||
type Props = {
|
||||
notification: WebNotification,
|
||||
@@ -34,14 +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 [isReplying, setReplying] = React.useState(false);
|
||||
const [quickReply, setQuickReply] = React.useState();
|
||||
|
||||
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) {
|
||||
@@ -57,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:
|
||||
@@ -72,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:
|
||||
@@ -100,59 +97,21 @@ 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) {
|
||||
const result = fullTitle.join(' ');
|
||||
return <LbcMessage key={result}>{result}</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);
|
||||
}
|
||||
}
|
||||
|
||||
function handleReadNotification(e) {
|
||||
e.stopPropagation();
|
||||
doReadNotifications([id]);
|
||||
}
|
||||
|
||||
const Wrapper = menuButton
|
||||
? (props: { children: any }) => (
|
||||
<MenuItem className="menu__link--notification" onSelect={handleNotificationClick}>
|
||||
@@ -161,9 +120,9 @@ export default function Notification(props: Props) {
|
||||
)
|
||||
: notificationLink
|
||||
? (props: { children: any }) => (
|
||||
<NavLink {...navLinkProps} className="menu__link--notification" onClick={handleNotificationClick}>
|
||||
<a className="menu__link--notification" onClick={handleNotificationClick}>
|
||||
{props.children}
|
||||
</NavLink>
|
||||
</a>
|
||||
)
|
||||
: (props: { children: any }) => (
|
||||
<span
|
||||
@@ -175,23 +134,29 @@ export default function Notification(props: Props) {
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('notification__wrapper', {
|
||||
'notification__wrapper--unread': !is_read,
|
||||
})}
|
||||
>
|
||||
<Wrapper>
|
||||
<Wrapper>
|
||||
<div
|
||||
className={classnames('notification__wrapper', {
|
||||
'notification__wrapper--unread': !is_read,
|
||||
})}
|
||||
>
|
||||
<div className="notification__icon">{icon}</div>
|
||||
|
||||
<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 title={commentText} className="notification__text">
|
||||
<div className="notification__title">
|
||||
<LbcMessage>{notification_parameters.device.title}</LbcMessage>
|
||||
</div>
|
||||
<div title={commentText} className="notification__text mobile-hidden">
|
||||
{commentText}
|
||||
</div>
|
||||
</>
|
||||
@@ -219,15 +184,7 @@ export default function Notification(props: Props) {
|
||||
</div>
|
||||
|
||||
<div className="notification__extra">
|
||||
{!is_read && (
|
||||
<Button
|
||||
className="notification__mark-seen"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
doReadNotifications([id]);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!is_read && <Button className="notification__mark-seen" onClick={handleReadNotification} />}
|
||||
<div className="notification__time">
|
||||
<DateTime timeAgo date={notification.active_at} />
|
||||
</div>
|
||||
@@ -236,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 className={'menu__button notification__menu-button'} onClick={(e) => e.stopPropagation()}>
|
||||
<Icon size={18} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
@@ -256,47 +207,7 @@ export default function Notification(props: Props) {
|
||||
</MenuList>
|
||||
</Menu>
|
||||
</div>
|
||||
</Wrapper>
|
||||
|
||||
{isCommentNotification && (
|
||||
<div>
|
||||
<div className="notification__reactions">
|
||||
<Button
|
||||
label={__('Reply')}
|
||||
className="comment__action"
|
||||
onClick={() => setReplying(!isReplying)}
|
||||
icon={ICONS.REPLY}
|
||||
/>
|
||||
<CommentReactions
|
||||
uri={notificationTarget}
|
||||
commentId={notification_parameters.dynamic.hash}
|
||||
hideCreatorLike
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isReplying && (
|
||||
<CommentCreate
|
||||
isReply
|
||||
uri={notificationTarget}
|
||||
parentId={notification_parameters.dynamic.hash}
|
||||
onDoneReplying={() => setReplying(false)}
|
||||
onCancelReplying={() => setReplying(false)}
|
||||
setQuickReply={setQuickReply}
|
||||
supportDisabled
|
||||
shouldFetchComment
|
||||
/>
|
||||
)}
|
||||
|
||||
{quickReply && (
|
||||
<CommentsReplies
|
||||
uri={notificationTarget}
|
||||
parentId={notification_parameters.dynamic.hash}
|
||||
numDirectReplies={1}
|
||||
supportDisabled
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import React, { Fragment } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import SideNavigation from 'component/sideNavigation';
|
||||
import SettingsSideNavigation from 'component/settingsSideNavigation';
|
||||
import Header from 'component/header';
|
||||
/* @if TARGET='app' */
|
||||
import StatusBar from 'component/common/status-bar';
|
||||
@@ -24,7 +23,6 @@ type Props = {
|
||||
isUpgradeAvailable: boolean,
|
||||
authPage: boolean,
|
||||
filePage: boolean,
|
||||
settingsPage?: boolean,
|
||||
noHeader: boolean,
|
||||
noFooter: boolean,
|
||||
noSideNavigation: boolean,
|
||||
@@ -47,7 +45,6 @@ function Page(props: Props) {
|
||||
children,
|
||||
className,
|
||||
filePage = false,
|
||||
settingsPage,
|
||||
authPage = false,
|
||||
fullWidthPage = false,
|
||||
noHeader = false,
|
||||
@@ -79,24 +76,6 @@ function Page(props: Props) {
|
||||
|
||||
const isAbsoluteSideNavHidden = (isOnFilePage || isMobile) && !sidebarOpen;
|
||||
|
||||
function getSideNavElem() {
|
||||
if (!authPage) {
|
||||
if (settingsPage) {
|
||||
return <SettingsSideNavigation />;
|
||||
} else if (!noSideNavigation) {
|
||||
return (
|
||||
<SideNavigation
|
||||
sidebarOpen={sidebarOpen}
|
||||
setSidebarOpen={setSidebarOpen}
|
||||
isMediumScreen={isMediumScreen}
|
||||
isOnFilePage={isOnFilePage}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (isOnFilePage || isMediumScreen) {
|
||||
setSidebarOpen(false);
|
||||
@@ -121,15 +100,20 @@ function Page(props: Props) {
|
||||
'main-wrapper__inner--theater-mode': isOnFilePage && videoTheaterMode,
|
||||
})}
|
||||
>
|
||||
{getSideNavElem()}
|
||||
|
||||
{!authPage && !noSideNavigation && (
|
||||
<SideNavigation
|
||||
sidebarOpen={sidebarOpen}
|
||||
setSidebarOpen={setSidebarOpen}
|
||||
isMediumScreen={isMediumScreen}
|
||||
isOnFilePage={isOnFilePage}
|
||||
/>
|
||||
)}
|
||||
<main
|
||||
id={'main-content'}
|
||||
className={classnames(MAIN_CLASS, className, {
|
||||
'main--full-width': fullWidthPage,
|
||||
'main--auth-page': authPage,
|
||||
'main--file-page': filePage,
|
||||
'main--settings-page': settingsPage,
|
||||
'main--markdown': isMarkdown,
|
||||
'main--theater-mode': isOnFilePage && videoTheaterMode && !livestream,
|
||||
'main--livestream': livestream && !chatDisabled,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DOMAIN } from 'config';
|
||||
import { connect } from 'react-redux';
|
||||
import { doSetDaemonSetting } from 'redux/actions/settings';
|
||||
import { doSetWelcomeVersion, doToggle3PAnalytics, doSignOut } from 'redux/actions/app';
|
||||
@@ -9,16 +10,17 @@ import { version as appVersion } from 'package.json';
|
||||
|
||||
import PrivacyAgreement from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
const select = state => ({
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
setWelcomeVersion: (version) => dispatch(doSetWelcomeVersion(version || WELCOME_VERSION)),
|
||||
setShareDataInternal: (share) => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, share)),
|
||||
setShareDataThirdParty: (share) => dispatch(doToggle3PAnalytics(share)),
|
||||
const perform = dispatch => ({
|
||||
setWelcomeVersion: version => dispatch(doSetWelcomeVersion(version || WELCOME_VERSION)),
|
||||
setShareDataInternal: share => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.SHARE_USAGE_DATA, share)),
|
||||
setShareDataThirdParty: share => dispatch(doToggle3PAnalytics(share)),
|
||||
signOut: () => dispatch(doSignOut()),
|
||||
authenticateIfSharingData: () => dispatch(doAuthenticate(appVersion, undefined, undefined, true)), // appVersion, shareData?, shareCallback, callInstall
|
||||
authenticateIfSharingData: () =>
|
||||
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();
|
||||
@@ -224,7 +218,6 @@ function PublishForm(props: Props) {
|
||||
(activeChannelClaim && activeChannelClaim.claim_id);
|
||||
|
||||
const nameEdited = isStillEditing && name !== prevName;
|
||||
const thumbnailUploaded = uploadThumbnailStatus === THUMBNAIL_STATUSES.COMPLETE && thumbnail;
|
||||
|
||||
const waitingForFile = waitForFile && !remoteUrl && !filePath;
|
||||
// If they are editing, they don't need a new file chosen
|
||||
@@ -236,7 +229,7 @@ function PublishForm(props: Props) {
|
||||
thumbnail &&
|
||||
!bidError &&
|
||||
!emptyPostError &&
|
||||
!(thumbnailError && !thumbnailUploaded) &&
|
||||
!thumbnailError &&
|
||||
!(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
||||
|
||||
const isOverwritingExistingClaim = !editingURI && myClaimForUri;
|
||||
@@ -270,12 +263,6 @@ function PublishForm(props: Props) {
|
||||
}
|
||||
}, [activeChannelClaimStr, setSignedMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasClaimedInitialRewards) {
|
||||
claimInitialRewards();
|
||||
}
|
||||
}, [hasClaimedInitialRewards, claimInitialRewards]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!modal) {
|
||||
setTimeout(() => {
|
||||
@@ -311,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) {
|
||||
@@ -548,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">
|
||||
@@ -648,7 +623,6 @@ function PublishForm(props: Props) {
|
||||
onClick={handlePublish}
|
||||
label={submitLabel}
|
||||
disabled={
|
||||
isClaimingInitialRewards ||
|
||||
formDisabled ||
|
||||
!formValid ||
|
||||
uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS ||
|
||||
|
||||
@@ -35,7 +35,6 @@ function PublishFormErrors(props: Props) {
|
||||
// If there is an error it will be presented as an inline error as well
|
||||
|
||||
const isUploadingThumbnail = uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS;
|
||||
const thumbnailUploaded = uploadThumbnailStatus === THUMBNAIL_STATUSES.COMPLETE && thumbnail;
|
||||
|
||||
return (
|
||||
<div className="error__text">
|
||||
@@ -46,11 +45,10 @@ function PublishFormErrors(props: Props) {
|
||||
{!bid && <div>{__('A deposit amount is required')}</div>}
|
||||
{bidError && <div>{__('Please check your deposit amount.')}</div>}
|
||||
{isUploadingThumbnail && <div>{__('Please wait for thumbnail to finish uploading')}</div>}
|
||||
{!isUploadingThumbnail && !thumbnail ? (
|
||||
{!isUploadingThumbnail && !thumbnail && (
|
||||
<div>{__('A thumbnail is required. Please upload or provide an image URL above.')}</div>
|
||||
) : (
|
||||
thumbnailError && !thumbnailUploaded && <div>{__('Thumbnail is invalid.')}</div>
|
||||
)}
|
||||
{thumbnailError && <div>{__('Thumbnail is invalid.')}</div>}
|
||||
{editingURI && !isStillEditing && !filePath && (
|
||||
<div>{__('Please reselect a file after changing the LBRY URL')}</div>
|
||||
)}
|
||||
|
||||
Loaded 100 of 283 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user