Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f67da4947d |
No files matched your search
+30
-84
@@ -1,29 +1,37 @@
|
||||
####### .env.default #########
|
||||
|
||||
# Copy this file to .env to make modifications
|
||||
|
||||
# Base config
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
WEBPACK_WEB_PORT=9090
|
||||
WEBPACK_ELECTRON_PORT=9091
|
||||
WEB_SERVER_PORT=1337
|
||||
|
||||
## APIS
|
||||
LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
LBRY_WEB_API=https://api.lbry.tv
|
||||
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/
|
||||
COMMENT_SERVER_API=https://comments.lbry.com/api/v2
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# STRIPE
|
||||
# STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
# Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
THUMBNAIL_CDN_URL=https://image-optimizer.vanwanet.com/?address=
|
||||
|
||||
# Analytics
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
# UI
|
||||
SITE_TITLE=lbry.tv
|
||||
SITE_NAME=lbry.tv
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
SITE_HELP_EMAIL=help@lbry.com
|
||||
LOGO_TITLE=lbry.tv
|
||||
SIMPLE_SITE=false
|
||||
SHOW_ADS=true
|
||||
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=false
|
||||
ENABLE_CREATOR_REACTIONS=false
|
||||
ENABLE_NO_SOURCE_CLAIMS=false
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
|
||||
|
||||
# OG
|
||||
OG_TITLE_SUFFIX=| lbry.tv
|
||||
@@ -31,85 +39,23 @@ OG_HOMEPAGE_TITLE=lbry.tv
|
||||
OG_IMAGE_URL=
|
||||
SITE_CANONICAL_URL=https://lbry.tv
|
||||
|
||||
# UI
|
||||
## Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
SITE_TITLE=lbry.tv
|
||||
SITE_NAME=lbry.tv
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
SITE_HELP_EMAIL=help@lbry.com
|
||||
LOGO_TITLE=lbry.tv
|
||||
## Social media
|
||||
TWITTER_ACCOUNT=LBRYcom
|
||||
BRANDED_SITE=odysee
|
||||
|
||||
## IMAGE ASSETS
|
||||
YRBL_HAPPY_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#LOGIN_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/login/b671946e911c66c5fa7233afb35de2badd9eceb8/0e1d81
|
||||
#LOGO=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
#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
|
||||
DEFAULT_LANGUAGE=en
|
||||
|
||||
## CUSTOM SETTINGS
|
||||
# Custom Settings
|
||||
# Additional settings for below are found in ui/constants/settings and are for
|
||||
# preventing user settings from applying to custom sites without overwriting them.
|
||||
# UNSYNCED_SETTINGS='theme dark_mode_times automatic_dark_mode_enabled'
|
||||
|
||||
## LINKED CONTENT WHITELIST
|
||||
KNOWN_APP_DOMAINS=lbry.tv,lbry.lat,odysee.com
|
||||
|
||||
## CUSTOM CONTENT
|
||||
# Custom Content
|
||||
# If the following is true, copy custom/homepage.example.js to custom/homepage.js and modify
|
||||
CUSTOM_HOMEPAGE=false
|
||||
|
||||
# Add channels to auto-follow on first run
|
||||
AUTO_FOLLOW_CHANNELS=lbry://@lbry#3fda836a92faaceedfe398225fb9b2ee2ed1f01a
|
||||
# Add up to 2 sidebar links:
|
||||
# PINNED_URI_1=@Lbrylatam#2/Integracionesporseguridad#4
|
||||
# PINNED_LABEL_1=LBRY LATAM
|
||||
# PINNED_URI_2=$/discover?t=lbrytvpaidbeta&fee_amount=>0&claim_type=stream&channel_ids=5af39f818f668d8c00943c9326c5201c4fe3c423,cda9c4e92f19d6fe0764524a2012056e06ca2055,760da3ba3dd85830a843beaaed543a89b7a367e7,40c36948f0da072dcba3e4833e90f71e16de78be,e8f68563d242f6ac9784dcbc41dd86c28a9391d6,7236fc5d2783ea7314d9076ae6c8a250e3992d1a,cf7792c2a37d0d76aaaff84aff0b99a8c791429d,8316ac90764fedf3147799b7b81a6575a9cc398e,8627af93c1a1219150f06b698f4b33e6ed2f1c1e,8972a1bd06de5186e5e89292b05aac8aaa817791,c5b0b17838df2f6c31162f64d55f60f34ae8bfc6,f576d5dba905fc179de880c3fe3eb3281ea74f59,97dd77c93c9603cbb2583f3589f7f5a6c92baa43,f399d873e0c37cf24de9569b5f22bbb30a5c6709,dba870d0620d41b2b9a152c961e0c06cf875ccfc,ca1fd651c9d14bf2e5088bb2aa0146ee7aeb2ae0,50ad846a4b1543b847bf3fdafb7b45f6b2f5844c,e09ff5abe9fb44dd0dd0576894a6db60a6211603,7b6f7517f6b816827d076fa0eaad550aa315a4e7,2068452c41d8da3bd68961335da0072a99258a1a,5da63df97c8255ae94a88940695b8471657dd5a1,3645cf2f5d0bdac0523f945be1c3ff60758f7845,4da85b12244839d6368b9290f1619ff9514ab2a8,4ad942982e43326c7700b1b6443049b3cfd82161,55304f219244abf82f684f759cc0c7769242f3b4,8f42e5b592bb7f7a03f4a94a86a41b1236bb099f,e2a014d885a48f5be2dc6409610996337312facb,c18996ca488753f714d36d4654715927c1d7f9c2,ebc4214424cfa683a7046e1f794fea1e44788d84,06b6d6d6a893fb589ec2ded948f5122856921ed5,07e4546674268fc0222b2ca22d31d0549dc217ee,060940e41973d4f7f16d72a2733138e931c35f41,f8d6eccd887c9cebd36b1d42aa349279b7f5c3ed,68098b8426f967b8d04cc566348b5c128823219e,2bfe6cdb24a21bdc1b76fb7c416edd50e9e85945,1f9bb08bfa2259629f4aaa9ed40f97e9a41b6fa1,2f20148495612946675fe1c8ea99171e4d950b81,bc6938fa1e09e840056c2e831abf9664f397c472,2a6194792beac5130641e932b5ac6e5a99b5ca4f,185ba2bd547a5e4a77d29fe6c1484f47db5e058f,29cc7f6081268eaa5b3f2946e0cd0b952a94812c,49389450b1241f5d8f4c8c4271a3eb56bba33965,ffdc62ac2f7549398d3aca9d2119e83d80d588d5,d7a4d2808074b0c55d6b239f69d90e7a4930f943,d58aa4a0b2f6c2504c3abce8de3f1afb71800acc,77ae23dc7eb8a75609881d4548a79e4935a89d37,f79bce8a60fbece671f6265adc39f6469f3b9b8c,051995fdf0af634e4911704057a551e9392e62b1
|
||||
# PINNED_LABEL_2=Paid Beta
|
||||
|
||||
## FEATURES AND LIMITS
|
||||
SIMPLE_SITE=false
|
||||
#BRANDED_SITE
|
||||
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=false
|
||||
ENABLE_CREATOR_REACTIONS=false
|
||||
ENABLE_NO_SOURCE_CLAIMS=false
|
||||
ENABLE_PREROLL_ADS=false
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
|
||||
CHANNEL_STAKED_LEVEL_LIVESTREAM=5
|
||||
WEB_PUBLISH_SIZE_LIMIT_GB=4
|
||||
LOADING_BAR_COLOR=#2bbb90
|
||||
LIGHTHOUSE_DEFAULT_TYPES=audio,video,text,image,application
|
||||
|
||||
SHOW_ADS=true
|
||||
|
||||
## SIMPLE_SITE REPLACEMENTS
|
||||
ENABLE_MATURE=true
|
||||
ENABLE_UI_NOTIFICATIONS=false
|
||||
|
||||
#ENABLE_LINK_TO_APP=true
|
||||
#FORCE_ANALYTICS=true
|
||||
#ENABLE_ADVANCED_FILTER=true
|
||||
#ENABLE_PAID_CONTENT=true
|
||||
#USE_FOOTER=true
|
||||
#USE_DISCOVER_WHITELIST=false
|
||||
#ENABLE_WILD_WEST=false
|
||||
#FULL_SIDE_LINKS=true
|
||||
#SHOW_TAGS_INTRO=false
|
||||
|
||||
# SEARCH TYPES
|
||||
#VIDEO_ENABLED=true
|
||||
#AUDIO_ENABLED=true
|
||||
#POSTS_ENABLED=true
|
||||
#IMAGES_ENABLED=true
|
||||
#FILES_ENABLED=true
|
||||
#MODELS_ENABLED=true
|
||||
|
||||
BRANDED_SITE=odysee
|
||||
@@ -35,14 +35,13 @@
|
||||
"object-curly-spacing": 0,
|
||||
"one-var": 0,
|
||||
"prefer-promise-reject-errors": 0,
|
||||
"promise/param-names": 0,
|
||||
"react/jsx-indent": 0,
|
||||
"react/jsx-no-comment-textnodes": 0,
|
||||
"react-hooks/exhaustive-deps": "warn",
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react/no-unescaped-entities": 0,
|
||||
"space-before-function-paren": [
|
||||
"warn",
|
||||
"error",
|
||||
{
|
||||
"anonymous": "never",
|
||||
"named": "never",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[ignore]
|
||||
.*\.typeface\.json
|
||||
.*/node_modules/findup/.*
|
||||
.*/node_modules/react-plastic/.*
|
||||
|
||||
|
||||
[include]
|
||||
@@ -31,7 +30,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,14 @@
|
||||
## 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 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 +19,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. -->
|
||||
@@ -57,7 +57,7 @@ jobs:
|
||||
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||
WIN_CSC_LINK: https://s3.amazonaws.com/files.lbry.io/cert/win-csc-2020-2021-08.p12
|
||||
CSC_LINK: https://s3.amazonaws.com/files.lbry.io/cert/osx-csc-2021-2022.p12
|
||||
CSC_LINK: https://s3.amazonaws.com/files.lbry.io/cert/osx-cert.p12
|
||||
|
||||
# UI
|
||||
MATOMO_URL: https://analytics.lbry.com/
|
||||
|
||||
@@ -23,16 +23,9 @@ package-lock.json
|
||||
/web/.env.defaults
|
||||
/custom/*
|
||||
/custom/homepages/*
|
||||
/custom/content/*
|
||||
!/custom/content/default.json
|
||||
!/custom/content/test.json
|
||||
!/custom/homepages/.gitkeep
|
||||
!/custom/homepages
|
||||
!/custom/content
|
||||
!/custom/homepage.example.js
|
||||
!/custom/robots.disallowall
|
||||
!/custom/robots.allowall
|
||||
.env
|
||||
.env.ody
|
||||
.env.desktop
|
||||
.env.lbrytv
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"ui/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"web/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"web/**/*.{js,jsx}": ["eslint", "git add"]
|
||||
"web/**/*.{js,jsx,scss}": ["eslint", "git add"]
|
||||
},
|
||||
"ignore": ["node_modules", "web/dist/**/*", "dist/**/*", "package-lock.json"]
|
||||
}
|
||||
+1
-102
@@ -1,123 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [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))
|
||||
- Add confirmation on comment removal _community pr!_ ([#6563](https://github.com/lbryio/lbry-desktop/pull/6563))
|
||||
- Show on content page if a file is part of a playlist already _community pr!_([#6393](https://github.com/lbryio/lbry-desktop/pull/6393))
|
||||
- Add filtering to playlists ([#6905](https://github.com/lbryio/lbry-desktop/pull/6905))
|
||||
|
||||
### Changed
|
||||
- Use Canonical Url for copy link ([#6500](https://github.com/lbryio/lbry-desktop/pull/6500))
|
||||
- Use better icon for copy link ([#6485](https://github.com/lbryio/lbry-desktop/pull/6485))
|
||||
- Comments load paginated ([#6390](https://github.com/lbryio/lbry-desktop/pull/6390))
|
||||
- Improve twitter share _community pr!_ ([#6690](https://github.com/lbryio/lbry-desktop/pull/6690))
|
||||
- Update lighthouse search api _community pr!_ ([#6731](https://github.com/lbryio/lbry-desktop/pull/6731))
|
||||
- Update sockety api _community pr!_ ([#6747](https://github.com/lbryio/lbry-desktop/pull/6747))
|
||||
- Use resolve for OG metadata instead of chainquery _community pr!_ ([#6787](https://github.com/lbryio/lbry-desktop/pull/6787))
|
||||
- Improved clickability of notification links _community pr!_ ([#6711](https://github.com/lbryio/lbry-desktop/pull/6711))
|
||||
|
||||
### Fixed
|
||||
- App now supports '#' and ':' for claimId separator ([#6496](https://github.com/lbryio/lbry-desktop/pull/6496))
|
||||
- Fix "exact match" being applied to Recommended ([#6460](https://github.com/lbryio/lbry-desktop/pull/6460))
|
||||
- Fix upload button on creator analytics _community pr!_ ([#6458](https://github.com/lbryio/lbry-desktop/pull/6458))
|
||||
- Prevent sidebar shortcut activation on textarea _community pr!_ ([#6454](https://github.com/lbryio/lbry-desktop/pull/6454))
|
||||
- Improve accessibility and some minor css fixes _community pr!_ ([#6470](https:/github.com/lbryio/lbry-desktop/pull/6470))
|
||||
- Fix drag / drop publish issues for web users _community pr!_ ([#6466](https://github.com/lbryio/lbry-desktop/pull/6466))
|
||||
- Fix yarn copyenv on windows _community pr!_ ([#6702](https://github.com/lbryio/lbry-desktop/pull/6702))
|
||||
- Fix unnecessary livestream api calls in channel page _community pr!_ ([#6652](https://github.com/lbryio/lbry-desktop/pull/6652))
|
||||
- Fix desktop app fails to resolve deep links _community pr!_ ([#6779](https://github.com/lbryio/lbry-desktop/pull/6779))
|
||||
- Fix wrong release date on GoogleVideo metadata _community pr!_ ([#6787](https://github.com/lbryio/lbry-desktop/pull/6787))
|
||||
- Fix markdown line breaking mid word _community pr!_ ([#6805](https://github.com/lbryio/lbry-desktop/pull/6805))
|
||||
- Added \ and = to reserved symbol warning _community pr!_ ([#6733](https://github.com/lbryio/lbry-desktop/pull/6733))
|
||||
- Don't break words in chat + fix text overflow past 3 dot menu _community pr!_ ([#6602](https://github.com/lbryio/lbry-desktop/pull/6602))
|
||||
- Fix embed shows wrong OG metadata _community pr!_ ([#6815](https://github.com/lbryio/lbry-desktop/pull/6815))
|
||||
- Fix OG: "Unparsable data structure - Truncated Unicode character" _community pr!_ ([#6839](https://github.com/lbryio/lbry-desktop/pull/6839))
|
||||
- Fix Paid embed warning overlay redirection button now links to odysee _community pr!_ ([#6819](https://github.com/lbryio/lbry-desktop/pull/6819))
|
||||
- Fix comment section redirection to create channel _community pr!_ ([#6557](https://github.com/lbryio/lbry-desktop/pull/6557))
|
||||
|
||||
## [0.51.1] - [2021-06-26]
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
- Enable sign up on desktop ([#6071](https://github.com/lbryio/lbry-desktop/issues/6071))
|
||||
|
||||
## [0.51.0] - [2021-06-26]
|
||||
|
||||
### Added
|
||||
- Private and Publishable Playlists ([#6157](https://github.com/lbryio/lbry-desktop/pull/6157))
|
||||
- Channel thumbnails in following side menu ([#6193](https://github.com/lbryio/lbry-desktop/pull/6193))
|
||||
- Web is now PWA app ([#6120](https://github.com/lbryio/lbry-desktop/pull/6120))
|
||||
- Send a tip with your comment ([#5920](https://github.com/lbryio/lbry-desktop/issues/5920))
|
||||
- Search for tags in search dropdown ([#5876](https://github.com/lbryio/lbry-desktop/issues/5876))
|
||||
- Japanese, Afrikaans, Filipino, Thai and Vietnamese language support ([#5684](https://github.com/lbryio/lbry-desktop/issues/5684))
|
||||
- Brazilian-Portuguese language support ([#5900](https://github.com/lbryio/lbry-desktop/issues/5900))
|
||||
- Highlight comments made by content owner _community pr!_ ([#5744](https://github.com/lbryio/lbry-desktop/pull/5744))
|
||||
- Ability to report infringing content directly from the application ([#5808](https://github.com/lbryio/lbry-desktop/pull/5808))
|
||||
- Re-added ability to export wallet transactions ([#5899](https://github.com/lbryio/lbry-desktop/pull/5899))
|
||||
- 24-hour clock setting _community pr!_ ([#5820](https://github.com/lbryio/lbry-desktop/pull/5820))
|
||||
- "Related" (recommendations) section: added option to view more from current creator _community pr!_ ([#5847](https://github.com/lbryio/lbry-desktop/pull/5847))
|
||||
- Wallet: ability to swap cryptocurrency into LBC ([#5654](https://github.com/lbryio/lbry-desktop/pull/5654))
|
||||
- Wallet: ability to send LBC directly to a user through a name or URL search _community pr!_ ([#5990](https://github.com/lbryio/lbry-desktop/pull/5990))
|
||||
- Publish: ability to edit the Release Date field ([#6049](https://github.com/lbryio/lbry-desktop/pull/6049))
|
||||
- Creator Settings: ability to mute specific words in comments ([#5934](https://github.com/lbryio/lbry-desktop/pull/5934))
|
||||
- Creator Settings: ability to disable comments + assign moderators ([#6199](https://github.com/lbryio/lbry-desktop/pull/6199))
|
||||
- Additional options in context-menu _community pr!_ ([#6106](https://github.com/lbryio/lbry-desktop/pull/6106))
|
||||
|
||||
### Changed
|
||||
|
||||
- Keyboard shortcut additions and changes _community pr!_ ([#5717](https://github.com/lbryio/lbry-desktop/pull/5717))
|
||||
- Removed the 10k character-limit when editing _Posts_ ([#5719](https://github.com/lbryio/lbry-desktop/pull/5719))
|
||||
- Improved search functionality (more filters, infinite-scroll, etc.) ([#5742](https://github.com/lbryio/lbry-desktop/pull/5742))
|
||||
- Removed google related section ads ([#6312](https://github.com/lbryio/lbry-desktop/pull/6312))
|
||||
- Debounce and min characters on wunderbar search ([#6319](https://github.com/lbryio/lbry-desktop/pull/6319))
|
||||
- Don't use optimizer for gif thumbnails ([#6320](https://github.com/lbryio/lbry-desktop/pull/6320))
|
||||
- Upgraded [LBRY SDK 0.99.0](https://github.com/lbryio/lbry/releases/tag/v0.99.0)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Lazy-load claim images to improve app responsiveness ([#5795](https://github.com/lbryio/lbry-desktop/issues/5795))
|
||||
- Fix display of upload date and view count on smaller screens ([#5822](https://github.com/lbryio/lbry-desktop/issues/5822))
|
||||
- Autoplay looping to a previous video or itself ([#5711](https://github.com/lbryio/lbry-desktop/pull/5711))
|
||||
- Autoplay not working in mini-player mode ([#5716](https://github.com/lbryio/lbry-desktop/pull/5716))
|
||||
- Edited claim accidentally moved to 'Anonymous' ([#5767](https://github.com/lbryio/lbry-desktop/pull/5767))
|
||||
- Squished "Upload Date" and "View Count" on smaller screens _community pr!_ ([#5823](https://github.com/lbryio/lbry-desktop/pull/5823))
|
||||
- Home and End key not working in search bar ([#5867](https://github.com/lbryio/lbry-desktop/pull/5867))
|
||||
- Unable to buy paid-Images or Posts ([#6114](https://github.com/lbryio/lbry-desktop/pull/6114))
|
||||
|
||||
## [0.50.2] - [2021-04-2]
|
||||
|
||||
### Changed
|
||||
|
||||
- Disable PDFs until security issue is fixed
|
||||
|
||||
## [0.50.1] - [2021-03-18]
|
||||
|
||||
|
||||
+26
-24
@@ -1,19 +1,21 @@
|
||||
# Contribute to LBRY
|
||||
|
||||
|
||||
**First:** if you're unsure or afraid of anything, just ask or submit the issue or pull request anyways. You won't be yelled at for giving your best effort. The worst that can happen is that you'll be politely asked to change something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that.
|
||||
|
||||
However, for those individuals who want a bit more guidance on the best way to contribute to the project, read on. This document will cover what we're looking for. By addressing all the points we're looking for, it raises the chances we can quickly merge or address your contributions.
|
||||
|
||||
|
||||
## TL;DR?
|
||||
|
||||
- [Here](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
* [Here](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
is a list of help wanted issues.
|
||||
- Comment on an issue to let us know if you are going to work on it, don't take an issue that someone reserved less than 3 days ago.
|
||||
- Submit a pull request and get paid in LBC.
|
||||
- Don't hesitate to contact us with any questions or comments.
|
||||
* Comment on an issue to let us know if you are going to work on it, don't take an issue that someone reserved less than 3 days ago.
|
||||
* Submit a pull request and get paid in LBC.
|
||||
* Don't hesitate to contact us with any questions or comments.
|
||||
* [Check out this video for a quickstart guide to running and developing the desktop app](https://spee.ch/7da73fc508ffc4ff8b2711e3c3950110430b0c5f/LBRYAppDesign.mp4).
|
||||
|
||||
## Contents
|
||||
|
||||
- [Choose an Issue](#choose-an-issue)
|
||||
- [Code Overview](#code-overview)
|
||||
- [Libraries](#libraries)
|
||||
@@ -36,20 +38,20 @@ receives contributions from individuals outside the core team -- such as yoursel
|
||||
|
||||
To make contributing as easy and rewarding as possible, we have instituted the following system:
|
||||
|
||||
- Anyone can view all issues in the system by clicking on the
|
||||
* Anyone can view all issues in the system by clicking on the
|
||||
[Issues](https://github.com/lbryio/lbry-desktop/issues) button at the top of the page. Feel free to
|
||||
add an issue if you think we have missed something (and you might earn some LBC in the process
|
||||
because we do tip people for reporting bugs).
|
||||
- Once on the [Issues](https://github.com/lbryio/lbry-desktop/issues) page, a potential contributor can
|
||||
* Once on the [Issues](https://github.com/lbryio/lbry-desktop/issues) page, a potential contributor can
|
||||
filter issues by the
|
||||
[Help Wanted](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
label to see a curated list of suggested issues with which community members can help.
|
||||
- Every
|
||||
* Every
|
||||
[Help Wanted](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+no%3Aassignee)
|
||||
issue is ranked on a scale from zero to four.
|
||||
|
||||
| Level | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||
| Level | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
|
||||
| [**level 0**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+0%22+no%3Aassignee) | Typos and text edits -- a tech-savvy non-programmer can fix these. |
|
||||
| [**level 1**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+1%22+no%3Aassignee) | Programming issues that require little knowledge of how the LBRY app works. |
|
||||
| [**level 2**](https://github.com/lbryio/lbry-desktop/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3A%22level%3A+2%22+no%3Aassignee) | Issues of average difficulty that require the developer to dig into how the app works a little bit. |
|
||||
@@ -78,7 +80,7 @@ our styling rules and code best practices.
|
||||
|
||||
### Libraries
|
||||
|
||||
This project uses [lbry-redux](https://github.com/lbryio/lbry-redux) and [lbryionc](https://github.com/lbryio/lbryinc) to share Redux and LBRY API specific code with other LBRY apps. Over time, more Redux code that is suitable to be shared will be moved into lbry-redux. If modifying Redux code, you may be asked to make some of your changes in lbry-redux rather than lbry-desktop. The steps to work with lbry-redux locally can be found [here](https://github.com/lbryio/lbry-redux#local-development).
|
||||
This project uses [lbry-redux](https://github.com/lbryio/lbry-redux) and [lbryionc](https://github.com/lbryio/lbryinc) to share Redux and LBRY API specific code with [lbry-android](https://github.com/lbryio/lbry-android) and other LBRY apps. Over time, more Redux code that is suitable to be shared will be moved into lbry-redux. If modifying Redux code, you may be asked to make some of your changes in lbry-redux rather than lbry-desktop. The steps to work with lbry-redux locally can be found [here](https://github.com/lbryio/lbry-redux#local-development).
|
||||
|
||||
### Flow
|
||||
|
||||
@@ -138,15 +140,15 @@ Editor integrations are available [here](https://prettier.io/docs/en/editors.htm
|
||||
|
||||
There are a few tools integrated to the project that will ease the process of debugging:
|
||||
|
||||
- [Chrome DevTools](https://developer.chrome.com/devtools)
|
||||
- Also available for the main process as a [remote target](chrome://inspect/#devices).
|
||||
- [Electron Devtron](https://electronjs.org/devtron)
|
||||
- [React DevTools](https://github.com/facebook/react-devtools)
|
||||
- [Redux DevTools](https://github.com/gaearon/redux-devtools)
|
||||
* [Chrome DevTools](https://developer.chrome.com/devtools)
|
||||
* Also available for the main process as a [remote target](chrome://inspect/#devices).
|
||||
* [Electron Devtron](https://electronjs.org/devtron)
|
||||
* [React DevTools](https://github.com/facebook/react-devtools)
|
||||
* [Redux DevTools](https://github.com/gaearon/redux-devtools)
|
||||
|
||||
## Submit a Pull Request
|
||||
|
||||
- After deciding what to work on, a potential contributor can
|
||||
* After deciding what to work on, a potential contributor can
|
||||
[fork](https://help.github.com/articles/fork-a-repo/) this repository, make his or her changes,
|
||||
and submit a
|
||||
[pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). A
|
||||
@@ -155,12 +157,12 @@ There are a few tools integrated to the project that will ease the process of de
|
||||
manner and, therefore, not begin working on anything reserved (or updated) within the last 3 days.
|
||||
If someone has been officially assigned an issue via GitHub's assignment system, it is also not
|
||||
available. Contributors are encouraged to ask if they have any questions about issue availability.
|
||||
- The [changelog](https://github.com/lbryio/lbry-desktop/blob/master/CHANGELOG.md) should be updated to
|
||||
* The [changelog](https://github.com/lbryio/lbry-desktop/blob/master/CHANGELOG.md) should be updated to
|
||||
include a reference to the fix/change/addition. See previous entries for format.
|
||||
- Once the pull request is visible in the LBRY repo, a LBRY team member will review it and make sure
|
||||
* Once the pull request is visible in the LBRY repo, a LBRY team member will review it and make sure
|
||||
it is up to our standards. At this point, the contributor may have to change his or her code based
|
||||
on our suggestions and comments.
|
||||
- Then, upon a satisfactory review of the code, we will merge it and send the contributor a tip (in
|
||||
* Then, upon a satisfactory review of the code, we will merge it and send the contributor a tip (in
|
||||
LBC) for the contribution.
|
||||
|
||||
We are dedicated to being fair and friendly in this process. In **general**, level 4 issues will be
|
||||
@@ -189,10 +191,10 @@ will earn you an extra 50 LBC on top of what we would otherwise tip you.
|
||||
|
||||
# Get in Touch
|
||||
|
||||
| Name | Role | Discord | Email |
|
||||
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------- |
|
||||
| [Tom](https://github.com/tzarebczan) | Community manager. He knows more than anyone about the app and all of its flaws. Reach out to him with any questions about how the app works, if a bug has been reported, or if a feature should be requested. | jiggytom | tom@lbry.com |
|
||||
| [Sean](https://github.com/seanyesmunt) | The primary engineer working on the app. Feel free to ask any questions about the code. | sean | sean@lbry.com |
|
||||
| Name | Role | Discord | Email |
|
||||
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------
|
||||
| [Tom](https://github.com/tzarebczan) | Community manager. He knows more than anyone about the app and all of its flaws. Reach out to him with any questions about how the app works, if a bug has been reported, or if a feature should be requested. | jiggytom | tom@lbry.com |
|
||||
| [Sean](https://github.com/seanyesmunt) | The primary engineer working on the app. Feel free to ask any questions about the code. | sean | sean@lbry.com |
|
||||
|
||||
Join our Discord [here](https://chat.lbry.com/).
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ We provide installers for Windows, macOS (v10.12.4, Sierra, or greater), and Deb
|
||||
| Latest Pre-release | [Download](https://lbry.com/get/lbry.pre.exe) | [Download](https://lbry.com/get/lbry.pre.dmg) | [Download](https://lbry.com/get/lbry.pre.deb) |
|
||||
|
||||
Our [releases page](https://github.com/lbryio/lbry-desktop/releases) also contains the latest
|
||||
release, pre-releases, and past builds.
|
||||
release, pre-releases, and past builds.
|
||||
_Note: If the deb fails to install using the Ubuntu Software Center, install manually via `sudo dpkg -i <path to deb>`. You'll need to run `sudo apt-get install -f` if this is the first time installing it to install dependencies_
|
||||
|
||||
To install from source or make changes to the application, continue to the next section below.
|
||||
@@ -63,10 +63,10 @@ To install from source or make changes to the application, continue to the next
|
||||
**Community maintained** builds for Arch Linux and Flatpak are available, see below. These installs will need to be updated manually as the in-app update process only supports Debian installs at this time.
|
||||
_Note: If coming from a deb install, the directory structure is different and you'll need to [migrate data](https://lbry.com/faq/backup-data)._
|
||||
|
||||
| | Flatpak | Arch | Nixpkgs | ARM/ARM64 |
|
||||
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------- |
|
||||
| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Nixpkgs](https://search.nixos.org/packages?channel=unstable&show=lbry&query=lbry) | [Build Guide](https://lbry.tv/@LBRYarm:5) |
|
||||
| Maintainers | [@kcSeb](https://keybase.io/kcseb) | [@kcSeb](https://keybase.io/kcseb) | [@Enderger](https://github.com/enderger) | [@Madiator2011](https://github.com/kodxana) |
|
||||
| | Flatpak | Arch | ARM/ARM64 |
|
||||
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------- |
|
||||
| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Build Guide](https://lbry.tv/@LBRYarm:5) |
|
||||
| Maintainers | [@kcSeb](https://keybase.io/kcseb) | [@kcSeb](https://keybase.io/kcseb)/[@TimurKiyivinski](https://github.com/TimurKiyivinski) | [@Madiator2011](https://github.com/kodxana) |
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -79,7 +79,7 @@ You can run the web version (lbry.tv), the electron app, or both at the same tim
|
||||
#### Prerequisites
|
||||
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
- [Node.js](https://nodejs.org/en/download/) (v14 required)
|
||||
- [Node.js](https://nodejs.org/en/download/) (v10 required)
|
||||
- [Yarn](https://yarnpkg.com/en/docs/install)
|
||||
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/lbryio/lbry-desktop`
|
||||
@@ -88,15 +88,19 @@ You can run the web version (lbry.tv), the electron app, or both at the same tim
|
||||
|
||||
#### Run the electron app
|
||||
|
||||
`yarn compile:electron` (this is only needed the first time you run the app)
|
||||
|
||||
`yarn dev`
|
||||
|
||||
- If you want to build and launch the production app you can run `yarn build`. This will give you an executable inside the `/dist` folder. We use [electron-builder](https://github.com/electron-userland/electron-builder) to create distributable packages.
|
||||
|
||||
#### Run the web app for development
|
||||
|
||||
`yarn compile:web` (this is only needed the first time you run the app)
|
||||
|
||||
`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
|
||||
|
||||
@@ -106,12 +110,11 @@ You can run the web version (lbry.tv), the electron app, or both at the same tim
|
||||
cp .env.defaults .env
|
||||
nano .env
|
||||
```
|
||||
|
||||
- To specify your own OG-IMAGE
|
||||
You can either place a png named v2-og.png in the /custom folder or specify the OG_IMAGE_URL in .env
|
||||
You can either place a png named v2-og.png in the /custom folder or specify the OG_IMAGE_URL in .env
|
||||
|
||||
- To specify your own channels to be followed on first run
|
||||
`AUTO_FOLLOW_URLS=lbry://@chan#123...a lbry://@chan2#456...a`
|
||||
`AUTO_FOLLOW_URLS=lbry://@chan#123...a lbry://@chan2#456...a`
|
||||
|
||||
- If you want to customize the homepage content
|
||||
|
||||
@@ -129,7 +132,7 @@ PINNED_LABEL_2=OtherLinkText
|
||||
```
|
||||
|
||||
- Finally `NODE_ENV=production yarn compile:web` to rebuild
|
||||
_Note: You don't need to edit the .env file in the /web folder - that is copied during compile._
|
||||
_Note: You don't need to edit the .env file in the /web folder - that is copied during compile._
|
||||
|
||||
#### Deploy the web app (_experimental_)
|
||||
|
||||
@@ -170,9 +173,8 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it. Previous versions up to v0.50.2 were signed by [Sean Yesmunt](https://keybase.io/seanyesmunt/key.asc).
|
||||
New Releases are signed by [Jessop Breth](https://keybase.io/jessopb/key.asc).
|
||||
We take security seriously. Please contact security@lbry.com regarding any security issues. Our PGP key is [here](https://keybase.io/lbry/key.asc) if you need it. All releases are signed by [Sean Yesmunt](https://keybase.io/seanyesmunt/key.asc).
|
||||
|
||||
## Contact
|
||||
|
||||
The primary contact for this project is [@jessopb](https://github.com/jessopb).
|
||||
The primary contact for this project is [@seanyesmunt](https://github.com/seanyesmunt).
|
||||
@@ -8,15 +8,11 @@ const config = {
|
||||
WEBPACK_WEB_PORT: process.env.WEBPACK_WEB_PORT,
|
||||
WEBPACK_ELECTRON_PORT: process.env.WEBPACK_ELECTRON_PORT,
|
||||
WEB_SERVER_PORT: process.env.WEB_SERVER_PORT,
|
||||
LBRY_WEB_API: process.env.LBRY_WEB_API, //api.na-backend.odysee.com',
|
||||
LBRY_WEB_PUBLISH_API: process.env.LBRY_WEB_PUBLISH_API,
|
||||
LBRY_WEB_API: process.env.LBRY_WEB_API, //api.lbry.tv',
|
||||
LBRY_API_URL: process.env.LBRY_API_URL, //api.lbry.com',
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
COMMENT_SERVER_NAME: process.env.COMMENT_SERVER_NAME,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||
DOMAIN: process.env.DOMAIN,
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
@@ -26,39 +22,21 @@ const config = {
|
||||
SITE_NAME: process.env.SITE_NAME,
|
||||
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
|
||||
SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL,
|
||||
// SOCIAL MEDIA
|
||||
TWITTER_ACCOUNT: process.env.TWITTER_ACCOUNT,
|
||||
// LOGO
|
||||
LOGO_TITLE: process.env.LOGO_TITLE,
|
||||
FAVICON: process.env.FAVICON,
|
||||
LOGO: process.env.LOGO,
|
||||
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,
|
||||
OG_IMAGE_URL: process.env.OG_IMAGE_URL,
|
||||
// MASCOT
|
||||
YRBL_HAPPY_IMG_URL: process.env.YRBL_HAPPY_IMG_URL,
|
||||
YRBL_SAD_IMG_URL: process.env.YRBL_SAD_IMG_URL,
|
||||
LOGIN_IMG_URL: process.env.LOGIN_IMG_URL,
|
||||
SITE_CANONICAL_URL: process.env.SITE_CANONICAL_URL,
|
||||
DEFAULT_LANGUAGE: process.env.DEFAULT_LANGUAGE,
|
||||
AUTO_FOLLOW_CHANNELS: process.env.AUTO_FOLLOW_CHANNELS,
|
||||
UNSYNCED_SETTINGS: process.env.UNSYNCED_SETTINGS,
|
||||
|
||||
// ENABLE FEATURES
|
||||
ENABLE_COMMENT_REACTIONS: process.env.ENABLE_COMMENT_REACTIONS === 'true',
|
||||
ENABLE_FILE_REACTIONS: process.env.ENABLE_FILE_REACTIONS === 'true',
|
||||
ENABLE_CREATOR_REACTIONS: process.env.ENABLE_CREATOR_REACTIONS === 'true',
|
||||
ENABLE_NO_SOURCE_CLAIMS: process.env.ENABLE_NO_SOURCE_CLAIMS === 'true',
|
||||
ENABLE_PREROLL_ADS: process.env.ENABLE_PREROLL_ADS === 'true',
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: process.env.CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS,
|
||||
CHANNEL_STAKED_LEVEL_LIVESTREAM: process.env.CHANNEL_STAKED_LEVEL_LIVESTREAM,
|
||||
WEB_PUBLISH_SIZE_LIMIT_GB: process.env.WEB_PUBLISH_SIZE_LIMIT_GB,
|
||||
LOADING_BAR_COLOR: process.env.LOADING_BAR_COLOR,
|
||||
SIMPLE_SITE: process.env.SIMPLE_SITE === 'true',
|
||||
SHOW_ADS: process.env.SHOW_ADS === 'true',
|
||||
PINNED_URI_1: process.env.PINNED_URI_1,
|
||||
@@ -66,16 +44,9 @@ const config = {
|
||||
PINNED_URI_2: process.env.PINNED_URI_2,
|
||||
PINNED_LABEL_2: process.env.PINNED_LABEL_2,
|
||||
KNOWN_APP_DOMAINS: process.env.KNOWN_APP_DOMAINS ? process.env.KNOWN_APP_DOMAINS.split(',') : [],
|
||||
STRIPE_PUBLIC_KEY: process.env.STRIPE_PUBLIC_KEY,
|
||||
ENABLE_UI_NOTIFICATIONS: process.env.ENABLE_UI_NOTIFICATIONS === 'true',
|
||||
ENABLE_MATURE: process.env.ENABLE_MATURE === 'true',
|
||||
CUSTOM_HOMEPAGE: process.env.CUSTOM_HOMEPAGE === 'true',
|
||||
SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true',
|
||||
LIGHTHOUSE_DEFAULT_TYPES: process.env.LIGHTHOUSE_DEFAULT_TYPES,
|
||||
BRANDED_SITE: process.env.BRANDED_SITE,
|
||||
};
|
||||
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
|
||||
module.exports = config;
|
||||
+5
-17
@@ -45,15 +45,9 @@ let daemon;
|
||||
let lbryFirst;
|
||||
|
||||
const appState = {};
|
||||
const PROTOCOL = 'lbry';
|
||||
|
||||
if (isDev && process.platform === 'win32') {
|
||||
// Setting this is required to get this working in dev mode.
|
||||
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [
|
||||
path.resolve(process.argv[1]),
|
||||
]);
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL);
|
||||
if (process.platform !== 'linux') {
|
||||
app.setAsDefaultProtocolClient('lbry');
|
||||
}
|
||||
|
||||
app.name = 'LBRY';
|
||||
@@ -155,15 +149,9 @@ if (!gotSingleInstanceLock) {
|
||||
app.on('second-instance', (event, argv) => {
|
||||
// Send the url to the app to navigate first, then focus
|
||||
if (rendererWindow) {
|
||||
// External uri (last item on argv):
|
||||
const EXTERNAL_URI = (argv.length) ? argv[argv.length - 1] : '';
|
||||
// Handle protocol requests for windows and linux
|
||||
const platforms = (process.platform === 'win32' || process.platform === 'linux');
|
||||
// Is LBRY protocol
|
||||
const isProtocolURI = String(EXTERNAL_URI).startsWith(PROTOCOL + '://');
|
||||
// External protocol requested:
|
||||
if (platforms && isProtocolURI) {
|
||||
let URI = EXTERNAL_URI;
|
||||
if ((process.platform === 'win32' || process.platform === 'linux') && String(argv[1]).startsWith('lbry')) {
|
||||
let URI = argv[1];
|
||||
|
||||
// Keep only command line / deep linked arguments
|
||||
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
||||
// restore the original URI that was typed.
|
||||
|
||||
Vendored
+6
-262
@@ -12,61 +12,25 @@ declare type Comment = {
|
||||
is_channel_signature_valid?: boolean, // whether or not the signature could be validated
|
||||
parent_id?: number, // comment_id of comment this is in reply to
|
||||
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,
|
||||
};
|
||||
|
||||
declare type PerChannelSettings = {
|
||||
words?: Array<string>,
|
||||
comments_enabled?: boolean,
|
||||
min_tip_amount_comment?: number,
|
||||
min_tip_amount_super_chat?: number,
|
||||
slow_mode_min_gap?: number,
|
||||
};
|
||||
|
||||
// todo: relate individual comments to their commentId
|
||||
declare type CommentsState = {
|
||||
commentsByUri: { [string]: string },
|
||||
superChatsByUri: { [string]: { totalAmount: number, comments: Array<Comment> } },
|
||||
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.
|
||||
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.
|
||||
byId: { [string]: Array<string> },
|
||||
repliesByParentId: { [string]: Array<string> }, // ParentCommentID -> list of reply comments
|
||||
topLevelCommentsById: { [string]: Array<string> }, // ClaimID -> list of top level comments
|
||||
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>,
|
||||
isFetchingReacts: boolean,
|
||||
myReactsByCommentId: ?{ [string]: Array<string> }, // {"CommentId:MyChannelId": ["like", "dislike", ...]}
|
||||
othersReactsByCommentId: ?{ [string]: { [string]: number } }, // {"CommentId:MyChannelId": {"like": 2, "dislike": 2, ...}}
|
||||
myReactsByCommentId: any,
|
||||
othersReactsByCommentId: any,
|
||||
pendingCommentReactions: Array<string>,
|
||||
moderationBlockList: ?Array<string>, // @KP rename to "personalBlockList"?
|
||||
adminBlockList: ?Array<string>,
|
||||
moderatorBlockList: ?Array<string>,
|
||||
moderatorBlockListDelegatorsMap: {[string]: Array<string>}, // {"blockedUri": ["delegatorUri1", ""delegatorUri2", ...]}
|
||||
moderationBlockList: ?Array<string>,
|
||||
fetchingModerationBlockList: boolean,
|
||||
moderationDelegatesById: { [string]: Array<{ channelId: string, channelName: string }> },
|
||||
fetchingModerationDelegates: boolean,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } }},
|
||||
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", ...]}
|
||||
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
||||
fetchingSettings: boolean,
|
||||
fetchingBlockedWords: boolean,
|
||||
};
|
||||
|
||||
declare type CommentReactParams = {
|
||||
@@ -77,223 +41,3 @@ declare type CommentReactParams = {
|
||||
clear_types?: string,
|
||||
remove?: boolean,
|
||||
};
|
||||
|
||||
declare type ReactionReactParams = {
|
||||
comment_ids: string,
|
||||
signature?: string,
|
||||
signing_ts?: string,
|
||||
remove?: boolean,
|
||||
clear_types?: string,
|
||||
type: string,
|
||||
channel_id: string,
|
||||
channel_name: string,
|
||||
};
|
||||
|
||||
declare type ReactionReactResponse = {
|
||||
Reactions: { [string]: { [string]: number} },
|
||||
};
|
||||
|
||||
declare type ReactionListParams = {
|
||||
comment_ids: string, // CSV of IDs
|
||||
channel_id?: string,
|
||||
channel_name?: string,
|
||||
signature?: string,
|
||||
signing_ts?: string,
|
||||
types?: string,
|
||||
};
|
||||
|
||||
declare type ReactionListResponse = {
|
||||
my_reactions: Array<MyReactions>,
|
||||
others_reactions: Array<OthersReactions>,
|
||||
};
|
||||
|
||||
declare type CommentListParams = {
|
||||
page: number, // pagination: which page of results
|
||||
page_size: number, // pagination: nr of comments to show in a page (max 200)
|
||||
claim_id: string, // claim id of claim being commented on
|
||||
channel_name?: string, // signing channel name of claim (enables 'commentsEnabled' check)
|
||||
channel_id?: string, // signing channel claim id of claim (enables 'commentsEnabled' check)
|
||||
author_claim_id?: string, // filters comments to just this author
|
||||
parent_id?: string, // filters comments to those under this thread
|
||||
top_level?: boolean, // filters to only top level comments
|
||||
hidden?: boolean, // if true, will show hidden comments as well
|
||||
sort_by?: number, // NEWEST=0, OLDEST=1, CONTROVERSY=2, POPULARITY=3,
|
||||
};
|
||||
|
||||
declare type CommentListResponse = {
|
||||
items: Array<Comment>,
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_items: number, // Grand total for the claim being commented on.
|
||||
total_filtered_items: number, // Total for filtered queries (e.g. top_level=true, parent_id=xxx, etc.).
|
||||
total_pages: number,
|
||||
has_hidden_comments: boolean,
|
||||
};
|
||||
|
||||
declare type CommentByIdParams = {
|
||||
comment_id: string,
|
||||
with_ancestors: boolean,
|
||||
}
|
||||
|
||||
declare type CommentByIdResponse = {
|
||||
item: Comment,
|
||||
items: Comment,
|
||||
ancestors: Array<Comment>,
|
||||
}
|
||||
|
||||
declare type CommentPinParams = {
|
||||
comment_id: string,
|
||||
channel_id: string,
|
||||
channel_name: string,
|
||||
remove?: boolean,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
}
|
||||
|
||||
declare type CommentPinResponse = {
|
||||
items: Comment, // "items" is an inherited typo to match SDK. Will be "item" in a new version.
|
||||
}
|
||||
|
||||
declare type CommentEditParams = {
|
||||
comment: string,
|
||||
comment_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
}
|
||||
|
||||
declare type CommentEditResponse = Comment
|
||||
|
||||
declare type CommentAbandonParams = {
|
||||
comment_id: string,
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
channel_id?: string,
|
||||
hexdata?: string,
|
||||
};
|
||||
|
||||
declare type CommentCreateParams = {
|
||||
comment: string,
|
||||
claim_id: string,
|
||||
parent_id?: string,
|
||||
signature: string,
|
||||
signing_ts: number,
|
||||
support_tx_id?: string,
|
||||
};
|
||||
|
||||
declare type SuperListParams = {};
|
||||
|
||||
declare type SuperListResponse = {
|
||||
page: number,
|
||||
page_size: number,
|
||||
total_pages: number,
|
||||
total_items: number,
|
||||
total_amount: number,
|
||||
items: Array<Comment>,
|
||||
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 ModerationAddDelegateParams = {
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationRemoveDelegateParams = {
|
||||
mod_channel_id: string,
|
||||
mod_channel_name: string,
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationListDelegatesParams = {
|
||||
creator_channel_id: string,
|
||||
creator_channel_name: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type ModerationAmIParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string
|
||||
};
|
||||
|
||||
declare type SettingsParams = {
|
||||
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,
|
||||
};
|
||||
|
||||
declare type UpdateSettingsParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
comments_enabled?: boolean,
|
||||
min_tip_amount_comment?: number,
|
||||
min_tip_amount_super_chat?: number,
|
||||
slow_mode_min_gap?: number,
|
||||
}
|
||||
|
||||
declare type BlockWordParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
words: string, // CSV list of containing words to block comment on content
|
||||
};
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// @flow
|
||||
declare type CommentListParams = {
|
||||
page: number,
|
||||
page_size: number,
|
||||
claim_id: string,
|
||||
};
|
||||
|
||||
declare type CommentAbandonParams = {
|
||||
comment_id: string,
|
||||
creator_channel_id?: string,
|
||||
creator_channel_name?: string,
|
||||
channel_id?: string,
|
||||
hexdata?: string,
|
||||
};
|
||||
|
||||
declare type ModerationBlockParams = {};
|
||||
Vendored
-1
@@ -2,7 +2,6 @@
|
||||
|
||||
declare type PlayingUri = {
|
||||
uri: string,
|
||||
primaryUri: string,
|
||||
pathname: string,
|
||||
commentId?: string,
|
||||
source?: string,
|
||||
|
||||
Vendored
+1
-2
@@ -17,11 +17,10 @@ declare type RowDataItem = {
|
||||
help?: any,
|
||||
icon?: string,
|
||||
extra?: any,
|
||||
pinnedUrls?: Array<string>,
|
||||
options?: {
|
||||
channelIds?: Array<string>,
|
||||
limitClaimsPerChannel?: number,
|
||||
pageSize?: number,
|
||||
pageSize: number,
|
||||
},
|
||||
route?: string,
|
||||
hideForUnauth?: boolean,
|
||||
|
||||
Vendored
-27
@@ -1,27 +0,0 @@
|
||||
// @flow
|
||||
|
||||
declare type LivestreamReplayItem = {
|
||||
data: {
|
||||
claimId: string,
|
||||
deleted: boolean,
|
||||
deletedAt: ?string,
|
||||
ffprobe: any,
|
||||
fileDuration: number, // decimal? float? string?
|
||||
fileType: string,
|
||||
fileLocation: string,
|
||||
fileSize: number,
|
||||
key: string,
|
||||
published: boolean,
|
||||
publishedAt: ?string,
|
||||
service: string,
|
||||
thumbnails: Array<string>,
|
||||
uploadedAt: string, // Date?
|
||||
},
|
||||
id: string,
|
||||
}
|
||||
declare type LivestreamReplayData = Array<LivestreamReplayItem>;
|
||||
|
||||
declare type LivestreamState = {
|
||||
fetchingById: {},
|
||||
viewersById: {},
|
||||
}
|
||||
Vendored
-5
@@ -36,8 +36,3 @@ declare type WebNotification = {
|
||||
user_id: number,
|
||||
group_count?: number,
|
||||
};
|
||||
|
||||
declare type NotificationCategory = {
|
||||
name: string,
|
||||
types: ?Array<string>,
|
||||
};
|
||||
Vendored
-1
@@ -11,7 +11,6 @@ declare type UpdatePublishFormData = {
|
||||
thumbnail_url?: string,
|
||||
uploadThumbnailStatus?: string,
|
||||
thumbnailPath?: string,
|
||||
thumbnailError?: boolean,
|
||||
description?: string,
|
||||
language?: string,
|
||||
channel?: string,
|
||||
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
declare type ReportContentState = {
|
||||
isReporting: boolean,
|
||||
error: string,
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-15
@@ -14,22 +14,11 @@ declare type SearchOptions = {
|
||||
MEDIA_TEXT: string,
|
||||
MEDIA_IMAGE: string,
|
||||
MEDIA_APPLICATION: string,
|
||||
SORT: string,
|
||||
SORT_ACCENDING: string,
|
||||
SORT_DESCENDING: string,
|
||||
EXACT: string,
|
||||
TIME_FILTER: string,
|
||||
TIME_FILTER_LAST_HOUR: string,
|
||||
TIME_FILTER_TODAY: string,
|
||||
TIME_FILTER_THIS_WEEK: string,
|
||||
TIME_FILTER_THIS_MONTH: string,
|
||||
TIME_FILTER_THIS_YEAR: string,
|
||||
};
|
||||
|
||||
declare type SearchState = {
|
||||
options: SearchOptions,
|
||||
resultsByQuery: {},
|
||||
hasReachedMaxResultsLength: {},
|
||||
urisByQuery: {},
|
||||
searching: boolean,
|
||||
};
|
||||
|
||||
@@ -37,10 +26,7 @@ declare type SearchSuccess = {
|
||||
type: ACTIONS.SEARCH_SUCCESS,
|
||||
data: {
|
||||
query: string,
|
||||
from: number,
|
||||
size: number,
|
||||
uris: Array<string>,
|
||||
recsys: string,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Vendored
+11
@@ -1,4 +1,15 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import {
|
||||
DOWNLOADED,
|
||||
DOWNLOADING,
|
||||
NOTIFY_ONLY,
|
||||
VIEW_ALL,
|
||||
VIEW_LATEST_FIRST,
|
||||
SUGGESTED_TOP_BID,
|
||||
SUGGESTED_TOP_SUBSCRIBED,
|
||||
SUGGESTED_FEATURED,
|
||||
} from 'constants/subscriptions';
|
||||
|
||||
declare type Subscription = {
|
||||
channelName: string, // @CryptoCandor,
|
||||
|
||||
Vendored
-4
@@ -28,8 +28,4 @@ declare type User = {
|
||||
device_types: Array<DeviceType>,
|
||||
lbry_first_approved: boolean,
|
||||
experimental_ui: boolean,
|
||||
fiat_enabled: boolean,
|
||||
odysee_live_enabled: boolean,
|
||||
odysee_live_disabled: boolean,
|
||||
global_mod: boolean,
|
||||
};
|
||||
+1311
-98
File diff suppressed because it is too large.
Load diff
+5
-3
@@ -1,3 +1,5 @@
|
||||
module.exports = {
|
||||
en: {},
|
||||
};
|
||||
import * as lbrytv from './homepage';
|
||||
// import all homepages
|
||||
// export object of homepages
|
||||
export default {'en': lbrytv};
|
||||
export const NO_ADS_CHANNEL_IDS = [];
|
||||
@@ -1,4 +0,0 @@
|
||||
module.exports = {
|
||||
text: `This is LBRY`,
|
||||
url: 'https://odysee.com/@Odysee:8?view=discussion',
|
||||
};
|
||||
+7
-22
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.51.2",
|
||||
"version": "0.50.1",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -20,11 +20,10 @@
|
||||
},
|
||||
"main": "./dist/electron/main.js",
|
||||
"scripts": {
|
||||
"analyze": "source-map-explorer --only-mapped dist/electron/webpack/ui*.js --html dist/sourceMap.html",
|
||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
||||
"copyenv": "copyfiles ./.env* web/",
|
||||
"copyenv": "cp ./.env* web/",
|
||||
"dev": "yarn dev:electron",
|
||||
"dev:electron": "cross-env NODE_ENV=development node ./electron/devServer.js",
|
||||
"dev:web": "yarn copyenv && cd web && yarn dev",
|
||||
@@ -38,7 +37,6 @@
|
||||
"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'",
|
||||
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
|
||||
"flow-defs": "flow-typed install",
|
||||
"precommit": "lint-staged",
|
||||
@@ -54,19 +52,9 @@
|
||||
"electron-notarize": "^1.0.0",
|
||||
"electron-updater": "^4.2.4",
|
||||
"express": "^4.17.1",
|
||||
"humanize-duration": "^3.27.0",
|
||||
"if-env": "^1.0.4",
|
||||
"match-sorter": "^6.3.0",
|
||||
"parse-duration": "^1.0.0",
|
||||
"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",
|
||||
"videojs-ima": "^1.11.0",
|
||||
"videojs-logo": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -110,7 +98,6 @@
|
||||
"concurrently": "^4.1.2",
|
||||
"connected-react-router": "^6.8.0",
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"copyfiles": "^2.4.1",
|
||||
"country-data": "^0.0.31",
|
||||
"cross-env": "^7.0.3",
|
||||
"crypto-js": "^4.0.0",
|
||||
@@ -155,8 +142,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#c9ced4f226e06f4f188cb8dc31b561e1c27c5266",
|
||||
"lbry-redux": "lbryio/lbry-redux#9a1701372829c21cefbedacfc6033aec4dc7fa3c",
|
||||
"lbryinc": "lbryio/lbryinc#7faea40d87b78ec91b901c62f501499dc4737025",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
"lodash-es": "^4.17.14",
|
||||
@@ -166,7 +153,6 @@
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-libs-browser": "^2.1.0",
|
||||
"node-loader": "^0.6.0",
|
||||
"node-wget": "^0.4.3",
|
||||
"nodemon": "^1.19.1",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
@@ -217,8 +203,7 @@
|
||||
"tree-kill": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.3",
|
||||
"uuid": "^8.3.2",
|
||||
"vast-client": "^3.1.1",
|
||||
"video.js": "^7.13.3",
|
||||
"video.js": "^7.10.1",
|
||||
"videojs-contrib-quality-levels": "^2.0.9",
|
||||
"videojs-event-tracking": "^1.0.1",
|
||||
"villain-react": "^1.0.9",
|
||||
@@ -232,7 +217,7 @@
|
||||
"webpack-hot-middleware": "^2.24.3",
|
||||
"webpack-merge": "^4.2.1",
|
||||
"webpack-node-externals": "^1.7.2",
|
||||
"y18n": "^4.0.1",
|
||||
"y18n": "^4.0.0",
|
||||
"yarnhook": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -240,7 +225,7 @@
|
||||
"yarn": "^1.3"
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.99.0",
|
||||
"lbrynetDaemonVersion": "0.92.0",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet",
|
||||
|
||||
+68
-541
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 320 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -3,15 +3,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
||||
<link rel="icon" type="image/png" href="/public/favicon.png" />
|
||||
|
||||
<link rel="preload" href="/public/font/v1/300.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/300i.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/400.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/400i.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/700.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/700i.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/300.woff" as="font" type="font/woff" />
|
||||
<link rel="preload" href="/public/font/v1/300i.woff" as="font" type="font/woff" />
|
||||
<link rel="preload" href="/public/font/v1/400.woff" as="font" type="font/woff" />
|
||||
<link rel="preload" href="/public/font/v1/400i.woff" as="font" type="font/woff" />
|
||||
<link rel="preload" href="/public/font/v1/700.woff" as="font" type="font/woff" />
|
||||
<link rel="preload" href="/public/font/v1/700i.woff" as="font" type="font/woff" />
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
|
||||
+59
-188
@@ -9,17 +9,14 @@ import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
// @endif
|
||||
import { MATOMO_ID, MATOMO_URL } from 'config';
|
||||
import { MATOMO_ID, MATOMO_URL, LBRY_WEB_BUFFER_API } from 'config';
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.includes('dev');
|
||||
const devInternalApis = process.env.LBRY_API_URL;
|
||||
|
||||
export const SHARE_INTERNAL = 'shareInternal';
|
||||
const SHARE_THIRD_PARTY = 'shareThirdParty';
|
||||
|
||||
const WATCHMAN_BACKEND_ENDPOINT = 'https://watchman.na-backend.odysee.com/reports/playback';
|
||||
const SEND_DATA_TO_WATCHMAN_INTERVAL = 10; // in seconds
|
||||
|
||||
// @if TARGET='app'
|
||||
if (isProduction) {
|
||||
ElectronCookies.enable({
|
||||
@@ -40,8 +37,11 @@ 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,
|
||||
videoFetchDuration: (string, number) => void,
|
||||
videoStartEvent: (string, number) => void,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
videoBufferEvent: (
|
||||
StreamClaim,
|
||||
{
|
||||
@@ -53,10 +53,7 @@ type Analytics = {
|
||||
playerPoweredBy: string,
|
||||
readyState: number,
|
||||
}
|
||||
) => Promise<any>,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
) => void,
|
||||
emailProvidedEvent: () => void,
|
||||
emailVerifiedEvent: () => void,
|
||||
rewardEligibleEvent: () => void,
|
||||
@@ -80,178 +77,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 +196,57 @@ const analytics: Analytics = {
|
||||
Lbryio.call('content_tags', 'sync', params);
|
||||
}
|
||||
},
|
||||
|
||||
apiSearchFeedback: (query, vote) => {
|
||||
if (isProduction) {
|
||||
// We don't need to worry about analytics enabled here because users manually click on the button to provide feedback
|
||||
Lbryio.call('feedback', 'search', { query, vote });
|
||||
}
|
||||
},
|
||||
|
||||
videoFetchDuration: (source, duration) => {
|
||||
sendPromMetric('time_to_fetch', duration);
|
||||
sendMatomoEvent('Media', 'TimeToFetch', source, duration);
|
||||
},
|
||||
|
||||
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,
|
||||
},
|
||||
}),
|
||||
});
|
||||
}
|
||||
},
|
||||
playerLoadedEvent: (embedded) => {
|
||||
sendMatomoEvent('Player', 'Loaded', embedded ? 'embedded' : 'onsite');
|
||||
},
|
||||
playerStartedEvent: (embedded) => {
|
||||
sendMatomoEvent('Player', 'Started', embedded ? 'embedded' : 'onsite');
|
||||
},
|
||||
adsFetchedEvent: () => {
|
||||
sendMatomoEvent('Media', 'AdsFetched');
|
||||
},
|
||||
@@ -379,12 +256,6 @@ const analytics: Analytics = {
|
||||
adsErrorEvent: (response) => {
|
||||
sendMatomoEvent('Media', 'AdsError', JSON.stringify(response));
|
||||
},
|
||||
playerLoadedEvent: (embedded) => {
|
||||
sendMatomoEvent('Player', 'Loaded', embedded ? 'embedded' : 'onsite');
|
||||
},
|
||||
playerStartedEvent: (embedded) => {
|
||||
sendMatomoEvent('Player', 'Started', embedded ? 'embedded' : 'onsite');
|
||||
},
|
||||
tagFollowEvent: (tag, following) => {
|
||||
sendMatomoEvent('Tag', following ? 'Tag-Follow' : 'Tag-Unfollow', tag);
|
||||
},
|
||||
|
||||
+4
-37
@@ -4,45 +4,17 @@ 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_add_delegate: (params: ModerationAddDelegateParams) => fetchCommentsApi('moderation.AddDelegate', params),
|
||||
moderation_remove_delegate: (params: ModerationRemoveDelegateParams) =>
|
||||
fetchCommentsApi('moderation.RemoveDelegate', params),
|
||||
moderation_list_delegates: (params: ModerationListDelegatesParams) =>
|
||||
fetchCommentsApi('moderation.ListDelegates', params),
|
||||
moderation_am_i: (params: ModerationAmIParams) => fetchCommentsApi('moderation.AmI', params),
|
||||
moderation_block_list: (params: ModerationBlockParams) => fetchCommentsApi('moderation.BlockedList', params),
|
||||
comment_list: (params: CommentListParams) => fetchCommentsApi('comment.List', params),
|
||||
comment_abandon: (params: CommentAbandonParams) => fetchCommentsApi('comment.Abandon', params),
|
||||
comment_create: (params: CommentCreateParams) => fetchCommentsApi('comment.Create', params),
|
||||
comment_by_id: (params: CommentByIdParams) => fetchCommentsApi('comment.ByID', params),
|
||||
comment_pin: (params: CommentPinParams) => fetchCommentsApi('comment.Pin', params),
|
||||
comment_edit: (params: CommentEditParams) => fetchCommentsApi('comment.Edit', params),
|
||||
reaction_list: (params: ReactionListParams) => fetchCommentsApi('reaction.List', params),
|
||||
reaction_react: (params: ReactionReactParams) => fetchCommentsApi('reaction.React', params),
|
||||
setting_list: (params: SettingsParams) => fetchCommentsApi('setting.List', params),
|
||||
setting_block_word: (params: BlockWordParams) => fetchCommentsApi('setting.BlockWord', params),
|
||||
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}`;
|
||||
@@ -61,12 +33,7 @@ function fetchCommentsApi(method: string, params: {}) {
|
||||
|
||||
return fetch(url, options)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.error) {
|
||||
throw new Error(res.error.message);
|
||||
}
|
||||
return res.result;
|
||||
});
|
||||
.then((res) => res.result);
|
||||
}
|
||||
|
||||
export default Comments;
|
||||
@@ -30,6 +30,6 @@ export default function I18nMessage(props: Props) {
|
||||
return (
|
||||
// style={{height: iframeHeight}}
|
||||
// ref={iframeRef}
|
||||
<iframe src={src} title={title} onLoad={onLoad} sandbox={!IS_WEB} />
|
||||
<iframe src={src} title={title} onLoad={onLoad} />
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import ChannelBlockButton from 'component/channelBlockButton';
|
||||
import ChannelMuteButton from 'component/channelMuteButton';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -31,7 +30,6 @@ function AbandonedChannelPreview(props: Props) {
|
||||
<div className="section__actions">
|
||||
<ChannelBlockButton uri={uri} />
|
||||
<ChannelMuteButton uri={uri} />
|
||||
<SubscribeButton uri={uri} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,14 +5,7 @@ import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors
|
||||
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
||||
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
||||
import {
|
||||
doFetchChannelListMine,
|
||||
doFetchCollectionListMine,
|
||||
SETTINGS,
|
||||
selectMyChannelUrls,
|
||||
doResolveUris,
|
||||
} from 'lbry-redux';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { doFetchChannelListMine, selectMyChannelUrls, SETTINGS } from 'lbry-redux';
|
||||
import {
|
||||
makeSelectClientSetting,
|
||||
selectLanguage,
|
||||
@@ -34,7 +27,7 @@ import {
|
||||
doSetActiveChannel,
|
||||
doSetIncognito,
|
||||
} from 'redux/actions/app';
|
||||
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
|
||||
import { doFetchModBlockedList } from 'redux/actions/comments';
|
||||
import App from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
@@ -54,13 +47,11 @@ const select = (state) => ({
|
||||
syncFatalError: selectSyncFatalError(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
myChannelUrls: selectMyChannelUrls(state),
|
||||
subscriptions: selectSubscriptions(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
|
||||
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
||||
signIn: () => dispatch(doSignIn()),
|
||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||
@@ -71,8 +62,6 @@ const perform = (dispatch) => ({
|
||||
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
|
||||
setIncognito: () => dispatch(doSetIncognito()),
|
||||
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
|
||||
resolveUris: (uris) => dispatch(doResolveUris(uris)),
|
||||
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
|
||||
});
|
||||
|
||||
export default hot(connect(select, perform)(App));
|
||||
+48
-133
@@ -1,27 +1,34 @@
|
||||
// @flow
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React, { useEffect, useRef, useState, useLayoutEffect } from 'react';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import analytics from 'analytics';
|
||||
import { buildURI, parseURI } from 'lbry-redux';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import Router from 'component/router/index';
|
||||
import ModalRouter from 'modal/modalRouter';
|
||||
import ReactModal from 'react-modal';
|
||||
import { openContextMenu } from 'util/context-menu';
|
||||
import useKonamiListener from 'util/enhanced-layout';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import FileRenderFloating from 'component/fileRenderFloating';
|
||||
import { withRouter } from 'react-router';
|
||||
import usePrevious from 'effects/use-previous';
|
||||
import Nag from 'component/common/nag';
|
||||
import REWARDS from 'rewards';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import FileDrop from 'component/fileDrop';
|
||||
import NagContinueFirstRun from 'component/nagContinueFirstRun';
|
||||
import Spinner from 'component/spinner';
|
||||
import LANGUAGES from 'constants/languages';
|
||||
import SyncFatalError from 'component/syncFatalError';
|
||||
// @if TARGET='app'
|
||||
import useZoom from 'effects/use-zoom';
|
||||
import useHistoryNav from 'effects/use-history-nav';
|
||||
// @endif
|
||||
// @if TARGET='web'
|
||||
import OpenInAppLink from 'web/component/openInAppLink';
|
||||
import YoutubeWelcome from 'web/component/youtubeReferralWelcome';
|
||||
import NagDegradedPerformance from 'web/component/nag-degraded-performance';
|
||||
import NagDataCollection from 'web/component/nag-data-collection';
|
||||
import {
|
||||
useDegradedPerformance,
|
||||
STATUS_OK,
|
||||
@@ -31,35 +38,6 @@ import {
|
||||
} from 'web/effects/use-degraded-performance';
|
||||
// @endif
|
||||
import LANGUAGE_MIGRATIONS from 'constants/language-migrations';
|
||||
|
||||
const FileDrop = lazyImport(() => import('component/fileDrop' /* webpackChunkName: "secondary" */));
|
||||
const ModalRouter = lazyImport(() => import('modal/modalRouter' /* webpackChunkName: "secondary" */));
|
||||
const Nag = lazyImport(() => import('component/common/nag' /* webpackChunkName: "secondary" */));
|
||||
const NagContinueFirstRun = lazyImport(() =>
|
||||
import('component/nagContinueFirstRun' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
const OpenInAppLink = lazyImport(() => import('web/component/openInAppLink' /* webpackChunkName: "secondary" */));
|
||||
|
||||
// @if TARGET='web'
|
||||
const NagDataCollection = lazyImport(() =>
|
||||
import('web/component/nag-data-collection' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
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" */));
|
||||
const Yrbl = lazyImport(() => import('component/yrbl' /* webpackChunkName: "yrbl" */));
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
|
||||
export const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
||||
|
||||
@@ -82,7 +60,6 @@ type Props = {
|
||||
},
|
||||
fetchAccessToken: () => void,
|
||||
fetchChannelListMine: () => void,
|
||||
fetchCollectionListMine: () => void,
|
||||
signIn: () => void,
|
||||
requestDownloadUpgrade: () => void,
|
||||
onSignedIn: () => void,
|
||||
@@ -100,16 +77,14 @@ type Props = {
|
||||
isAuthenticated: boolean,
|
||||
socketConnect: () => void,
|
||||
syncLoop: (?boolean) => void,
|
||||
syncEnabled: boolean,
|
||||
currentModal: any,
|
||||
syncFatalError: boolean,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
myChannelUrls: ?Array<string>,
|
||||
subscriptions: Array<Subscription>,
|
||||
setActiveChannelIfNotSet: () => void,
|
||||
setIncognito: (boolean) => void,
|
||||
fetchModBlockedList: () => void,
|
||||
resolveUris: (Array<string>) => void,
|
||||
fetchModAmIList: () => void,
|
||||
};
|
||||
|
||||
function App(props: Props) {
|
||||
@@ -118,7 +93,6 @@ function App(props: Props) {
|
||||
user,
|
||||
fetchAccessToken,
|
||||
fetchChannelListMine,
|
||||
fetchCollectionListMine,
|
||||
signIn,
|
||||
autoUpdateDownloaded,
|
||||
isUpgradeAvailable,
|
||||
@@ -142,9 +116,6 @@ function App(props: Props) {
|
||||
setActiveChannelIfNotSet,
|
||||
setIncognito,
|
||||
fetchModBlockedList,
|
||||
resolveUris,
|
||||
subscriptions,
|
||||
fetchModAmIList,
|
||||
} = props;
|
||||
|
||||
const appRef = useRef();
|
||||
@@ -162,16 +133,12 @@ function App(props: Props) {
|
||||
// @endif
|
||||
const { pathname, hash, search } = props.location;
|
||||
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}`);
|
||||
const userId = user && user.id;
|
||||
@@ -180,8 +147,6 @@ function App(props: Props) {
|
||||
const hasNoChannels = myChannelUrls && myChannelUrls.length === 0;
|
||||
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
|
||||
const hasActiveChannelClaim = activeChannelClaim !== undefined;
|
||||
const isPersonalized = !IS_WEB || hasVerifiedEmail;
|
||||
const renderFiledrop = !IS_WEB || isAuthenticated;
|
||||
|
||||
let uri;
|
||||
try {
|
||||
@@ -267,9 +232,8 @@ function App(props: Props) {
|
||||
|
||||
// @if TARGET='app'
|
||||
fetchChannelListMine(); // This is fetched after a user is signed in on web
|
||||
fetchCollectionListMine();
|
||||
// @endif
|
||||
}, [appRef, fetchAccessToken, fetchChannelListMine, fetchCollectionListMine]);
|
||||
}, [appRef, fetchAccessToken, fetchChannelListMine]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
@@ -285,22 +249,12 @@ function App(props: Props) {
|
||||
|
||||
if (hasMyChannels) {
|
||||
fetchModBlockedList();
|
||||
fetchModAmIList();
|
||||
}
|
||||
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
document.documentElement.setAttribute('lang', language);
|
||||
}, [language]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!languages.includes(language)) {
|
||||
setLanguage(language);
|
||||
|
||||
if (document && document.documentElement && LANGUAGES[language].length >= 3) {
|
||||
document.documentElement.dir = LANGUAGES[language][2];
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [language, languages]);
|
||||
@@ -325,23 +279,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) {
|
||||
@@ -397,16 +334,6 @@ function App(props: Props) {
|
||||
}
|
||||
}, [hasVerifiedEmail, signIn, hasSignedIn]);
|
||||
|
||||
// batch resolve subscriptions to be used by the sideNavigation component.
|
||||
// add it here so that it only resolves the first time, despite route changes.
|
||||
// useLayoutEffect because it has to be executed before the sideNavigation component requests them
|
||||
useLayoutEffect(() => {
|
||||
if (sidebarOpen && isPersonalized && subscriptions && !resolvedSubscriptions) {
|
||||
setResolvedSubscriptions(true);
|
||||
resolveUris(subscriptions.map((sub) => sub.uri));
|
||||
}
|
||||
}, [sidebarOpen, isPersonalized, resolvedSubscriptions, subscriptions, resolveUris, setResolvedSubscriptions]);
|
||||
|
||||
// @if TARGET='web'
|
||||
useDegradedPerformance(setLbryTvApiStatus, user);
|
||||
// @endif
|
||||
@@ -415,7 +342,7 @@ function App(props: Props) {
|
||||
// Require an internal-api user on lbry.tv
|
||||
// This also prevents the site from loading in the un-authed state while we wait for internal-apis to return for the first time
|
||||
// It's not needed on desktop since there is no un-authed state
|
||||
if (user === undefined) {
|
||||
if (!user) {
|
||||
return (
|
||||
<div className="main--empty">
|
||||
<Spinner delayed />
|
||||
@@ -426,13 +353,11 @@ function App(props: Props) {
|
||||
|
||||
if (syncFatalError) {
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<SyncFatalError
|
||||
// @if TARGET='web'
|
||||
lbryTvApiStatus={lbryTvApiStatus}
|
||||
// @endif
|
||||
/>
|
||||
</React.Suspense>
|
||||
<SyncFatalError
|
||||
// @if TARGET='web'
|
||||
lbryTvApiStatus={lbryTvApiStatus}
|
||||
// @endif
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -448,51 +373,41 @@ function App(props: Props) {
|
||||
onContextMenu={IS_WEB ? undefined : (e) => openContextMenu(e)}
|
||||
>
|
||||
{IS_WEB && lbryTvApiStatus === STATUS_DOWN ? (
|
||||
<React.Suspense fallback={null}>
|
||||
<Yrbl
|
||||
className="main--empty"
|
||||
title={__('lbry.tv is currently down')}
|
||||
subtitle={__('My wheel broke, but the good news is that someone from LBRY is working on it.')}
|
||||
/>
|
||||
</React.Suspense>
|
||||
<Yrbl
|
||||
className="main--empty"
|
||||
title={__('lbry.tv is currently down')}
|
||||
subtitle={__('My wheel broke, but the good news is that someone from LBRY is working on it.')}
|
||||
/>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<Router />
|
||||
<React.Suspense fallback={null}>
|
||||
<ModalRouter />
|
||||
{renderFiledrop && <FileDrop />}
|
||||
</React.Suspense>
|
||||
<ModalRouter />
|
||||
<FileDrop />
|
||||
<FileRenderFloating />
|
||||
<React.Suspense fallback={null}>
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
{/* @if TARGET='app' */}
|
||||
{showUpgradeButton && (
|
||||
<Nag
|
||||
message={__('An upgrade is available.')}
|
||||
actionText={__('Install Now')}
|
||||
onClick={requestDownloadUpgrade}
|
||||
onClose={() => setUpgradeNagClosed(true)}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{/* @if TARGET='app' */}
|
||||
{showUpgradeButton && (
|
||||
<Nag
|
||||
message={__('An upgrade is available.')}
|
||||
actionText={__('Install Now')}
|
||||
onClick={requestDownloadUpgrade}
|
||||
onClose={() => setUpgradeNagClosed(true)}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
{/* @if TARGET='web' */}
|
||||
<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)} />
|
||||
)}
|
||||
{!SIMPLE_SITE && lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (
|
||||
<NagDataCollection onClose={handleAnalyticsDismiss} />
|
||||
)}
|
||||
{user === null && <NagNoUser />}
|
||||
{/* @endif */}
|
||||
</React.Suspense>
|
||||
{/* @if TARGET='web' */}
|
||||
<YoutubeWelcome />
|
||||
{false && !shouldHideNag && <OpenInAppLink uri={uri} />}
|
||||
{!shouldHideNag && <NagContinueFirstRun />}
|
||||
{(lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) && !shouldHideNag && (
|
||||
<NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />
|
||||
)}
|
||||
{false && lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (
|
||||
<NagDataCollection onClose={handleAnalyticsDismiss} />
|
||||
)}
|
||||
{/* @endif */}
|
||||
</React.Fragment>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, SETTINGS } 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';
|
||||
|
||||
/*
|
||||
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
|
||||
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
|
||||
*/
|
||||
const select = (state, props) => ({
|
||||
nextRecommendedClaim: makeSelectClaimForUri(props.nextRecommendedUri)(state),
|
||||
modal: selectModal(state),
|
||||
});
|
||||
const select = (state, props) => {
|
||||
const nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
|
||||
return {
|
||||
nextRecommendedUri,
|
||||
nextRecommendedClaim: makeSelectClaimForUri(nextRecommendedUri)(state),
|
||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||
autoplay: makeSelectClientSetting(SETTINGS.AUTOPLAY)(state),
|
||||
modal: selectModal(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default withRouter(connect(select, null)(AutoplayCountdown));
|
||||
export default withRouter(
|
||||
connect(select, {
|
||||
doSetPlayingUri,
|
||||
doPlayUri,
|
||||
})(AutoplayCountdown)
|
||||
);
|
||||
@@ -1,38 +1,34 @@
|
||||
// @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';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 150;
|
||||
const CLASSNAME_AUTOPLAY_COUNTDOWN = 'autoplay-countdown';
|
||||
|
||||
type Props = {
|
||||
history: { push: (string) => void },
|
||||
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,
|
||||
};
|
||||
|
||||
function AutoplayCountdown(props: Props) {
|
||||
const {
|
||||
nextRecommendedUri,
|
||||
nextRecommendedClaim,
|
||||
doSetPlayingUri,
|
||||
doPlayUri,
|
||||
isFloating,
|
||||
history: { push },
|
||||
modal,
|
||||
skipPaid,
|
||||
doNavigate,
|
||||
doReplay,
|
||||
doPrevious,
|
||||
onCanceled,
|
||||
} = props;
|
||||
const nextTitle = nextRecommendedClaim && nextRecommendedClaim.value && nextRecommendedClaim.value.title;
|
||||
|
||||
@@ -45,25 +41,37 @@ function AutoplayCountdown(props: Props) {
|
||||
const anyModalPresent = modal !== undefined && modal !== null;
|
||||
const isTimerPaused = timerPaused || anyModalPresent;
|
||||
|
||||
let navigateUrl;
|
||||
if (nextTitle) {
|
||||
navigateUrl = formatLbryUrlForWeb(nextRecommendedUri);
|
||||
}
|
||||
|
||||
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.
|
||||
setTimerPaused(shouldPauseAutoplay());
|
||||
|
||||
const handleScroll = debounce((e) => {
|
||||
const handleScroll = debounce(e => {
|
||||
setTimerPaused(shouldPauseAutoplay());
|
||||
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
||||
|
||||
@@ -82,7 +90,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 +100,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 +127,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
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
import Button from './view';
|
||||
import React, { forwardRef } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
const mapStateToProps = state => ({
|
||||
pathname: state.router.location.pathname,
|
||||
emailVerified: selectUserVerifiedEmail(state),
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
const ConnectedButton = connect(mapStateToProps)(Button);
|
||||
|
||||
@@ -38,7 +38,6 @@ type Props = {
|
||||
myref: any,
|
||||
dispatch: any,
|
||||
'aria-label'?: string,
|
||||
user: ?User,
|
||||
};
|
||||
|
||||
// use forwardRef to allow consumers to pass refs to the button content if they want to
|
||||
@@ -70,13 +69,10 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
myref,
|
||||
dispatch, // <button> doesn't know what to do with dispatch
|
||||
pathname,
|
||||
user,
|
||||
authSrc,
|
||||
...otherProps
|
||||
} = props;
|
||||
|
||||
const disable = disabled || (user === null && requiresAuth);
|
||||
|
||||
const combinedClassName = classnames(
|
||||
'button',
|
||||
button
|
||||
@@ -86,7 +82,7 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
'button--alt': button === 'alt',
|
||||
'button--inverse': button === 'inverse',
|
||||
'button--close': button === 'close',
|
||||
'button--disabled': disable,
|
||||
'button--disabled': disabled,
|
||||
'button--link': button === 'link',
|
||||
}
|
||||
: 'button--no-style',
|
||||
@@ -97,9 +93,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
const combinedRef = useCombinedRefs(ref, innerRef, myref);
|
||||
const size = iconSize || (!label && !children) ? 18 : undefined; // Fall back to default
|
||||
|
||||
// Label can be a string or object ( use title instead )
|
||||
const ariaLabel = description || (typeof label === 'string' ? label : title);
|
||||
|
||||
const content = (
|
||||
<span className="button__content">
|
||||
{icon && <Icon icon={icon} iconColor={iconColor} size={iconSize} />}
|
||||
@@ -153,7 +146,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
className={combinedClassName}
|
||||
title={title}
|
||||
onClick={onClick}
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
@@ -192,15 +184,14 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
return (
|
||||
<NavLink
|
||||
exact
|
||||
onClick={(e) => {
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
to={redirectUrl}
|
||||
title={title || defaultTooltip}
|
||||
disabled={disable}
|
||||
disabled={disabled}
|
||||
className={combinedClassName}
|
||||
activeClassName={activeClass}
|
||||
aria-label={ariaLabel}
|
||||
>
|
||||
{content}
|
||||
</NavLink>
|
||||
@@ -212,8 +203,8 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
exact
|
||||
to={path}
|
||||
title={title || defaultTooltip}
|
||||
disabled={disable}
|
||||
onClick={(e) => {
|
||||
disabled={disabled}
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
if (onClick) {
|
||||
onClick();
|
||||
@@ -221,7 +212,6 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
}}
|
||||
className={combinedClassName}
|
||||
activeClassName={activeClass}
|
||||
aria-label={ariaLabel}
|
||||
{...otherProps}
|
||||
>
|
||||
{content}
|
||||
@@ -230,15 +220,15 @@ const Button = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
<button
|
||||
ref={combinedRef}
|
||||
title={title || defaultTooltip}
|
||||
aria-label={ariaLabel}
|
||||
aria-label={description || label || title}
|
||||
className={combinedClassName}
|
||||
onClick={(e) => {
|
||||
onClick={e => {
|
||||
if (onClick) {
|
||||
e.stopPropagation();
|
||||
onClick(e);
|
||||
}
|
||||
}}
|
||||
disabled={disable}
|
||||
disabled={disabled}
|
||||
type={type}
|
||||
{...otherProps}
|
||||
>
|
||||
|
||||
@@ -111,7 +111,6 @@ class CardVerify extends React.Component {
|
||||
CardVerify.stripeHandler = StripeCheckout.configure({
|
||||
key: this.props.stripeKey,
|
||||
});
|
||||
|
||||
if (this.hasPendingClick) {
|
||||
this.showStripeDialog();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectMetadataItemForUri, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectMetadataItemForUri, makeSelectClaimForUri, makeSelectStakedLevelForChannelUri } from 'lbry-redux';
|
||||
import ChannelAbout from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
stakedLevel: makeSelectStakedLevelForChannelUri(props.uri)(state),
|
||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
|
||||
email: makeSelectMetadataItemForUri(props.uri, 'email')(state),
|
||||
|
||||
@@ -17,6 +17,7 @@ type Props = {
|
||||
email: ?string,
|
||||
website: ?string,
|
||||
languages: Array<string>,
|
||||
stakedLevel?: number,
|
||||
};
|
||||
|
||||
const formatEmail = (email: string) => {
|
||||
@@ -29,7 +30,7 @@ const formatEmail = (email: string) => {
|
||||
};
|
||||
|
||||
function ChannelAbout(props: Props) {
|
||||
const { claim, uri, description, email, website, languages } = props;
|
||||
const { claim, uri, description, email, website, languages, stakedLevel } = props;
|
||||
const claimId = claim && claim.claim_id;
|
||||
|
||||
return (
|
||||
@@ -40,7 +41,7 @@ function ChannelAbout(props: Props) {
|
||||
<>
|
||||
<label>{__('Description')}</label>
|
||||
<div className="media__info-text media__info-text--constrained">
|
||||
<MarkdownPreview content={description} />
|
||||
<MarkdownPreview content={description} stakedLevel={stakedLevel} />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,57 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIdForUri } from 'lbry-redux';
|
||||
import {
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModUnBlockAsAdmin,
|
||||
doCommentModUnBlockAsModerator,
|
||||
doCommentModBlockAsModerator,
|
||||
} from 'redux/actions/comments';
|
||||
import {
|
||||
makeSelectChannelIsBlocked,
|
||||
makeSelectChannelIsAdminBlocked,
|
||||
makeSelectChannelIsModeratorBlockedForCreator,
|
||||
makeSelectUriIsBlockingOrUnBlocking,
|
||||
makeSelectIsTogglingForDelegator,
|
||||
} from 'redux/selectors/comments';
|
||||
|
||||
import { BLOCK_LEVEL } from 'constants/comment';
|
||||
import { doCommentModUnBlock, doCommentModBlock } from 'redux/actions/comments';
|
||||
import { makeSelectChannelIsBlocked, makeSelectUriIsBlockingOrUnBlocking } from 'redux/selectors/comments';
|
||||
import ChannelBlockButton from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
let isBlocked;
|
||||
let isToggling;
|
||||
|
||||
switch (props.blockLevel) {
|
||||
default:
|
||||
case BLOCK_LEVEL.SELF:
|
||||
isBlocked = makeSelectChannelIsBlocked(props.uri)(state);
|
||||
break;
|
||||
|
||||
case BLOCK_LEVEL.MODERATOR:
|
||||
isBlocked = makeSelectChannelIsModeratorBlockedForCreator(props.uri, props.creatorUri)(state);
|
||||
isToggling = makeSelectIsTogglingForDelegator(props.uri, props.creatorUri)(state);
|
||||
break;
|
||||
|
||||
case BLOCK_LEVEL.ADMIN:
|
||||
isBlocked = makeSelectChannelIsAdminBlocked(props.uri)(state);
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
isBlocked,
|
||||
isToggling,
|
||||
isBlockingOrUnBlocking: makeSelectUriIsBlockingOrUnBlocking(props.uri)(state),
|
||||
creatorId: makeSelectClaimIdForUri(props.creatorUri)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
isBlocked: makeSelectChannelIsBlocked(props.uri)(state),
|
||||
isBlockingOrUnBlocking: makeSelectUriIsBlockingOrUnBlocking(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlockAsAdmin,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModUnBlockAsModerator,
|
||||
doCommentModBlockAsModerator,
|
||||
})(ChannelBlockButton);
|
||||
@@ -1,93 +1,41 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { BLOCK_LEVEL } from 'constants/comment';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
blockLevel?: string,
|
||||
creatorUri?: string,
|
||||
isBlocked: boolean,
|
||||
isBlockingOrUnBlocking: boolean,
|
||||
isToggling: boolean,
|
||||
doCommentModUnBlock: (string, boolean) => void,
|
||||
doCommentModBlock: (string, ?Number, boolean) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModUnBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModBlockAsModerator: (string, string, string) => void,
|
||||
doCommentModUnBlock: (string) => void,
|
||||
doCommentModBlock: (string) => void,
|
||||
};
|
||||
|
||||
function ChannelBlockButton(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
blockLevel,
|
||||
creatorUri,
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlockAsAdmin,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModUnBlockAsModerator,
|
||||
doCommentModBlockAsModerator,
|
||||
isBlocked,
|
||||
isBlockingOrUnBlocking,
|
||||
isToggling,
|
||||
} = props;
|
||||
const { uri, doCommentModUnBlock, doCommentModBlock, isBlocked, isBlockingOrUnBlocking } = props;
|
||||
|
||||
function handleClick() {
|
||||
switch (blockLevel) {
|
||||
default:
|
||||
case BLOCK_LEVEL.SELF:
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri, false);
|
||||
} else {
|
||||
doCommentModBlock(uri, undefined, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLOCK_LEVEL.MODERATOR:
|
||||
if (creatorUri) {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsModerator(uri, creatorUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsModerator(uri, creatorUri, '');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BLOCK_LEVEL.ADMIN:
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlockAsAdmin(uri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(uri, '');
|
||||
}
|
||||
break;
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri);
|
||||
} else {
|
||||
doCommentModBlock(uri);
|
||||
}
|
||||
}
|
||||
|
||||
function getButtonText(blockLevel) {
|
||||
switch (blockLevel) {
|
||||
default:
|
||||
case BLOCK_LEVEL.SELF:
|
||||
case BLOCK_LEVEL.ADMIN:
|
||||
return isBlocked
|
||||
return (
|
||||
<Button
|
||||
button={isBlocked ? 'alt' : 'secondary'}
|
||||
label={
|
||||
isBlocked
|
||||
? isBlockingOrUnBlocking
|
||||
? __('Unblocking...')
|
||||
: __('Unblock')
|
||||
: isBlockingOrUnBlocking
|
||||
? __('Blocking...')
|
||||
: __('Block');
|
||||
|
||||
case BLOCK_LEVEL.MODERATOR:
|
||||
if (isToggling) {
|
||||
return isBlocked ? __('Unblocking...') : __('Blocking...');
|
||||
} else {
|
||||
return isBlocked ? __('Unblock') : __('Block');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return <Button button={isBlocked ? 'alt' : 'secondary'} label={getButtonText(blockLevel)} onClick={handleClick} />;
|
||||
: __('Block')
|
||||
}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default ChannelBlockButton;
|
||||
@@ -14,7 +14,7 @@ import { withRouter } from 'react-router';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
|
||||
import ChannelContent from './view';
|
||||
import ChannelPage from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
@@ -37,4 +37,4 @@ const perform = (dispatch) => ({
|
||||
doResolveUris: (uris, returnCachedUris) => dispatch(doResolveUris(uris, returnCachedUris)),
|
||||
});
|
||||
|
||||
export default withRouter(connect(select, perform)(ChannelContent));
|
||||
export default withRouter(connect(select, perform)(ChannelPage));
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { SHOW_ADS, SIMPLE_SITE } from 'config';
|
||||
import { SHOW_ADS } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React, { Fragment } from 'react';
|
||||
@@ -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,
|
||||
@@ -28,14 +26,12 @@ type Props = {
|
||||
channelIsBlackListed: boolean,
|
||||
defaultPageSize?: number,
|
||||
defaultInfiniteScroll?: Boolean,
|
||||
claim: Claim,
|
||||
claim: ?Claim,
|
||||
isAuthenticated: boolean,
|
||||
showMature: boolean,
|
||||
tileLayout: boolean,
|
||||
viewHiddenChannels: boolean,
|
||||
doResolveUris: (Array<string>, boolean) => void,
|
||||
claimType: string,
|
||||
empty?: string,
|
||||
};
|
||||
|
||||
function ChannelContent(props: Props) {
|
||||
@@ -53,8 +49,6 @@ function ChannelContent(props: Props) {
|
||||
tileLayout,
|
||||
viewHiddenChannels,
|
||||
doResolveUris,
|
||||
claimType,
|
||||
empty,
|
||||
} = props;
|
||||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
const [searchQuery, setSearchQuery] = React.useState('');
|
||||
@@ -64,11 +58,6 @@ 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));
|
||||
|
||||
function handleInputChange(e) {
|
||||
const { value } = e.target;
|
||||
@@ -87,7 +76,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}`;
|
||||
});
|
||||
@@ -141,26 +130,21 @@ function ChannelContent(props: Props) {
|
||||
|
||||
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
|
||||
|
||||
<ClaimListDiscover
|
||||
hasSource
|
||||
defaultFreshness={CS.FRESH_ALL}
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
forceShowReposts
|
||||
fetchViewCount
|
||||
hideFilters={!showFilters}
|
||||
hideAdvancedFilter={!showFilters}
|
||||
tileLayout={tileLayout}
|
||||
uris={searchResults}
|
||||
streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined}
|
||||
channelIds={[claimId]}
|
||||
claimType={claimType}
|
||||
feeAmount={CS.FEE_AMOUNT_ANY}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={defaultPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />}
|
||||
meta={
|
||||
showFilters && (
|
||||
{claim && claimsInChannel > 0 ? (
|
||||
<ClaimListDiscover
|
||||
hideLivestreamClaims
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
forceShowReposts
|
||||
tileLayout={tileLayout}
|
||||
uris={searchResults}
|
||||
streamType={CS.CONTENT_ALL}
|
||||
channelIds={[claim.claim_id]}
|
||||
feeAmount={CS.FEE_AMOUNT_ANY}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={defaultPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />}
|
||||
meta={
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
@@ -171,12 +155,11 @@ function ChannelContent(props: Props) {
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
isChannel
|
||||
channelIsMine={channelIsMine}
|
||||
empty={empty}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<section className="main--empty">{__("This channel hasn't published anything yet")}</section>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router';
|
||||
import { makeSelectCommentForCommentId } from 'redux/selectors/comments';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
import ChannelDiscussion from './view';
|
||||
import { makeSelectTagInClaimOrChannelForUri } from 'lbry-redux';
|
||||
@@ -7,9 +8,10 @@ import { makeSelectTagInClaimOrChannelForUri } from 'lbry-redux';
|
||||
const select = (state, props) => {
|
||||
const { search } = props.location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const linkedCommentId = urlParams.get('lc');
|
||||
|
||||
return {
|
||||
linkedCommentId: urlParams.get('lc'),
|
||||
linkedComment: makeSelectCommentForCommentId(linkedCommentId)(state),
|
||||
commentsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,19 +5,19 @@ import Empty from 'component/common/empty';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
linkedCommentId?: string,
|
||||
linkedComment: ?any,
|
||||
commentsDisabled: boolean,
|
||||
};
|
||||
|
||||
function ChannelDiscussion(props: Props) {
|
||||
const { uri, linkedCommentId, commentsDisabled } = props;
|
||||
const { uri, linkedComment, commentsDisabled } = props;
|
||||
|
||||
if (commentsDisabled) {
|
||||
return <Empty text={__('This channel has disabled comments on their page.')} />;
|
||||
}
|
||||
return (
|
||||
<section className="section">
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} />
|
||||
<CommentsList uri={uri} linkedComment={linkedComment} />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@ 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';
|
||||
import ChannelPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
@@ -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);
|
||||
export default connect(select, perform)(ChannelPage);
|
||||
@@ -21,9 +21,6 @@ import LbcSymbol from 'component/common/lbc-symbol';
|
||||
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 +47,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 +78,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 +93,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 +172,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 +202,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 +218,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 +229,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 +241,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 +253,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 +267,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)}
|
||||
@@ -426,7 +361,6 @@ function ChannelForm(props: Props) {
|
||||
<TagsSearch
|
||||
suggestMature={!SIMPLE_SITE}
|
||||
disableAutoFocus
|
||||
disableControlTags
|
||||
limitSelect={MAX_TAG_SELECT}
|
||||
tagsPassedIn={params.tags || []}
|
||||
label={__('Selected Tags')}
|
||||
@@ -481,9 +415,9 @@ function ChannelForm(props: Props) {
|
||||
<option key={'pri-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
<option key={langKey} value={langKey}>
|
||||
{langName}
|
||||
{Object.keys(SUPPORTED_LANGUAGES).map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
@@ -499,11 +433,13 @@ function ChannelForm(props: Props) {
|
||||
<option key={'sec-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
<option key={langKey} value={langKey} disabled={langKey === languageParam[0]}>
|
||||
{langName}
|
||||
</option>
|
||||
))}
|
||||
{Object.keys(SUPPORTED_LANGUAGES)
|
||||
.filter((lang) => lang !== languageParam[0])
|
||||
.map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
</>
|
||||
}
|
||||
@@ -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 ? (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
|
||||
import { doToggleMuteChannel } from 'redux/actions/blocked';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import ChannelMuteButton from './view';
|
||||
|
||||
@@ -8,6 +8,5 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doChannelMute,
|
||||
doChannelUnmute,
|
||||
doToggleMuteChannel,
|
||||
})(ChannelMuteButton);
|
||||
@@ -6,24 +6,19 @@ type Props = {
|
||||
uri: string,
|
||||
isMuted: boolean,
|
||||
channelClaim: ?ChannelClaim,
|
||||
doChannelMute: (string, boolean) => void,
|
||||
doChannelUnmute: (string, boolean) => void,
|
||||
doToggleMuteChannel: (string) => void,
|
||||
};
|
||||
|
||||
function ChannelMuteButton(props: Props) {
|
||||
const { uri, doChannelMute, doChannelUnmute, isMuted } = props;
|
||||
|
||||
function handleClick() {
|
||||
if (isMuted) {
|
||||
doChannelUnmute(uri, false);
|
||||
} else {
|
||||
doChannelMute(uri, false);
|
||||
}
|
||||
}
|
||||
function ChannelBlockButton(props: Props) {
|
||||
const { uri, doToggleMuteChannel, isMuted } = props;
|
||||
|
||||
return (
|
||||
<Button button={isMuted ? 'alt' : 'secondary'} label={isMuted ? __('Unmute') : __('Mute')} onClick={handleClick} />
|
||||
<Button
|
||||
button={isMuted ? 'alt' : 'secondary'}
|
||||
label={isMuted ? __('Unmute') : __('Mute')}
|
||||
onClick={() => doToggleMuteChannel(uri)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default ChannelMuteButton;
|
||||
export default ChannelBlockButton;
|
||||
@@ -2,9 +2,9 @@ import { connect } from 'react-redux';
|
||||
import { selectMyChannelClaims } from 'lbry-redux';
|
||||
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
||||
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||
import ChannelSelector from './view';
|
||||
import SelectChannel from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
const select = state => ({
|
||||
channels: selectMyChannelClaims(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
incognito: selectIncognito(state),
|
||||
@@ -13,4 +13,4 @@ const select = (state) => ({
|
||||
export default connect(select, {
|
||||
doSetActiveChannel,
|
||||
doSetIncognito,
|
||||
})(ChannelSelector);
|
||||
})(SelectChannel);
|
||||
@@ -30,7 +30,7 @@ function ChannelListItem(props: ListItemProps) {
|
||||
|
||||
return (
|
||||
<div className={classnames('channel__list-item', { 'channel__list-item--selected': isSelected })}>
|
||||
<ChannelThumbnail uri={uri} hideStakedIndicator xsmall noLazyLoad />
|
||||
<ChannelThumbnail uri={uri} hideStakedIndicator />
|
||||
<ChannelTitle uri={uri} />
|
||||
{isSelected && <Icon icon={ICONS.DOWN} />}
|
||||
</div>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
@@ -2,11 +2,9 @@
|
||||
import React from 'react';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import classnames from 'classnames';
|
||||
import Gerbil from './gerbil.png';
|
||||
import Spaceman from './spaceman.png';
|
||||
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
|
||||
import ChannelStakedIndicator from 'component/channelStakedIndicator';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import { AVATAR_DEFAULT } from 'config';
|
||||
|
||||
type Props = {
|
||||
thumbnail: ?string,
|
||||
@@ -15,18 +13,12 @@ type Props = {
|
||||
thumbnailPreview: ?string,
|
||||
obscure?: boolean,
|
||||
small?: boolean,
|
||||
xsmall?: boolean,
|
||||
allowGifs?: boolean,
|
||||
claim: ?ChannelClaim,
|
||||
doResolveUri: (string) => void,
|
||||
isResolving: boolean,
|
||||
showDelayedMessage?: boolean,
|
||||
noLazyLoad?: boolean,
|
||||
hideStakedIndicator?: boolean,
|
||||
xsmall?: boolean,
|
||||
noOptimization?: boolean,
|
||||
setThumbUploadError: (boolean) => void,
|
||||
ThumbUploadError: boolean,
|
||||
};
|
||||
|
||||
function ChannelThumbnail(props: Props) {
|
||||
@@ -37,26 +29,19 @@ function ChannelThumbnail(props: Props) {
|
||||
thumbnailPreview: rawThumbnailPreview,
|
||||
obscure,
|
||||
small = false,
|
||||
xsmall = false,
|
||||
allowGifs = false,
|
||||
claim,
|
||||
doResolveUri,
|
||||
isResolving,
|
||||
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 isGif = channelThumbnail && channelThumbnail.endsWith('gif');
|
||||
const channelThumbnail = thumbnail || thumbnailPreview;
|
||||
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
|
||||
|
||||
// Generate a random color class based on the first letter of the channel name
|
||||
const { channelName } = parseURI(uri);
|
||||
let initializer;
|
||||
@@ -74,7 +59,7 @@ function ChannelThumbnail(props: Props) {
|
||||
}
|
||||
}, [doResolveUri, shouldResolve, uri]);
|
||||
|
||||
if (isGif && !allowGifs) {
|
||||
if (channelThumbnail && channelThumbnail.endsWith('gif') && !allowGifs) {
|
||||
return (
|
||||
<FreezeframeWrapper src={channelThumbnail} className={classnames('channel-thumbnail', className)}>
|
||||
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
|
||||
@@ -87,27 +72,31 @@ function ChannelThumbnail(props: Props) {
|
||||
className={classnames('channel-thumbnail', className, {
|
||||
[colorClassName]: !showThumb,
|
||||
'channel-thumbnail--small': small,
|
||||
'channel-thumbnail--xsmall': xsmall,
|
||||
'channel-thumbnail--resolving': isResolving,
|
||||
})}
|
||||
>
|
||||
{showDelayedMessage ? (
|
||||
<div className="channel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
|
||||
) : (
|
||||
<OptimizedImage
|
||||
{!showThumb && (
|
||||
<img
|
||||
alt={__('Channel profile picture')}
|
||||
className={!channelThumbnail ? 'channel-thumbnail__default' : 'channel-thumbnail__custom'}
|
||||
src={(!thumbLoadError && channelThumbnail) || defaultAvatar}
|
||||
loading={noLazyLoad ? undefined : 'lazy'}
|
||||
onError={() => {
|
||||
if (setThumbUploadError) {
|
||||
setThumbUploadError(true);
|
||||
} else {
|
||||
setThumbLoadError(true);
|
||||
}
|
||||
}}
|
||||
className="channel-thumbnail__default"
|
||||
src={!thumbError && thumbnailPreview ? thumbnailPreview : Spaceman}
|
||||
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>
|
||||
) : (
|
||||
<img
|
||||
alt={__('Channel profile picture')}
|
||||
className="channel-thumbnail__custom"
|
||||
src={!thumbError ? thumbnailPreview || thumbnail : Spaceman}
|
||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -6,22 +6,13 @@ import Button from 'component/button';
|
||||
|
||||
type Props = {
|
||||
doOpenModal: (string, {}) => void,
|
||||
claim: Claim,
|
||||
abandonActionCallback: (any) => void,
|
||||
claim: StreamClaim,
|
||||
abandonActionCallback: any => void,
|
||||
iconSize: number,
|
||||
};
|
||||
|
||||
export default function ClaimAbandonButton(props: Props) {
|
||||
const { doOpenModal, claim, abandonActionCallback } = props;
|
||||
const { value_type } = claim || {};
|
||||
let buttonLabel;
|
||||
if (value_type === 'channel') {
|
||||
buttonLabel = __('Delete Channel');
|
||||
} else if (value_type === 'collection') {
|
||||
buttonLabel = __('Delete List');
|
||||
} else if (value_type === 'stream') {
|
||||
buttonLabel = __('Delete Publish');
|
||||
}
|
||||
|
||||
function abandonClaim() {
|
||||
doOpenModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim: claim, cb: abandonActionCallback });
|
||||
@@ -30,7 +21,7 @@ export default function ClaimAbandonButton(props: Props) {
|
||||
return (
|
||||
<Button
|
||||
disabled={!claim}
|
||||
label={buttonLabel}
|
||||
label={__('Delete Channel')}
|
||||
button="alt"
|
||||
iconColor="red"
|
||||
icon={ICONS.DELETE}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// @flow
|
||||
import * as React from 'react';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
|
||||
type Props = {
|
||||
channelUri: string,
|
||||
hideActions?: boolean,
|
||||
channelSubCount?: number,
|
||||
};
|
||||
|
||||
function ClaimAuthor(props: Props) {
|
||||
const { channelUri, hideActions, channelSubCount } = props;
|
||||
|
||||
return channelUri ? (
|
||||
<ClaimPreview
|
||||
uri={channelUri}
|
||||
type="inline"
|
||||
properties={false}
|
||||
hideMenu
|
||||
hideActions={hideActions}
|
||||
channelSubCount={channelSubCount}
|
||||
/>
|
||||
) : (
|
||||
<div className="claim-preview--inline claim-preview__title">{__('Anonymous')}</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ClaimAuthor;
|
||||
@@ -1,23 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import ClaimCollectionAdd from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
doLocalCollectionCreate,
|
||||
selectBuiltinCollections,
|
||||
selectMyPublishedCollections,
|
||||
selectMyUnpublishedCollections,
|
||||
} from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
builtin: selectBuiltinCollections(state),
|
||||
published: selectMyPublishedCollections(state),
|
||||
unpublished: selectMyUnpublishedCollections(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
addCollection: (name, items, type) => dispatch(doLocalCollectionCreate(name, items, type)),
|
||||
});
|
||||
|
||||
export default withRouter(connect(select, perform)(ClaimCollectionAdd));
|
||||
@@ -1,168 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import type { ElementRef } from 'react';
|
||||
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 = {
|
||||
claim: Claim,
|
||||
builtin: any,
|
||||
published: any,
|
||||
unpublished: any,
|
||||
addCollection: (string, Array<string>, string) => void,
|
||||
closeModal: () => void,
|
||||
uri: string,
|
||||
};
|
||||
|
||||
const ClaimCollectionAdd = (props: Props) => {
|
||||
const { builtin, published, unpublished, addCollection, claim, closeModal, uri } = props;
|
||||
const buttonref: ElementRef<any> = React.useRef();
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
|
||||
const [addNewCollection, setAddNewCollection] = React.useState(false);
|
||||
const [newCollectionName, setNewCollectionName] = React.useState('');
|
||||
|
||||
// TODO: when other collection types added, filter list in context
|
||||
// const isPlayable =
|
||||
// claim &&
|
||||
// claim.value &&
|
||||
// // $FlowFixMe
|
||||
// claim.value.stream_type &&
|
||||
// (claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
|
||||
function handleNameInput(e) {
|
||||
const { value } = e.target;
|
||||
setNewCollectionName(value);
|
||||
}
|
||||
|
||||
function handleAddCollection() {
|
||||
addCollection(newCollectionName, [permanentUrl], isChannel ? 'collection' : 'playlist');
|
||||
setNewCollectionName('');
|
||||
setAddNewCollection(false);
|
||||
}
|
||||
|
||||
function altEnterListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if (e.keyCode === KEYCODES.ENTER) {
|
||||
e.preventDefault();
|
||||
buttonref.current.click();
|
||||
}
|
||||
}
|
||||
|
||||
function onTextareaFocus() {
|
||||
window.addEventListener('keydown', altEnterListener);
|
||||
}
|
||||
|
||||
function onTextareaBlur() {
|
||||
window.removeEventListener('keydown', altEnterListener);
|
||||
}
|
||||
|
||||
function handleClearNew() {
|
||||
setNewCollectionName('');
|
||||
setAddNewCollection(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__('Add To...')}
|
||||
actions={
|
||||
<div className="card__body">
|
||||
{uri && (
|
||||
<fieldset-section>
|
||||
<div className={'card__body-scrollable'}>
|
||||
{(Object.values(builtin): any)
|
||||
// $FlowFixMe
|
||||
.filter((list) => (isChannel ? list.type === 'collection' : list.type === 'playlist'))
|
||||
.map((l) => {
|
||||
const { id } = l;
|
||||
return (
|
||||
<CollectionSelectItem
|
||||
claim={claim}
|
||||
collectionId={id}
|
||||
uri={permanentUrl}
|
||||
key={id}
|
||||
category={'builtin'}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{unpublished &&
|
||||
(Object.values(unpublished): any)
|
||||
// $FlowFixMe
|
||||
.filter((list) => (isChannel ? list.type === 'collection' : list.type === 'playlist'))
|
||||
.map((l) => {
|
||||
const { id } = l;
|
||||
return (
|
||||
<CollectionSelectItem
|
||||
claim={claim}
|
||||
collectionId={id}
|
||||
uri={permanentUrl}
|
||||
key={id}
|
||||
category={'unpublished'}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{published &&
|
||||
(Object.values(published): any).map((l) => {
|
||||
// $FlowFixMe
|
||||
const { id } = l;
|
||||
return (
|
||||
<CollectionSelectItem
|
||||
claim={claim}
|
||||
collectionId={id}
|
||||
uri={permanentUrl}
|
||||
key={id}
|
||||
category={'published'}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset-section>
|
||||
)}
|
||||
<fieldset-section>
|
||||
{addNewCollection && (
|
||||
<FormField
|
||||
autoFocus
|
||||
type="text"
|
||||
name="new_collection"
|
||||
value={newCollectionName}
|
||||
label={__('New List Title')}
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
inputButton={
|
||||
<>
|
||||
<Button
|
||||
button={'alt'}
|
||||
icon={ICONS.ADD}
|
||||
className={'button-toggle'}
|
||||
disabled={!newCollectionName.length}
|
||||
onClick={() => handleAddCollection()}
|
||||
ref={buttonref}
|
||||
/>
|
||||
<Button
|
||||
button={'alt'}
|
||||
className={'button-toggle'}
|
||||
icon={ICONS.REMOVE}
|
||||
onClick={() => handleClearNew()}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
onChange={handleNameInput}
|
||||
/>
|
||||
)}
|
||||
{!addNewCollection && (
|
||||
<Button button={'link'} label={__('New List')} onClick={() => setAddNewCollection(true)} />
|
||||
)}
|
||||
</fieldset-section>
|
||||
<div className="card__actions">
|
||||
<Button button="secondary" label={__('Done')} disabled={addNewCollection} onClick={closeModal} />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default ClaimCollectionAdd;
|
||||
@@ -1,18 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import CollectionAddButton from './view';
|
||||
import { makeSelectClaimForUri, makeSelectClaimUrlInCollection } from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri)(state);
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
|
||||
return {
|
||||
claim,
|
||||
isSaved: makeSelectClaimUrlInCollection(permanentUrl)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, {
|
||||
doOpenModal,
|
||||
})(CollectionAddButton);
|
||||
@@ -1,41 +0,0 @@
|
||||
// @flow
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
doOpenModal: (string, {}) => void,
|
||||
fileAction?: boolean,
|
||||
type?: boolean,
|
||||
claim: Claim,
|
||||
isSaved: boolean,
|
||||
};
|
||||
|
||||
export default function CollectionAddButton(props: Props) {
|
||||
const { doOpenModal, uri, fileAction, type = 'playlist', claim, isSaved } = props;
|
||||
|
||||
// $FlowFixMe
|
||||
const streamType = (claim && claim.value && claim.value.stream_type) || '';
|
||||
const isPlayable = streamType === 'video' || streamType === 'audio';
|
||||
|
||||
if (!isPlayable) return null;
|
||||
return (
|
||||
<Button
|
||||
button={fileAction ? undefined : 'alt'}
|
||||
className={classnames({ 'button--file-action': fileAction })}
|
||||
icon={fileAction ? (!isSaved ? ICONS.ADD : ICONS.STACK) : ICONS.LIBRARY}
|
||||
iconSize={fileAction ? 22 : undefined}
|
||||
label={uri ? (!isSaved ? __('Save') : __('Saved')) : __('New List')}
|
||||
requiresAuth={IS_WEB}
|
||||
title={__('Add this claim to a list')}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
doOpenModal(MODALS.COLLECTION_ADD, { uri, type });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import EmbedPlayButton from 'component/embedPlayButton';
|
||||
import Button from 'component/button';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import { INLINE_PLAYER_WRAPPER_CLASS } from 'component/fileRenderFloating/view';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -13,7 +12,7 @@ type Props = {
|
||||
children: React.Node,
|
||||
description: ?string,
|
||||
isResolvingUri: boolean,
|
||||
doResolveUri: (string) => void,
|
||||
doResolveUri: string => void,
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
@@ -21,7 +20,6 @@ type Props = {
|
||||
playingUri: ?PlayingUri,
|
||||
parentCommentId?: string,
|
||||
isMarkdownPost?: boolean,
|
||||
allowPreview: boolean,
|
||||
};
|
||||
|
||||
class ClaimLink extends React.Component<Props> {
|
||||
@@ -31,7 +29,6 @@ class ClaimLink extends React.Component<Props> {
|
||||
thumbnail: null,
|
||||
description: null,
|
||||
isResolvingUri: false,
|
||||
allowPreview: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@@ -49,7 +46,7 @@ class ClaimLink extends React.Component<Props> {
|
||||
let blackListed = false;
|
||||
|
||||
blackListed = blackListedOutpoints.some(
|
||||
(outpoint) =>
|
||||
outpoint =>
|
||||
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
||||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
||||
);
|
||||
@@ -66,16 +63,7 @@ class ClaimLink extends React.Component<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
uri,
|
||||
claim,
|
||||
children,
|
||||
isResolvingUri,
|
||||
playingUri,
|
||||
parentCommentId,
|
||||
isMarkdownPost,
|
||||
allowPreview,
|
||||
} = this.props;
|
||||
const { uri, claim, children, isResolvingUri, playingUri, parentCommentId, isMarkdownPost } = this.props;
|
||||
const isUnresolved = (!isResolvingUri && !claim) || !claim;
|
||||
const isBlacklisted = this.isClaimBlackListed();
|
||||
const isPlayingInline =
|
||||
@@ -93,7 +81,7 @@ class ClaimLink extends React.Component<Props> {
|
||||
|
||||
return isChannel ? (
|
||||
<UriIndicator uri={uri} link />
|
||||
) : allowPreview ? (
|
||||
) : (
|
||||
<div className={classnames('claim-link')}>
|
||||
<div
|
||||
className={classnames({
|
||||
@@ -104,14 +92,6 @@ class ClaimLink extends React.Component<Props> {
|
||||
</div>
|
||||
<Button button="link" className="preview-link__url" label={uri} navigate={uri} />
|
||||
</div>
|
||||
) : (
|
||||
<Button
|
||||
button="link"
|
||||
title={SIMPLE_SITE ? __("This channel isn't staking enough LBRY Credits for link previews.") : children}
|
||||
label={children}
|
||||
className="button--external-link"
|
||||
navigate={uri}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import ClaimList from './view';
|
||||
import { SETTINGS, selectClaimSearchByQuery, selectClaimsByUri } from 'lbry-redux';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
|
||||
const select = (state) => ({
|
||||
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
});
|
||||
|
||||
export default connect(select)(ClaimList);
|
||||
const perform = (dispatch) => ({});
|
||||
|
||||
export default connect(select, perform)(ClaimList);
|
||||
@@ -9,7 +9,6 @@ import { FormField } from 'component/common/form';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import debounce from 'util/debounce';
|
||||
import ClaimPreviewTile from 'component/claimPreviewTile';
|
||||
import { prioritizeActiveLivestreams } from 'component/claimTilesDiscover/view';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 150;
|
||||
const SORT_NEW = 'new';
|
||||
@@ -21,37 +20,29 @@ type Props = {
|
||||
headerAltControls: Node,
|
||||
loading: boolean,
|
||||
type: string,
|
||||
activeUri?: string,
|
||||
empty?: string,
|
||||
defaultSort?: boolean,
|
||||
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,
|
||||
showUnresolvedClaims?: boolean,
|
||||
renderActions?: (Claim) => ?Node,
|
||||
renderProperties?: (Claim) => ?Node,
|
||||
renderProperties: ?(Claim) => Node,
|
||||
includeSupportAction?: boolean,
|
||||
injectedItem: ?Node,
|
||||
timedOutMessage?: Node,
|
||||
tileLayout?: boolean,
|
||||
renderActions?: (Claim) => ?Node,
|
||||
searchInLanguage: boolean,
|
||||
hideMenu?: boolean,
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
claimsByUri: { [string]: any },
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
searchOptions?: any,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
onClick?: (e: any, claim?: ?Claim, index?: number) => void,
|
||||
hideLivestreamClaims?: boolean,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
const {
|
||||
activeUri,
|
||||
uris,
|
||||
headerAltControls,
|
||||
loading,
|
||||
@@ -65,55 +56,29 @@ export default function ClaimList(props: Props) {
|
||||
page,
|
||||
showHiddenByUser,
|
||||
showUnresolvedClaims,
|
||||
renderProperties,
|
||||
includeSupportAction,
|
||||
injectedItem,
|
||||
timedOutMessage,
|
||||
tileLayout = false,
|
||||
renderActions,
|
||||
renderProperties,
|
||||
searchInLanguage,
|
||||
hideMenu,
|
||||
claimSearchByQuery,
|
||||
claimsByUri,
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
searchOptions,
|
||||
collectionId,
|
||||
showNoSourceClaims,
|
||||
onClick,
|
||||
hideLivestreamClaims,
|
||||
} = props;
|
||||
|
||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||
const timedOut = uris === null;
|
||||
const urisLength = (uris && uris.length) || 0;
|
||||
|
||||
const liveUris = [];
|
||||
if (liveLivestreamsFirst && livestreamMap) {
|
||||
prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery, searchOptions);
|
||||
}
|
||||
|
||||
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];
|
||||
const noResultMsg = searchInLanguage
|
||||
? __('No results. Contents may be hidden by the Language filter.')
|
||||
: __('No results');
|
||||
|
||||
const resolveLive = (index) => {
|
||||
if (liveLivestreamsFirst && livestreamMap && index < liveUris.length) {
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
function handleSortChange() {
|
||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||
}
|
||||
|
||||
function handleClaimClicked(e, claim, index) {
|
||||
if (onClick) {
|
||||
onClick(e, claim, index);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = debounce((e) => {
|
||||
if (page && pageSize && onScrollBottom) {
|
||||
@@ -138,15 +103,12 @@ export default function ClaimList(props: Props) {
|
||||
return tileLayout && !header ? (
|
||||
<section className="claim-grid">
|
||||
{urisLength > 0 &&
|
||||
uris.map((uri, index) => (
|
||||
uris.map((uri) => (
|
||||
<ClaimPreviewTile
|
||||
key={uri}
|
||||
uri={uri}
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
properties={renderProperties}
|
||||
live={resolveLive(index)}
|
||||
collectionId={collectionId}
|
||||
showNoSourceClaims={showNoSourceClaims}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
/>
|
||||
))}
|
||||
{!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>}
|
||||
@@ -164,23 +126,21 @@ export default function ClaimList(props: Props) {
|
||||
<div className={classnames('claim-list__header', { 'section__title--small': type === 'small' })}>
|
||||
{header}
|
||||
{loading && <Spinner type="small" />}
|
||||
{(headerAltControls || defaultSort) && (
|
||||
<div className="claim-list__alt-controls">
|
||||
{headerAltControls}
|
||||
{defaultSort && (
|
||||
<FormField
|
||||
className="claim-list__dropdown"
|
||||
type="select"
|
||||
name="file_sort"
|
||||
value={currentSort}
|
||||
onChange={handleSortChange}
|
||||
>
|
||||
<option value={SORT_NEW}>{__('Newest First')}</option>
|
||||
<option value={SORT_OLD}>{__('Oldest First')}</option>
|
||||
</FormField>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className="claim-list__alt-controls">
|
||||
{headerAltControls}
|
||||
{defaultSort && (
|
||||
<FormField
|
||||
className="claim-list__dropdown"
|
||||
type="select"
|
||||
name="file_sort"
|
||||
value={currentSort}
|
||||
onChange={handleSortChange}
|
||||
>
|
||||
<option value={SORT_NEW}>{__('Newest First')}</option>
|
||||
<option value={SORT_OLD}>{__('Oldest First')}</option>
|
||||
</FormField>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</React.Fragment>
|
||||
@@ -198,9 +158,7 @@ export default function ClaimList(props: Props) {
|
||||
{injectedItem && index === 4 && <li>{injectedItem}</li>}
|
||||
<ClaimPreview
|
||||
uri={uri}
|
||||
indexInContainer={index}
|
||||
type={type}
|
||||
active={activeUri && uri === activeUri}
|
||||
hideMenu={hideMenu}
|
||||
includeSupportAction={includeSupportAction}
|
||||
showUnresolvedClaim={showUnresolvedClaims}
|
||||
@@ -208,16 +166,17 @@ export default function ClaimList(props: Props) {
|
||||
renderActions={renderActions}
|
||||
showUserBlocked={showHiddenByUser}
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
collectionId={collectionId}
|
||||
showNoSourceClaims={showNoSourceClaims}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
customShouldHide={(claim: StreamClaim) => {
|
||||
// Hack to hide spee.ch thumbnail publishes
|
||||
// If it meets these requirements, it was probably uploaded here:
|
||||
// https://github.com/lbryio/lbry-redux/blob/master/src/redux/actions/publish.js#L74-L79
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
if (claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}}
|
||||
live={resolveLive(index)}
|
||||
onClick={(e, claim, index) => handleClaimClicked(e, claim, index)}
|
||||
/>
|
||||
</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);
|
||||
@@ -1,11 +1,11 @@
|
||||
// @flow
|
||||
import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import type { Node } from 'react';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import React from 'react';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import { withRouter } from 'react-router';
|
||||
import { createNormalizedClaimSearchKey, MATURE_TAGS, splitBySeparator } from 'lbry-redux';
|
||||
import { createNormalizedClaimSearchKey, MATURE_TAGS } from 'lbry-redux';
|
||||
import Button from 'component/button';
|
||||
import moment from 'moment';
|
||||
import ClaimList from 'component/claimList';
|
||||
@@ -14,109 +14,81 @@ import ClaimPreviewTile from 'component/claimPreviewTile';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import ClaimListHeader from 'component/claimListHeader';
|
||||
import { useIsLargeScreen } from 'effects/use-screensize';
|
||||
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>,
|
||||
subscribedChannels: Array<Subscription>,
|
||||
livestreamMap?: { [string]: any },
|
||||
|
||||
header?: Node,
|
||||
headerLabel?: string | Node,
|
||||
hiddenNsfwMessage?: Node,
|
||||
injectedItem: ?Node,
|
||||
doClaimSearch: ({}) => void,
|
||||
loading: boolean,
|
||||
personalView: boolean,
|
||||
doToggleTagFollowDesktop: (string) => void,
|
||||
meta?: Node,
|
||||
renderProperties?: (Claim) => Node,
|
||||
|
||||
// showNsfw: boolean,
|
||||
hideReposts: boolean,
|
||||
history: { action: string, push: (string) => void, replace: (string) => void },
|
||||
location: { search: string, pathname: string },
|
||||
|
||||
// --- select ---
|
||||
followedTags?: Array<Tag>,
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
claimSearchByQuery: {
|
||||
[string]: Array<string>,
|
||||
},
|
||||
claimSearchByQueryLastPageReached: { [string]: boolean },
|
||||
claimsByUri: { [string]: any },
|
||||
loading: boolean,
|
||||
showNsfw: boolean,
|
||||
hideReposts: boolean,
|
||||
languageSetting: string,
|
||||
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,
|
||||
limitClaimsPerChannel?: number,
|
||||
releaseTime?: string,
|
||||
hideLivestreamClaims?: boolean,
|
||||
};
|
||||
|
||||
function ClaimListDiscover(props: Props) {
|
||||
const {
|
||||
doClaimSearch,
|
||||
claimSearchByQuery,
|
||||
showHeader = true,
|
||||
type,
|
||||
claimSearchByQueryLastPageReached,
|
||||
tags,
|
||||
defaultTags,
|
||||
loading,
|
||||
meta,
|
||||
channelIds,
|
||||
showNsfw,
|
||||
// showNsfw,
|
||||
hideReposts,
|
||||
fetchViewCount,
|
||||
history,
|
||||
location,
|
||||
mutedUris,
|
||||
blockedUris,
|
||||
hiddenNsfwMessage,
|
||||
defaultOrderBy,
|
||||
sortBy,
|
||||
orderBy,
|
||||
headerLabel,
|
||||
header,
|
||||
@@ -124,8 +96,8 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType,
|
||||
pageSize,
|
||||
defaultClaimType,
|
||||
streamType = SIMPLE_SITE ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE
|
||||
streamType = CS.FILE_VIDEO,
|
||||
defaultStreamType = CS.FILE_VIDEO,
|
||||
freshness,
|
||||
defaultFreshness = CS.FRESH_WEEK,
|
||||
renderProperties,
|
||||
@@ -148,15 +120,7 @@ function ClaimListDiscover(props: Props) {
|
||||
releaseTime,
|
||||
scrollAnchor,
|
||||
showHiddenByUser = false,
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
hasSource,
|
||||
hasNoSource,
|
||||
isChannel = false,
|
||||
showNoSourceClaims,
|
||||
empty,
|
||||
claimsByUri,
|
||||
doFetchViewCount,
|
||||
hideLivestreamClaims,
|
||||
} = props;
|
||||
const didNavigateForward = history.action === 'PUSH';
|
||||
const { search } = location;
|
||||
@@ -172,10 +136,7 @@ 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]))
|
||||
);
|
||||
const mutedAndBlockedChannelIds = Array.from(new Set(mutedUris.concat(blockedUris).map((uri) => uri.split('#')[1])));
|
||||
|
||||
const langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
|
||||
const languageParams = searchInLanguage
|
||||
@@ -198,7 +159,7 @@ function ClaimListDiscover(props: Props) {
|
||||
const durationParam = urlParams.get(CS.DURATION_KEY) || null;
|
||||
const channelIdsInUrl = urlParams.get(CS.CHANNEL_IDS_KEY);
|
||||
const channelIdsParam = channelIdsInUrl ? channelIdsInUrl.split(',') : channelIds;
|
||||
const feeAmountParam = urlParams.get('fee_amount') || feeAmount;
|
||||
const feeAmountParam = urlParams.get('fee_amount') || feeAmount || CS.FEE_AMOUNT_ONLY_FREE;
|
||||
const originalPageSize = pageSize || CS.PAGE_SIZE;
|
||||
const dynamicPageSize = isLargeScreen ? Math.ceil(originalPageSize * (3 / 2)) : originalPageSize;
|
||||
const historyAction = history.action;
|
||||
@@ -236,7 +197,7 @@ function ClaimListDiscover(props: Props) {
|
||||
not_tags: Array<string>,
|
||||
channel_ids?: Array<string>,
|
||||
claim_ids?: Array<string>,
|
||||
not_channel_ids?: Array<string>,
|
||||
not_channel_ids: Array<string>,
|
||||
order_by: Array<string>,
|
||||
release_time?: string,
|
||||
claim_type?: string | Array<string>,
|
||||
@@ -252,18 +213,23 @@ 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),
|
||||
not_channel_ids:
|
||||
// If channelIdsParam were passed in, we don't need not_channel_ids
|
||||
!channelIdsParam ? mutedAndBlockedChannelIds : [],
|
||||
not_tags: MATURE_TAGS,
|
||||
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 (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === CS.CLAIM_STREAM)) {
|
||||
options.has_source = true;
|
||||
}
|
||||
|
||||
@@ -299,7 +265,7 @@ function ClaimListDiscover(props: Props) {
|
||||
// SDK chokes on reposted_claim_id of null or false, needs to not be present if no value
|
||||
options.reposted_claim_id = repostedClaimId;
|
||||
}
|
||||
// IF release time, set it, else set fallback release times using the hack below.
|
||||
|
||||
if (releaseTime) {
|
||||
options.release_time = releaseTime;
|
||||
} else if (claimType !== CS.CLAIM_CHANNEL) {
|
||||
@@ -337,7 +303,7 @@ function ClaimListDiscover(props: Props) {
|
||||
}
|
||||
|
||||
if (streamTypeParam && streamTypeParam !== CS.CONTENT_ALL && claimType !== CS.CLAIM_CHANNEL) {
|
||||
options.stream_types = typeof streamTypeParam === 'string' ? [streamTypeParam] : streamTypeParam;
|
||||
options.stream_types = [streamTypeParam];
|
||||
}
|
||||
|
||||
if (claimTypeParam) {
|
||||
@@ -379,10 +345,9 @@ function ClaimListDiscover(props: Props) {
|
||||
}
|
||||
|
||||
const hasMatureTags = tagsParam && tagsParam.split(',').some((t) => MATURE_TAGS.includes(t));
|
||||
|
||||
const mainSearchKey = createNormalizedClaimSearchKey(options);
|
||||
let claimSearchResult = claimSearchByQuery[mainSearchKey];
|
||||
const claimSearchResultLastPageReached = claimSearchByQueryLastPageReached[mainSearchKey];
|
||||
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
|
||||
let claimSearchResult = claimSearchByQuery[claimSearchCacheQuery];
|
||||
const claimSearchResultLastPageReached = claimSearchByQueryLastPageReached[claimSearchCacheQuery];
|
||||
|
||||
// uncomment to fix an item on a page
|
||||
// const fixUri = 'lbry://@corbettreport#0/lbryodysee#5';
|
||||
@@ -400,14 +365,6 @@ function ClaimListDiscover(props: Props) {
|
||||
// claimSearchResult.splice(2, 0, fixUri);
|
||||
// }
|
||||
|
||||
const livestreamSearchKey = liveLivestreamsFirst
|
||||
? createNormalizedClaimSearchKey(getLivestreamOnlyOptions(options))
|
||||
: 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 +426,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) {
|
||||
@@ -514,91 +467,13 @@ function ClaimListDiscover(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function urisEqual(prev: Array<string>, next: Array<string>) {
|
||||
if (!prev || !next) {
|
||||
// From 'ClaimList', "null" and "undefined" have special meaning,
|
||||
// so we can't just compare array length here.
|
||||
// - null = "timed out"
|
||||
// - undefined = "no result".
|
||||
return prev === next;
|
||||
}
|
||||
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);
|
||||
doClaimSearch(searchOptions);
|
||||
|
||||
if (liveLivestreamsFirst && options.page === 1) {
|
||||
doClaimSearch(getLivestreamOnlyOptions(searchOptions));
|
||||
}
|
||||
}
|
||||
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, forceRefresh]);
|
||||
|
||||
// Resolve 'finalUri'
|
||||
React.useEffect(() => {
|
||||
if (uris) {
|
||||
if (!urisEqual(uris, finalUris)) {
|
||||
setFinalUris(uris);
|
||||
}
|
||||
} else {
|
||||
// Wait until all queries are done before updating the uris to avoid layout shifts.
|
||||
const pending = claimSearchResult === undefined || (liveLivestreamsFirst && livestreamSearchResult === undefined);
|
||||
if (!pending && !urisEqual(claimSearchResult, finalUris)) {
|
||||
setFinalUris(claimSearchResult);
|
||||
}
|
||||
}
|
||||
}, [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}
|
||||
@@ -609,7 +484,7 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType={claimType}
|
||||
streamType={streamType}
|
||||
defaultStreamType={defaultStreamType}
|
||||
feeAmount={feeAmount} // ENABLE_PAID_CONTENT_DISCOVER or something
|
||||
// feeAmount={feeAmount}
|
||||
orderBy={orderBy}
|
||||
defaultOrderBy={defaultOrderBy}
|
||||
hideAdvancedFilter={hideAdvancedFilter}
|
||||
@@ -635,8 +510,9 @@ function ClaimListDiscover(props: Props) {
|
||||
)}
|
||||
<ClaimList
|
||||
tileLayout
|
||||
id={claimSearchCacheQuery}
|
||||
loading={loading}
|
||||
uris={finalUris}
|
||||
uris={uris || claimSearchResult}
|
||||
onScrollBottom={handleScrollBottom}
|
||||
page={page}
|
||||
pageSize={dynamicPageSize}
|
||||
@@ -645,11 +521,7 @@ function ClaimListDiscover(props: Props) {
|
||||
includeSupportAction={includeSupportAction}
|
||||
injectedItem={injectedItem}
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
liveLivestreamsFirst={liveLivestreamsFirst}
|
||||
livestreamMap={livestreamMap}
|
||||
searchOptions={options}
|
||||
showNoSourceClaims={showNoSourceClaims}
|
||||
empty={empty}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
/>
|
||||
{loading && (
|
||||
<div className="claim-grid">
|
||||
@@ -661,16 +533,15 @@ function ClaimListDiscover(props: Props) {
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
{showHeader && (
|
||||
<div className="section__header--actions">
|
||||
{headerToUse}
|
||||
{meta && <div className="section__actions--no-margin">{meta}</div>}
|
||||
</div>
|
||||
)}
|
||||
<div className="section__header--actions">
|
||||
{headerToUse}
|
||||
{meta && <div className="section__actions--no-margin">{meta}</div>}
|
||||
</div>
|
||||
|
||||
<ClaimList
|
||||
type={type}
|
||||
id={claimSearchCacheQuery}
|
||||
loading={loading}
|
||||
uris={finalUris}
|
||||
uris={uris || claimSearchResult}
|
||||
onScrollBottom={handleScrollBottom}
|
||||
page={page}
|
||||
pageSize={dynamicPageSize}
|
||||
@@ -679,23 +550,9 @@ function ClaimListDiscover(props: Props) {
|
||||
includeSupportAction={includeSupportAction}
|
||||
injectedItem={injectedItem}
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
liveLivestreamsFirst={liveLivestreamsFirst}
|
||||
livestreamMap={livestreamMap}
|
||||
searchOptions={options}
|
||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||
empty={empty}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
/>
|
||||
{loading &&
|
||||
new Array(dynamicPageSize)
|
||||
.fill(1)
|
||||
.map((x, i) => (
|
||||
<ClaimPreview
|
||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||
key={i}
|
||||
placeholder="loading"
|
||||
type={type}
|
||||
/>
|
||||
))}
|
||||
{loading && new Array(dynamicPageSize).fill(1).map((x, i) => <ClaimPreview key={i} placeholder="loading" />)}
|
||||
</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,
|
||||
@@ -29,7 +29,7 @@ type Props = {
|
||||
channelIds?: Array<string>,
|
||||
tileLayout: boolean,
|
||||
doSetClientSetting: (string, boolean, ?boolean) => void,
|
||||
setPage: (number) => void,
|
||||
setPage: number => void,
|
||||
hideFilters: boolean,
|
||||
searchInLanguage: boolean,
|
||||
languageSetting: string,
|
||||
@@ -45,7 +45,6 @@ function ClaimListHeader(props: Props) {
|
||||
streamType,
|
||||
defaultStreamType,
|
||||
feeAmount,
|
||||
sortBy,
|
||||
orderBy,
|
||||
defaultOrderBy,
|
||||
hideAdvancedFilter,
|
||||
@@ -72,11 +71,10 @@ 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;
|
||||
const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL && claimType === CS.CLAIM_COLLECTION);
|
||||
const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL);
|
||||
const isFiltered = () =>
|
||||
Boolean(
|
||||
urlParams.get(CS.FRESH_KEY) ||
|
||||
@@ -146,7 +144,7 @@ function ClaimListHeader(props: Props) {
|
||||
|
||||
function buildUrl(delta) {
|
||||
const newUrlParams = new URLSearchParams(location.search);
|
||||
CS.KEYS.forEach((k) => {
|
||||
CS.KEYS.forEach(k => {
|
||||
// $FlowFixMe get() can return null
|
||||
if (urlParams.get(k) !== null) newUrlParams.set(k, urlParams.get(k));
|
||||
});
|
||||
@@ -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);
|
||||
@@ -170,11 +161,7 @@ function ClaimListHeader(props: Props) {
|
||||
}
|
||||
break;
|
||||
case CS.CONTENT_KEY:
|
||||
if (
|
||||
delta.value === CS.CLAIM_CHANNEL ||
|
||||
delta.value === CS.CLAIM_REPOST ||
|
||||
delta.value === CS.CLAIM_COLLECTION
|
||||
) {
|
||||
if (delta.value === CS.CLAIM_CHANNEL || delta.value === CS.CLAIM_REPOST) {
|
||||
newUrlParams.delete(CS.DURATION_KEY);
|
||||
newUrlParams.set(CS.CONTENT_KEY, delta.value);
|
||||
} else if (delta.value === CS.CONTENT_ALL) {
|
||||
@@ -225,13 +212,13 @@ function ClaimListHeader(props: Props) {
|
||||
<>
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__top">
|
||||
{!hideFilters && (
|
||||
<div className="claim-search__menu-group">
|
||||
{CS.ORDER_BY_TYPES.map((type) => (
|
||||
<div className="claim-search__menu-group">
|
||||
{!hideFilters &&
|
||||
CS.ORDER_BY_TYPES.map(type => (
|
||||
<Button
|
||||
key={type}
|
||||
button="alt"
|
||||
onClick={(e) =>
|
||||
onClick={e =>
|
||||
handleChange({
|
||||
key: CS.ORDER_BY_KEY,
|
||||
value: type,
|
||||
@@ -246,10 +233,10 @@ function ClaimListHeader(props: Props) {
|
||||
label={__(toCapitalCase(type))}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="claim-search__menu-group">
|
||||
{!hideAdvancedFilter && (
|
||||
{!hideAdvancedFilter && !SIMPLE_SITE && (
|
||||
<Button
|
||||
button="alt"
|
||||
aria-label={__('More')}
|
||||
@@ -275,7 +262,7 @@ function ClaimListHeader(props: Props) {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{expanded && (
|
||||
{expanded && !SIMPLE_SITE && (
|
||||
<>
|
||||
<div className={classnames(`card claim-search__menus`)}>
|
||||
{/* FRESHNESS FIELD */}
|
||||
@@ -289,23 +276,21 @@ function ClaimListHeader(props: Props) {
|
||||
name="trending_time"
|
||||
label={__('How Fresh')}
|
||||
value={freshnessParam}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.FRESH_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{CS.FRESH_TYPES.map((time) => (
|
||||
{CS.FRESH_TYPES.map(time => (
|
||||
<option key={time} value={time}>
|
||||
{/* i18fixme */}
|
||||
{time === CS.FRESH_DAY && __('Today')}
|
||||
{
|
||||
time !== CS.FRESH_ALL &&
|
||||
time !== CS.FRESH_DEFAULT &&
|
||||
time !== CS.FRESH_DAY &&
|
||||
__('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */
|
||||
}
|
||||
{time !== CS.FRESH_ALL &&
|
||||
time !== CS.FRESH_DEFAULT &&
|
||||
time !== CS.FRESH_DAY &&
|
||||
__('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */}
|
||||
{time === CS.FRESH_ALL && __('All time')}
|
||||
{time === CS.FRESH_DEFAULT && __('Default')}
|
||||
</option>
|
||||
@@ -329,19 +314,18 @@ function ClaimListHeader(props: Props) {
|
||||
name="claimType"
|
||||
label={__('Content Type')}
|
||||
value={contentTypeParam || CS.CONTENT_ALL}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.CONTENT_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{CS.CONTENT_TYPES.map((type) => {
|
||||
{CS.CONTENT_TYPES.map(type => {
|
||||
if (type !== CS.CLAIM_CHANNEL || (type === CS.CLAIM_CHANNEL && !channelIdsParam)) {
|
||||
return (
|
||||
<option key={type} value={type}>
|
||||
{/* i18fixme */}
|
||||
{type === CS.CLAIM_COLLECTION && __('List')}
|
||||
{type === CS.CLAIM_CHANNEL && __('Channel')}
|
||||
{type === CS.CLAIM_REPOST && __('Repost')}
|
||||
{type === CS.FILE_VIDEO && __('Video')}
|
||||
@@ -374,7 +358,7 @@ function ClaimListHeader(props: Props) {
|
||||
name="claimType"
|
||||
label={__('Language')}
|
||||
value={languageValue || CS.LANGUAGES_ALL}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.LANGUAGE_KEY,
|
||||
value: e.target.value,
|
||||
@@ -414,14 +398,14 @@ function ClaimListHeader(props: Props) {
|
||||
)
|
||||
}
|
||||
value={durationParam || CS.DURATION_ALL}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.DURATION_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{CS.DURATION_TYPES.map((dur) => (
|
||||
{CS.DURATION_TYPES.map(dur => (
|
||||
<option key={dur} value={dur}>
|
||||
{/* i18fixme */}
|
||||
{dur === CS.DURATION_SHORT && __('Short (< 4 minutes)')}
|
||||
@@ -444,7 +428,7 @@ function ClaimListHeader(props: Props) {
|
||||
type="select"
|
||||
name="paidcontent"
|
||||
value={feeAmountParam}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.FEE_AMOUNT_KEY,
|
||||
value: e.target.value,
|
||||
@@ -458,32 +442,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>
|
||||
|
||||
@@ -1,110 +1,20 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doCollectionEdit,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
doPrepareEdit,
|
||||
makeSelectCollectionForIdHasClaimUrl,
|
||||
makeSelectCollectionIsMine,
|
||||
COLLECTIONS_CONSTS,
|
||||
makeSelectEditedCollectionForId,
|
||||
makeSelectClaimIsMine,
|
||||
doFetchItemsInCollection,
|
||||
makeSelectUrlsForCollectionId,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsMine } from 'lbry-redux';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
|
||||
import { doSetActiveChannel, doSetIncognito, doOpenModal } from 'redux/actions/app';
|
||||
import {
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModUnBlockAsAdmin,
|
||||
} from 'redux/actions/comments';
|
||||
import {
|
||||
selectHasAdminChannel,
|
||||
makeSelectChannelIsBlocked,
|
||||
makeSelectChannelIsAdminBlocked,
|
||||
} from 'redux/selectors/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
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 { doToggleMuteChannel } from 'redux/actions/blocked';
|
||||
import { doCommentModBlock, doCommentModUnBlock } from 'redux/actions/comments';
|
||||
import { makeSelectChannelIsBlocked } from 'redux/selectors/comments';
|
||||
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,
|
||||
repostedClaim,
|
||||
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),
|
||||
channelIsMuted: makeSelectChannelIsMuted(contentChannelUri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsBlocked(contentChannelUri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(contentPermanentUri)(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),
|
||||
isAuthenticated: Boolean(selectUserVerifiedEmail(state)),
|
||||
resolvedList: makeSelectUrlsForCollectionId(collectionId)(state),
|
||||
playNextUri,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
prepareEdit: (publishData, uri, fileInfo) => {
|
||||
if (publishData.signing_channel) {
|
||||
dispatch(doSetIncognito(false));
|
||||
dispatch(doSetActiveChannel(publishData.signing_channel.claim_id));
|
||||
} else {
|
||||
dispatch(doSetIncognito(true));
|
||||
}
|
||||
|
||||
dispatch(doPrepareEdit(publishData, uri, fileInfo, fs));
|
||||
},
|
||||
doToast: (props) => dispatch(doToast(props)),
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doChannelMute: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
doChannelUnmute: (channelUri) => dispatch(doChannelUnmute(channelUri)),
|
||||
doCommentModBlock: (channelUri) => dispatch(doCommentModBlock(channelUri)),
|
||||
doCommentModUnBlock: (channelUri) => dispatch(doCommentModUnBlock(channelUri)),
|
||||
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));
|
||||
},
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreview);
|
||||
export default connect(select, {
|
||||
doToggleMuteChannel,
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlock,
|
||||
})(ClaimPreview);
|
||||
@@ -1,269 +1,70 @@
|
||||
// @flow
|
||||
import { URL, SHARE_DOMAIN_URL } from 'config';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
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 { useHistory } from 'react-router';
|
||||
import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import { generateShareUrl } from 'util/url';
|
||||
|
||||
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
||||
const PAGE_VIEW_QUERY = 'view';
|
||||
const EDIT_PAGE = 'edit';
|
||||
|
||||
type SubscriptionArgs = {
|
||||
channelName: string,
|
||||
uri: string,
|
||||
notificationsDisabled?: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
repostedClaim: ?Claim,
|
||||
contentClaim: ?Claim,
|
||||
contentSigningChannel: ?Claim,
|
||||
contentChannelUri: string,
|
||||
openModal: (id: string, {}) => void,
|
||||
inline?: boolean,
|
||||
claimIsMine: boolean,
|
||||
channelIsMuted: boolean,
|
||||
channelIsBlocked: boolean,
|
||||
channelIsAdminBlocked: boolean,
|
||||
isAdmin: boolean,
|
||||
doChannelMute: (string) => void,
|
||||
doChannelUnmute: (string) => void,
|
||||
doToggleMuteChannel: (string) => void,
|
||||
doCommentModBlock: (string) => void,
|
||||
doCommentModUnBlock: (string) => void,
|
||||
doCommentModBlockAsAdmin: (string, string) => void,
|
||||
doCommentModUnBlockAsAdmin: (string, string) => void,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
hasClaimInWatchLater: boolean,
|
||||
hasClaimInFavorites: boolean,
|
||||
claimInCollection: boolean,
|
||||
collectionId: string,
|
||||
isMyCollection: boolean,
|
||||
doToast: ({ message: string, isError?: boolean }) => void,
|
||||
claimIsMine: boolean,
|
||||
fileInfo: FileListItem,
|
||||
prepareEdit: ({}, string, {}) => void,
|
||||
isSubscribed: boolean,
|
||||
doChannelSubscribe: (SubscriptionArgs) => void,
|
||||
doChannelUnsubscribe: (SubscriptionArgs) => void,
|
||||
isChannelPage: boolean,
|
||||
editedCollection: Collection,
|
||||
isAuthenticated: boolean,
|
||||
playNextUri: string,
|
||||
resolvedList: boolean,
|
||||
fetchCollectionItems: (string) => void,
|
||||
doToggleShuffleList: (string) => void,
|
||||
};
|
||||
|
||||
function ClaimMenuList(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
claim,
|
||||
repostedClaim,
|
||||
contentClaim,
|
||||
contentSigningChannel,
|
||||
contentChannelUri,
|
||||
openModal,
|
||||
inline = false,
|
||||
doChannelMute,
|
||||
doChannelUnmute,
|
||||
claimIsMine,
|
||||
doToggleMuteChannel,
|
||||
channelIsMuted,
|
||||
channelIsBlocked,
|
||||
channelIsAdminBlocked,
|
||||
isAdmin,
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlock,
|
||||
doCommentModBlockAsAdmin,
|
||||
doCommentModUnBlockAsAdmin,
|
||||
doCollectionEdit,
|
||||
hasClaimInWatchLater,
|
||||
hasClaimInFavorites,
|
||||
collectionId,
|
||||
isMyCollection,
|
||||
doToast,
|
||||
claimIsMine,
|
||||
fileInfo,
|
||||
prepareEdit,
|
||||
isSubscribed,
|
||||
doChannelSubscribe,
|
||||
doChannelUnsubscribe,
|
||||
isChannelPage = false,
|
||||
editedCollection,
|
||||
isAuthenticated,
|
||||
playNextUri,
|
||||
resolvedList,
|
||||
fetchCollectionItems,
|
||||
doToggleShuffleList,
|
||||
} = props;
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
|
||||
const isChannel = !incognitoClaim && !contentSigningChannel;
|
||||
const { channelName } = parseURI(contentChannelUri);
|
||||
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
|
||||
const subscriptionLabel = repostedClaim
|
||||
? isSubscribed
|
||||
? __('Unfollow @%channelName%', { channelName })
|
||||
: __('Follow @%channelName%', { channelName })
|
||||
: isSubscribed
|
||||
? __('Unfollow')
|
||||
: __('Follow');
|
||||
const channelUri =
|
||||
claim &&
|
||||
(claim.value_type === 'channel'
|
||||
? claim.permanent_url
|
||||
: claim.signing_channel && claim.signing_channel.permanent_url);
|
||||
|
||||
const { push, replace } = useHistory();
|
||||
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri);
|
||||
|
||||
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) {
|
||||
if (!channelUri || !claim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const lbryUrl: string = generateLbryContentUrl(claim.canonical_url, claim.permanent_url);
|
||||
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, lbryUrl);
|
||||
const rssUrl: string = isChannel ? generateRssUrl(SHARE_DOMAIN, claim) : '';
|
||||
const isCollectionClaim = claim && claim.value_type === 'collection';
|
||||
// $FlowFixMe
|
||||
const isPlayable =
|
||||
contentClaim &&
|
||||
// $FlowFixMe
|
||||
contentClaim.value &&
|
||||
// $FlowFixMe
|
||||
contentClaim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(contentClaim.value.stream_type === 'audio' || contentClaim.value.stream_type === 'video');
|
||||
|
||||
function handleAdd(source, name, collectionId) {
|
||||
doToast({
|
||||
message: source ? __('Item removed from %name%', { name }) : __('Item added to %name%', { name }),
|
||||
});
|
||||
doCollectionEdit(collectionId, {
|
||||
claims: [contentClaim],
|
||||
remove: source,
|
||||
type: 'playlist',
|
||||
});
|
||||
}
|
||||
|
||||
function handleFollow() {
|
||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||
|
||||
subscriptionHandler({
|
||||
channelName: '@' + channelName,
|
||||
uri: contentChannelUri,
|
||||
notificationsDisabled: true,
|
||||
});
|
||||
}
|
||||
|
||||
function handleToggleMute() {
|
||||
if (channelIsMuted) {
|
||||
doChannelUnmute(contentChannelUri);
|
||||
} else {
|
||||
doChannelMute(contentChannelUri);
|
||||
}
|
||||
doToggleMuteChannel(channelUri);
|
||||
}
|
||||
|
||||
function handleToggleBlock() {
|
||||
if (channelIsBlocked) {
|
||||
doCommentModUnBlock(contentChannelUri);
|
||||
doCommentModUnBlock(channelUri);
|
||||
} else {
|
||||
doCommentModBlock(contentChannelUri);
|
||||
doCommentModBlock(channelUri);
|
||||
}
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
if (!isChannel) {
|
||||
const signingChannelName = contentSigningChannel && contentSigningChannel.name;
|
||||
|
||||
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
|
||||
streamName: claim.name,
|
||||
streamClaimId: claim.claim_id,
|
||||
};
|
||||
if (signingChannelName) {
|
||||
uriObject.channelName = signingChannelName;
|
||||
}
|
||||
const editUri = buildURI(uriObject);
|
||||
|
||||
push(`/$/${PAGES.UPLOAD}`);
|
||||
prepareEdit(claim, editUri, fileInfo);
|
||||
} else {
|
||||
const channelUrl = claim.name + ':' + claim.claim_id;
|
||||
push(`/${channelUrl}?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDelete() {
|
||||
if (!repostedClaim && !isChannel) {
|
||||
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri, doGoBack: false });
|
||||
} else {
|
||||
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: isChannel && (() => replace(`/$/${PAGES.CHANNELS}`)) });
|
||||
}
|
||||
}
|
||||
|
||||
function handleSupport() {
|
||||
openModal(MODALS.SEND_TIP, { uri, isSupport: true });
|
||||
}
|
||||
|
||||
function handleToggleAdminBlock() {
|
||||
if (channelIsAdminBlocked) {
|
||||
doCommentModUnBlockAsAdmin(contentChannelUri, '');
|
||||
} else {
|
||||
doCommentModBlockAsAdmin(contentChannelUri, '');
|
||||
}
|
||||
}
|
||||
|
||||
function copyToClipboard(textToCopy, successMsg, failureMsg) {
|
||||
navigator.clipboard
|
||||
.writeText(textToCopy)
|
||||
.then(() => {
|
||||
doToast({ message: __(successMsg) });
|
||||
})
|
||||
.catch(() => {
|
||||
doToast({ message: __(failureMsg), isError: true });
|
||||
});
|
||||
}
|
||||
|
||||
function handleCopyRssLink() {
|
||||
copyToClipboard(rssUrl, 'RSS URL copied.', 'Failed to copy RSS URL.');
|
||||
}
|
||||
|
||||
function handleCopyLink() {
|
||||
copyToClipboard(shareUrl, 'Link copied.', 'Failed to copy link.');
|
||||
navigator.clipboard.writeText(shareUrl);
|
||||
}
|
||||
|
||||
function handleReportContent() {
|
||||
// $FlowFixMe
|
||||
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
|
||||
window.open(`https://lbry.com/dmca/${claim.claim_id}`, '_blank', 'noopener');
|
||||
}
|
||||
|
||||
const shouldShow = !IS_WEB || (IS_WEB && isAuthenticated);
|
||||
return (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
@@ -276,190 +77,34 @@ function ClaimMenuList(props: Props) {
|
||||
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
<>
|
||||
{/* COLLECTION OPERATIONS */}
|
||||
{collectionId && isCollectionClaim ? (
|
||||
<>
|
||||
<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 && (
|
||||
<>
|
||||
<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>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
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 && (
|
||||
{!claimIsMine && (
|
||||
<>
|
||||
{!isChannelPage && (
|
||||
<>
|
||||
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.LBC} />
|
||||
{__('Support --[button to support a claim]--')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleBlock}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.BLOCK} />
|
||||
{channelIsBlocked ? __('Unblock Channel') : __('Block Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{!incognitoClaim && !claimIsMine && !isChannelPage && (
|
||||
<>
|
||||
<hr className="menu__separator" />
|
||||
<MenuItem className="comment__menu-option" onSelect={handleFollow}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SUBSCRIBE} />
|
||||
{subscriptionLabel}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleMute}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.MUTE} />
|
||||
{channelIsMuted ? __('Unmute Channel') : __('Mute Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{!isMyCollection && (
|
||||
<>
|
||||
{(!claimIsMine || channelIsBlocked) && contentChannelUri ? (
|
||||
!incognitoClaim && (
|
||||
<>
|
||||
<hr className="menu__separator" />
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleBlock}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.BLOCK} />
|
||||
{channelIsBlocked ? __('Unblock Channel') : __('Block Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{isAdmin && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleAdminBlock}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.GLOBE} />
|
||||
{channelIsAdminBlocked ? __('Global Unblock Channel') : __('Global Block Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleMute}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.MUTE} />
|
||||
{channelIsMuted ? __('Unmute Channel') : __('Mute Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
{!isChannelPage && !repostedClaim && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleEdit}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.EDIT} />
|
||||
{__('Edit')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{showDelete && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDelete}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<hr className="menu__separator" />
|
||||
</>
|
||||
)}
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
||||
<Icon aria-hidden icon={ICONS.SHARE} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{isChannelPage && IS_WEB && rssUrl && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyRssLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.RSS} />
|
||||
{__('Copy RSS URL')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{!claimIsMine && !isMyCollection && (
|
||||
{!claimIsMine && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.REPORT} />
|
||||
|
||||
@@ -14,7 +14,6 @@ function ClaimPreviewLoading(props: Props) {
|
||||
className={classnames('claim-preview__wrapper', {
|
||||
'claim-preview__wrapper--channel': isChannel && type !== 'inline',
|
||||
'claim-preview__wrapper--inline': type === 'inline',
|
||||
'claim-preview__wrapper--small': type === 'small',
|
||||
})}
|
||||
>
|
||||
<div className={classnames('claim-preview', { 'claim-preview--large': type === 'large' })}>
|
||||
|
||||
@@ -11,12 +11,6 @@ import {
|
||||
makeSelectClaimWasPurchased,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectCollectionIsMine,
|
||||
doCollectionEdit,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectIndexForUrlInCollection,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectDateForUri,
|
||||
} from 'lbry-redux';
|
||||
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
@@ -24,48 +18,33 @@ import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
|
||||
import ClaimPreview from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
||||
|
||||
return {
|
||||
claim,
|
||||
mediaDuration,
|
||||
date: props.uri && makeSelectDateForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||
obscureNsfw: selectShowMatureContent(state) === false,
|
||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
||||
repostClaim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||
obscureNsfw: selectShowMatureContent(state) === false,
|
||||
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
||||
repostClaim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
getFile: (uri) => dispatch(doFileGet(uri, false)),
|
||||
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreview);
|
||||
@@ -2,15 +2,13 @@
|
||||
import type { Node } from 'react';
|
||||
import React, { useEffect, forwardRef } from 'react';
|
||||
import { NavLink, withRouter } from 'react-router-dom';
|
||||
import { isEmpty } from 'util/object';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import { parseURI, COLLECTIONS_CONSTS, isURIEqual } from 'lbry-redux';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { isEmpty } from 'util/object';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import FileProperties from 'component/fileProperties';
|
||||
import ClaimTags from 'component/claimTags';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
@@ -20,25 +18,17 @@ import ClaimPreviewTitle from 'component/claimPreviewTitle';
|
||||
import ClaimPreviewSubtitle from 'component/claimPreviewSubtitle';
|
||||
import ClaimRepostAuthor from 'component/claimRepostAuthor';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
||||
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
||||
import PublishPending from 'component/publishPending';
|
||||
import ClaimMenuList from 'component/claimMenuList';
|
||||
import ClaimPreviewLoading from './claim-preview-loading';
|
||||
import ClaimPreviewHidden from './claim-preview-no-mature';
|
||||
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';
|
||||
|
||||
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,
|
||||
active: boolean,
|
||||
obscureNsfw: boolean,
|
||||
showUserBlocked: boolean,
|
||||
claimIsMine: boolean,
|
||||
@@ -46,7 +36,7 @@ type Props = {
|
||||
reflectingProgress?: any, // fxme
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
history: { push: (string | any) => void },
|
||||
history: { push: (string) => void },
|
||||
title: string,
|
||||
nsfw: boolean,
|
||||
placeholder: string,
|
||||
@@ -66,7 +56,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?: (any) => any,
|
||||
streamingUrl: ?string,
|
||||
getFile: (string) => void,
|
||||
customShouldHide?: (Claim) => boolean,
|
||||
@@ -80,17 +70,6 @@ type Props = {
|
||||
repostUrl?: string,
|
||||
hideMenu?: boolean,
|
||||
isLivestream?: boolean,
|
||||
live?: boolean,
|
||||
collectionId?: string,
|
||||
editCollection: (string, CollectionEditParams) => void,
|
||||
isCollectionMine: boolean,
|
||||
collectionUris: Array<Collection>,
|
||||
collectionIndex?: number,
|
||||
disableNavigation?: boolean,
|
||||
mediaDuration?: string,
|
||||
date?: any,
|
||||
indexInContainer?: number, // The index order of this component within 'containerId'.
|
||||
channelSubCount?: number,
|
||||
};
|
||||
|
||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
@@ -105,11 +84,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
// claim properties
|
||||
// is the claim consider nsfw?
|
||||
nsfw,
|
||||
date,
|
||||
title,
|
||||
claimIsMine,
|
||||
streamingUrl,
|
||||
mediaDuration,
|
||||
// user properties
|
||||
channelIsBlocked,
|
||||
hasVisitedUri,
|
||||
@@ -123,7 +99,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
pending,
|
||||
empty,
|
||||
// modifiers
|
||||
active,
|
||||
customShouldHide,
|
||||
showNullPlaceholder,
|
||||
// value from show mature content user setting
|
||||
@@ -144,39 +119,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
renderActions,
|
||||
hideMenu = false,
|
||||
// repostUrl,
|
||||
isLivestream, // need both? CHECK
|
||||
live,
|
||||
collectionId,
|
||||
collectionIndex,
|
||||
editCollection,
|
||||
isCollectionMine,
|
||||
collectionUris,
|
||||
disableNavigation,
|
||||
indexInContainer,
|
||||
channelSubCount,
|
||||
isLivestream,
|
||||
} = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
const listId = collectionId || collectionClaimId;
|
||||
const WrapperElement = wrapperElement || 'li';
|
||||
const shouldFetch =
|
||||
claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending);
|
||||
const abandoned = !isResolvingUri && !claim;
|
||||
const isMyCollection = listId && (isCollectionMine || listId.includes('-'));
|
||||
const shouldHideActions = hideActions || isMyCollection || type === 'small' || type === 'tooltip';
|
||||
const shouldHideActions = hideActions || 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 {
|
||||
@@ -186,56 +137,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
// $FlowFixMe
|
||||
const isPlayable =
|
||||
claim &&
|
||||
// $FlowFixMe
|
||||
claim.value &&
|
||||
// $FlowFixMe
|
||||
claim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
const isChannelUri = claim ? claim.value_type === 'channel' : false;
|
||||
const isRepost = claim && claim.repost_url;
|
||||
|
||||
const contentUri = claim && isRepost ? claim.canonical_url || claim.permanent_url : uri;
|
||||
const isChannelUri = isValid ? parseURI(contentUri).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;
|
||||
if (signingChannel) {
|
||||
const { value, name } = signingChannel;
|
||||
if (value && value.title) {
|
||||
channelTitle = value.title;
|
||||
} else {
|
||||
channelTitle = name;
|
||||
}
|
||||
}
|
||||
|
||||
// Aria-label value for claim preview
|
||||
let ariaLabelData = isChannelUri ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
||||
|
||||
let navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
|
||||
let navigateSearch = new URLSearchParams();
|
||||
if (listId) {
|
||||
navigateSearch.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
}
|
||||
|
||||
const handleNavLinkClick = (e) => {
|
||||
if (onClick) {
|
||||
onClick(e, claim, indexInContainer); // not sure indexInContainer is used for anything.
|
||||
}
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
const navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
|
||||
const navLinkProps = {
|
||||
to: {
|
||||
pathname: navigateUrl,
|
||||
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
|
||||
},
|
||||
onClick: handleNavLinkClick,
|
||||
onAuxClick: handleNavLinkClick,
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
};
|
||||
|
||||
// do not block abandoned and nsfw claims if showUserBlocked is passed
|
||||
@@ -263,10 +173,10 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
}
|
||||
// block stream claims
|
||||
if (claim && !shouldHide && !showUserBlocked && mutedUris.length && signingChannel) {
|
||||
shouldHide = mutedUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
shouldHide = mutedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
||||
}
|
||||
if (claim && !shouldHide && !showUserBlocked && blockedUris.length && signingChannel) {
|
||||
shouldHide = blockedUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
shouldHide = blockedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
||||
}
|
||||
|
||||
if (!shouldHide && customShouldHide && claim) {
|
||||
@@ -277,18 +187,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
||||
// Weird placement warning
|
||||
// Make sure this happens after we figure out if this claim needs to be hidden
|
||||
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide);
|
||||
const thumbnailUrl = useGetThumbnail(contentUri, claim, streamingUrl, getFile, shouldHide);
|
||||
|
||||
function handleOnClick(e) {
|
||||
if (onClick) {
|
||||
onClick(e, claim, indexInContainer);
|
||||
onClick(e);
|
||||
}
|
||||
|
||||
if (claim && !pending && !disableNavigation) {
|
||||
history.push({
|
||||
pathname: navigateUrl,
|
||||
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
|
||||
});
|
||||
if (claim && !pending) {
|
||||
history.push(navigateUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,22 +231,13 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
return empty || <ClaimPreviewNoContent isChannel={isChannelUri} type={type} />;
|
||||
}
|
||||
|
||||
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && isChannelUri && claim === null) {
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<AbandonedChannelPreview uri={uri} type />
|
||||
</React.Suspense>
|
||||
);
|
||||
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && claim === null) {
|
||||
return <AbandonedChannelPreview uri={contentUri} type />;
|
||||
}
|
||||
if (placeholder === 'publish' && !claim && uri.startsWith('lbry://@')) {
|
||||
if (placeholder === 'publish' && !claim && contentUri.startsWith('lbry://@')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let liveProperty = null;
|
||||
if (live === true) {
|
||||
liveProperty = (claim) => <>LIVE</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<WrapperElement
|
||||
ref={ref}
|
||||
@@ -349,8 +247,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
'claim-preview__wrapper--channel': isChannelUri && type !== 'inline',
|
||||
'claim-preview__wrapper--inline': type === 'inline',
|
||||
'claim-preview__wrapper--small': type === 'small',
|
||||
'claim-preview__live': live,
|
||||
'claim-preview__active': active,
|
||||
})}
|
||||
>
|
||||
<>
|
||||
@@ -368,27 +264,24 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
})}
|
||||
>
|
||||
{isChannelUri && claim ? (
|
||||
<UriIndicator focusable={false} uri={uri} link>
|
||||
<ChannelThumbnail uri={uri} small={type === 'inline'} />
|
||||
<UriIndicator uri={contentUri} link>
|
||||
<ChannelThumbnail uri={contentUri} />
|
||||
</UriIndicator>
|
||||
) : (
|
||||
<>
|
||||
{!pending ? (
|
||||
<NavLink aria-hidden tabIndex={-1} {...navLinkProps}>
|
||||
<NavLink {...navLinkProps}>
|
||||
<FileThumbnail thumbnail={thumbnailUrl}>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
|
||||
</div>
|
||||
{/* @if TARGET='app' */}
|
||||
<div className="claim-preview__hover-actions">
|
||||
{claim && !isCollection && (
|
||||
<FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||
)}
|
||||
</div>
|
||||
{claim && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||
</div>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{!isLivestream && (
|
||||
{!isRepost && !isChannelUri && !isLivestream && (
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
|
||||
<FileProperties uri={contentUri} small />
|
||||
</div>
|
||||
)}
|
||||
</FileThumbnail>
|
||||
@@ -403,87 +296,38 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
<div className="claim-preview-metadata">
|
||||
<div className="claim-preview-info">
|
||||
{pending ? (
|
||||
<ClaimPreviewTitle uri={uri} />
|
||||
<ClaimPreviewTitle uri={contentUri} />
|
||||
) : (
|
||||
<NavLink aria-label={ariaLabelData} aria-current={active ? 'page' : null} {...navLinkProps}>
|
||||
<NavLink {...navLinkProps}>
|
||||
<ClaimPreviewTitle uri={uri} />
|
||||
</NavLink>
|
||||
)}
|
||||
|
||||
{/* {type !== 'small' && !isChannelUri && signingChannel && SIMPLE_SITE && (
|
||||
<ChannelThumbnail uri={signingChannel.permanent_url} />
|
||||
)} */}
|
||||
</div>
|
||||
<ClaimPreviewSubtitle uri={uri} type={type} />
|
||||
{(pending || !!reflectingProgress) && <PublishPending uri={uri} />}
|
||||
{channelSubscribers}
|
||||
</div>
|
||||
{type !== 'small' && (
|
||||
<div className="claim-preview__actions">
|
||||
{!pending && (
|
||||
<>
|
||||
{renderActions && claim && renderActions(claim)}
|
||||
{Boolean(isMyCollection && listId) && (
|
||||
<>
|
||||
<div className="collection-preview__edit-buttons">
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
button="alt"
|
||||
className={'button-collection-order'}
|
||||
disabled={collectionIndex === 0}
|
||||
icon={ICONS.UP}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex) - 1 },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
className={'button-collection-order'}
|
||||
icon={ICONS.DOWN}
|
||||
disabled={collectionIndex === lastCollectionIndex}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex + 1) },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
button="alt"
|
||||
icon={ICONS.DELETE}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// $FlowFixMe
|
||||
if (editCollection) editCollection(listId, { claims: [claim], remove: true });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{shouldHideActions || renderActions ? null : actions !== undefined ? (
|
||||
actions
|
||||
) : (
|
||||
<div className="claim-preview__primary-actions">
|
||||
{!isChannelUri && signingChannel && (
|
||||
<div className="claim-preview__channel-staked">
|
||||
<ChannelThumbnail uri={signingChannel.permanent_url} xsmall />
|
||||
<ChannelThumbnail uri={signingChannel.permanent_url} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isChannelUri && !channelIsBlocked && !claimIsMine && (
|
||||
<SubscribeButton
|
||||
uri={repostedChannelUri || (uri.startsWith('lbry://') ? uri : `lbry://${uri}`)}
|
||||
uri={contentUri.startsWith('lbry://') ? contentUri : `lbry://${contentUri}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -507,7 +351,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{!hideMenu && <ClaimMenuList uri={uri} collectionId={listId} />}
|
||||
{!hideMenu && <ClaimMenuList uri={uri} />}
|
||||
</>
|
||||
</WrapperElement>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -9,35 +9,25 @@ import {
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectDateForUri,
|
||||
} from 'lbry-redux';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import ClaimPreviewTile from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
||||
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
||||
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
||||
|
||||
return {
|
||||
claim,
|
||||
mediaDuration,
|
||||
date: props.uri && makeSelectDateForUri(props.uri)(state),
|
||||
channel: props.uri && makeSelectChannelForClaimUri(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
||||
channel: props.uri && makeSelectChannelForClaimUri(props.uri)(state),
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
|
||||
@@ -7,26 +7,18 @@ 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 { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { parseURI, isURIEqual } from 'lbry-redux';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import FileProperties from 'component/fileProperties';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
||||
import ClaimRepostAuthor from 'component/claimRepostAuthor';
|
||||
import ClaimMenuList from 'component/claimMenuList';
|
||||
import CollectionPreviewOverlay from 'component/collectionPreviewOverlay';
|
||||
// $FlowFixMe cannot resolve ...
|
||||
import PlaceholderTx from 'static/img/placeholderTx.gif';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
date?: any,
|
||||
claim: ?Claim,
|
||||
mediaDuration?: string,
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
history: { push: (string) => void },
|
||||
@@ -43,23 +35,19 @@ type Props = {
|
||||
}>,
|
||||
blockedChannelUris: Array<string>,
|
||||
getFile: (string) => void,
|
||||
placeholder: boolean,
|
||||
streamingUrl: string,
|
||||
isMature: boolean,
|
||||
showMature: boolean,
|
||||
showHiddenByUser?: boolean,
|
||||
properties?: (Claim) => void,
|
||||
live?: boolean,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
hideLivestreamClaims?: boolean,
|
||||
isLivestream: boolean,
|
||||
};
|
||||
|
||||
// preview image cards used in related video functionality
|
||||
function ClaimPreviewTile(props: Props) {
|
||||
const {
|
||||
history,
|
||||
uri,
|
||||
date,
|
||||
isResolvingUri,
|
||||
thumbnail,
|
||||
title,
|
||||
@@ -74,56 +62,36 @@ function ClaimPreviewTile(props: Props) {
|
||||
isMature,
|
||||
showMature,
|
||||
showHiddenByUser,
|
||||
properties,
|
||||
live,
|
||||
showNoSourceClaims,
|
||||
hideLivestreamClaims,
|
||||
isLivestream,
|
||||
collectionId,
|
||||
mediaDuration,
|
||||
} = props;
|
||||
const isRepost = claim && claim.repost_channel_url;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const isStream = claim && claim.value_type === 'stream';
|
||||
// $FlowFixMe
|
||||
const isPlayable =
|
||||
claim &&
|
||||
// $FlowFixMe
|
||||
claim.value &&
|
||||
// $FlowFixMe
|
||||
claim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
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;
|
||||
const listId = collectionId || collectionClaimId;
|
||||
const navigateUrl =
|
||||
formatLbryUrlForWeb(canonicalUrl || uri || '/') + (listId ? generateListSearchUrlParams(listId) : '');
|
||||
const navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');
|
||||
|
||||
const navLinkProps = {
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
};
|
||||
|
||||
let isChannel;
|
||||
let isValid = false;
|
||||
if (uri) {
|
||||
try {
|
||||
parseURI(uri);
|
||||
({ isChannel } = parseURI(uri));
|
||||
isValid = true;
|
||||
} catch (e) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
let channelUri;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
const channelUri = !isChannel ? signingChannel && signingChannel.permanent_url : claim && claim.permanent_url;
|
||||
const channelTitle = signingChannel && ((signingChannel.value && signingChannel.value.title) || signingChannel.name);
|
||||
const repostedChannelUri = isRepost && isChannel ? permanentUrl || canonicalUrl : undefined;
|
||||
|
||||
// Aria-label value for claim preview
|
||||
let ariaLabelData = isChannel ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
|
||||
if (signingChannel) {
|
||||
channelUri = signingChannel.permanent_url;
|
||||
}
|
||||
|
||||
function handleClick(e) {
|
||||
if (navigateUrl) {
|
||||
@@ -165,24 +133,22 @@ function ClaimPreviewTile(props: Props) {
|
||||
|
||||
// block stream claims
|
||||
if (claim && !shouldHide && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
||||
}
|
||||
// block channel claims if we can't control for them in claim search
|
||||
// e.g. fetchRecommendedSubscriptions
|
||||
if (claim && isChannel && !shouldHide && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
if (claim && isChannel && !shouldHide && !showHiddenByUser && blockedChannelUris.length) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === claim.permanent_url);
|
||||
}
|
||||
|
||||
if (shouldHide || (isLivestream && !showNoSourceClaims)) {
|
||||
if (shouldHide || (isLivestream && hideLivestreamClaims)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (placeholder || (!claim && isResolvingUri)) {
|
||||
return (
|
||||
<li className={classnames('claim-preview--tile', {})}>
|
||||
<div className="placeholder media__thumb">
|
||||
<img src={PlaceholderTx} alt="Placeholder" />
|
||||
</div>
|
||||
<div className="placeholder media__thumb" />
|
||||
<div className="placeholder__wrapper">
|
||||
<div className="placeholder claim-tile__title" />
|
||||
<div className="placeholder claim-tile__info" />
|
||||
@@ -191,77 +157,56 @@ function ClaimPreviewTile(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
let liveProperty = null;
|
||||
if (live === true) {
|
||||
liveProperty = (claim) => <>LIVE</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<li
|
||||
role="link"
|
||||
onClick={handleClick}
|
||||
className={classnames('card claim-preview--tile', {
|
||||
'claim-preview__wrapper--channel': isChannel,
|
||||
'claim-preview__live': live,
|
||||
})}
|
||||
>
|
||||
<NavLink {...navLinkProps} role="none" tabIndex={-1} aria-hidden>
|
||||
<NavLink {...navLinkProps}>
|
||||
<FileThumbnail thumbnail={thumbnailUrl} allowGifs>
|
||||
{!isChannel && (
|
||||
<React.Fragment>
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
|
||||
</div>
|
||||
{/* @if TARGET='app' */}
|
||||
<div className="claim-preview__hover-actions">
|
||||
{isStream && <FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />}
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton />
|
||||
</div>
|
||||
{/* @endif */}
|
||||
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
{isCollection && (
|
||||
<React.Fragment>
|
||||
<div className="claim-preview__collection-wrapper">
|
||||
<CollectionPreviewOverlay collectionId={listId} uri={uri} />
|
||||
<FileProperties uri={uri} small />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
</FileThumbnail>
|
||||
</NavLink>
|
||||
<div className="claim-tile__header">
|
||||
<NavLink aria-label={ariaLabelData} {...navLinkProps}>
|
||||
<h2 className="claim-tile__title">
|
||||
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
||||
{isChannel && (
|
||||
<div className="claim-tile__about">
|
||||
<UriIndicator uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
</h2>
|
||||
</NavLink>
|
||||
<ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} />
|
||||
</div>
|
||||
<NavLink {...navLinkProps}>
|
||||
<h2 className="claim-tile__title">
|
||||
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
|
||||
{isChannel && (
|
||||
<div className="claim-tile__about">
|
||||
<UriIndicator uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
<ClaimMenuList uri={uri} />
|
||||
</h2>
|
||||
</NavLink>
|
||||
<div>
|
||||
<div className="claim-tile__info">
|
||||
{isChannel ? (
|
||||
<div className="claim-tile__about--channel">
|
||||
<SubscribeButton uri={repostedChannelUri || uri} />
|
||||
<SubscribeButton uri={uri} />
|
||||
</div>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<UriIndicator focusable={false} uri={uri} link hideAnonymous>
|
||||
<ChannelThumbnail uri={channelUri} xsmall />
|
||||
<UriIndicator uri={uri} link hideAnonymous>
|
||||
<ChannelThumbnail uri={channelUri} />
|
||||
</UriIndicator>
|
||||
|
||||
<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>
|
||||
)}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Icon from 'component/common/icon';
|
||||
import FilePrice from 'component/filePrice';
|
||||
import ClaimType from 'component/claimType';
|
||||
import * as COL from 'constants/collections';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
isSubscribed: boolean,
|
||||
small: boolean,
|
||||
claim: Claim | CollectionClaim,
|
||||
iconOnly: boolean,
|
||||
};
|
||||
export default function ClaimProperties(props: Props) {
|
||||
const { uri, isSubscribed, small = false, claim, iconOnly } = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const size = small ? COL.ICON_SIZE : undefined;
|
||||
// $FlowFixMe
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('claim-preview__overlay-properties', { 'claim-preview__overlay-properties--small': small })}
|
||||
>
|
||||
{
|
||||
<>
|
||||
<ClaimType uri={uri} small />
|
||||
{/* // $FlowFixMe */}
|
||||
{isCollection && claim && claim.value.claims && !iconOnly && <div>{claim.value.claims.length}</div>}
|
||||
{isSubscribed && <Icon size={size} tooltip icon={ICONS.SUBSCRIBE} />}
|
||||
<FilePrice hideFree uri={uri} />
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export default function ClaimTags(props: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classnames('claim__tags', { 'claim__tags--large': type === 'large' })}>
|
||||
<div className={classnames('file-properties--small', { 'file-properties--large': type === 'large' })}>
|
||||
{tagsToDisplay.map((tag) => (
|
||||
<Tag key={tag} title={tag} name={tag} />
|
||||
))}
|
||||
|
||||
@@ -1,32 +1,19 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
selectClaimSearchByQuery,
|
||||
selectFetchingClaimSearchByQuery,
|
||||
SETTINGS,
|
||||
selectClaimsByUri,
|
||||
} from 'lbry-redux';
|
||||
import { doFetchViewCount } from 'lbryinc';
|
||||
import { doClaimSearch, selectClaimSearchByQuery, selectFetchingClaimSearchByQuery, SETTINGS } from 'lbry-redux';
|
||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import ClaimListDiscover from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
fetchingClaimSearchByQuery: selectFetchingClaimSearchByQuery(state),
|
||||
showNsfw: selectShowMatureContent(state),
|
||||
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
});
|
||||
|
||||
const perform = {
|
||||
doClaimSearch,
|
||||
doToggleTagFollowDesktop,
|
||||
doFetchViewCount,
|
||||
};
|
||||
|
||||
export default connect(select, perform)(ClaimListDiscover);
|
||||
@@ -1,100 +1,27 @@
|
||||
// @flow
|
||||
import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import type { Node } from 'react';
|
||||
import React from 'react';
|
||||
import { createNormalizedClaimSearchKey, MATURE_TAGS, splitBySeparator } from 'lbry-redux';
|
||||
import { createNormalizedClaimSearchKey, MATURE_TAGS } from 'lbry-redux';
|
||||
import ClaimPreviewTile from 'component/claimPreviewTile';
|
||||
import { useHistory } from 'react-router';
|
||||
import { getLivestreamOnlyOptions } from 'util/search';
|
||||
|
||||
/**
|
||||
* Updates 'uris' by adding and/or moving active livestreams to the front of
|
||||
* list.
|
||||
* 'liveUris' is also updated with any entries that were moved to the
|
||||
* front, for convenience.
|
||||
*
|
||||
* @param uris [Ref]
|
||||
* @param liveUris [Ref]
|
||||
* @param livestreamMap
|
||||
* @param claimsByUri
|
||||
* @param claimSearchByQuery
|
||||
* @param options
|
||||
*/
|
||||
export function prioritizeActiveLivestreams(
|
||||
uris: Array<string>,
|
||||
liveUris: Array<string>,
|
||||
livestreamMap: { [string]: any },
|
||||
claimsByUri: { [string]: any },
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
options: any
|
||||
) {
|
||||
if (!livestreamMap || !uris) return;
|
||||
|
||||
const claimIsLive = (claim, liveChannelIds) => {
|
||||
// This function relies on:
|
||||
// 1. Only 1 actual livestream per channel (i.e. all other livestream-claims
|
||||
// for that channel actually point to the same source).
|
||||
// 2. 'liveChannelIds' needs to be pruned after being accounted for,
|
||||
// otherwise all livestream-claims will be "live" (we'll only take the
|
||||
// latest one as "live" ).
|
||||
return (
|
||||
claim &&
|
||||
claim.value_type === 'stream' &&
|
||||
claim.value.source === undefined &&
|
||||
claim.signing_channel &&
|
||||
liveChannelIds.includes(claim.signing_channel.claim_id)
|
||||
);
|
||||
};
|
||||
|
||||
let liveChannelIds = Object.keys(livestreamMap);
|
||||
|
||||
// 1. Collect active livestreams from the primary search to put in front.
|
||||
uris.forEach((uri) => {
|
||||
const claim = claimsByUri[uri];
|
||||
if (claimIsLive(claim, liveChannelIds)) {
|
||||
liveUris.push(uri);
|
||||
// This live channel has been accounted for, so remove it.
|
||||
liveChannelIds.splice(liveChannelIds.indexOf(claim.signing_channel.claim_id), 1);
|
||||
}
|
||||
});
|
||||
|
||||
// 2. Now, repeat on the secondary search.
|
||||
if (options) {
|
||||
const livestreamsOnlySearchCacheQuery = createNormalizedClaimSearchKey(getLivestreamOnlyOptions(options));
|
||||
const livestreamsOnlyUris = claimSearchByQuery[livestreamsOnlySearchCacheQuery];
|
||||
if (livestreamsOnlyUris) {
|
||||
livestreamsOnlyUris.forEach((uri) => {
|
||||
const claim = claimsByUri[uri];
|
||||
if (!uris.includes(uri) && claimIsLive(claim, liveChannelIds)) {
|
||||
liveUris.push(uri);
|
||||
// This live channel has been accounted for, so remove it.
|
||||
liveChannelIds.splice(liveChannelIds.indexOf(claim.signing_channel.claim_id), 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Finalize uris by putting live livestreams in front.
|
||||
const newUris = liveUris.concat(uris.filter((uri) => !liveUris.includes(uri)));
|
||||
uris.splice(0, uris.length, ...newUris);
|
||||
}
|
||||
|
||||
// ****************************************************************************
|
||||
// ClaimTilesDiscover
|
||||
// ****************************************************************************
|
||||
|
||||
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,
|
||||
},
|
||||
// claim search options are below
|
||||
tags: Array<string>,
|
||||
blockedUris: Array<string>,
|
||||
mutedUris: Array<string>,
|
||||
claimIds?: Array<string>,
|
||||
channelIds?: Array<string>,
|
||||
pageSize: number,
|
||||
@@ -102,33 +29,19 @@ type Props = {
|
||||
releaseTime?: string,
|
||||
languages?: Array<string>,
|
||||
claimType?: string | Array<string>,
|
||||
streamTypes?: Array<string>,
|
||||
timestamp?: string,
|
||||
feeAmount?: string,
|
||||
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,
|
||||
streamTypes?: Array<string>,
|
||||
pin?: boolean,
|
||||
};
|
||||
|
||||
function ClaimTilesDiscover(props: Props) {
|
||||
const {
|
||||
doClaimSearch,
|
||||
claimSearchByQuery,
|
||||
claimsByUri,
|
||||
showNsfw,
|
||||
hideReposts,
|
||||
fetchViewCount,
|
||||
// Below are options to pass that are forwarded to claim_search
|
||||
tags,
|
||||
channelIds,
|
||||
@@ -138,40 +51,17 @@ function ClaimTilesDiscover(props: Props) {
|
||||
releaseTime,
|
||||
languages,
|
||||
claimType,
|
||||
streamTypes,
|
||||
timestamp,
|
||||
feeAmount,
|
||||
limitClaimsPerChannel,
|
||||
fetchingClaimSearchByQuery,
|
||||
hasSource,
|
||||
hasNoSource,
|
||||
renderProperties,
|
||||
blockedUris,
|
||||
mutedUris,
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
pinUrls,
|
||||
prefixUris,
|
||||
showNoSourceClaims,
|
||||
doFetchViewCount,
|
||||
streamTypes,
|
||||
pin,
|
||||
} = props;
|
||||
|
||||
const { location } = useHistory();
|
||||
const urlParams = new URLSearchParams(location.search);
|
||||
const feeAmountInUrl = urlParams.get('fee_amount');
|
||||
const feeAmountParam = feeAmountInUrl || feeAmount;
|
||||
const mutedAndBlockedChannelIds = Array.from(
|
||||
new Set(mutedUris.concat(blockedUris).map((uri) => splitBySeparator(uri)[1]))
|
||||
);
|
||||
const liveUris = [];
|
||||
let streamTypesParam;
|
||||
if (streamTypes) {
|
||||
streamTypesParam = streamTypes;
|
||||
} else if (SIMPLE_SITE && !hasNoSource && streamTypes !== null) {
|
||||
streamTypesParam = [CS.FILE_VIDEO, CS.FILE_AUDIO];
|
||||
}
|
||||
|
||||
const [prevUris, setPrevUris] = React.useState([]);
|
||||
const feeAmountParam = feeAmountInUrl || feeAmount || CS.FEE_AMOUNT_ONLY_FREE;
|
||||
|
||||
const options: {
|
||||
page_size: number,
|
||||
@@ -193,7 +83,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,
|
||||
@@ -201,14 +91,12 @@ function ClaimTilesDiscover(props: Props) {
|
||||
not_tags: !showNsfw ? MATURE_TAGS : [],
|
||||
any_languages: languages,
|
||||
channel_ids: channelIds || [],
|
||||
not_channel_ids: mutedAndBlockedChannelIds,
|
||||
not_channel_ids: [],
|
||||
order_by: orderBy || ['trending_group', 'trending_mixed'],
|
||||
stream_types: streamTypesParam,
|
||||
stream_types: streamTypes || [CS.FILE_VIDEO],
|
||||
};
|
||||
|
||||
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
|
||||
options.has_no_source = true;
|
||||
} else if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream'))) {
|
||||
if (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream')) {
|
||||
options.has_source = true;
|
||||
}
|
||||
|
||||
@@ -245,120 +133,36 @@ function ClaimTilesDiscover(props: Props) {
|
||||
options.claim_ids = claimIds;
|
||||
}
|
||||
|
||||
const mainSearchKey = createNormalizedClaimSearchKey(options);
|
||||
const livestreamSearchKey = liveLivestreamsFirst
|
||||
? createNormalizedClaimSearchKey(getLivestreamOnlyOptions(options))
|
||||
: undefined;
|
||||
|
||||
let uris = (prefixUris || []).concat(claimSearchByQuery[mainSearchKey] || []);
|
||||
|
||||
const isLoading = fetchingClaimSearchByQuery[mainSearchKey];
|
||||
|
||||
if (liveLivestreamsFirst && livestreamMap && !isLoading) {
|
||||
prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery, options);
|
||||
}
|
||||
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
|
||||
const uris = claimSearchByQuery[claimSearchCacheQuery] || [];
|
||||
|
||||
// Don't use the query from createNormalizedClaimSearchKey for the effect since that doesn't include page & release_time
|
||||
const optionsStringForEffect = JSON.stringify(options);
|
||||
const isLoading = fetchingClaimSearchByQuery[claimSearchCacheQuery];
|
||||
const shouldPerformSearch = !isLoading && uris.length === 0;
|
||||
|
||||
if (
|
||||
prefixUris === undefined &&
|
||||
(claimSearchByQuery[mainSearchKey] === undefined ||
|
||||
(livestreamSearchKey && claimSearchByQuery[livestreamSearchKey] === undefined))
|
||||
) {
|
||||
// This is a new query and we don't have results yet ...
|
||||
if (prevUris.length !== 0) {
|
||||
// ... but we have previous results. Use it until new results are here.
|
||||
uris = prevUris;
|
||||
const fixUri = 'lbry://@samtime#1/us-gov-tries-suing-a-cryptocurrency-lbry#8';
|
||||
if (pin && uris && uris.length > 2 && window.location.pathname === '/') {
|
||||
if (uris.indexOf(fixUri) !== -1) {
|
||||
uris.splice(uris.indexOf(fixUri), 1);
|
||||
} else {
|
||||
uris.pop();
|
||||
}
|
||||
uris.splice(2, 0, fixUri);
|
||||
}
|
||||
|
||||
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);
|
||||
doClaimSearch(searchOptions);
|
||||
|
||||
if (liveLivestreamsFirst) {
|
||||
doClaimSearch(getLivestreamOnlyOptions(searchOptions));
|
||||
}
|
||||
}
|
||||
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, liveLivestreamsFirst]);
|
||||
|
||||
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
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect]);
|
||||
|
||||
return (
|
||||
<ul className="claim-grid">
|
||||
{modifiedUris && modifiedUris.length
|
||||
? modifiedUris.map((uri, index) => (
|
||||
<ClaimPreviewTile
|
||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||
key={uri}
|
||||
uri={uri}
|
||||
properties={renderProperties}
|
||||
live={resolveLive(index)}
|
||||
/>
|
||||
))
|
||||
: new Array(pageSize)
|
||||
.fill(1)
|
||||
.map((x, i) => (
|
||||
<ClaimPreviewTile showNoSourceClaims={hasNoSource || showNoSourceClaims} key={i} placeholder />
|
||||
))}
|
||||
{uris && uris.length
|
||||
? uris.map((uri) => <ClaimPreviewTile key={uri} uri={uri} />)
|
||||
: new Array(pageSize).fill(1).map((x, i) => <ClaimPreviewTile key={i} placeholder />)}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsStreamPlaceholder } from 'lbry-redux';
|
||||
import FileType from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(FileType);
|
||||
@@ -1,29 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as COL from 'constants/collections';
|
||||
|
||||
type Props = {
|
||||
claim: Claim,
|
||||
small: boolean,
|
||||
};
|
||||
|
||||
function ClaimType(props: Props) {
|
||||
const { claim, small } = props;
|
||||
const { value_type: claimType } = claim || {};
|
||||
|
||||
const size = small ? COL.ICON_SIZE : undefined;
|
||||
|
||||
if (claimType === 'collection') {
|
||||
return <Icon size={size} icon={ICONS.STACK} />;
|
||||
} else if (claimType === 'channel') {
|
||||
return <Icon size={size} icon={ICONS.CHANNEL} />;
|
||||
} else if (claimType === 'repost') {
|
||||
return <Icon size={size} icon={ICONS.REPOST} />;
|
||||
}
|
||||
|
||||
return <Icon icon={ICONS.DOWNLOADABLE} />;
|
||||
}
|
||||
|
||||
export default ClaimType;
|
||||
@@ -1,49 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectCollectionIsMine,
|
||||
makeSelectEditedCollectionForId,
|
||||
} from 'lbry-redux';
|
||||
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 perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doToggleShuffleList: (collectionId, shuffle) => {
|
||||
dispatch(doToggleLoopList(collectionId, false, true));
|
||||
dispatch(doToggleShuffleList(undefined, collectionId, shuffle, true));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionActions);
|
||||
@@ -1,182 +0,0 @@
|
||||
// @flow
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import ClaimSupportButton from 'component/claimSupportButton';
|
||||
import FileReactions from 'component/fileReactions';
|
||||
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,
|
||||
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) {
|
||||
const {
|
||||
uri,
|
||||
openModal,
|
||||
claim,
|
||||
claimIsPending,
|
||||
isMyCollection,
|
||||
collectionId,
|
||||
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 })}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
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}`}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
const infoButton = (
|
||||
<Button
|
||||
title={__('Info')}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': showInfo,
|
||||
})}
|
||||
icon={ICONS.MORE}
|
||||
onClick={() => setShowInfo(!showInfo)}
|
||||
/>
|
||||
);
|
||||
|
||||
if (isMobile) {
|
||||
return (
|
||||
<div className="media__actions">
|
||||
{lhsSection}
|
||||
{rhsSection}
|
||||
{uri && <span>{infoButton}</span>}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="media__subtitle--between">
|
||||
<div className="section__actions">
|
||||
{lhsSection}
|
||||
{rhsSection}
|
||||
</div>
|
||||
{uri && <>{infoButton}</>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CollectionActions;
|
||||
@@ -1,37 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import CollectionContent from './view';
|
||||
import {
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
makeSelectCollectionForId,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'lbry-redux';
|
||||
import { selectPlayingUri, selectListLoop, selectListShuffle } from 'redux/selectors/content';
|
||||
import { doToggleLoopList, doToggleShuffleList } from 'redux/actions/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,
|
||||
collection: makeSelectCollectionForId(props.id)(state),
|
||||
collectionUrls: makeSelectUrlsForCollectionId(props.id)(state),
|
||||
collectionName: makeSelectNameForCollectionId(props.id)(state),
|
||||
isMine: makeSelectClaimIsMine(url)(state),
|
||||
loop,
|
||||
shuffle,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, {
|
||||
doToggleLoopList,
|
||||
doToggleShuffleList,
|
||||
})(CollectionContent);
|
||||
@@ -1,83 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Card from 'component/common/card';
|
||||
import Button from 'component/button';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
|
||||
type Props = {
|
||||
id: string,
|
||||
url: string,
|
||||
isMine: boolean,
|
||||
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;
|
||||
|
||||
return (
|
||||
<Card
|
||||
isBodyList
|
||||
className="file-page__recommended-collection"
|
||||
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>
|
||||
</>
|
||||
}
|
||||
titleActions={
|
||||
<div className="card__title-actions--link">
|
||||
{/* TODO: BUTTON TO SAVE COLLECTION - Probably save/copy modal */}
|
||||
<Button label={'View List'} button="link" navigate={`/$/${PAGES.LIST}/${id}`} />
|
||||
</div>
|
||||
}
|
||||
body={
|
||||
<ClaimList
|
||||
isCardBody
|
||||
type="small"
|
||||
activeUri={url}
|
||||
uris={collectionUrls}
|
||||
collectionId={id}
|
||||
empty={__('List is Empty')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectMetadataItemForUri,
|
||||
doCollectionPublish,
|
||||
doCollectionPublishUpdate,
|
||||
makeSelectAmountForUri,
|
||||
makeSelectClaimForUri,
|
||||
selectUpdateCollectionError,
|
||||
selectUpdatingCollection,
|
||||
selectCreateCollectionError,
|
||||
selectBalance,
|
||||
selectCreatingCollection,
|
||||
makeSelectCollectionForId,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectClaimIdsForCollectionId,
|
||||
ACTIONS as LBRY_REDUX_ACTIONS,
|
||||
} from 'lbry-redux';
|
||||
|
||||
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),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
|
||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||
tags: makeSelectMetadataItemForUri(props.uri, 'tags')(state),
|
||||
locations: makeSelectMetadataItemForUri(props.uri, 'locations')(state),
|
||||
languages: makeSelectMetadataItemForUri(props.uri, 'languages')(state),
|
||||
amount: makeSelectAmountForUri(props.uri)(state),
|
||||
updateError: selectUpdateCollectionError(state),
|
||||
updatingCollection: selectUpdatingCollection(state),
|
||||
createError: selectCreateCollectionError(state),
|
||||
creatingCollection: selectCreatingCollection(state),
|
||||
balance: selectBalance(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
incognito: selectIncognito(state),
|
||||
collection: makeSelectCollectionForId(props.collectionId)(state),
|
||||
collectionUrls: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionClaimIds: makeSelectClaimIdsForCollectionId(props.collectionId)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
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);
|
||||
@@ -1,493 +0,0 @@
|
||||
// @flow
|
||||
import { DOMAIN } from 'config';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import TagsSearch from 'component/tagsSearch';
|
||||
import ErrorText from 'component/common/error-text';
|
||||
import ClaimAbandonButton from 'component/claimAbandonButton';
|
||||
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 { useHistory } from 'react-router-dom';
|
||||
import { isNameValid, regexInvalidURI, THUMBNAIL_STATUSES } from 'lbry-redux';
|
||||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
||||
import { FormField } from 'component/common/form';
|
||||
import { handleBidChange } from 'util/publish';
|
||||
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
|
||||
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;
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: CollectionClaim,
|
||||
balance: number,
|
||||
disabled: boolean,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
incognito: boolean,
|
||||
// params
|
||||
title: string,
|
||||
amount: number,
|
||||
thumbnailUrl: string,
|
||||
description: string,
|
||||
tags: Array<string>,
|
||||
locations: Array<string>,
|
||||
languages: Array<string>,
|
||||
collectionId: string,
|
||||
collection: Collection,
|
||||
collectionClaimIds: Array<string>,
|
||||
collectionUrls: Array<string>,
|
||||
updatingCollection: boolean,
|
||||
updateError: string,
|
||||
createError: string,
|
||||
creatingCollection: boolean,
|
||||
publishCollectionUpdate: (CollectionUpdateParams) => Promise<any>,
|
||||
publishCollection: (CollectionPublishParams, string) => Promise<any>,
|
||||
clearCollectionErrors: () => void,
|
||||
onDone: (string) => void,
|
||||
setActiveChannel: (string) => void,
|
||||
setIncognito: (boolean) => void,
|
||||
};
|
||||
|
||||
function CollectionForm(props: Props) {
|
||||
const {
|
||||
uri, // collection uri
|
||||
claim,
|
||||
balance,
|
||||
// publish params
|
||||
amount,
|
||||
title,
|
||||
description,
|
||||
thumbnailUrl,
|
||||
tags,
|
||||
locations,
|
||||
languages = [],
|
||||
// rest
|
||||
updateError,
|
||||
updatingCollection,
|
||||
creatingCollection,
|
||||
createError,
|
||||
disabled,
|
||||
activeChannelClaim,
|
||||
incognito,
|
||||
collectionId,
|
||||
collection,
|
||||
collectionUrls,
|
||||
collectionClaimIds,
|
||||
publishCollectionUpdate,
|
||||
publishCollection,
|
||||
clearCollectionErrors,
|
||||
setActiveChannel,
|
||||
setIncognito,
|
||||
onDone,
|
||||
} = props;
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
let prefix = IS_WEB ? `${DOMAIN}/` : 'lbry://';
|
||||
if (activeChannelName && !incognito) {
|
||||
prefix += `${activeChannelName}/`;
|
||||
}
|
||||
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 name = params.name;
|
||||
const isNewCollection = !uri;
|
||||
const { replace } = useHistory();
|
||||
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');
|
||||
return newName.replace(INVALID_URI_CHARS, '-');
|
||||
}
|
||||
|
||||
function setParam(paramObj) {
|
||||
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,
|
||||
name?: string,
|
||||
description?: string,
|
||||
title?: string,
|
||||
bid: string,
|
||||
languages?: ?Array<string>,
|
||||
locations?: ?Array<string>,
|
||||
tags?: ?Array<{ name: string }>,
|
||||
claim_id?: string,
|
||||
channel_id?: string,
|
||||
claims: ?Array<string>,
|
||||
} = {
|
||||
thumbnail_url: thumbnailUrl,
|
||||
name: parseName(collectionName),
|
||||
description,
|
||||
title: claim ? title : collectionName,
|
||||
bid: String(amount || 0.001),
|
||||
languages: languages ? dedupeLanguages(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,
|
||||
};
|
||||
|
||||
return collectionParams;
|
||||
}
|
||||
|
||||
function handleLanguageChange(index, code) {
|
||||
let langs = [...languageParam];
|
||||
if (index === 0) {
|
||||
if (code === LANG_NONE) {
|
||||
// clear all
|
||||
langs = [];
|
||||
} else {
|
||||
langs[0] = code;
|
||||
if (langs[0] === langs[1]) {
|
||||
langs.length = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (code === LANG_NONE || code === langs[0]) {
|
||||
langs.splice(1, 1);
|
||||
} else {
|
||||
langs[index] = code;
|
||||
}
|
||||
}
|
||||
setParams({ ...params, languages: langs });
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (uri) {
|
||||
publishCollectionUpdate(params).then((pendingClaim) => {
|
||||
if (pendingClaim) {
|
||||
const claimId = pendingClaim.claim_id;
|
||||
analytics.apiLogPublish(pendingClaim);
|
||||
onDone(claimId);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
publishCollection(params, collectionId).then((pendingClaim) => {
|
||||
if (pendingClaim) {
|
||||
const claimId = pendingClaim.claim_id;
|
||||
analytics.apiLogPublish(pendingClaim);
|
||||
onDone(claimId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
const collectionClaimIds = JSON.parse(collectionClaimIdsString);
|
||||
setParams({ ...params, claims: collectionClaimIds });
|
||||
clearCollectionErrors();
|
||||
}, [collectionClaimIdsString, setParams]);
|
||||
|
||||
React.useEffect(() => {
|
||||
let nameError;
|
||||
if (!name && name !== undefined) {
|
||||
nameError = __('A name is required for your url');
|
||||
} else if (!isNameValid(name, false)) {
|
||||
nameError = INVALID_NAME_ERROR;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}, [setInitialized, setActiveChannel, collectionChannel, setIncognito, hasClaim, incognito, initialized]);
|
||||
|
||||
// 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]);
|
||||
|
||||
// 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 })}>
|
||||
<Tabs>
|
||||
<TabList className="tabs__list--collection-edit-page">
|
||||
<Tab>{__('General')}</Tab>
|
||||
<Tab>{__('Items')}</Tab>
|
||||
<Tab>{__('Credits')}</Tab>
|
||||
<Tab>{__('Tags')}</Tab>
|
||||
<Tab>{__('Other')}</Tab>
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
<TabPanel>
|
||||
<div className={'card-stack'}>
|
||||
<ChannelSelector disabled={disabled} />
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="channel_name">{__('Name')}</label>
|
||||
<div className="form-field__prefix">{prefix}</div>
|
||||
</fieldset-section>
|
||||
|
||||
<FormField
|
||||
autoFocus={isNewCollection}
|
||||
type="text"
|
||||
name="channel_name"
|
||||
placeholder={__('MyAwesomeList')}
|
||||
value={params.name}
|
||||
error={nameError}
|
||||
disabled={!isNewCollection}
|
||||
onChange={(e) => setParams({ ...params, name: e.target.value || '' })}
|
||||
/>
|
||||
</fieldset-group>
|
||||
{!isNewCollection && (
|
||||
<span className="form-field__help">{__('This field cannot be changed.')}</span>
|
||||
)}
|
||||
|
||||
<FormField
|
||||
type="text"
|
||||
name="channel_title2"
|
||||
label={__('Title')}
|
||||
placeholder={__('My Awesome List')}
|
||||
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>
|
||||
<FormField
|
||||
type="markdown"
|
||||
name="content_description2"
|
||||
label={__('Description')}
|
||||
placeholder={__('Description of your content')}
|
||||
value={params.description}
|
||||
onChange={(text) => setParams({ ...params, description: text })}
|
||||
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ClaimList uris={collectionUrls} collectionId={collectionId} empty={__('This list has no items.')} />
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
body={
|
||||
<FormField
|
||||
className="form-field--price-amount"
|
||||
type="number"
|
||||
name="content_bid2"
|
||||
step="any"
|
||||
label={<LbcSymbol postfix={__('Deposit')} size={14} />}
|
||||
value={params.bid}
|
||||
error={bidError}
|
||||
min="0.0"
|
||||
disabled={false}
|
||||
onChange={(event) =>
|
||||
handleBidChange(parseFloat(event.target.value), amount, balance, setBidError, setParam)
|
||||
}
|
||||
placeholder={0.1}
|
||||
helper={__('Increasing your deposit can help your channel be discovered more easily.')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
body={
|
||||
<TagsSearch
|
||||
suggestMature
|
||||
disableAutoFocus
|
||||
limitSelect={MAX_TAG_SELECT}
|
||||
tagsPassedIn={params.tags || []}
|
||||
label={__('Selected Tags')}
|
||||
onRemove={(clickedTag) => {
|
||||
const newTags = params.tags.slice().filter((tag) => tag.name !== clickedTag.name);
|
||||
setParams({ ...params, tags: newTags });
|
||||
}}
|
||||
onSelect={(newTags) => {
|
||||
newTags.forEach((newTag) => {
|
||||
if (!params.tags.map((savedTag) => savedTag.name).includes(newTag.name)) {
|
||||
setParams({ ...params, tags: [...params.tags, newTag] });
|
||||
} else {
|
||||
// If it already exists and the user types it in, remove it
|
||||
setParams({ ...params, tags: params.tags.filter((tag) => tag.name !== newTag.name) });
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
<FormField
|
||||
name="language_select"
|
||||
type="select"
|
||||
label={__('Primary Language')}
|
||||
onChange={(event) => handleLanguageChange(0, event.target.value)}
|
||||
value={primaryLanguage}
|
||||
helper={__('Your main content language')}
|
||||
>
|
||||
<option key={'pri-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{Object.keys(SUPPORTED_LANGUAGES).map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
<FormField
|
||||
name="language_select2"
|
||||
type="select"
|
||||
label={__('Secondary Language')}
|
||||
onChange={(event) => handleLanguageChange(1, event.target.value)}
|
||||
value={secondaryLanguage}
|
||||
disabled={!languageParam[0]}
|
||||
helper={__('Your other content language')}
|
||||
>
|
||||
<option key={'sec-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{Object.keys(SUPPORTED_LANGUAGES)
|
||||
.filter((lang) => lang !== languageParam[0])
|
||||
.map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
<Card
|
||||
className="card--after-tabs"
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
disabled={
|
||||
creatingCollection || updatingCollection || nameError || bidError || thumbnailError || !hasClaims
|
||||
}
|
||||
label={creatingCollection || updatingCollection ? __('Submitting') : __('Submit')}
|
||||
onClick={handleSubmit}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => onDone(collectionId)} />
|
||||
</div>
|
||||
{submitError ? (
|
||||
<ErrorText>{submitError}</ErrorText>
|
||||
) : (
|
||||
<p className="help">
|
||||
{__('After submitting, it will take a few minutes for your changes to be live for everyone.')}
|
||||
</p>
|
||||
)}
|
||||
{!isNewCollection && (
|
||||
<div className="section__actions">
|
||||
<ClaimAbandonButton uri={uri} abandonActionCallback={() => replace(`/$/${PAGES.LIBRARY}`)} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default CollectionForm;
|
||||
@@ -1,28 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectNameForCollectionId } 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);
|
||||
@@ -1,96 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
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 { 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
|
||||
className={classnames('menu__button', { 'claim__menu-button': !inline, 'claim__menu-button--inline': inline })}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
{collectionId && collectionName && (
|
||||
<>
|
||||
<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={() => {
|
||||
doToggleShuffleList(collectionId);
|
||||
setDoShuffle(true);
|
||||
}}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
||||
{__('Shuffle Play')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.PUBLISH} />
|
||||
{__('Publish List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => doOpenModal(MODALS.COLLECTION_DELETE, { collectionId })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
export default CollectionMenuList;
|
||||
@@ -1,30 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectClaimIdForUri,
|
||||
makeSelectClaimForClaimId,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
makeSelectPendingCollectionForId,
|
||||
makeSelectCountForCollectionId,
|
||||
} from 'lbry-redux';
|
||||
import CollectionPreviewOverlay from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
return {
|
||||
collectionId,
|
||||
uri: collectionUri,
|
||||
collectionCount: makeSelectCountForCollectionId(collectionId)(state),
|
||||
collectionName: makeSelectNameForCollectionId(collectionId)(state),
|
||||
collectionItemUrls: makeSelectUrlsForCollectionId(collectionId)(state), // ForId || ForUri
|
||||
pendingCollection: makeSelectPendingCollectionForId(collectionId)(state),
|
||||
claim,
|
||||
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select)(CollectionPreviewOverlay);
|
||||
@@ -1,42 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
collectionId: string,
|
||||
collectionName: string,
|
||||
collectionCount: number,
|
||||
editedCollection?: Collection,
|
||||
pendingCollection?: Collection,
|
||||
claim: ?Claim,
|
||||
collectionItemUrls: Array<string>,
|
||||
};
|
||||
|
||||
function CollectionPreviewOverlay(props: Props) {
|
||||
const { collectionItemUrls } = props;
|
||||
|
||||
if (collectionItemUrls && collectionItemUrls.length > 0) {
|
||||
return (
|
||||
<div className="collection-preview__overlay-thumbs">
|
||||
<div className="collection-preview__overlay-side" />
|
||||
<div className="collection-preview__overlay-grid">
|
||||
{collectionItemUrls &&
|
||||
collectionItemUrls.map((item, index) => {
|
||||
if (index < 2) {
|
||||
return (
|
||||
<div className="collection-preview__overlay-grid-items">
|
||||
<FileThumbnail uri={item} key={item} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export default withRouter(CollectionPreviewOverlay);
|
||||
@@ -1,19 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Icon from 'component/common/icon';
|
||||
type Props = {
|
||||
count: number,
|
||||
};
|
||||
|
||||
export default function collectionCount(props: Props) {
|
||||
const { count = 0 } = props;
|
||||
|
||||
return (
|
||||
<div className={classnames('claim-preview__overlay-properties', 'claim-preview__overlay-properties--small')}>
|
||||
<Icon icon={ICONS.STACK} />
|
||||
<div>{count}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Icon from 'component/common/icon';
|
||||
|
||||
export default function collectionCount() {
|
||||
return (
|
||||
<div className={classnames('claim-preview__overlay-properties', 'claim-preview__overlay-properties--small')}>
|
||||
<Icon icon={ICONS.LOCK} />
|
||||
<div>{__('Private')}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loaded 100 of 622 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user