Compare commits

..
Author SHA1 Message Date
zeppi 52800e8fd6 test api 2021-06-18 10:29:18 -04:00
385 changed files with 14978 additions and 3527 deletions

No files matched your search

+3
View File
@@ -31,7 +31,10 @@ 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
# OG
OG_TITLE_SUFFIX=| lbry.tv
+1 -1
View File
@@ -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-cert.p12
CSC_LINK: https://s3.amazonaws.com/files.lbry.io/cert/osx-csc-2021-2022.p12
# UI
MATOMO_URL: https://analytics.lbry.com/
+4
View File
@@ -23,8 +23,12 @@ 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
+16
View File
@@ -8,6 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- 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))
- 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))
### Changed
- Keyboard shortcut additions and changes _community pr!_ ([#5717](https://github.com/lbryio/lbry-desktop/pull/5717))
@@ -15,8 +22,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.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))
## [0.50.2] - [2021-04-2]
### Changed
- Disable PDFs until security issue is fixed
## [0.50.1] - [2021-03-18]
+24 -26
View File
@@ -1,21 +1,19 @@
# 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.
* [Check out this video for a quickstart guide to running and developing the desktop app](https://spee.ch/7da73fc508ffc4ff8b2711e3c3950110430b0c5f/LBRYAppDesign.mp4).
- 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.
## Contents
- [Choose an Issue](#choose-an-issue)
- [Code Overview](#code-overview)
- [Libraries](#libraries)
@@ -38,20 +36,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. |
@@ -80,7 +78,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 [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).
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).
### Flow
@@ -140,15 +138,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
@@ -157,12 +155,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
@@ -191,10 +189,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/).
+12 -14
View File
@@ -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 | 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) |
| | 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)/[@TimurKiyivinski](https://github.com/TimurKiyivinski) | [@Enderger](https://github.com/enderger) | [@Madiator2011](https://github.com/kodxana) |
## Usage
@@ -88,16 +88,12 @@ 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/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.
@@ -110,11 +106,12 @@ 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
@@ -132,7 +129,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_)
@@ -173,8 +170,9 @@ 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://keybase.io/lbry/key.asc) if you need it. All releases are signed by [Sean Yesmunt](https://keybase.io/seanyesmunt/key.asc).
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).
## Contact
The primary contact for this project is [@seanyesmunt](https://github.com/seanyesmunt).
The primary contact for this project is [@jessopb](https://github.com/jessopb).
+4
View File
@@ -28,6 +28,7 @@ const config = {
OG_IMAGE_URL: process.env.OG_IMAGE_URL,
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,
@@ -36,7 +37,10 @@ const config = {
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,
SIMPLE_SITE: process.env.SIMPLE_SITE === 'true',
SHOW_ADS: process.env.SHOW_ADS === 'true',
PINNED_URI_1: process.env.PINNED_URI_1,
+71
View File
@@ -12,11 +12,21 @@ 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,
};
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> },
repliesByParentId: { [string]: Array<string> }, // ParentCommentID -> list of reply comments
topLevelCommentsById: { [string]: Array<string> }, // ClaimID -> list of top level comments
@@ -31,6 +41,9 @@ declare type CommentsState = {
fetchingModerationBlockList: boolean,
blockingByUri: {},
unBlockingByUri: {},
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
fetchingSettings: boolean,
fetchingBlockedWords: boolean,
};
declare type CommentReactParams = {
@@ -41,3 +54,61 @@ declare type CommentReactParams = {
clear_types?: string,
remove?: boolean,
};
declare type CommentListParams = {
page: number,
page_size: number,
claim_id: string,
};
declare type CommentListResponse = {
items: Array<Comment>,
total_amount: number,
};
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 ModerationBlockParams = {};
declare type SettingsParams = {
channel_name: string,
channel_id: string,
signature: string,
signing_ts: string,
};
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
};
-16
View File
@@ -1,16 +0,0 @@
// @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 = {};
+26
View File
@@ -0,0 +1,26 @@
// @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: {},
}
+5
View File
@@ -36,3 +36,8 @@ declare type WebNotification = {
user_id: number,
group_count?: number,
};
declare type NotificationCategory = {
name: string,
types: ?Array<string>,
};
+1
View File
@@ -11,6 +11,7 @@ declare type UpdatePublishFormData = {
thumbnail_url?: string,
uploadThumbnailStatus?: string,
thumbnailPath?: string,
thumbnailError?: boolean,
description?: string,
language?: string,
channel?: string,
+9
View File
@@ -0,0 +1,9 @@
// @flow
import * as ACTIONS from 'constants/action_types';
declare type ReportContentState = {
isReporting: boolean,
error: string,
};
+13
View File
@@ -14,11 +14,22 @@ 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,
urisByQuery: {},
hasReachedMaxResultsLength: {},
searching: boolean,
};
@@ -26,6 +37,8 @@ declare type SearchSuccess = {
type: ACTIONS.SEARCH_SUCCESS,
data: {
query: string,
from: number,
size: number,
uris: Array<string>,
},
};
-11
View File
@@ -1,15 +1,4 @@
// @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,
+3
View File
@@ -28,4 +28,7 @@ declare type User = {
device_types: Array<DeviceType>,
lbry_first_approved: boolean,
experimental_ui: boolean,
odysee_live_enabled: boolean,
odysee_live_disabled: boolean,
global_mod: boolean,
};
+1
View File
@@ -1276,6 +1276,7 @@ export default function GetHomePageRowData(
link: `/$/${PAGES.CHANNELS_FOLLOWING}`,
icon: ICONS.SUBSCRIBE,
options: {
streamTypes: null,
orderBy: ['release_time'],
streamTypes: CS.FILE_TYPES,
releaseTime:
+6 -4
View File
@@ -1,6 +1,6 @@
{
"name": "lbry",
"version": "0.50.1",
"version": "0.50.3-rc.1",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"keywords": [
"lbry"
@@ -53,6 +53,7 @@
"electron-updater": "^4.2.4",
"express": "^4.17.1",
"if-env": "^1.0.4",
"react-datetime-picker": "^3.2.1",
"remove-markdown": "^0.3.0",
"tempy": "^0.6.0",
"videojs-logo": "^2.1.4"
@@ -142,8 +143,8 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#9a1701372829c21cefbedacfc6033aec4dc7fa3c",
"lbryinc": "lbryio/lbryinc#7faea40d87b78ec91b901c62f501499dc4737025",
"lbry-redux": "lbryio/lbry-redux#508e8d36fd91106beb7d6b4edb9f726dae0e6264",
"lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",
"lodash-es": "^4.17.14",
@@ -203,6 +204,7 @@
"tree-kill": "^1.1.0",
"unist-util-visit": "^2.0.3",
"uuid": "^8.3.2",
"vast-client": "^3.1.1",
"video.js": "^7.10.1",
"videojs-contrib-quality-levels": "^2.0.9",
"videojs-event-tracking": "^1.0.1",
@@ -217,7 +219,7 @@
"webpack-hot-middleware": "^2.24.3",
"webpack-merge": "^4.2.1",
"webpack-node-externals": "^1.7.2",
"y18n": "^4.0.0",
"y18n": "^4.0.1",
"yarnhook": "^0.2.0"
},
"engines": {
+287 -31
View File
@@ -48,7 +48,6 @@
"Description of your content": "Description of your content",
"Price": "Price",
"Free": "Free",
"The LBRY URL is the exact address where people find your content (ex. lbry://myvideo).": "The LBRY URL is the exact address where people find your content (ex. lbry://myvideo).",
"Learn more": "Learn more",
"Name": "Name",
"Deposit": "Deposit",
@@ -115,6 +114,7 @@
"Recipient address": "Recipient address",
"Send": "Send",
"Receive Credits": "Receive Credits",
"Send Credits": "Send Credits",
"Address copied.": "Address copied.",
"Get New Address": "Get New Address",
"Show QR code": "Show QR code",
@@ -173,9 +173,7 @@
"Yes": "Yes",
"No": "No",
"These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.",
"FILTER": "FILTER",
"View file": "View file",
"Search For": "Search For",
"Files": "Files",
"Channels": "Channels",
"Everything": "Everything",
@@ -184,6 +182,16 @@
"Other": "Other",
"Other Options": "Other Options",
"Returned Results": "Returned Results",
"Find results that include all the given words in the exact order.\nThis can also be done by surrounding the search query with quotation marks (e.g. \"hello world\").": "Find results that include all the given words in the exact order.\nThis can also be done by surrounding the search query with quotation marks (e.g. \"hello world\").",
"Last Hour": "Last Hour",
"Last 24 Hours": "Last 24 Hours",
"Relevance": "Relevance",
"Newest first": "Newest first",
"Oldest first": "Oldest first",
"Exact match": "Exact match",
"Upload Date": "Upload Date",
"Creation Date": "Creation Date",
"Sort By": "Sort By",
"Custom Code": "Custom Code",
"Are you a supermodel or rockstar that received a custom reward code? Claim it here.": "Are you a supermodel or rockstar that received a custom reward code? Claim it here.",
"Go To Invites": "Go To Invites",
@@ -197,6 +205,7 @@
"Connecting...": "Connecting...",
"Comments": "Comments",
"Comment": "Comment",
"Comment --[button to submit something]--": "Comment",
"Your comment": "Your comment",
"Post --[button to submit something]--": "Post",
"Post --[noun, markdown post tab button]--": "Post",
@@ -300,6 +309,9 @@
"upload": "upload",
"Uploading thumbnail": "Uploading thumbnail",
"Please wait for thumbnail to finish uploading": "Please wait for thumbnail to finish uploading",
"A thumbnail is required. Please upload or provide an image URL above.": "A thumbnail is required. Please upload or provide an image URL above.",
"Thumbnail is invalid.": "Thumbnail is invalid.",
"Please reselect a file after changing the LBRY URL": "Please reselect a file after changing the LBRY URL",
"API connection string": "API connection string",
"Method": "Method",
"Parameters": "Parameters",
@@ -372,8 +384,11 @@
"Email Us": "Email Us",
"Today": "Today",
"All time": "All time",
"Share on Reddit": "Share on Reddit",
"Share on Facebook": "Share on Facebook",
"Share On Twitter": "Share On Twitter",
"Share on Telegram": "Share on Telegram",
"Share via...": "Share via...",
"View on lbry.tv": "View on lbry.tv",
"You will receive an SMS text message confirming your phone number is valid. Does not work for Canada and possibly other regions.": "You will receive an SMS text message confirming your phone number is valid. Does not work for Canada and possibly other regions.",
"Standard messaging rates apply. LBRY will not text or call you otherwise. Having trouble?": "Standard messaging rates apply. LBRY will not text or call you otherwise. Having trouble?",
@@ -436,6 +451,7 @@
"Trending": "Trending",
"Top": "Top",
"New": "New",
"New --[clears Publish Form]--": "New",
"Loading": "Loading",
"This file is in your library.": "This file is in your library.",
"'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.": "'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.",
@@ -473,6 +489,7 @@
"Blocked and muted channels": "Blocked and muted channels",
"Manage": "Manage",
"Automatic dark mode": "Automatic dark mode",
"24-hour clock": "24-hour clock",
"Hide wallet balance in header": "Hide wallet balance in header",
"Max Connections": "Max Connections",
"For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.": "For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.",
@@ -485,6 +502,7 @@
"From --[the tip sender]--": "From",
"From --[initial time]--": "From",
"Not enough Credits": "Not enough Credits",
"Decrease amount to account for transaction fee": "Decrease amount to account for transaction fee",
"You have %credit_amount% in unclaimed rewards.": "You have %credit_amount% in unclaimed rewards.",
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.",
"Read More": "Read More",
@@ -530,7 +548,6 @@
"Extra Verification Needed": "Extra Verification Needed",
"We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.": "We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.",
"Verify phone number": "Verify phone number",
"Verify Phone Number": "Verify Phone Number",
"OR": "OR",
"Proof via Credit": "Proof via Credit",
"If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.": "If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.",
@@ -605,6 +622,7 @@
"Looks like you don't have any transactions.": "Looks like you don't have any transactions.",
"If Sync is on, LBRY will backup your wallet and preferences. If disabled, you are responsible for keeping a backup.": "If Sync is on, LBRY will backup your wallet and preferences. If disabled, you are responsible for keeping a backup.",
"Your update is now pending on LBRY. It will take a few minutes to appear for other users.": "Your update is now pending on LBRY. It will take a few minutes to appear for other users.",
"Your livestream is now pending. You will be able to start shortly at the streaming dashboard.": "Your livestream is now pending. You will be able to start shortly at the streaming dashboard.",
"Your file is now pending on LBRY. It will take a few minutes to appear for other users.": "Your file is now pending on LBRY. It will take a few minutes to appear for other users.",
"Your video will appear on Odysee shortly.": "Your video will appear on Odysee shortly.",
"Upload will continue in the background, please do not shut down immediately. Leaving the app running helps the network, thank you!": "Upload will continue in the background, please do not shut down immediately. Leaving the app running helps the network, thank you!",
@@ -628,7 +646,7 @@
"Claim Channels": "Claim Channels",
"Say something about this...": "Say something about this...",
"Update email preferences": "Update email preferences",
"An account with lbry.tv allows you to earn rewards and backup your data.": "An account with lbry.tv allows you to earn rewards and backup your data.",
"An account allows you to earn rewards and backup your data.": "An account allows you to earn rewards and backup your data.",
"Backup your account and wallet data.": "Backup your account and wallet data.",
"Sign in": "Sign in",
"We just sent an email to %email% with a link for you to %verify_text%. Remember to check other email folders like spam or promotions.": "We just sent an email to %email% with a link for you to %verify_text%. Remember to check other email folders like spam or promotions.",
@@ -714,6 +732,7 @@
"This is an experiment, and may be removed in the future. Upload something with the #homepagecagematch tag to battle for the top spot on the home page!": "This is an experiment, and may be removed in the future. Upload something with the #homepagecagematch tag to battle for the top spot on the home page!",
"Publishing": "Publishing",
"Update published": "Update published",
"Livestream Created": "Livestream Created",
"Delete this file from my computer": "Delete this file from my computer",
"Are you sure you'd like to remove %title% from LBRY?": "Are you sure you'd like to remove %title% from LBRY?",
"reclaim %amount%": "reclaim %amount%",
@@ -803,6 +822,7 @@
"try again in a few seconds.": "try again in a few seconds.",
"Any": "Any",
"Video": "Video",
"Video/Audio": "Video/Audio",
"Document": "Document",
"Duration": "Duration",
"Long": "Long",
@@ -814,6 +834,7 @@
"gaming, crypto": "gaming, crypto",
"Autocomplete": "Autocomplete",
"Followed Tags": "Followed Tags",
"Manage Tags": "Manage Tags",
"%selectTagsLabel% (%number% left)": "%selectTagsLabel% (%number% left)",
"Matching": "Matching",
"Please check your deposit amount.": "Please check your deposit amount.",
@@ -861,7 +882,6 @@
"Back": "Back",
"Experimental Transcoding": "Experimental Transcoding",
"A Folder containing FFmpeg": "A Folder containing FFmpeg",
"Check again": "Check again",
"FFmpeg could not be found. Navigate to it or Install, Then %check_again% or quit and restart the app. %learn_more%": "FFmpeg could not be found. Navigate to it or Install, Then %check_again% or quit and restart the app. %learn_more%",
"FFmpeg is correctly configured. %learn_more%": "FFmpeg is correctly configured. %learn_more%",
"Finnish": "Finnish",
@@ -1044,6 +1064,7 @@
"download the app": "download the app",
"lbry.tv collects usage information for itself only (%more_information%).": "lbry.tv collects usage information for itself only (%more_information%).",
"lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?": "lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?",
"more --[value for \"more_information\"]--": "more",
"%DOMAIN% performance may be degraded. You can try to use it, or wait 5 minutes and refresh. Please no crush us.": "%DOMAIN% performance may be degraded. You can try to use it, or wait 5 minutes and refresh. Please no crush us.",
"Please %sign_in_link% to comment.": "Please %sign_in_link% to comment.",
"Replying as %reply_channel%": "Replying as %reply_channel%",
@@ -1130,6 +1151,7 @@
"Update Your Password": "Update Your Password",
"Your Wallet is Empty": "Your Wallet is Empty",
"Buy Credits": "Buy Credits",
"Buy/Swap Credits": "Buy/Swap Credits",
"LBRY, Inc. partners with Moonpay to provide the option to purchase LBRY Credits. %learn_more%.": "LBRY, Inc. partners with Moonpay to provide the option to purchase LBRY Credits. %learn_more%.",
"Earn Rewards": "Earn Rewards",
"Rewards are currently disabled for your account. Turn on diagnostic data sharing, in %settings%, to re-enable them.": "Rewards are currently disabled for your account. Turn on diagnostic data sharing, in %settings%, to re-enable them.",
@@ -1177,6 +1199,7 @@
"Send a %amount% Tip": "Send a %amount% Tip",
"Channel to show support as": "Channel to show support as",
"Buy more LBRY Credits": "Buy more LBRY Credits",
"Buy or swap more LBRY Credits": "Buy or swap more LBRY Credits",
"Support this content": "Support this content",
"Custom support amount": "Custom support amount",
"(%lbc_balance% Credits available)": "(%lbc_balance% Credits available)",
@@ -1231,8 +1254,12 @@
"%image_type% %recommended_ratio%": "%image_type% %recommended_ratio%",
"%label% • File to upload": "%label% • File to upload",
"Video file": "Video file",
"Select video file to upload": "Select video file to upload",
"Select video or audio file to upload": "Select video or audio file to upload",
"Select a file to upload": "Select a file to upload",
"Select file to upload": "Select file to upload",
"Url copied.": "Url copied.",
"Uploading...": "Uploading...",
"Creating...": "Creating...",
"Use a URL": "Use a URL",
"Edit Cover Image": "Edit Cover Image",
"Cover Image": "Cover Image",
@@ -1293,6 +1320,7 @@
"Upload Complete": "Upload Complete",
"Uploading": "Uploading",
"View My Uploads": "View My Uploads",
"View My Dashboard": "View My Dashboard",
"No recent uploads": "No recent uploads",
"Removing...": "Removing...",
"License description": "License description",
@@ -1344,10 +1372,10 @@
"Sync YouTube Channel": "Sync YouTube Channel",
"Terms": "Terms",
"Privacy Policy": "Privacy Policy",
"Comment replies": "Comment replies",
"Daily watch availability": "Daily watch availability",
"Daily watch reminders": "Daily watch reminders",
"New content": "New content",
"Replies": "Replies",
"Others": "Others",
"HyperChat": "HyperChat",
"New Content": "New Content",
"No notifications": "No notifications",
"Try selecting another filter.": "Try selecting another filter.",
"You don't have any notifications yet, but they will be here when you do!": "You don't have any notifications yet, but they will be here when you do!",
@@ -1357,16 +1385,22 @@
"An account with %domain% allows you to earn rewards and backup your data.": "An account with %domain% allows you to earn rewards and backup your data.",
"Sync my YouTube channel": "Sync my YouTube channel",
"Log in to %SITE_NAME%": "Log in to %SITE_NAME%",
"Log in": "Log in",
"Not Yet": "Not Yet",
"Preparing...": "Preparing...",
"Confirm Upload": "Confirm Upload",
"Confirm Edit": "Confirm Edit",
"Create Livestream": "Create Livestream",
"File": "File",
"Video/audio file": "Video/audio file",
"Transcode": "Transcode",
"Estimated transaction fee:": "Estimated transaction fee:",
"Est. transaction fee:": "Est. transaction fee:",
"Skip preview and confirmation": "Skip preview and confirmation",
"Upload settings": "Upload settings",
"Currently uploading": "Currently uploading",
"Your files are currently uploading.": "Your files are currently uploading.",
"Your file is currently uploading.": "Your file is currently uploading.",
"Enable Sync": "Enable Sync",
"Disable Sync": "Disable Sync",
"Getting your profiles...": "Getting your profiles...",
@@ -1374,7 +1408,6 @@
"Disabling sync will switch to your local profile.": "Disabling sync will switch to your local profile.",
"To enable Sync, close LBRY completely and check 'Remember Password' during wallet unlock.": "To enable Sync, close LBRY completely and check 'Remember Password' during wallet unlock.",
"Something went wrong. Please %click_here% to learn about sync limitations.": "Something went wrong. Please %click_here% to learn about sync limitations.",
"Buy LBC": "Buy LBC",
"Continue...": "Continue...",
"Leave a comment": "Leave a comment",
"Be the first to comment!": "Be the first to comment!",
@@ -1394,6 +1427,8 @@
"Controversial": "Controversial",
"Show Replies": "Show Replies",
"Unable to create comment, please try again later.": "Unable to create comment, please try again later.",
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
"Unable to delete this comment, please try again later.": "Unable to delete this comment, please try again later.",
"Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.",
@@ -1418,19 +1453,17 @@
"A channel is required to comment on %SITE_NAME%": "A channel is required to comment on %SITE_NAME%",
"A channel is required to comment on lbry.tv": "A channel is required to comment on lbry.tv",
"A welcome bonus and thank you for your contribution to content freedom.": "A welcome bonus and thank you for your contribution to content freedom.",
"You earned %lbc% new user reward.": "You earned %lbc% LBC new user reward.",
"You earned %lbc% new user reward.": "You earned %lbc% new user reward.",
"Just press play on something. Anything at all. Yep, even that one. Everybody's doing it.": "Just press play on something. Anything at all. Yep, even that one. Everybody's doing it.",
"Claim your channel! Create an identity used to securely publish content.": "Claim your channel! Create an identity used to securely publish content.",
"You earned %lbc% for creating a channel.": "You earned %lbc% for creating a channel.",
"Launch your own channel by sharing a video.": "Launch your own channel by sharing a video.",
"You earned %lbc% for making your first upload.": "You earned %lbc% for making your first upload.",
"Return to the app 24-48 hours following your first use of the app. This reward will self destruct after that time span.": "Return to the app 24-48 hours following your first use of the app. This reward will self destruct after that time span.",
"Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 2). Only up to 10 views per day count.": "Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 2). Only up to 10 views per day count.",
"Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 1).": "Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 1).",
"A small amount of Credits to get you started.": "A small amount of Credits to get you started.",
"Gain a following to earn this reward. 1 validated followers needed for level 1 (Current Score: 0). This amount may not match your total followers.": "Gain a following to earn this reward. 1 validated followers needed for level 1 (Current Score: 0). This amount may not match your total followers.",
"Some extra Credits for you and the person that brought you to us.": "Some extra Credits for you and the person that brought you to us.",
"Daily Watch Reward": "Daily Watch Reward",
"%SITE_NAME% view reward": "%SITE_NAME% view reward",
"You earned %lbc% for looking at neat stuff. ": "You earned %lbc% for looking at neat stuff. ",
"Earn a random reward of at least %lbc% for watching anything at all.": "Earn a random reward of at least %lbc% for watching anything at all.",
"You have already claimed this reward within the last 24 hours.": "You have already claimed this reward within the last 24 hours.",
@@ -1445,18 +1478,14 @@
"Welcome Back": "Welcome Back",
"You earned %lbc% for coming back.": "You earned %lbc% for coming back.",
"Email Verified": "Email Verified",
"A small amount of LBC to get you started.": "A small amount of LBC to get you started.",
"You earned %lbc% for adding your email.": "You earned %lbc% for adding your email.",
"Inviter Bonus": "Inviter Bonus",
"Some extra LBC for you and the person that brought you to us.": "Some extra LBC for you and the person that brought you to us.",
"You earned %lbc% reward for you and your friend.": "You earned %lbc% LBC reward for you and your friend.",
"You earned %lbc% reward for you and your friend.": "You earned %lbc% reward for you and your friend.",
"Odyseenaut": "Odyseenaut",
"Watch 10 things, like 5 things, and leave a comment on odysee.com.": "Watch 10 things, like 5 things, and leave a comment on odysee.com.",
"You earned %lbc% for trying out Odysee.": "You earned %lbc% for trying out Odysee.",
"Earn an upgrade reward with each LBRY update. Patches will not trigger a new reward.": "Earn an upgrade reward with each LBRY update. Patches will not trigger a new reward.",
"You earned %lbc% for upgrading to the latest release of LBRY.": "You earned %lbc% LBC for upgrading to the latest release of LBRY.",
"Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 1). Only up to 10 views per day count.": "Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 1). Only up to 10 views per day count.",
"Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 12).": "Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 12).",
"You earned %lbc% for upgrading to the latest release of LBRY.": "You earned %lbc% for upgrading to the latest release of LBRY.",
"Create A Channel": "Create A Channel",
"At least 10 views are required to earn the reward, consume more!": "At least 10 views are required to earn the reward, consume more!",
"Blocked %channel%": "Blocked %channel%",
@@ -1482,16 +1511,17 @@
"Favorite Five 🖐️": "Favorite Five 🖐️",
"When creators repost other creators, it makes a delicious shared audience fondue. Repost 5 of your favorite creators with the qualified channel.": "When creators repost other creators, it makes a delicious shared audience fondue. Repost 5 of your favorite creators with the qualified channel.",
"You earned %lbc% for reposting your favorite creators.": "You earned %lbc% for reposting your favorite creators.",
"\uD83C\uDF81 Treats are available": "\uD83C\uDF81 Treats are available",
"Claiming your daily reward is as easy as pressing this bell \uD83D\uDD14": "Claiming your daily reward is as easy as pressing this bell \uD83D\uDD14",
"Press ▶️ for \uD83C\uDF81": "Press ▶️ for \uD83C\uDF81",
"🎁 Treats are available": "🎁 Treats are available",
"Claiming your daily reward is as easy as pressing this bell 🔔": "Claiming your daily reward is as easy as pressing this bell 🔔",
"Press ▶️ for 🎁": "Press ▶️ for 🎁",
"Your daily watch reward is ready": "Your daily watch reward is ready",
"Subscribe and s̶̶a̶̶v̶̶e̶ Earn": "Subscribe and s̶̶a̶̶v̶̶e̶ Earn",
"Follow your first channel for a reward \uD83C\uDF81": "Follow your first channel for a reward \uD83C\uDF81",
"Follow your first channel for a reward 🎁": "Follow your first channel for a reward 🎁",
"Free LBC?": "Free LBC?",
"Free Credits?": "Free Credits?",
"You missed out on the daily view reward, sign up for our rewards program!": "You missed out on the daily view reward, sign up for our rewards program!",
"A Welcome \uD83C\uDF81": "A Welcome \uD83C\uDF81",
"Receive free credits for using LBRY": "Receive free credits for using LBRY",
"A Welcome 🎁": "A Welcome 🎁",
"Receive free Credits just for doing what you're already doing": "Receive free Credits just for doing what you're already doing",
"Watch more content to get to the next level.": "Watch more content to get to the next level.",
"Follow more channels to reach the next level.": "Follow more channels to reach the next level.",
"You need to improve the cool-aid (gain more followers) to get to the next level.": "You need to improve the cool-aid (gain more followers) to get to the next level.",
@@ -1553,7 +1583,10 @@
"Search only in this language by default": "Search only in this language by default",
"This link leads to an external website.": "This link leads to an external website.",
"No Content Found": "No Content Found",
"No Lists Found": "No Lists Found",
"No Reposts Found": "No Reposts Found",
"Publish Something": "Publish Something",
"Repost Something": "Repost Something",
"Watch on lbry.tv": "Watch on lbry.tv",
"Paid content cannot be embedded.": "Paid content cannot be embedded.",
"Please wait a bit, we are still getting your account ready.": "Please wait a bit, we are still getting your account ready.",
@@ -1638,8 +1671,9 @@
"%balance% available.": "%balance% available.",
"Unlock all tips": "Unlock all tips",
"Unlock All": "Unlock All",
"Obviously, You're Not A Golfer.": "Obviously, You're Not A Golfer.",
"just like the simulations": "just like the simulations",
"Moon cheese is an acquired taste": "Moon cheese is an acquired taste",
"Nothing found here. Like big tech ethics.": "Nothing found here. Like big tech ethics.",
"Level %current_level%": "Level %current_level%",
"Creator tools": "Creator tools",
"Prevent this channel from interacting with you.": "Prevent this channel from interacting with you.",
@@ -1677,8 +1711,9 @@
"Announcements, updates, and rewards specific to users of lbry.tv": "Announcements, updates, and rewards specific to users of lbry.tv",
"Receive emails about the latest rewards that are available to LBRY users.": "Receive emails about the latest rewards that are available to LBRY users.",
"Stay up to date on the latest content from your favorite creators.": "Stay up to date on the latest content from your favorite creators.",
"Receive tutorial emails related to LBRY": "Receive tutorial emails related to LBRY",
"Receive tutorial emails related to LBRY ": "Receive tutorial emails related to LBRY ",
"Create A LiveStream": "Create A LiveStream",
"%channel% has disabled chat for this stream. Enjoy the stream!": "%channel% has disabled chat for this stream. Enjoy the stream!",
"%channel% isn't live right now, but the chat is! Check back later to watch the stream.": "%channel% isn't live right now, but the chat is! Check back later to watch the stream.",
"Right now": "Right now",
"%viewer_count% currently watching": "%viewer_count% currently watching",
@@ -1690,11 +1725,232 @@
"Stream server": "Stream server",
"Stream key": "Stream key",
"Your livestream uploads": "Your livestream uploads",
"Your pending livestream uploads": "Your pending livestream uploads",
"No livestream publishes found": "No livestream publishes found",
"You need to upload your livestream details before you can go live.": "You need to upload your livestream details before you can go live.",
"Nothing here yet. %check_again%": "Nothing here yet. %check_again%",
"Check again": "Check again",
"Check again...": "Check again...",
"You need to upload your livestream details before you can go live. If you already created one in this channel, it should appear soon.": "You need to upload your livestream details before you can go live. If you already created one in this channel, it should appear soon.",
"Create A Livestream": "Create A Livestream",
"Create a Livestream by first submitting your Livestream details and waiting for approval confirmation.": "Create a Livestream by first submitting your Livestream details and waiting for approval confirmation.",
"The livestream will not be visible on your channel until you are live, but you can share the URL in advance.": "The livestream will not be visible on your channel until you are live, but you can share the URL in advance.",
"Once the your livestream is confirmed, configure your streaming software (OBS, Restream, etc) and input the server URL along with the stream key in it.": "Once the your livestream is confirmed, configure your streaming software (OBS, Restream, etc) and input the server URL along with the stream key in it.",
"To ensure the best streaming experience with OBS, open settings -> output": "To ensure the best streaming experience with OBS, open settings -> output",
"Select advanced mode from the dropdown at the top.": "Select advanced mode from the dropdown at the top.",
"Ensure the following settings are selected under the streaming tab:": "Ensure the following settings are selected under the streaming tab:",
"Bitrate: 1000 to 2500 kbps": "Bitrate: 1000 to 2500 kbps",
"Keyframes: 1": "Keyframes: 1",
"Profile: High": "Profile: High",
"Tune: Zerolatency": "Tune: Zerolatency",
"If using other livestreaming software, make sure the bitrate is below 5000 kbps or the stream will not work.": "If using other livestreaming software, make sure the bitrate is below 5000 kbps or the stream will not work.",
"Please note: You'll need to record your own stream through your software if you plan to share it afterward. You can also delete it if you prefer not to upload the copy.": "Please note: You'll need to record your own stream through your software if you plan to share it afterward. You can also delete it if you prefer not to upload the copy.",
"In the near future, this manual step will be removed and you will be able to share the stream right after its finished without needing to record it yourself.": "In the near future, this manual step will be removed and you will be able to share the stream right after its finished without needing to record it yourself.",
"After your livestream:\nClick the Publish Replay button. This will allow you to edit details before sharing on Odysee. Be sure to select the saved mp4 file you recorded.": "After your livestream:\nClick the Publish Replay button. This will allow you to edit details before sharing on Odysee. Be sure to select the saved mp4 file you recorded.",
"Click Save and you are done!": "Click Save and you are done!",
"How does this work?": "How does this work?",
"Update your livestream": "Update your livestream",
"Prepare an upcoming livestream": "Prepare an upcoming livestream",
"Edit your post": "Edit your post",
"Update your video": "Update your video",
"Go Live on Odysee": "Go Live on Odysee",
"You're invited to try out our new livestreaming service while in beta!": "You're invited to try out our new livestreaming service while in beta!",
"lbry.tv is being retired in favor of %odysee% and new sign ups are disabled. Sign up on %odysee% instead": "lbry.tv is being retired in favor of %odysee% and new sign ups are disabled. Sign up on %odysee% instead",
"lbry.tv is being retired in favor of %odysee%": "lbry.tv is being retired in favor of %odysee%",
"You will have to switch to the %desktop_app% or %odysee% in the near future. Your existing login details will work on %odysee% and all of your %credits% and other settings will be there.": "You will have to switch to the %desktop_app% or %odysee% in the near future. Your existing login details will work on %odysee% and all of your %credits% and other settings will be there.",
"Swap": "Swap",
"Swap Crypto": "Swap Crypto",
"Enter desired %lbc%": "Enter desired %lbc%",
"Estimated BTC price": "Estimated BTC price",
"Start Swap": "Start Swap",
"To": "To",
"Receiving": "Receiving",
"Send crypto to the address provided and you will be sent an equivalent amount of Credits. You can pay with BCH, LTC, ETH, USDC or DAI after starting the swap.": "Send crypto to the address provided and you will be sent an equivalent amount of Credits. You can pay with BCH, LTC, ETH, USDC or DAI after starting the swap.",
"Swap Crypto for %lbc%": "Swap Crypto for %lbc%",
"Processing...": "Processing...",
"View Past Swaps": "View Past Swaps",
"Remove swap": "Remove swap",
"Waiting": "Waiting",
"Waiting to receive your crypto.": "Waiting to receive your crypto.",
"Confirming transaction.": "Confirming transaction.",
"Sending Credits": "Sending Credits",
"Crypto received. Sending your Credits.": "Crypto received. Sending your Credits.",
"Completed": "Completed",
"Credits sent. You should see it in your wallet.": "Credits sent. You should see it in your wallet.",
"Expired": "Expired",
"Swap expired.": "Swap expired.",
"Failed": "Failed",
"An error occurred on the previous swap.": "An error occurred on the previous swap.",
"Alternative coins": "Alternative coins",
"Failed to initiate swap.": "Failed to initiate swap.",
"Failed to query swap status.": "Failed to query swap status.",
"The system is currently down. Come back later.": "The system is currently down. Come back later.",
"Unable to obtain exchange rate. Try again later.": "Unable to obtain exchange rate. Try again later.",
"The amount needs to be higher": "The amount needs to be higher",
"The amount is too high": "The amount is too high",
"Confirm Swap Removal": "Confirm Swap Removal",
"Remove Swap": "Remove Swap",
"Remove %address%?": "Remove %address%?",
"This process cannot be reversed.": "This process cannot be reversed.",
"View transaction": "View transaction",
"Use the copy button to ensure the EXACT amount is sent!": "Use the copy button to ensure the EXACT amount is sent!",
"Amount copied.": "Amount copied.",
"Copy transaction ID": "Copy transaction ID",
"Transaction ID copied.": "Transaction ID copied.",
"This page can be closed while the transactions are in progress.\nYou can view the status later from:\n • Wallet » Swap » View Past Swaps": "This page can be closed while the transactions are in progress.\nYou can view the status later from:\n • Wallet » Swap » View Past Swaps",
"Credits sent": "Credits sent",
"Unresolved": "Unresolved",
"Received amount did not match order code %chargeCode%. Contact hello@lbry.com to resolve the payment.": "Received amount did not match order code %chargeCode%. Contact hello@lbry.com to resolve the payment.",
"Users are currently limited to 4 completed swaps per month or 5 pending swaps.": "Users are currently limited to 4 completed swaps per month or 5 pending swaps.",
"publish": "publish",
"Sexual content": "Sexual content",
"Violent or repulsive content": "Violent or repulsive content",
"Hateful or abusive content": "Hateful or abusive content",
"Harmful or dangerous acts": "Harmful or dangerous acts",
"Child abuse": "Child abuse",
"Promotes terrorism": "Promotes terrorism",
"Spam or misleading": "Spam or misleading",
"Infringes my rights": "Infringes my rights",
"Next": "Next",
"Graphic sexual activity": "Graphic sexual activity",
"Nudity": "Nudity",
"Suggestive, but without nudity": "Suggestive, but without nudity",
"Content involving minors": "Content involving minors",
"Sexual Abusive title or description": "Sexual Abusive title or description",
"Other sexual content": "Other sexual content",
"Timestamp": "Timestamp",
"Provide additional details": "Provide additional details",
"e.g. John Doe": "e.g. John Doe",
"e.g. john@example.com": "e.g. john@example.com",
"e.g. satoshi@example.com": "e.g. satoshi@example.com",
"Your channel": "Your channel",
"Set to \"Anonymous\" if you do not want to associate your channel in this report.": "Set to \"Anonymous\" if you do not want to associate your channel in this report.",
"Send report?": "Send report?",
"Send Report": "Send Report",
"Contact details": "Contact details",
"Report submitted": "Report submitted",
"We will review and respond shortly.": "We will review and respond shortly.",
"Adults fighting": "Adults fighting",
"Physical attack": "Physical attack",
"Youth violence": "Youth violence",
"Animal abuse": "Animal abuse",
"Promotes hatred or violence": "Promotes hatred or violence",
"Bullying": "Bullying",
"Hateful Abusive title or description": "Hateful Abusive title or description",
"Pharmaceutical or drug abuse": "Pharmaceutical or drug abuse",
"Abuse of fire or explosives": "Abuse of fire or explosives",
"Suicide or self injury": "Suicide or self injury",
"Other dangerous acts": "Other dangerous acts",
"Mass advertising": "Mass advertising",
"Pharmaceutical drugs for sale": "Pharmaceutical drugs for sale",
"Misleading text": "Misleading text",
"Misleading thumbnail": "Misleading thumbnail",
"Scams or fraud": "Scams or fraud",
"Copyright issue": "Copyright issue",
"Other legal issue": "Other legal issue",
"Affected party": "Affected party",
"Myself": "Myself",
"My company, organization, or client": "My company, organization, or client",
"Copyright owner name": "Copyright owner name",
"Relationship to copyrighted content": "Relationship to copyrighted content",
"(between 10 to 500 characters)": "(between 10 to 500 characters)",
"Remove now": "Remove now",
"Additional email (optional)": "Additional email (optional)",
"Phone number": "Phone number",
"Address": "Address",
"City": "City",
"State/province": "State/province",
"Zip code": "Zip code",
"Signature": "Signature",
"Your name": "Your name",
"Acting on behalf of": "Acting on behalf of",
"Self": "Self",
"Client": "Client",
"Title of specific law": "Title of specific law",
"Specific law": "Specific law",
"Law URL": "Law URL",
"Clarification": "Clarification",
"Client name": "Client name",
"Creator settings": "Creator settings",
"Muted words": "Muted words",
"Add words": "Add words",
"Suggestions": "Suggestions",
"Add words to block": "Add words to block",
"Enable comments for channel.": "Enable comments for channel.",
"Minimum time gap in seconds for Slow Mode in livestream chat.": "Minimum time gap in seconds for Slow Mode in livestream chat.",
"Minimum %lbc% tip amount for comments": "Minimum %lbc% tip amount for comments",
"Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.",
"Minimum %lbc% tip amount for hyperchats": "Minimum %lbc% tip amount for hyperchats",
"Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.": "Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.",
"Settings unavailable for this channel": "Settings unavailable for this channel",
"This channel isn't staking enough LBRY Credits to enable Creator Settings.": "This channel isn't staking enough LBRY Credits to enable Creator Settings.",
"We apologize for this inconvenience, but have added this additional step to prevent abuse. Users on VPN or shared connections will continue to see this message and are not eligible for Rewards.": "We apologize for this inconvenience, but have added this additional step to prevent abuse. Users on VPN or shared connections will continue to see this message and are not eligible for Rewards.",
"Help LBRY Save Crypto": "Help LBRY Save Crypto",
"The US government is attempting to destroy the cryptocurrency industry. Can you help?": "The US government is attempting to destroy the cryptocurrency industry. Can you help?",
"Learn more and sign petition": "Learn more and sign petition",
"View claim details": "View claim details",
"Publishing...": "Publishing...",
"Collection": "Collection",
"Enter a name, @username or URL": "Enter a name, @username or URL:",
"Recipient search": "Recipient search",
"Fetch transaction data for export": "Fetch transaction data for export",
"Fetching data": "Fetching data",
"Download fetched file": "Download fetched file",
"No data to export": "No data to export",
"Failed to process fetched data.": "Failed to process fetched data.",
"More from %claim_name%": "More from %claim_name%",
"Update your video/audio": "Update your video/audio",
"Upload that unlabeled video you found behind the TV in 1991": "Upload that unlabeled video you found behind the TV in 1991",
"Upload that unlabeled video or cassette you found behind the TV in 1991": "Upload that unlabeled video or cassette you found behind the TV in 1991",
"Select Replay": "Select Replay",
"Craft an epic post clearly explaining... whatever.": "Craft an epic post clearly explaining... whatever.",
"%viewer_count% currently %viewer_state%": "%viewer_count% currently %viewer_state%",
"watching": "watching",
"waiting": "waiting",
"Choose Replay": "Choose Replay",
"Choose a replay file, or select None": "Choose a replay file, or select None",
"No replays found.": "No replays found.",
"Replay video available": "Replay video available",
"Check for Replays:": "Check for Replays",
"You can upload your own recording or select a replay when your stream is over": "You can upload your own recording or select a replay when your stream is over",
"This channel isn't staking enough LBRY Credits for inline image previews.": "This channel isn't staking enough LBRY Credits for inline image previews.",
"Latest": "Latest",
"Channel Not Found": "Channel Not Found",
"Probably because you didn't make it.": "Probably because you didn't make it.",
"Release date": "Release date",
"Set custom release date": "Set custom release date",
"Now": "Now",
"Set to current date and time": "Set to current date and time",
"Remove custom release date": "Remove custom release date",
"%SITE_NAME% login": "%SITE_NAME% login",
"Lists": "Lists",
"Watch Later": "Watch Later",
"Add to Lists": "Add to Lists",
"Nothing in %collection_name%": "Nothing in %collection_name%",
"Playlists": "Playlists",
"Edit List": "Edit List",
"Delete List": "Delete List",
"Private": "Private",
"View List": "View List",
"Delete Collection": "Delete Collection",
"Info": "Info",
"Publishes": "Publishes",
"Add To...": "Add To...",
"Unpublished Edits": "Unpublished Edits",
"Report channel": "Report channel",
"List": "List",
"Items": "Items",
"Credits": "Credits",
"MyAwesomeCollection": "MyAwesomeCollection",
"My Awesome Collection": "My Awesome Collection",
"This collection has no items.": "This collection has no items.",
"Select File": "Select File",
"File Selected": "File Selected",
"Url": "Url",
"URL Selected": "URL Selected",
"Keep": "Keep",
"Add this claim to a list": "Add this claim to a list",
"List is Empty": "List is Empty",
"Confirm Collection Unpublish": "Confirm Collection Unpublish",
"This will permanently delete the list.": "This will permanently delete the list.",
"--end--": "--end--"
}
+6 -19
View File
@@ -37,7 +37,6 @@ type Analytics = {
tagFollowEvent: (string, boolean, ?string) => void,
playerLoadedEvent: (?boolean) => void,
playerStartedEvent: (?boolean) => void,
videoFetchDuration: (string, number) => void,
videoStartEvent: (string, number) => void,
adsFetchedEvent: () => void,
adsReceivedEvent: (any) => void,
@@ -197,18 +196,6 @@ const analytics: Analytics = {
}
},
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);
@@ -241,12 +228,6 @@ const analytics: Analytics = {
});
}
},
playerLoadedEvent: (embedded) => {
sendMatomoEvent('Player', 'Loaded', embedded ? 'embedded' : 'onsite');
},
playerStartedEvent: (embedded) => {
sendMatomoEvent('Player', 'Started', embedded ? 'embedded' : 'onsite');
},
adsFetchedEvent: () => {
sendMatomoEvent('Media', 'AdsFetched');
},
@@ -256,6 +237,12 @@ 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);
},
+13 -1
View File
@@ -10,6 +10,13 @@ const Comments = {
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),
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),
super_list: (params: SuperListParams) => fetchCommentsApi('comment.SuperChatList', params),
};
function fetchCommentsApi(method: string, params: {}) {
@@ -33,7 +40,12 @@ function fetchCommentsApi(method: string, params: {}) {
return fetch(url, options)
.then((res) => res.json())
.then((res) => res.result);
.then((res) => {
if (res.error) {
throw new Error(res.error.message);
}
return res.result;
});
}
export default Comments;
+1 -1
View File
@@ -30,6 +30,6 @@ export default function I18nMessage(props: Props) {
return (
// style={{height: iframeHeight}}
// ref={iframeRef}
<iframe src={src} title={title} onLoad={onLoad} />
<iframe src={src} title={title} onLoad={onLoad} sandbox={!IS_WEB} />
);
}
@@ -5,6 +5,7 @@ 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,
@@ -30,6 +31,7 @@ function AbandonedChannelPreview(props: Props) {
<div className="section__actions">
<ChannelBlockButton uri={uri} />
<ChannelMuteButton uri={uri} />
<SubscribeButton uri={uri} />
</div>
</div>
</div>
+2 -1
View File
@@ -5,7 +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, selectMyChannelUrls, SETTINGS } from 'lbry-redux';
import { doFetchChannelListMine, doFetchCollectionListMine, SETTINGS, selectMyChannelUrls } from 'lbry-redux';
import {
makeSelectClientSetting,
selectLanguage,
@@ -52,6 +52,7 @@ const select = (state) => ({
const perform = (dispatch) => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
setLanguage: (language) => dispatch(doSetLanguage(language)),
signIn: () => dispatch(doSignIn()),
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
+7 -3
View File
@@ -4,6 +4,7 @@ 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';
@@ -60,6 +61,7 @@ type Props = {
},
fetchAccessToken: () => void,
fetchChannelListMine: () => void,
fetchCollectionListMine: () => void,
signIn: () => void,
requestDownloadUpgrade: () => void,
onSignedIn: () => void,
@@ -93,6 +95,7 @@ function App(props: Props) {
user,
fetchAccessToken,
fetchChannelListMine,
fetchCollectionListMine,
signIn,
autoUpdateDownloaded,
isUpgradeAvailable,
@@ -232,8 +235,9 @@ function App(props: Props) {
// @if TARGET='app'
fetchChannelListMine(); // This is fetched after a user is signed in on web
fetchCollectionListMine();
// @endif
}, [appRef, fetchAccessToken, fetchChannelListMine]);
}, [appRef, fetchAccessToken, fetchChannelListMine, fetchCollectionListMine]);
useEffect(() => {
// $FlowFixMe
@@ -399,12 +403,12 @@ function App(props: Props) {
{/* @if TARGET='web' */}
<YoutubeWelcome />
{false && !shouldHideNag && <OpenInAppLink uri={uri} />}
{!SIMPLE_SITE && !shouldHideNag && <OpenInAppLink uri={uri} />}
{!shouldHideNag && <NagContinueFirstRun />}
{(lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) && !shouldHideNag && (
<NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />
)}
{false && lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (
{!SIMPLE_SITE && lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (
<NagDataCollection onClose={handleAnalyticsDismiss} />
)}
{/* @endif */}
+16 -3
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri, SETTINGS } from 'lbry-redux';
import { makeSelectClaimForUri, SETTINGS, COLLECTIONS_CONSTS, makeSelectNextUrlForCollectionAndUrl } from 'lbry-redux';
import { withRouter } from 'react-router';
import { makeSelectIsPlayerFloating, makeSelectNextUnplayedRecommended } from 'redux/selectors/content';
import { makeSelectClientSetting } from 'redux/selectors/settings';
@@ -8,11 +8,24 @@ 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
AutoplayCountdown does not fetch it's own next content to play, it relies on <RecommendedContent> being rendered.
This is dumb but I'm just the guy who noticed -kj
*/
const select = (state, props) => {
const nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
const { location } = props;
const { search } = location;
const urlParams = new URLSearchParams(search);
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
let nextRecommendedUri;
if (collectionId) {
nextRecommendedUri = makeSelectNextUrlForCollectionAndUrl(collectionId, props.uri)(state);
} else {
nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
}
return {
collectionId,
nextRecommendedUri,
nextRecommendedClaim: makeSelectClaimForUri(nextRecommendedUri)(state),
isFloating: makeSelectIsPlayerFloating(props.location)(state),
+11 -4
View File
@@ -6,18 +6,19 @@ import I18nMessage from 'component/i18nMessage';
import { formatLbryUrlForWeb } from 'util/url';
import { withRouter } from 'react-router';
import debounce from 'util/debounce';
import { COLLECTIONS_CONSTS } from 'lbry-redux';
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,
doPlayUri: (string) => void,
modal: { id: string, modalProps: {} },
collectionId?: string,
};
function AutoplayCountdown(props: Props) {
@@ -29,6 +30,7 @@ function AutoplayCountdown(props: Props) {
isFloating,
history: { push },
modal,
collectionId,
} = props;
const nextTitle = nextRecommendedClaim && nextRecommendedClaim.value && nextRecommendedClaim.value.title;
@@ -44,6 +46,11 @@ function AutoplayCountdown(props: Props) {
let navigateUrl;
if (nextTitle) {
navigateUrl = formatLbryUrlForWeb(nextRecommendedUri);
if (collectionId) {
const collectionParams = new URLSearchParams();
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
navigateUrl = navigateUrl + `?` + collectionParams.toString();
}
}
const doNavigate = useCallback(() => {
@@ -71,7 +78,7 @@ function AutoplayCountdown(props: Props) {
// Ensure correct 'setTimerPaused' on initial render.
setTimerPaused(shouldPauseAutoplay());
const handleScroll = debounce(e => {
const handleScroll = debounce((e) => {
setTimerPaused(shouldPauseAutoplay());
}, DEBOUNCE_SCROLL_HANDLER_MS);
+1 -2
View File
@@ -1,10 +1,9 @@
import { connect } from 'react-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri, makeSelectStakedLevelForChannelUri } from 'lbry-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri } 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),
+2 -3
View File
@@ -17,7 +17,6 @@ type Props = {
email: ?string,
website: ?string,
languages: Array<string>,
stakedLevel?: number,
};
const formatEmail = (email: string) => {
@@ -30,7 +29,7 @@ const formatEmail = (email: string) => {
};
function ChannelAbout(props: Props) {
const { claim, uri, description, email, website, languages, stakedLevel } = props;
const { claim, uri, description, email, website, languages } = props;
const claimId = claim && claim.claim_id;
return (
@@ -41,7 +40,7 @@ function ChannelAbout(props: Props) {
<>
<label>{__('Description')}</label>
<div className="media__info-text media__info-text--constrained">
<MarkdownPreview content={description} stakedLevel={stakedLevel} />
<MarkdownPreview content={description} />
</div>
</>
)}
+6 -6
View File
@@ -6,8 +6,8 @@ type Props = {
uri: string,
isBlocked: boolean,
isBlockingOrUnBlocking: boolean,
doCommentModUnBlock: (string) => void,
doCommentModBlock: (string) => void,
doCommentModUnBlock: (string, boolean) => void,
doCommentModBlock: (string, boolean) => void,
};
function ChannelBlockButton(props: Props) {
@@ -15,9 +15,9 @@ function ChannelBlockButton(props: Props) {
function handleClick() {
if (isBlocked) {
doCommentModUnBlock(uri);
doCommentModUnBlock(uri, false);
} else {
doCommentModBlock(uri);
doCommentModBlock(uri, false);
}
}
@@ -30,8 +30,8 @@ function ChannelBlockButton(props: Props) {
? __('Unblocking...')
: __('Unblock')
: isBlockingOrUnBlocking
? __('Blocking...')
: __('Block')
? __('Blocking...')
: __('Block')
}
onClick={handleClick}
/>
+30 -21
View File
@@ -26,12 +26,14 @@ 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) {
@@ -49,6 +51,8 @@ function ChannelContent(props: Props) {
tileLayout,
viewHiddenChannels,
doResolveUris,
claimType,
empty,
} = props;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
const [searchQuery, setSearchQuery] = React.useState('');
@@ -58,6 +62,7 @@ function ChannelContent(props: Props) {
} = useHistory();
const url = `${pathname}${search}`;
const claimId = claim && claim.claim_id;
const showFilters = !claimType || claimType === 'stream';
function handleInputChange(e) {
const { value } = e.target;
@@ -130,21 +135,24 @@ function ChannelContent(props: Props) {
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
{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={
<ClaimListDiscover
hideLivestreamClaims
showHiddenByUser={viewHiddenChannels}
forceShowReposts
hideFilters={!showFilters}
hideAdvancedFilter={!showFilters}
tileLayout={tileLayout}
uris={searchResults}
streamType={CS.CONTENT_ALL}
channelIds={[claim.claim_id]}
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 && (
<Form onSubmit={() => {}} className="wunderbar--inline">
<Icon icon={ICONS.SEARCH} />
<FormField
@@ -155,11 +163,12 @@ function ChannelContent(props: Props) {
placeholder={__('Search')}
/>
</Form>
}
/>
) : (
<section className="main--empty">{__("This channel hasn't published anything yet")}</section>
)}
)
}
isChannel
channelIsMine={channelIsMine}
empty={empty}
/>
</Fragment>
);
}
+10 -10
View File
@@ -21,6 +21,7 @@ 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';
const LANG_NONE = 'none';
@@ -361,6 +362,7 @@ function ChannelForm(props: Props) {
<TagsSearch
suggestMature={!SIMPLE_SITE}
disableAutoFocus
disableControlTags
limitSelect={MAX_TAG_SELECT}
tagsPassedIn={params.tags || []}
label={__('Selected Tags')}
@@ -415,9 +417,9 @@ function ChannelForm(props: Props) {
<option key={'pri-langNone'} value={LANG_NONE}>
{__('None selected')}
</option>
{Object.keys(SUPPORTED_LANGUAGES).map((language) => (
<option key={language} value={language}>
{SUPPORTED_LANGUAGES[language]}
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
<option key={langKey} value={langKey}>
{langName}
</option>
))}
</FormField>
@@ -433,13 +435,11 @@ function ChannelForm(props: Props) {
<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>
))}
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
<option key={langKey} value={langKey} disabled={langKey === languageParam[0]}>
{langName}
</option>
))}
</FormField>
</>
}
+3 -2
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { doToggleMuteChannel } from 'redux/actions/blocked';
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import ChannelMuteButton from './view';
@@ -8,5 +8,6 @@ const select = (state, props) => ({
});
export default connect(select, {
doToggleMuteChannel,
doChannelMute,
doChannelUnmute,
})(ChannelMuteButton);
+12 -3
View File
@@ -6,17 +6,26 @@ type Props = {
uri: string,
isMuted: boolean,
channelClaim: ?ChannelClaim,
doToggleMuteChannel: (string) => void,
doChannelMute: (string, boolean) => void,
doChannelUnmute: (string, boolean) => void,
};
function ChannelBlockButton(props: Props) {
const { uri, doToggleMuteChannel, isMuted } = props;
const { uri, doChannelMute, doChannelUnmute, isMuted } = props;
function handleClick() {
if (isMuted) {
doChannelUnmute(uri, false);
} else {
doChannelMute(uri, false);
}
}
return (
<Button
button={isMuted ? 'alt' : 'secondary'}
label={isMuted ? __('Unmute') : __('Mute')}
onClick={() => doToggleMuteChannel(uri)}
onClick={handleClick}
/>
);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

+27 -3
View File
@@ -3,8 +3,11 @@ import React from 'react';
import { parseURI } from 'lbry-redux';
import classnames from 'classnames';
import Spaceman from './spaceman.png';
import Transparent from './transparent_1x1.png';
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
import ChannelStakedIndicator from 'component/channelStakedIndicator';
import { getThumbnailCdnUrl } from 'util/thumbnail';
import useLazyLoading from 'effects/use-lazy-loading';
type Props = {
thumbnail: ?string,
@@ -19,6 +22,8 @@ type Props = {
isResolving: boolean,
showDelayedMessage?: boolean,
hideStakedIndicator?: boolean,
xsmall?: boolean,
noOptimization?: boolean,
};
function ChannelThumbnail(props: Props) {
@@ -29,19 +34,23 @@ function ChannelThumbnail(props: Props) {
thumbnailPreview: rawThumbnailPreview,
obscure,
small = false,
xsmall = false,
allowGifs = false,
claim,
doResolveUri,
isResolving,
showDelayedMessage = false,
hideStakedIndicator = false,
noOptimization,
} = props;
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 channelThumbnail = thumbnail || thumbnailPreview;
const isGif = channelThumbnail && channelThumbnail.endsWith('gif');
const showThumb = (!obscure && !!thumbnail) || thumbnailPreview;
const thumbnailRef = React.useRef(null);
// Generate a random color class based on the first letter of the channel name
const { channelName } = parseURI(uri);
let initializer;
@@ -59,7 +68,9 @@ function ChannelThumbnail(props: Props) {
}
}, [doResolveUri, shouldResolve, uri]);
if (channelThumbnail && channelThumbnail.endsWith('gif') && !allowGifs) {
useLazyLoading(thumbnailRef, 0.25, [showThumb, thumbError, channelThumbnail]);
if (isGif && !allowGifs) {
return (
<FreezeframeWrapper src={channelThumbnail} className={classnames('channel-thumbnail', className)}>
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
@@ -67,19 +78,30 @@ function ChannelThumbnail(props: Props) {
);
}
let url = channelThumbnail;
// @if TARGET='web'
// Pass image urls through a compression proxy, except for GIFs.
if (thumbnail && !noOptimization && !(isGif && allowGifs)) {
url = getThumbnailCdnUrl({ thumbnail });
}
// @endif
return (
<div
className={classnames('channel-thumbnail', className, {
[colorClassName]: !showThumb,
'channel-thumbnail--small': small,
'channel-thumbnail--xsmall': xsmall,
'channel-thumbnail--resolving': isResolving,
})}
>
{!showThumb && (
<img
ref={thumbnailRef}
alt={__('Channel profile picture')}
className="channel-thumbnail__default"
src={!thumbError && thumbnailPreview ? thumbnailPreview : Spaceman}
data-src={!thumbError && url ? url : Spaceman}
src={Transparent}
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
/>
)}
@@ -89,9 +111,11 @@ function ChannelThumbnail(props: Props) {
<div className="chanel-thumbnail--waiting">{__('This will be visible in a few minutes.')}</div>
) : (
<img
ref={thumbnailRef}
alt={__('Channel profile picture')}
className="channel-thumbnail__custom"
src={!thumbError ? thumbnailPreview || thumbnail : Spaceman}
data-src={!thumbError && url ? url : Spaceman}
src={Transparent}
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
/>
)}
+12 -3
View File
@@ -6,13 +6,22 @@ import Button from 'component/button';
type Props = {
doOpenModal: (string, {}) => void,
claim: StreamClaim,
abandonActionCallback: any => void,
claim: Claim,
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 });
@@ -21,7 +30,7 @@ export default function ClaimAbandonButton(props: Props) {
return (
<Button
disabled={!claim}
label={__('Delete Channel')}
label={buttonLabel}
button="alt"
iconColor="red"
icon={ICONS.DELETE}
@@ -1,9 +1,9 @@
import { connect } from 'react-redux';
import { makeSelectChannelForClaimUri } from 'lbry-redux';
import FileAuthor from './view';
import ClaimAuthor from './view';
const select = (state, props) => ({
channelUri: makeSelectChannelForClaimUri(props.uri)(state),
});
export default connect(select)(FileAuthor);
export default connect(select)(ClaimAuthor);
@@ -7,7 +7,7 @@ type Props = {
hideActions?: boolean,
};
function FileAuthor(props: Props) {
function ClaimAuthor(props: Props) {
const { channelUri, hideActions } = props;
return channelUri ? (
@@ -17,4 +17,4 @@ function FileAuthor(props: Props) {
);
}
export default FileAuthor;
export default ClaimAuthor;
+23
View File
@@ -0,0 +1,23 @@
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));
+148
View File
@@ -0,0 +1,148 @@
// @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 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<*>) {
const KEYCODE_ENTER = 13;
if (e.keyCode === KEYCODE_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;
@@ -0,0 +1,12 @@
import { connect } from 'react-redux';
import { doOpenModal } from 'redux/actions/app';
import PlaylistAddButton from './view';
import { makeSelectClaimForUri } from 'lbry-redux';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
});
export default connect(select, {
doOpenModal,
})(PlaylistAddButton);
@@ -0,0 +1,40 @@
// @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,
};
export default function CollectionAddButton(props: Props) {
const { doOpenModal, uri, fileAction, type = 'playlist', claim } = 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 ? ICONS.ADD : ICONS.LIBRARY}
iconSize={fileAction ? 22 : undefined}
label={uri ? __('Save') : 'New List'}
requiresAuth={IS_WEB}
title={__('Add this claim to a list')}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
doOpenModal(MODALS.COLLECTION_ADD, { uri, type });
}}
/>
);
}
+24 -4
View File
@@ -5,6 +5,7 @@ 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,
@@ -12,7 +13,7 @@ type Props = {
children: React.Node,
description: ?string,
isResolvingUri: boolean,
doResolveUri: string => void,
doResolveUri: (string) => void,
blackListedOutpoints: Array<{
txid: string,
nout: number,
@@ -20,6 +21,7 @@ type Props = {
playingUri: ?PlayingUri,
parentCommentId?: string,
isMarkdownPost?: boolean,
allowPreview: boolean,
};
class ClaimLink extends React.Component<Props> {
@@ -29,6 +31,7 @@ class ClaimLink extends React.Component<Props> {
thumbnail: null,
description: null,
isResolvingUri: false,
allowPreview: false,
};
componentDidMount() {
@@ -46,7 +49,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)
);
@@ -63,7 +66,16 @@ class ClaimLink extends React.Component<Props> {
};
render() {
const { uri, claim, children, isResolvingUri, playingUri, parentCommentId, isMarkdownPost } = this.props;
const {
uri,
claim,
children,
isResolvingUri,
playingUri,
parentCommentId,
isMarkdownPost,
allowPreview,
} = this.props;
const isUnresolved = (!isResolvingUri && !claim) || !claim;
const isBlacklisted = this.isClaimBlackListed();
const isPlayingInline =
@@ -81,7 +93,7 @@ class ClaimLink extends React.Component<Props> {
return isChannel ? (
<UriIndicator uri={uri} link />
) : (
) : allowPreview ? (
<div className={classnames('claim-link')}>
<div
className={classnames({
@@ -92,6 +104,14 @@ 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}
/>
);
}
}
+4 -4
View File
@@ -1,12 +1,12 @@
import { connect } from 'react-redux';
import ClaimList from './view';
import { SETTINGS } from 'lbry-redux';
import { SETTINGS, selectClaimSearchByQuery, selectClaimsByUri } 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),
});
const perform = (dispatch) => ({});
export default connect(select, perform)(ClaimList);
export default connect(select)(ClaimList);
+53 -24
View File
@@ -9,6 +9,7 @@ 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';
@@ -30,14 +31,20 @@ type Props = {
persistedStorageKey?: string,
showHiddenByUser: boolean,
showUnresolvedClaims?: boolean,
renderProperties: ?(Claim) => Node,
renderActions?: (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,
hideLivestreamClaims?: boolean,
};
@@ -56,25 +63,44 @@ 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,
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);
}
@@ -103,11 +129,14 @@ export default function ClaimList(props: Props) {
return tileLayout && !header ? (
<section className="claim-grid">
{urisLength > 0 &&
uris.map((uri) => (
uris.map((uri, index) => (
<ClaimPreviewTile
key={uri}
uri={uri}
showHiddenByUser={showHiddenByUser}
properties={renderProperties}
live={resolveLive(index)}
collectionId={collectionId}
hideLivestreamClaims={hideLivestreamClaims}
/>
))}
@@ -126,21 +155,23 @@ export default function ClaimList(props: Props) {
<div className={classnames('claim-list__header', { 'section__title--small': type === 'small' })}>
{header}
{loading && <Spinner type="small" />}
<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>
{(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>
)}
</React.Fragment>
@@ -166,17 +197,15 @@ export default function ClaimList(props: Props) {
renderActions={renderActions}
showUserBlocked={showHiddenByUser}
showHiddenByUser={showHiddenByUser}
collectionId={collectionId}
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
if (claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch') {
return true;
} else {
return false;
}
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
}}
live={resolveLive(index)}
/>
</React.Fragment>
))}
+45 -14
View File
@@ -14,16 +14,19 @@ 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>,
showHeader: boolean,
type: string,
subscribedChannels: Array<Subscription>,
doClaimSearch: ({}) => void,
loading: boolean,
personalView: boolean,
doToggleTagFollowDesktop: (string) => void,
meta?: Node,
// showNsfw: boolean,
showNsfw: boolean,
hideReposts: boolean,
history: { action: string, push: (string) => void, replace: (string) => void },
location: { search: string, pathname: string },
@@ -66,22 +69,29 @@ type Props = {
searchInLanguage: boolean,
scrollAnchor?: string,
showHiddenByUser?: boolean,
liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any },
hasSource?: boolean,
limitClaimsPerChannel?: number,
releaseTime?: string,
hideLivestreamClaims?: boolean,
isChannel?: boolean,
empty?: string,
};
function ClaimListDiscover(props: Props) {
const {
doClaimSearch,
claimSearchByQuery,
showHeader = true,
type,
claimSearchByQueryLastPageReached,
tags,
defaultTags,
loading,
meta,
channelIds,
// showNsfw,
showNsfw,
hideReposts,
history,
location,
@@ -120,7 +130,12 @@ function ClaimListDiscover(props: Props) {
releaseTime,
scrollAnchor,
showHiddenByUser = false,
liveLivestreamsFirst,
livestreamMap,
hasSource,
isChannel = false,
hideLivestreamClaims,
empty,
} = props;
const didNavigateForward = history.action === 'PUSH';
const { search } = location;
@@ -197,7 +212,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>,
@@ -217,10 +232,8 @@ function ClaimListDiscover(props: Props) {
// 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:
// If channelIdsParam were passed in, we don't need not_channel_ids
!channelIdsParam ? mutedAndBlockedChannelIds : [],
not_tags: MATURE_TAGS,
not_channel_ids: isChannel ? undefined : mutedAndBlockedChannelIds,
not_tags: !showNsfw ? MATURE_TAGS : [],
order_by:
orderParam === CS.ORDER_BY_TRENDING
? CS.ORDER_BY_TRENDING_VALUE
@@ -229,7 +242,7 @@ function ClaimListDiscover(props: Props) {
: CS.ORDER_BY_TOP_VALUE, // Sort by top
};
if (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === CS.CLAIM_STREAM)) {
if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === CS.CLAIM_STREAM))) {
options.has_source = true;
}
@@ -266,6 +279,7 @@ function ClaimListDiscover(props: Props) {
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) {
@@ -471,6 +485,10 @@ function ClaimListDiscover(props: Props) {
if (shouldPerformSearch) {
const searchOptions = JSON.parse(optionsStringForEffect);
doClaimSearch(searchOptions);
if (liveLivestreamsFirst && options.page === 1) {
doClaimSearch(getLivestreamOnlyOptions(searchOptions));
}
}
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, forceRefresh]);
@@ -521,7 +539,11 @@ function ClaimListDiscover(props: Props) {
includeSupportAction={includeSupportAction}
injectedItem={injectedItem}
showHiddenByUser={showHiddenByUser}
liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap}
searchOptions={options}
hideLivestreamClaims={hideLivestreamClaims}
empty={empty}
/>
{loading && (
<div className="claim-grid">
@@ -533,13 +555,15 @@ function ClaimListDiscover(props: Props) {
</div>
) : (
<div>
<div className="section__header--actions">
{headerToUse}
{meta && <div className="section__actions--no-margin">{meta}</div>}
</div>
{showHeader && (
<div className="section__header--actions">
{headerToUse}
{meta && <div className="section__actions--no-margin">{meta}</div>}
</div>
)}
<ClaimList
id={claimSearchCacheQuery}
type={type}
loading={loading}
uris={uris || claimSearchResult}
onScrollBottom={handleScrollBottom}
@@ -550,9 +574,16 @@ function ClaimListDiscover(props: Props) {
includeSupportAction={includeSupportAction}
injectedItem={injectedItem}
showHiddenByUser={showHiddenByUser}
liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap}
searchOptions={options}
hideLivestreamClaims={hideLivestreamClaims}
empty={empty}
/>
{loading && new Array(dynamicPageSize).fill(1).map((x, i) => <ClaimPreview key={i} placeholder="loading" />)}
{loading &&
new Array(dynamicPageSize)
.fill(1)
.map((x, i) => <ClaimPreview key={i} placeholder="loading" type={type} />)}
</div>
)}
</React.Fragment>
+29 -22
View File
@@ -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,
@@ -74,7 +74,7 @@ function ClaimListHeader(props: Props) {
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);
const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL && claimType === CS.CLAIM_COLLECTION);
const isFiltered = () =>
Boolean(
urlParams.get(CS.FRESH_KEY) ||
@@ -144,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));
});
@@ -161,7 +161,11 @@ function ClaimListHeader(props: Props) {
}
break;
case CS.CONTENT_KEY:
if (delta.value === CS.CLAIM_CHANNEL || delta.value === CS.CLAIM_REPOST) {
if (
delta.value === CS.CLAIM_CHANNEL ||
delta.value === CS.CLAIM_REPOST ||
delta.value === CS.CLAIM_COLLECTION
) {
newUrlParams.delete(CS.DURATION_KEY);
newUrlParams.set(CS.CONTENT_KEY, delta.value);
} else if (delta.value === CS.CONTENT_ALL) {
@@ -212,13 +216,13 @@ function ClaimListHeader(props: Props) {
<>
<div className="claim-search__wrapper">
<div className="claim-search__top">
<div className="claim-search__menu-group">
{!hideFilters &&
CS.ORDER_BY_TYPES.map(type => (
{!hideFilters && (
<div className="claim-search__menu-group">
{CS.ORDER_BY_TYPES.map((type) => (
<Button
key={type}
button="alt"
onClick={e =>
onClick={(e) =>
handleChange({
key: CS.ORDER_BY_KEY,
value: type,
@@ -233,8 +237,8 @@ function ClaimListHeader(props: Props) {
label={__(toCapitalCase(type))}
/>
))}
</div>
</div>
)}
<div className="claim-search__menu-group">
{!hideAdvancedFilter && !SIMPLE_SITE && (
<Button
@@ -276,21 +280,23 @@ 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>
@@ -314,18 +320,19 @@ 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')}
@@ -358,7 +365,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,
@@ -398,14 +405,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)')}
@@ -428,7 +435,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,
+57 -12
View File
@@ -1,20 +1,65 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri, makeSelectClaimIsMine } from 'lbry-redux';
import {
doCollectionEdit,
makeSelectClaimForUri,
makeSelectFileInfoForUri,
doPrepareEdit,
makeSelectCollectionForIdHasClaimUrl,
makeSelectNameForCollectionId,
makeSelectCollectionIsMine,
COLLECTIONS_CONSTS,
makeSelectEditedCollectionForId,
} from 'lbry-redux';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { doToggleMuteChannel } from 'redux/actions/blocked';
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
import { doSetActiveChannel, doSetIncognito, doOpenModal } from 'redux/actions/app';
import { doCommentModBlock, doCommentModUnBlock } from 'redux/actions/comments';
import { makeSelectChannelIsBlocked } from 'redux/selectors/comments';
import { doToast } from 'redux/actions/notifications';
import { makeSelectSigningIsMine } from 'redux/selectors/content';
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
import ClaimPreview from './view';
import fs from 'fs';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
const select = (state, props) => {
const claim = makeSelectClaimForUri(props.uri, false)(state);
const permanentUri = claim && claim.permanent_url;
return {
claim,
claimIsMine: makeSelectSigningIsMine(props.uri)(state),
hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.WATCH_LATER_ID, permanentUri)(state),
channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.channelUri, true)(state),
claimInCollection: makeSelectCollectionForIdHasClaimUrl(props.collectionId, permanentUri)(state),
collectionName: makeSelectNameForCollectionId(props.collectionId)(state),
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
editedCollection: makeSelectEditedCollectionForId(props.collectionId)(state),
};
};
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)),
doChannelSubscribe: (subscription) => dispatch(doChannelSubscribe(subscription)),
doChannelUnsubscribe: (subscription) => dispatch(doChannelUnsubscribe(subscription)),
doCollectionEdit: (collection, props) => dispatch(doCollectionEdit(collection, props)),
});
export default connect(select, {
doToggleMuteChannel,
doCommentModBlock,
doCommentModUnBlock,
})(ClaimPreview);
export default connect(select, perform)(ClaimPreview);
+254 -27
View File
@@ -1,52 +1,128 @@
// @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 } from 'util/url';
import { useHistory } from 'react-router';
import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
const PAGE_VIEW_QUERY = `view`;
const EDIT_PAGE = 'edit';
type SubscriptionArgs = {
channelName: string,
uri: string,
notificationsDisabled?: boolean,
};
type Props = {
uri: string,
channelUri: string,
claim: ?Claim,
openModal: (id: string, {}) => void,
inline?: boolean,
claimIsMine: boolean,
channelIsMuted: boolean,
channelIsBlocked: boolean,
doToggleMuteChannel: (string) => void,
doChannelMute: (string) => void,
doChannelUnmute: (string) => void,
doCommentModBlock: (string) => void,
doCommentModUnBlock: (string) => void,
isRepost: boolean,
doCollectionEdit: (string, any) => void,
hasClaimInWatchLater: boolean,
claimInCollection: boolean,
collectionName?: string,
collectionId: string,
isMyCollection: boolean,
doToast: ({ message: string }) => void,
claimIsMine: boolean,
fileInfo: FileListItem,
prepareEdit: ({}, string, {}) => void,
isSubscribed: boolean,
doChannelSubscribe: (SubscriptionArgs) => void,
doChannelUnsubscribe: (SubscriptionArgs) => void,
isChannelPage: boolean,
editedCollection: Collection,
};
function ClaimMenuList(props: Props) {
const {
uri,
channelUri,
claim,
openModal,
inline = false,
claimIsMine,
doToggleMuteChannel,
doChannelMute,
doChannelUnmute,
channelIsMuted,
channelIsBlocked,
doCommentModBlock,
doCommentModUnBlock,
isRepost,
doCollectionEdit,
hasClaimInWatchLater,
collectionId,
collectionName,
isMyCollection,
doToast,
claimIsMine,
fileInfo,
prepareEdit,
isSubscribed,
doChannelSubscribe,
doChannelUnsubscribe,
isChannelPage = false,
editedCollection,
} = props;
const channelUri =
claim &&
(claim.value_type === 'channel'
? claim.permanent_url
: claim.signing_channel && claim.signing_channel.permanent_url);
const repostedContent = claim && claim.reposted_claim;
const contentClaim = repostedContent || claim;
const incognitoClaim = channelUri && !channelUri.includes('@');
const signingChannel = claim && (claim.signing_channel || claim);
const permanentUrl = String(channelUri);
const isChannel = !incognitoClaim && signingChannel === claim;
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
const subscriptionLabel = isSubscribed ? __('Unfollow') : __('Follow');
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri);
if (!channelUri || !claim) {
const { push, replace } = useHistory();
if (!claim) {
return null;
}
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri);
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 handleFollow() {
const { channelName } = parseURI(permanentUrl);
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
subscriptionHandler({
channelName: '@' + channelName,
uri: permanentUrl,
notificationsDisabled: true,
});
}
function handleToggleMute() {
doToggleMuteChannel(channelUri);
if (channelIsMuted) {
doChannelUnmute(channelUri);
} else {
doChannelMute(channelUri);
}
}
function handleToggleBlock() {
@@ -57,12 +133,46 @@ function ClaimMenuList(props: Props) {
}
}
function handleEdit() {
if (!isChannel) {
const signingChannelName = signingChannel && signingChannel.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 (!isRepost && !isChannel) {
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri });
} else {
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)) });
}
}
function handleSupport() {
openModal(MODALS.SEND_TIP, { uri, isSupport: true });
}
function handleCopyLink() {
navigator.clipboard.writeText(shareUrl);
}
function handleReportContent() {
window.open(`https://lbry.com/dmca/${claim.claim_id}`, '_blank', 'noopener');
// $FlowFixMe
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${(repostedContent && repostedContent.claim_id) || claim.claim_id}`);
}
return (
@@ -77,26 +187,143 @@ function ClaimMenuList(props: Props) {
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
</MenuButton>
<MenuList className="menu__list">
{!claimIsMine && (
{/* WATCH LATER */}
<>
<MenuItem className="comment__menu-option" onSelect={handleToggleBlock}>
{isPlayable && !collectionId && (
<MenuItem
className="comment__menu-option"
onSelect={() => {
doToast({
message: __('Item %action% Watch Later', {
action: hasClaimInWatchLater ? __('removed from') : __('added to'),
}),
});
doCollectionEdit(COLLECTIONS_CONSTS.WATCH_LATER_ID, {
claims: [contentClaim],
remove: hasClaimInWatchLater,
type: 'playlist',
});
}}
>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.BLOCK} />
{channelIsBlocked ? __('Unblock Channel') : __('Block Channel')}
<Icon aria-hidden icon={hasClaimInWatchLater ? ICONS.DELETE : ICONS.TIME} />
{hasClaimInWatchLater ? __('In Watch Later') : __('Watch Later')}
</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>
)}
{/* COLLECTION OPERATIONS */}
{collectionId && collectionName && isCollectionClaim && (
<>
{Boolean(editedCollection) && (
<MenuItem
className="comment__menu-option"
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
>
<div className="menu__link">
<Icon aria-hidden iconColor={'red'} icon={ICONS.PUBLISH} />
{__('Publish')}
</div>
</MenuItem>
)}
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.VIEW} />
{__('View 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>
</>
)}
{/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
{isPlayable && (
<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>
)}
</>
{!isChannelPage && (
<>
<hr className="menu__separator" />
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.LBC} />
{__('Support')}
</div>
</MenuItem>
</>
)}
{!incognitoClaim && !isRepost && !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>
</>
)}
{!isMyCollection && (
<>
{(!claimIsMine || channelIsBlocked) && channelUri ? (
!incognitoClaim &&
!isRepost && (
<>
<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>
<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 && !isRepost && (
<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.SHARE} />
@@ -104,7 +331,7 @@ function ClaimMenuList(props: Props) {
</div>
</MenuItem>
{!claimIsMine && (
{!claimIsMine && !isMyCollection && (
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.REPORT} />
+8
View File
@@ -11,6 +11,10 @@ import {
makeSelectClaimWasPurchased,
makeSelectStreamingUrlForUri,
makeSelectClaimIsStreamPlaceholder,
makeSelectCollectionIsMine,
doCollectionEdit,
makeSelectUrlsForCollectionId,
makeSelectIndexForUrlInCollection,
} from 'lbry-redux';
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
@@ -40,11 +44,15 @@ const select = (state, props) => ({
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
});
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
getFile: (uri) => dispatch(doFileGet(uri, false)),
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
});
export default connect(select, perform)(ClaimPreview);
+100 -28
View File
@@ -3,12 +3,12 @@ import type { Node } from 'react';
import React, { useEffect, forwardRef } from 'react';
import { NavLink, withRouter } from 'react-router-dom';
import classnames from 'classnames';
import { parseURI } from 'lbry-redux';
import { parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
import { formatLbryUrlForWeb } from 'util/url';
import { isEmpty } from 'util/object';
import FileThumbnail from 'component/fileThumbnail';
import UriIndicator from 'component/uriIndicator';
import FileProperties from 'component/fileProperties';
import PreviewOverlayProperties from 'component/previewOverlayProperties';
import ClaimTags from 'component/claimTags';
import SubscribeButton from 'component/subscribeButton';
import ChannelThumbnail from 'component/channelThumbnail';
@@ -25,6 +25,8 @@ 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';
type Props = {
uri: string,
@@ -70,6 +72,12 @@ type Props = {
repostUrl?: string,
hideMenu?: boolean,
isLivestream?: boolean,
live?: boolean,
collectionId?: string,
editCollection: (string, CollectionEditParams) => void,
isCollectionMine: boolean,
collectionUris: Array<Collection>,
collectionIndex?: number,
};
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
@@ -119,15 +127,23 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
renderActions,
hideMenu = false,
// repostUrl,
isLivestream,
isLivestream, // need both? CHECK
live,
collectionId,
collectionIndex,
editCollection,
isCollectionMine,
collectionUris,
} = props;
const isRepost = claim && claim.repost_channel_url;
const WrapperElement = wrapperElement || 'li';
const shouldFetch =
claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending);
const abandoned = !isResolvingUri && !claim;
const shouldHideActions = hideActions || type === 'small' || type === 'tooltip';
const isMyCollection = collectionId && (isCollectionMine || collectionId.includes('-'));
const shouldHideActions = hideActions || isMyCollection || type === 'small' || type === 'tooltip';
const canonicalUrl = claim && claim.canonical_url;
const lastCollectionIndex = collectionUris ? collectionUris.length - 1 : 0;
let isValid = false;
if (uri) {
try {
@@ -137,12 +153,16 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
isValid = 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 isCollection = claim && claim.value_type === 'collection';
const isChannelUri = isValid ? parseURI(uri).isChannel : false;
const signingChannel = claim && claim.signing_channel;
const navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
let navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
if (collectionId) {
const collectionParams = new URLSearchParams();
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
navigateUrl = navigateUrl + `?` + collectionParams.toString();
}
const channelUri = claim && (signingChannel ? signingChannel.permanent_url : claim.permanent_url);
const navLinkProps = {
to: navigateUrl,
onClick: (e) => e.stopPropagation(),
@@ -187,7 +207,7 @@ 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(contentUri, claim, streamingUrl, getFile, shouldHide);
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide);
function handleOnClick(e) {
if (onClick) {
@@ -231,13 +251,18 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
return empty || <ClaimPreviewNoContent isChannel={isChannelUri} type={type} />;
}
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && claim === null) {
return <AbandonedChannelPreview uri={contentUri} type />;
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && isChannelUri && claim === null) {
return <AbandonedChannelPreview uri={uri} type />;
}
if (placeholder === 'publish' && !claim && contentUri.startsWith('lbry://@')) {
if (placeholder === 'publish' && !claim && uri.startsWith('lbry://@')) {
return null;
}
let liveProperty = null;
if (live === true) {
liveProperty = (claim) => <>LIVE</>;
}
return (
<WrapperElement
ref={ref}
@@ -247,6 +272,7 @@ 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,
})}
>
<>
@@ -264,8 +290,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
})}
>
{isChannelUri && claim ? (
<UriIndicator uri={contentUri} link>
<ChannelThumbnail uri={contentUri} />
<UriIndicator uri={uri} link>
<ChannelThumbnail uri={uri} />
</UriIndicator>
) : (
<>
@@ -273,15 +299,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<NavLink {...navLinkProps}>
<FileThumbnail thumbnail={thumbnailUrl}>
{/* @if TARGET='app' */}
{claim && (
{claim && !isCollection && (
<div className="claim-preview__hover-actions">
<FileDownloadLink uri={canonicalUrl} hideOpenButton hideDownloadStatus />
</div>
)}
{/* @endif */}
{!isRepost && !isChannelUri && !isLivestream && (
{!isLivestream && (
<div className="claim-preview__file-property-overlay">
<FileProperties uri={contentUri} small />
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
</div>
)}
</FileThumbnail>
@@ -296,16 +322,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<div className="claim-preview-metadata">
<div className="claim-preview-info">
{pending ? (
<ClaimPreviewTitle uri={contentUri} />
<ClaimPreviewTitle uri={uri} />
) : (
<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} />}
@@ -315,6 +337,58 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
{!pending && (
<>
{renderActions && claim && renderActions(claim)}
{Boolean(isMyCollection && collectionId) && (
<>
<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(collectionId, {
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(collectionId, {
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(collectionId, { claims: [claim], remove: true });
}}
/>
</div>
</div>
</>
)}
{shouldHideActions || renderActions ? null : actions !== undefined ? (
actions
) : (
@@ -326,9 +400,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
)}
{isChannelUri && !channelIsBlocked && !claimIsMine && (
<SubscribeButton
uri={contentUri.startsWith('lbry://') ? contentUri : `lbry://${contentUri}`}
/>
<SubscribeButton uri={uri.startsWith('lbry://') ? uri : `lbry://${uri}`} />
)}
{includeSupportAction && <ClaimSupportButton uri={uri} />}
@@ -351,7 +423,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
)}
</div>
</div>
{!hideMenu && <ClaimMenuList uri={uri} />}
{!hideMenu && <ClaimMenuList uri={uri} collectionId={collectionId} channelUri={channelUri} isRepost={isRepost} />}
</>
</WrapperElement>
);
+41 -13
View File
@@ -10,11 +10,12 @@ import ChannelThumbnail from 'component/channelThumbnail';
import SubscribeButton from 'component/subscribeButton';
import useGetThumbnail from 'effects/use-get-thumbnail';
import { formatLbryUrlForWeb } from 'util/url';
import { parseURI } from 'lbry-redux';
import FileProperties from 'component/fileProperties';
import { parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
import PreviewOverlayProperties from 'component/previewOverlayProperties';
import FileDownloadLink from 'component/fileDownloadLink';
import ClaimRepostAuthor from 'component/claimRepostAuthor';
import ClaimMenuList from 'component/claimMenuList';
import CollectionPreviewOverlay from 'component/collectionPreviewOverlay';
type Props = {
uri: string,
@@ -40,6 +41,9 @@ type Props = {
isMature: boolean,
showMature: boolean,
showHiddenByUser?: boolean,
properties?: (Claim) => void,
live?: boolean,
collectionId?: string,
hideLivestreamClaims?: boolean,
isLivestream: boolean,
};
@@ -62,15 +66,26 @@ function ClaimPreviewTile(props: Props) {
isMature,
showMature,
showHiddenByUser,
properties,
live,
hideLivestreamClaims,
isLivestream,
collectionId,
} = props;
const isRepost = claim && claim.repost_channel_url;
const isCollection = claim && claim.value_type === 'collection';
const isStream = claim && claim.value_type === 'stream';
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 navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');
let navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');
const listId = collectionId || collectionClaimId;
if (listId) {
const collectionParams = new URLSearchParams();
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
navigateUrl = navigateUrl + `?` + collectionParams.toString();
}
const navLinkProps = {
to: navigateUrl,
onClick: (e) => e.stopPropagation(),
@@ -87,11 +102,8 @@ function ClaimPreviewTile(props: Props) {
}
}
let channelUri;
const signingChannel = claim && claim.signing_channel;
if (signingChannel) {
channelUri = signingChannel.permanent_url;
}
const channelUri = signingChannel && signingChannel.permanent_url;
function handleClick(e) {
if (navigateUrl) {
@@ -157,12 +169,18 @@ 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}>
@@ -170,12 +188,22 @@ function ClaimPreviewTile(props: Props) {
{!isChannel && (
<React.Fragment>
{/* @if TARGET='app' */}
<div className="claim-preview__hover-actions">
<FileDownloadLink uri={canonicalUrl} hideOpenButton />
</div>
{isStream && (
<div className="claim-preview__hover-actions">
<FileDownloadLink uri={canonicalUrl} hideOpenButton />
</div>
)}
{/* @endif */}
<div className="claim-preview__file-property-overlay">
<FileProperties uri={uri} small />
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
</div>
</React.Fragment>
)}
{isCollection && (
<React.Fragment>
<div className="claim-preview__collection-wrapper">
<CollectionPreviewOverlay collectionId={listId} uri={uri} />
</div>
</React.Fragment>
)}
@@ -189,7 +217,7 @@ function ClaimPreviewTile(props: Props) {
<UriIndicator uri={uri} />
</div>
)}
<ClaimMenuList uri={uri} />
<ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} isRepost={isRepost} />
</h2>
</NavLink>
<div>
@@ -1,12 +1,12 @@
import { connect } from 'react-redux';
import { makeSelectFilePartlyDownloaded, makeSelectClaimIsMine } from 'lbry-redux';
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
import FileProperties from './view';
import ClaimProperties from './view';
const select = (state, props) => ({
downloaded: makeSelectFilePartlyDownloaded(props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
});
export default connect(select, null)(FileProperties);
export default connect(select, null)(ClaimProperties);
+38
View File
@@ -0,0 +1,38 @@
// @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>
);
}
+1 -1
View File
@@ -52,7 +52,7 @@ export default function ClaimTags(props: Props) {
}
return (
<div className={classnames('file-properties--small', { 'file-properties--large': type === 'large' })}>
<div className={classnames('claim__tags', { 'claim__tags--large': type === 'large' })}>
{tagsToDisplay.map((tag) => (
<Tag key={tag} title={tag} name={tag} />
))}
+12 -1
View File
@@ -1,14 +1,25 @@
import { connect } from 'react-redux';
import { doClaimSearch, selectClaimSearchByQuery, selectFetchingClaimSearchByQuery, SETTINGS } from 'lbry-redux';
import {
doClaimSearch,
selectClaimSearchByQuery,
selectFetchingClaimSearchByQuery,
SETTINGS,
selectClaimsByUri,
} 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 = {
+169 -25
View File
@@ -1,23 +1,99 @@
// @flow
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config';
import * as CS from 'constants/claim_search';
import type { Node } from 'react';
import React from 'react';
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>,
uris: Array<string>,
doClaimSearch: ({}) => void,
showNsfw: boolean,
hideReposts: boolean,
history: { action: string, push: (string) => void, replace: (string) => void },
claimSearchByQuery: {
[string]: Array<string>,
},
fetchingClaimSearchByQuery: {
[string]: boolean,
},
claimSearchByQuery: { [string]: Array<string> },
fetchingClaimSearchByQuery: { [string]: boolean },
claimsByUri: { [string]: any },
// claim search options are below
tags: Array<string>,
blockedUris: Array<string>,
@@ -29,10 +105,15 @@ type Props = {
releaseTime?: string,
languages?: Array<string>,
claimType?: string | Array<string>,
streamTypes?: Array<string>,
timestamp?: string,
feeAmount?: string,
limitClaimsPerChannel?: number,
streamTypes?: Array<string>,
hasSource?: boolean,
hasNoSource?: boolean,
renderProperties?: (Claim) => ?Node,
liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any },
pin?: boolean,
};
@@ -40,6 +121,7 @@ function ClaimTilesDiscover(props: Props) {
const {
doClaimSearch,
claimSearchByQuery,
claimsByUri,
showNsfw,
hideReposts,
// Below are options to pass that are forwarded to claim_search
@@ -51,17 +133,30 @@ function ClaimTilesDiscover(props: Props) {
releaseTime,
languages,
claimType,
streamTypes,
timestamp,
feeAmount,
limitClaimsPerChannel,
fetchingClaimSearchByQuery,
streamTypes,
hasSource,
hasNoSource,
renderProperties,
blockedUris,
mutedUris,
liveLivestreamsFirst,
livestreamMap,
pin,
prefixUris,
} = props;
const { location } = useHistory();
const urlParams = new URLSearchParams(location.search);
const feeAmountInUrl = urlParams.get('fee_amount');
const feeAmountParam = feeAmountInUrl || feeAmount || CS.FEE_AMOUNT_ONLY_FREE;
const mutedAndBlockedChannelIds = Array.from(new Set(mutedUris.concat(blockedUris).map((uri) => uri.split('#')[1])));
const liveUris = [];
const [prevUris, setPrevUris] = React.useState([]);
const options: {
page_size: number,
@@ -91,12 +186,15 @@ function ClaimTilesDiscover(props: Props) {
not_tags: !showNsfw ? MATURE_TAGS : [],
any_languages: languages,
channel_ids: channelIds || [],
not_channel_ids: [],
not_channel_ids: mutedAndBlockedChannelIds,
order_by: orderBy || ['trending_group', 'trending_mixed'],
stream_types: streamTypes || [CS.FILE_VIDEO],
stream_types:
streamTypes === null ? undefined : SIMPLE_SITE && !hasNoSource ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
};
if (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream')) {
if (ENABLE_NO_SOURCE_CLAIMS && hasNoSource) {
options.has_no_source = true;
} else if (hasSource || (!ENABLE_NO_SOURCE_CLAIMS && (!claimType || claimType === 'stream'))) {
options.has_source = true;
}
@@ -133,35 +231,81 @@ function ClaimTilesDiscover(props: Props) {
options.claim_ids = claimIds;
}
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const uris = claimSearchByQuery[claimSearchCacheQuery] || [];
const mainSearchKey = createNormalizedClaimSearchKey(options);
const livestreamSearchKey = liveLivestreamsFirst
? createNormalizedClaimSearchKey(getLivestreamOnlyOptions(options))
: undefined;
let uris = (prefixUris || []).concat(claimSearchByQuery[mainSearchKey] || []);
const isLoading = fetchingClaimSearchByQuery[mainSearchKey];
// && !isLoading isn't on master, doesn't seem to affect the functionality, don't recall why it was added.
if (liveLivestreamsFirst && livestreamMap && !isLoading) {
prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery, options);
}
// 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;
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();
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;
}
uris.splice(2, 0, fixUri);
}
React.useEffect(() => {
if (shouldPerformSearch) {
const searchOptions = JSON.parse(optionsStringForEffect);
doClaimSearch(searchOptions);
if (liveLivestreamsFirst) {
doClaimSearch(getLivestreamOnlyOptions(searchOptions));
}
}
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect]);
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, liveLivestreamsFirst]);
React.useEffect(() => {
if (JSON.stringify(prevUris) !== JSON.stringify(uris) && !shouldPerformSearch) {
setPrevUris(uris);
}
}, [shouldPerformSearch, prevUris, uris]);
const resolveLive = (index) => {
if (liveLivestreamsFirst && livestreamMap && index < liveUris.length) {
return true;
}
return undefined;
};
const modifiedUris = uris ? uris.slice() : [];
const fixUris = [
'lbry://@AdrianLogan#5/why-i-talk-to-myself#3',
];
if (pin && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') {
fixUris.forEach((fixUri) => {
if (modifiedUris.indexOf(fixUri) !== -1) {
modifiedUris.splice(modifiedUris.indexOf(fixUri), 1);
} else {
modifiedUris.pop();
}
});
modifiedUris.splice(2, 0, ...fixUris);
}
return (
<ul className="claim-grid">
{uris && uris.length
? uris.map((uri) => <ClaimPreviewTile key={uri} uri={uri} />)
{modifiedUris && modifiedUris.length
? modifiedUris.map((uri, index) => (
<ClaimPreviewTile key={uri} uri={uri} properties={renderProperties} live={resolveLive(index)} />
))
: new Array(pageSize).fill(1).map((x, i) => <ClaimPreviewTile key={i} placeholder />)}
</ul>
);
+10
View File
@@ -0,0 +1,10 @@
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);
+29
View File
@@ -0,0 +1,29 @@
// @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;
+30
View File
@@ -0,0 +1,30 @@
import { connect } from 'react-redux';
import {
makeSelectClaimIsMine,
makeSelectClaimForUri,
selectMyChannelClaims,
makeSelectClaimIsPending,
makeSelectCollectionIsMine,
makeSelectEditedCollectionForId,
} from 'lbry-redux';
import { makeSelectCostInfoForUri } from 'lbryinc';
import { doToast } from 'redux/actions/notifications';
import { doOpenModal } from 'redux/actions/app';
import CollectionActions from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
costInfo: makeSelectCostInfoForUri(props.uri)(state),
myChannels: selectMyChannelClaims(state),
claimIsPending: makeSelectClaimIsPending(props.uri)(state),
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
collectionHasEdits: Boolean(makeSelectEditedCollectionForId(props.collectionId)(state)),
});
const perform = (dispatch) => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
doToast: (options) => dispatch(doToast(options)),
});
export default connect(select, perform)(CollectionActions);
+130
View File
@@ -0,0 +1,130 @@
// @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';
type Props = {
uri: string,
claim: StreamClaim,
openModal: (id: string, { uri: string, claimIsMine?: boolean, isSupport?: boolean }) => void,
myChannels: ?Array<ChannelClaim>,
doToast: ({ message: string }) => void,
claimIsPending: boolean,
isMyCollection: boolean,
collectionId: string,
showInfo: boolean,
setShowInfo: (boolean) => void,
collectionHasEdits: boolean,
};
function CollectionActions(props: Props) {
const {
uri,
openModal,
claim,
claimIsPending,
isMyCollection,
collectionId,
showInfo,
setShowInfo,
collectionHasEdits,
} = props;
const { push } = useHistory();
const isMobile = useIsMobile();
const claimId = claim && claim.claim_id;
const webShareable = true; // collections have cost?
const lhsSection = (
<>
{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 = (
<>
{isMyCollection && (
<Button
title={uri ? __('Update') : __('Publish')}
label={uri ? __('Update') : __('Publish')}
className={classnames('button--file-action')}
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
icon={ICONS.PUBLISH}
iconColor={collectionHasEdits && 'red'}
iconSize={18}
disabled={claimIsPending}
/>
)}
{isMyCollection && (
<Button
className={classnames('button--file-action')}
title={__('Delete List')}
onClick={() => openModal(MODALS.COLLECTION_DELETE, { uri, collectionId, redirect: `/$/${PAGES.LISTS}` })}
icon={ICONS.DELETE}
iconSize={18}
description={__('Delete List')}
disabled={claimIsPending}
/>
)}
{!isMyCollection && (
<Button
title={__('Report content')}
className="button--file-action"
icon={ICONS.REPORT}
navigate={`/$/${PAGES.REPORT_CONTENT}?claimId=${claimId}`}
/>
)}
</>
);
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;
@@ -0,0 +1,24 @@
import { connect } from 'react-redux';
import CollectionContent from './view';
import {
makeSelectUrlsForCollectionId,
makeSelectNameForCollectionId,
makeSelectCollectionForId,
makeSelectClaimForClaimId,
makeSelectClaimIsMine,
} from 'lbry-redux';
const select = (state, props) => {
const claim = makeSelectClaimForClaimId(props.id)(state);
const url = claim && claim.permanent_url;
return {
collection: makeSelectCollectionForId(props.id)(state),
collectionUrls: makeSelectUrlsForCollectionId(props.id)(state),
collectionName: makeSelectNameForCollectionId(props.id)(state),
claim,
isMine: makeSelectClaimIsMine(url)(state),
};
};
export default connect(select)(CollectionContent);
@@ -0,0 +1,42 @@
// @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';
type Props = {
collectionUrls: Array<Claim>,
collectionName: string,
collection: any,
createUnpublishedCollection: (string, Array<any>, ?string) => void,
id: string,
claim: Claim,
isMine: boolean,
};
export default function CollectionContent(props: Props) {
const { collectionUrls, collectionName, id } = props;
return (
<Card
isBodyList
className="file-page__recommended"
title={
<span>
<Icon icon={ICONS.STACK} className="icon--margin-right" />
{collectionName}
</span>
}
titleActions={
<>
{/* TODO: BUTTON TO SAVE COLLECTION - Probably save/copy modal */}
<Button label={'View List'} button="link" navigate={`/$/${PAGES.LIST}/${id}`} />
</>
}
body={<ClaimList isCardBody type="small" uris={collectionUrls} collectionId={id} empty={__('List is Empty')} />}
/>
);
}
+53
View File
@@ -0,0 +1,53 @@
import { connect } from 'react-redux';
import {
makeSelectTitleForUri,
makeSelectThumbnailForUri,
makeSelectMetadataItemForUri,
doCollectionPublish,
doCollectionPublishUpdate,
makeSelectAmountForUri,
makeSelectClaimForUri,
selectUpdateCollectionError,
selectUpdatingCollection,
selectCreateCollectionError,
selectBalance,
doClearCollectionErrors,
selectCreatingCollection,
makeSelectCollectionForId,
makeSelectUrlsForCollectionId,
makeSelectClaimIdsForCollectionId,
} from 'lbry-redux';
import { doOpenModal } from 'redux/actions/app';
import CollectionPage from './view';
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/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) => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
publishCollectionUpdate: (params) => dispatch(doCollectionPublishUpdate(params)),
publishCollection: (params, collectionId) => dispatch(doCollectionPublish(params, collectionId)),
clearCollectionErrors: () => dispatch(doClearCollectionErrors()),
});
export default connect(select, perform)(CollectionPage);
+441
View File
@@ -0,0 +1,441 @@
// @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 ThumbnailPicker from 'component/thumbnailPicker';
import { useHistory } from 'react-router-dom';
import { isNameValid, regexInvalidURI } from 'lbry-redux';
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
import { FormField } from 'component/common/form';
import { handleBidChange } from 'util/publish';
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>,
publishCollectionUpdate: (CollectionUpdateParams) => Promise<any>,
updatingCollection: boolean,
updateError: string,
publishCollection: (CollectionPublishParams, string) => Promise<any>,
createError: string,
creatingCollection: boolean,
clearCollectionErrors: () => void,
onDone: (string) => void,
openModal: (
id: string,
{ onUpdate: (string) => void, assetName: string, helpText: string, currentValue: string, title: string }
) => void,
};
function CollectionForm(props: Props) {
const {
uri, // collection uri
claim,
balance,
// publish params
amount,
title,
description,
thumbnailUrl,
tags,
locations,
languages = [],
// rest
onDone,
publishCollectionUpdate,
updateError,
updatingCollection,
publishCollection,
creatingCollection,
createError,
disabled,
activeChannelClaim,
incognito,
collectionId,
collection,
collectionUrls,
collectionClaimIds,
} = 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 [nameError, setNameError] = React.useState(undefined);
const [bidError, setBidError] = React.useState('');
const [params, setParams]: [any, (any) => void] = React.useState(getCollectionParams());
const name = params.name;
const isNewCollection = !uri;
const { replace } = useHistory();
const languageParam = params.languages;
const primaryLanguage = Array.isArray(languageParam) && languageParam.length && languageParam[0];
const secondaryLanguage = Array.isArray(languageParam) && languageParam.length >= 2 && languageParam[1];
const collectionClaimIdsString = JSON.stringify(collectionClaimIds);
function parseName(newName) {
let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu');
return newName.replace(INVALID_URI_CHARS, '-');
}
function setParam(paramObj) {
setParams({ ...params, ...paramObj });
}
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,
description,
bid: String(amount || 0.001),
languages: languages || [],
locations: locations || [],
tags: tags
? tags.map((tag) => {
return { name: tag };
})
: [],
claims: collectionClaimIds,
};
collectionParams['name'] = parseName(collectionName);
if (activeChannelId) {
collectionParams['channel_id'] = activeChannelId;
}
if (!claim) {
collectionParams['title'] = collectionName;
}
if (claim) {
collectionParams['claim_id'] = claim.claim_id;
collectionParams['title'] = title;
}
return collectionParams;
}
React.useEffect(() => {
const collectionClaimIds = JSON.parse(collectionClaimIdsString);
setParams({ ...params, claims: collectionClaimIds });
}, [collectionClaimIdsString, setParams]);
function handleLanguageChange(index, code) {
let langs = [...languageParam];
if (index === 0) {
if (code === LANG_NONE) {
// clear all
langs = [];
} else {
langs[0] = code;
}
} else {
if (code === LANG_NONE || code === langs[0]) {
langs.splice(1, 1);
} else {
langs[index] = code;
}
}
setParams({ ...params, languages: langs });
}
function handleThumbnailChange(thumbnailUrl: string) {
setParams({ ...params, thumbnail_url: thumbnailUrl });
}
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(() => {
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]);
React.useEffect(() => {
if (incognito) {
const newParams = Object.assign({}, params);
delete newParams.channel_id;
setParams(newParams);
} else if (activeChannelId) {
setParams({ ...params, channel_id: activeChannelId });
}
}, [activeChannelId, incognito, setParams]);
const itemError = !params.claims.length ? __('Cannot publish empty collection') : '';
const submitError = nameError || bidError || itemError || updateError || createError;
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 className="fieldset-group--smushed fieldset-group--disabled-prefix">
<fieldset-section>
<label htmlFor="channel_name">{__('Channel')}</label>
</fieldset-section>
</fieldset-group>
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
<fieldset-section>
<label htmlFor="channel_name">{__('Name')}</label>
<div className="form-field__prefix">{prefix}</div>
</fieldset-section>
<FormField
autoFocus={isNewCollection}
type="text"
name="channel_name"
placeholder={__('MyAwesomeCollection')}
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 Collection')}
value={params.title}
onChange={(e) => setParams({ ...params, title: e.target.value })}
/>
<ThumbnailPicker
inline
thumbnailParam={params.thumbnail_url}
updateThumbnailParam={handleThumbnailChange}
/>
<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 collection 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 || !params.claims.length}
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;
+16
View File
@@ -0,0 +1,16 @@
import { connect } from 'react-redux';
import { doCollectionEdit, makeSelectNameForCollectionId, doCollectionDelete } from 'lbry-redux';
import { doOpenModal } from 'redux/actions/app';
import CollectionMenuList from './view';
const select = (state, props) => {
return {
collectionName: makeSelectNameForCollectionId(props.collectionId)(state),
};
};
export default connect(select, {
doCollectionEdit,
doOpenModal,
doCollectionDelete,
})(CollectionMenuList);
+68
View File
@@ -0,0 +1,68 @@
// @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';
type Props = {
inline?: boolean,
doOpenModal: (string, {}) => void,
collectionName?: string,
collectionId: string,
};
function ClaimMenuList(props: Props) {
const { inline = false, collectionId, collectionName, doOpenModal } = props;
const { push } = useHistory();
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}`)}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.VIEW} />
{__('View List')}
</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 ClaimMenuList;
@@ -0,0 +1,30 @@
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);
@@ -0,0 +1,42 @@
// @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 CollectionPreviewTileOverlay(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(CollectionPreviewTileOverlay);
@@ -0,0 +1,19 @@
// @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>
);
}
@@ -0,0 +1,14 @@
// @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>
);
}
@@ -0,0 +1,58 @@
import { connect } from 'react-redux';
import {
doResolveUri,
makeSelectIsUriResolving,
makeSelectThumbnailForUri,
makeSelectTitleForUri,
makeSelectChannelForClaimUri,
makeSelectClaimIsNsfw,
makeSelectClaimIdForUri,
makeSelectClaimForClaimId,
makeSelectUrlsForCollectionId,
makeSelectNameForCollectionId,
doLocalCollectionDelete,
doFetchItemsInCollection,
makeSelectEditedCollectionForId,
makeSelectPendingCollectionForId,
makeSelectCountForCollectionId,
makeSelectIsResolvingCollectionForId,
} from 'lbry-redux';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings';
import CollectionPreviewTile 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
editedCollection: makeSelectEditedCollectionForId(collectionId)(state),
pendingCollection: makeSelectPendingCollectionForId(collectionId)(state),
claim,
isResolvingCollectionClaims: makeSelectIsResolvingCollectionForId(collectionId)(state),
channelClaim: collectionUri && makeSelectChannelForClaimUri(collectionUri)(state),
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
thumbnail: collectionUri && makeSelectThumbnailForUri(collectionUri)(state),
title: collectionUri && makeSelectTitleForUri(collectionUri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
filteredOutpoints: selectFilteredOutpoints(state),
blockedChannelUris: selectMutedChannels(state),
showMature: selectShowMatureContent(state),
isMature: makeSelectClaimIsNsfw(collectionUri)(state),
};
};
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
resolveCollectionItems: (options) => doFetchItemsInCollection(options),
deleteCollection: (id) => dispatch(doLocalCollectionDelete(id)),
});
export default connect(select, perform)(CollectionPreviewTile);
+171
View File
@@ -0,0 +1,171 @@
// @flow
import React from 'react';
import classnames from 'classnames';
import { NavLink, useHistory } from 'react-router-dom';
import ClaimPreviewTile from 'component/claimPreviewTile';
import TruncatedText from 'component/common/truncated-text';
import CollectionCount from './collectionCount';
import CollectionPrivate from './collectionPrivate';
import CollectionMenuList from 'component/collectionMenuList';
import { formatLbryUrlForWeb } from 'util/url';
import { COLLECTIONS_CONSTS } from 'lbry-redux';
import FileThumbnail from 'component/fileThumbnail';
type Props = {
uri: string,
collectionId: string,
collectionName: string,
collectionCount: number,
editedCollection?: Collection,
pendingCollection?: Collection,
claim: ?Claim,
channelClaim: ?ChannelClaim,
collectionItemUrls: Array<string>,
resolveUri: (string) => void,
isResolvingUri: boolean,
thumbnail?: string,
title?: string,
placeholder: boolean,
blackListedOutpoints: Array<{
txid: string,
nout: number,
}>,
filteredOutpoints: Array<{
txid: string,
nout: number,
}>,
blockedChannelUris: Array<string>,
isMature?: boolean,
showMature: boolean,
collectionId: string,
deleteCollection: (string) => void,
resolveCollectionItems: (any) => void,
isResolvingCollectionClaims: boolean,
};
function CollectionPreviewTile(props: Props) {
const {
uri,
collectionId,
collectionName,
collectionCount,
isResolvingUri,
isResolvingCollectionClaims,
collectionItemUrls,
claim,
resolveCollectionItems,
} = props;
const { push } = useHistory();
const hasClaim = Boolean(claim);
React.useEffect(() => {
if (collectionId && hasClaim && resolveCollectionItems) {
resolveCollectionItems({ collectionId, page_size: 5 });
}
}, [collectionId, hasClaim]);
// const signingChannel = claim && claim.signing_channel;
let navigateUrl = formatLbryUrlForWeb(collectionItemUrls[0] || '/');
if (collectionId) {
const collectionParams = new URLSearchParams();
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
navigateUrl = navigateUrl + `?` + collectionParams.toString();
}
function handleClick(e) {
if (navigateUrl) {
push(navigateUrl);
}
}
const navLinkProps = {
to: navigateUrl,
onClick: (e) => e.stopPropagation(),
};
/* REMOVE IF WORKS
let shouldHide = false;
if (isMature && !showMature) {
// Unfortunately needed until this is resolved
// https://github.com/lbryio/lbry-sdk/issues/2785
shouldHide = true;
}
// This will be replaced once blocking is done at the wallet server level
if (claim && !shouldHide && blackListedOutpoints) {
shouldHide = blackListedOutpoints.some(
(outpoint) =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
);
}
// We're checking to see if the stream outpoint
// or signing channel outpoint is in the filter list
if (claim && !shouldHide && filteredOutpoints) {
shouldHide = filteredOutpoints.some(
(outpoint) =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
);
}
// block stream claims
if (claim && !shouldHide && blockedChannelUris.length && signingChannel) {
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 (shouldHide) {
return null;
}
*/
if (isResolvingUri || isResolvingCollectionClaims) {
return (
<li className={classnames('claim-preview--tile', {})}>
<div className="placeholder media__thumb" />
<div className="placeholder__wrapper">
<div className="placeholder claim-tile__title" />
<div className="placeholder claim-tile__info" />
</div>
</li>
);
}
if (uri) {
return <ClaimPreviewTile uri={uri} />;
}
return (
<li role="link" onClick={handleClick} className={'card claim-preview--tile'}>
<NavLink {...navLinkProps}>
<FileThumbnail uri={collectionItemUrls && collectionItemUrls.length && collectionItemUrls[0]}>
<React.Fragment>
<div className="claim-preview__claim-property-overlay">
<CollectionCount count={collectionCount} />
</div>
</React.Fragment>
</FileThumbnail>
</NavLink>
<NavLink {...navLinkProps}>
<h2 className="claim-tile__title">
<TruncatedText text={collectionName} lines={1} />
<CollectionMenuList collectionId={collectionId} />
</h2>
</NavLink>
<div>
<div className="claim-tile__info">
<React.Fragment>
<div className="claim-tile__about">
<CollectionPrivate />
</div>
</React.Fragment>
</div>
</div>
</li>
);
}
export default CollectionPreviewTile;
@@ -0,0 +1,22 @@
import { connect } from 'react-redux';
import {
doCollectionEdit,
makeSelectCollectionForId,
makeSelectClaimIsPending,
makeSelectCollectionForIdHasClaimUrl,
} from 'lbry-redux';
import CollectionSelectItem from './view';
const select = (state, props) => {
return {
collection: makeSelectCollectionForId(props.collectionId)(state),
hasClaim: makeSelectCollectionForIdHasClaimUrl(props.collectionId, props.uri)(state),
collectionPending: makeSelectClaimIsPending(props.collectionId)(state),
};
};
const perform = (dispatch) => ({
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
});
export default connect(select, perform)(CollectionSelectItem);
@@ -0,0 +1,59 @@
// @flow
import * as ICONS from 'constants/icons';
import React from 'react';
import { FormField } from 'component/common/form';
import Icon from 'component/common/icon';
import { COLLECTIONS_CONSTS } from 'lbry-redux';
type Props = {
collection: Collection,
hasClaim: boolean,
category: string,
edited: boolean,
editCollection: (string, CollectionEditParams) => void,
claim: Claim,
collectionPending: Collection,
};
function CollectionSelectItem(props: Props) {
const { collection, hasClaim, category, editCollection, claim, collectionPending } = props;
const { name, id } = collection;
const handleChange = (e) => {
editCollection(id, { claims: [claim], remove: hasClaim });
};
let icon;
switch (category) {
case 'builtin':
icon = id === COLLECTIONS_CONSTS.WATCH_LATER_ID ? ICONS.TIME : ICONS.STACK;
break;
case 'published':
icon = ICONS.STACK;
break;
default:
// 'unpublished'
icon = ICONS.LOCK;
break;
}
return (
<div className={'collection-select__item'}>
<FormField
checked={hasClaim}
disabled={collectionPending}
icon={icon}
type="checkbox"
name={`select-${id}`}
onChange={handleChange} // edit the collection
label={
<span>
<Icon icon={icon} className={'icon-collection-select'} />
{`${name}`}
</span>
} // the collection name
/>
</div>
);
}
export default CollectionSelectItem;
+17
View File
@@ -0,0 +1,17 @@
import { connect } from 'react-redux';
import {
selectBuiltinCollections,
selectMyPublishedPlaylistCollections,
selectMyUnpublishedCollections, // should probably distinguish types
// selectSavedCollections,
} from 'lbry-redux';
import CollectionsListMine from './view';
const select = (state) => ({
builtinCollections: selectBuiltinCollections(state),
publishedPlaylists: selectMyPublishedPlaylistCollections(state),
unpublishedCollections: selectMyUnpublishedCollections(state),
// savedCollections: selectSavedCollections(state),
});
export default connect(select)(CollectionsListMine);
+141
View File
@@ -0,0 +1,141 @@
// @flow
import React from 'react';
import CollectionPreviewTile from 'component/collectionPreviewTile';
import ClaimList from 'component/claimList';
import Button from 'component/button';
import { COLLECTIONS_CONSTS } from 'lbry-redux';
import Icon from 'component/common/icon';
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
import Yrbl from 'component/yrbl';
import usePersistedState from 'effects/use-persisted-state';
import Card from 'component/common/card';
import classnames from 'classnames';
type Props = {
builtinCollections: CollectionGroup,
publishedCollections: CollectionGroup,
publishedPlaylists: CollectionGroup,
unpublishedCollections: CollectionGroup,
// savedCollections: CollectionGroup,
};
export default function CollectionsListMine(props: Props) {
const {
builtinCollections,
publishedPlaylists,
unpublishedCollections,
// savedCollections, these are resolved on startup from sync'd claimIds or urls
} = props;
const builtinCollectionsList = (Object.values(builtinCollections || {}): any);
const unpublishedCollectionsList = (Object.keys(unpublishedCollections || {}): any);
const publishedList = (Object.keys(publishedPlaylists || {}): any);
const hasCollections = unpublishedCollectionsList.length || publishedList.length;
const watchLater = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID);
const favorites = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.FAVORITES_ID);
const builtin = [watchLater, favorites];
const [showHelp, setShowHelp] = usePersistedState('livestream-help-seen', true);
const helpText = (
<div className="section__subtitle">
<p>{__(`Everyone starts with 2 private lists - Watch Later and Favorites.`)}</p>
<p>{__(`Add content to existing lists or new lists from content pages or content previews.`)}</p>
<p>
{__(
`By default, lists are private. You can edit them and later publish them from the Lists page or the Publish context menu on this page. Similar to uploads, small blockchain fees apply.`
)}
</p>
</div>
);
return (
<>
{builtin.map((list: Collection) => {
const { items: itemUrls } = list;
return (
<div className="claim-grid__wrapper" key={list.name}>
<>
{Boolean(itemUrls && itemUrls.length) && (
<>
<h1 className="claim-grid__header">
<Button
className="claim-grid__title"
button="link"
navigate={`/$/${PAGES.LIST}/${list.id}`}
label={
<span className="claim-grid__title-span">
{list.name}
<div className="claim-grid__title--empty">
<Icon className="icon--margin-right" icon={ICONS.STACK} />
{itemUrls.length}
</div>
</span>
}
/>
</h1>
<ClaimList tileLayout key={list.name} uris={itemUrls.slice(0, 6)} collectionId={list.id} />
</>
)}
{!(itemUrls && itemUrls.length) && (
<h1 className="claim-grid__header claim-grid__title">
{__('%collection_name%', { collection_name: list.name })}{' '}
<div className="claim-grid__title--empty">(Empty)</div>
</h1>
)}
</>
</div>
);
})}
<div className="claim-grid__wrapper">
<div className="claim-grid__header claim-grid__header--between section">
<h1 className="claim-grid__title">
{__('Playlists')}
{!hasCollections && <div className="claim-grid__title--empty">(Empty)</div>}
</h1>
<Button button="link" onClick={() => setShowHelp(!showHelp)} label={__('How does this work?')} />
</div>
{showHelp && (
<Card
titleActions={<Button button="close" icon={ICONS.REMOVE} onClick={() => setShowHelp(false)} />}
title={__('Introducing Lists')}
actions={helpText}
/>
)}
{Boolean(hasCollections) && (
<div
className={classnames({
section: showHelp,
})}
>
{/* TODO: fix above spacing hack */}
<div className="claim-grid">
{unpublishedCollectionsList &&
unpublishedCollectionsList.length > 0 &&
unpublishedCollectionsList.map((key) => (
<CollectionPreviewTile tileLayout collectionId={key} key={key} />
))}
{publishedList &&
publishedList.length > 0 &&
publishedList.map((key) => <CollectionPreviewTile tileLayout collectionId={key} key={key} />)}
</div>
</div>
)}
{!hasCollections && (
<div className="main--empty">
<Yrbl
type={'sad'}
title={__('You have no lists yet. Better start hoarding!')}
// actions={
// <div className="section__actions">
// <Button button="primary" label={__('View Content')} onClick={() => setViewBlockedChannel(true)} />
// </div>
// }
/>
</div>
)}
</div>
</>
);
}
+2 -1
View File
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { makeSelectStakedLevelForChannelUri, makeSelectThumbnailForUri, selectMyChannelClaims } from 'lbry-redux';
import { makeSelectStakedLevelForChannelUri, makeSelectClaimForUri, makeSelectThumbnailForUri, selectMyChannelClaims } from 'lbry-redux';
import { doCommentUpdate } from 'redux/actions/comments';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { doToast } from 'redux/actions/notifications';
@@ -11,6 +11,7 @@ import { selectPlayingUri } from 'redux/selectors/content';
import Comment from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
thumbnail: props.authorUri && makeSelectThumbnailForUri(props.authorUri)(state),
channelIsBlocked: props.authorUri && makeSelectChannelIsMuted(props.authorUri)(state),
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
+42 -40
View File
@@ -21,10 +21,12 @@ import { useHistory } from 'react-router';
import CommentCreate from 'component/commentCreate';
import CommentMenuList from 'component/commentMenuList';
import UriIndicator from 'component/uriIndicator';
import CreditAmount from 'component/common/credit-amount';
type Props = {
clearPlayingUri: () => void,
uri: string,
claim: StreamClaim,
author: ?string, // LBRY Channel Name, e.g. @channel
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
commentId: string, // sha256 digest identifying the comment
@@ -50,7 +52,7 @@ type Props = {
activeChannelClaim: ?ChannelClaim,
playingUri: ?PlayingUri,
stakedLevel: number,
livestream?: boolean,
supportAmount: number,
};
const LENGTH_TO_COLLAPSE = 300;
@@ -59,6 +61,7 @@ const ESCAPE_KEY = 27;
function Comment(props: Props) {
const {
clearPlayingUri,
claim,
uri,
author,
authorUri,
@@ -78,7 +81,7 @@ function Comment(props: Props) {
othersReacts,
playingUri,
stakedLevel,
livestream,
supportAmount,
} = props;
const {
push,
@@ -98,6 +101,7 @@ function Comment(props: Props) {
const dislikesCount = (othersReacts && othersReacts.dislike) || 0;
const totalLikesAndDislikes = likesCount + dislikesCount;
const slimedToDeath = totalLikesAndDislikes >= 5 && dislikesCount / totalLikesAndDislikes > 0.8;
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
let channelOwnerOfContent;
try {
@@ -164,7 +168,7 @@ function Comment(props: Props) {
className={classnames('comment', {
'comment--top-level': isTopLevel,
'comment--reply': !isTopLevel,
'comment--livestream': livestream,
'comment--superchat': supportAmount > 0,
})}
id={commentId}
onMouseOver={() => setMouseHover(true)}
@@ -176,36 +180,35 @@ function Comment(props: Props) {
'comment--slimed': slimedToDeath && !displayDeadComment,
})}
>
{!livestream && (
<div className="comment__thumbnail-wrapper">
{authorUri ? (
<ChannelThumbnail
uri={authorUri}
obscure={channelIsBlocked}
small
className="comment__author-thumbnail"
/>
) : (
<ChannelThumbnail small className="comment__author-thumbnail" />
)}
</div>
)}
<div className="comment__thumbnail-wrapper">
{authorUri ? (
<ChannelThumbnail uri={authorUri} obscure={channelIsBlocked} small className="comment__author-thumbnail" />
) : (
<ChannelThumbnail small className="comment__author-thumbnail" />
)}
</div>
<div className="comment__body_container">
<div className="comment__body-container">
<div className="comment__meta">
<div className="comment__meta-information">
{!author ? (
<span className="comment__author">{__('Anonymous')}</span>
) : (
<UriIndicator link external={livestream} uri={authorUri} />
)}
{!livestream && (
<Button
className="comment__time"
onClick={handleTimeClick}
label={<DateTime date={timePosted} timeAgo />}
<UriIndicator
className={classnames('comment__author', {
'comment__author--creator': commentByOwnerOfContent,
})}
link
uri={authorUri}
/>
)}
<Button
className="comment__time"
onClick={handleTimeClick}
label={<DateTime date={timePosted} timeAgo />}
/>
{supportAmount > 0 && <CreditAmount amount={supportAmount} superChatLight size={12} />}
{isPinned && (
<span className="comment__pin">
@@ -241,6 +244,7 @@ function Comment(props: Props) {
{isEditing ? (
<Form onSubmit={handleSubmit}>
<FormField
className="comment__edit-input"
type={!SIMPLE_SITE && advancedEditor ? 'markdown' : 'textarea'}
name="editing_comment"
value={editedMessage}
@@ -248,7 +252,7 @@ function Comment(props: Props) {
onChange={handleEditMessageChanged}
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
/>
<div className="section__actions">
<div className="section__actions section__actions--no-margin">
<Button
button="primary"
type="submit"
@@ -285,20 +289,18 @@ function Comment(props: Props) {
)}
</div>
{!livestream && (
<div className="comment__actions">
{threadDepth !== 0 && (
<Button
requiresAuth={IS_WEB}
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
className="comment__action"
onClick={handleCommentReply}
icon={ICONS.REPLY}
/>
)}
{ENABLE_COMMENT_REACTIONS && <CommentReactions uri={uri} commentId={commentId} />}
</div>
)}
<div className="comment__actions">
{threadDepth !== 0 && (
<Button
requiresAuth={IS_WEB}
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
className="comment__action"
onClick={handleCommentReply}
icon={ICONS.REPLY}
/>
)}
{ENABLE_COMMENT_REACTIONS && <CommentReactions uri={uri} commentId={commentId} />}
</div>
{isReplying && (
<CommentCreate
+4 -4
View File
@@ -4,8 +4,8 @@ import {
makeSelectClaimIsMine,
selectMyChannelClaims,
selectFetchingMyChannels,
doSendTip,
} from 'lbry-redux';
import { selectIsPostingComment } from 'redux/selectors/comments';
import { doOpenModal, doSetActiveChannel } from 'redux/actions/app';
import { doCommentCreate } from 'redux/actions/comments';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
@@ -18,17 +18,17 @@ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
channels: selectMyChannelClaims(state),
isFetchingChannels: selectFetchingMyChannels(state),
isPostingComment: selectIsPostingComment(state),
activeChannelClaim: selectActiveChannelClaim(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
});
const perform = (dispatch, ownProps) => ({
createComment: (comment, claimId, parentId) =>
dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri, ownProps.livestream)),
createComment: (comment, claimId, parentId, txid) =>
dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri, ownProps.livestream, txid)),
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
toast: (message) => dispatch(doToast({ message, isError: true })),
sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)),
});
export default connect(select, perform)(CommentCreate);
+161 -74
View File
@@ -1,7 +1,9 @@
// @flow
import type { ElementRef } from 'react';
import { SIMPLE_SITE } from 'config';
import * as PAGES from 'constants/pages';
import React, { useEffect, useState } from 'react';
import * as ICONS from 'constants/icons';
import React from 'react';
import classnames from 'classnames';
import { FormField, Form } from 'component/common/form';
import Button from 'component/button';
@@ -9,17 +11,12 @@ import SelectChannel from 'component/selectChannel';
import usePersistedState from 'effects/use-persisted-state';
import { FF_MAX_CHARS_IN_COMMENT, FF_MAX_CHARS_IN_LIVESTREAM_COMMENT } from 'constants/form-field';
import { useHistory } from 'react-router';
import type { ElementRef } from 'react';
import emoji from 'emoji-dictionary';
import WalletTipAmountSelector from 'component/walletTipAmountSelector';
import CreditAmount from 'component/common/credit-amount';
import ChannelThumbnail from 'component/channelThumbnail';
import UriIndicator from 'component/uriIndicator';
const COMMENT_SLOW_MODE_SECONDS = 5;
const LIVESTREAM_EMOJIS = [
emoji.getUnicode('rocket'),
emoji.getUnicode('jeans'),
emoji.getUnicode('fire'),
emoji.getUnicode('heart'),
emoji.getUnicode('open_mouth'),
];
type Props = {
uri: string,
@@ -32,15 +29,16 @@ type Props = {
isFetchingChannels: boolean,
parentId: string,
isReply: boolean,
isPostingComment: boolean,
activeChannel: string,
activeChannelClaim: ?ChannelClaim,
bottom: boolean,
onSubmit: (string, string) => void,
livestream: boolean,
authenticated: boolean,
embed?: boolean,
toast: (string) => void,
claimIsMine: boolean,
sendTip: ({}, (any) => void, (any) => void) => void,
justCommented: Array<string>,
commentingEnabled: boolean,
};
@@ -55,29 +53,35 @@ export function CommentCreate(props: Props) {
isFetchingChannels,
isReply,
parentId,
isPostingComment,
activeChannelClaim,
onSubmit,
bottom,
livestream,
authenticated,
embed,
toast,
claimIsMine,
sendTip,
commentingEnabled,
justCommented,
} = props;
const buttonref: ElementRef<any> = React.useRef();
const {
push,
location: { pathname },
} = useHistory();
const [isSubmitting, setIsSubmitting] = React.useState(false);
const [commentFailure, setCommentFailure] = React.useState(false);
const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });
const { claim_id: claimId } = claim;
const [isSupportComment, setIsSupportComment] = React.useState();
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
const [tipAmount, setTipAmount] = React.useState(1);
const [commentValue, setCommentValue] = React.useState('');
const [lastCommentTime, setLastCommentTime] = React.useState();
const [charCount, setCharCount] = useState(commentValue.length);
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
const hasChannels = channels && channels.length;
const disabled = isPostingComment || !activeChannelClaim || !commentValue.length;
const disabled = isSubmitting || !activeChannelClaim || !commentValue.length;
const charCount = commentValue.length;
function handleCommentChange(event) {
let commentValue;
@@ -117,10 +121,58 @@ export function CommentCreate(props: Props) {
return;
}
createComment(commentValue, claimId, parentId).then((res) => {
handleCreateComment();
}
}
function handleSupportComment() {
if (!activeChannelClaim) {
return;
}
if (commentFailure && tipAmount === successTip.tipAmount) {
handleCreateComment(successTip.txid);
return;
} else {
setSuccessTip({ txid: undefined, tipAmount: undefined });
}
const params = {
amount: tipAmount,
claim_id: claimId,
channel_id: activeChannelClaim.claim_id,
};
setIsSubmitting(true);
sendTip(
params,
(response) => {
const { txid } = response;
setTimeout(() => {
handleCreateComment(txid);
}, 1500);
setSuccessTip({ txid, tipAmount });
},
() => {
setIsSubmitting(false);
}
);
}
function handleCreateComment(txid) {
setIsSubmitting(true);
createComment(commentValue, claimId, parentId, txid)
.then((res) => {
setIsSubmitting(false);
if (res && res.signature) {
setCommentValue('');
setLastCommentTime(Date.now());
setIsReviewingSupportComment(false);
setIsSupportComment(false);
setCommentFailure(false);
justCommented.push(res.comment_id);
if (onSubmit) {
onSubmit(commentValue, activeChannelClaim.name);
@@ -130,27 +182,34 @@ export function CommentCreate(props: Props) {
onDoneReplying();
}
}
})
.catch(() => {
setIsSubmitting(false);
setCommentFailure(true);
});
}
}
function toggleEditorMode() {
setAdvancedEditor(!advancedEditor);
}
useEffect(() => setCharCount(commentValue.length), [commentValue]);
if (!commentingEnabled || !hasChannels) {
return (
<div
role="button"
onClick={() =>
embed
? window.open(`https://odysee.com/$/${PAGES.AUTH}?redirect=/$/${PAGES.LIVESTREAM}`)
: authenticated
? push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`)
: push(`/$/${PAGES.AUTH}?redirect=${pathname}`)
}
onClick={() => {
if (embed) {
window.open(`https://odysee.com/$/${PAGES.AUTH}?redirect=/$/${PAGES.LIVESTREAM}`);
return;
}
const pathPlusRedirect = `/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`;
if (livestream) {
window.open(pathPlusRedirect);
} else {
push(pathPlusRedirect);
}
}}
>
<FormField
type="textarea"
@@ -158,8 +217,34 @@ export function CommentCreate(props: Props) {
placeholder={__('Say something about this...')}
label={isFetchingChannels ? __('Comment') : undefined}
/>
<div className="section__actions">
<Button disabled button="primary" label={__('Post --[button to submit something]--')} />
<div className="section__actions--no-margin">
<Button disabled button="primary" label={__('Post --[button to submit something]--')} requiresAuth={IS_WEB} />
</div>
</div>
);
}
if (isReviewingSupportComment && activeChannelClaim) {
return (
<div className="comment__create">
<div className="comment__sc-preview">
<CreditAmount className="comment__scpreview-amount" amount={tipAmount} size={18} />
<ChannelThumbnail xsmall uri={activeChannelClaim.canonical_url} />
<div>
<UriIndicator uri={activeChannelClaim.name} link />
<div>{commentValue}</div>
</div>
</div>
<div className="section__actions--no-margin">
<Button
autoFocus
button="primary"
disabled={disabled}
label={isSubmitting ? __('Sending...') : (commentFailure && tipAmount === successTip.tipAmount) ? __('Re-submit') : __('Send')}
onClick={handleSupportComment}
/>
<Button button="link" label={__('Cancel')} onClick={() => setIsReviewingSupportComment(false)} />
</div>
</div>
);
@@ -180,7 +265,9 @@ export function CommentCreate(props: Props) {
name={isReply ? 'content_reply' : 'content_description'}
label={
<span className="comment-new__label-wrapper">
<div className="comment-new__label">{isReply ? __('Replying as') + ' ' : __('Comment as') + ' '}</div>
{!livestream && (
<div className="comment-new__label">{isReply ? __('Replying as') + ' ' : __('Comment as') + ' '}</div>
)}
<SelectChannel tiny />
</span>
}
@@ -197,54 +284,54 @@ export function CommentCreate(props: Props) {
autoFocus={isReply}
textAreaMaxLength={livestream ? FF_MAX_CHARS_IN_LIVESTREAM_COMMENT : FF_MAX_CHARS_IN_COMMENT}
/>
{livestream && hasChannels && (
<div className="livestream__emoji-actions">
{LIVESTREAM_EMOJIS.map((emoji) => (
{isSupportComment && <WalletTipAmountSelector amount={tipAmount} onChange={(amount) => setTipAmount(amount)} />}
<div className="section__actions section__actions--no-margin">
{isSupportComment ? (
<>
<Button
key={emoji}
disabled={isPostingComment}
disabled={disabled}
type="button"
button="alt"
className="button--emoji"
label={emoji}
onClick={() => {
setCommentValue(commentValue ? `${commentValue} ${emoji}` : emoji);
}}
button="primary"
icon={ICONS.LBC}
label={__('Review')}
onClick={() => setIsReviewingSupportComment(true)}
/>
))}
</div>
)}
<div
className={classnames('section__actions', {
'section__actions--no-margin': !livestream,
})}
>
<Button
ref={buttonref}
button="primary"
disabled={disabled}
type="submit"
label={
isReply
? isPostingComment
? __('Replying...')
: __('Reply')
: isPostingComment
? __('Posting...')
: __('Post --[button to submit something]--')
}
requiresAuth={IS_WEB}
/>
{isReply && (
<Button
button="link"
label={__('Cancel')}
onClick={() => {
if (onCancelReplying) {
onCancelReplying();
<Button disabled={disabled} button="link" label={__('Cancel')} onClick={() => setIsSupportComment(false)} />
</>
) : (
<>
<Button
ref={buttonref}
button="primary"
disabled={disabled}
type="submit"
label={
isReply
? isSubmitting
? __('Replying...')
: __('Reply')
: isSubmitting
? __('Commenting...')
: __('Comment --[button to submit something]--')
}
}}
/>
requiresAuth={IS_WEB}
/>
{!claimIsMine && (
<Button disabled={disabled} button="alt" icon={ICONS.LBC} onClick={() => setIsSupportComment(true)} />
)}
{isReply && (
<Button
button="link"
label={__('Cancel')}
onClick={() => {
if (onCancelReplying) {
onCancelReplying();
}
}}
/>
)}
</>
)}
</div>
</Form>
+2 -2
View File
@@ -1,7 +1,7 @@
import { connect } from 'react-redux';
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
import { doCommentAbandon, doCommentPin, doCommentList, doCommentModBlock } from 'redux/actions/comments';
import { doToggleMuteChannel } from 'redux/actions/blocked';
import { doChannelMute } from 'redux/actions/blocked';
// import { doSetActiveChannel } from 'redux/actions/app';
import { doSetPlayingUri } from 'redux/actions/content';
import { selectActiveChannelClaim } from 'redux/selectors/app';
@@ -19,7 +19,7 @@ const select = (state, props) => ({
const perform = (dispatch) => ({
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
deleteComment: (commentId, creatorChannelUrl) => dispatch(doCommentAbandon(commentId, creatorChannelUrl)),
blockChannel: (channelUri) => dispatch(doToggleMuteChannel(channelUri)),
muteChannel: (channelUri) => dispatch(doChannelMute(channelUri)),
pinComment: (commentId, remove) => dispatch(doCommentPin(commentId, remove)),
fetchComments: (uri) => dispatch(doCommentList(uri)),
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
+11 -11
View File
@@ -10,21 +10,21 @@ type Props = {
clearPlayingUri: () => void,
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
commentId: string, // sha256 digest identifying the comment
claimIsMine: boolean, // if you control the claim which this comment was posted on
commentIsMine: boolean, // if this comment was signed by an owned channel
deleteComment: (string, ?string) => void,
linkedComment?: any,
isPinned: boolean,
pinComment: (string, boolean) => Promise<any>,
blockChannel: (string) => void,
muteChannel: (string) => void,
fetchComments: (string) => void,
handleEditComment: () => void,
contentChannelPermanentUrl: any,
activeChannelClaim: ?ChannelClaim,
claimIsMine: boolean,
isTopLevel: boolean,
commentModBlock: (string) => void,
playingUri: ?PlayingUri,
disableEdit?: boolean,
disableRemove?: boolean,
};
function CommentMenuList(props: Props) {
@@ -34,9 +34,8 @@ function CommentMenuList(props: Props) {
commentIsMine,
commentId,
deleteComment,
blockChannel,
muteChannel,
pinComment,
claimIsMine,
clearPlayingUri,
activeChannelClaim,
contentChannelPermanentUrl,
@@ -46,6 +45,8 @@ function CommentMenuList(props: Props) {
fetchComments,
commentModBlock,
playingUri,
disableEdit,
disableRemove,
} = props;
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
@@ -61,13 +62,11 @@ function CommentMenuList(props: Props) {
}
function handleCommentBlock() {
if (claimIsMine) {
commentModBlock(authorUri);
}
commentModBlock(authorUri);
}
function handleCommentMute() {
blockChannel(authorUri);
muteChannel(authorUri);
}
return (
@@ -86,7 +85,8 @@ function CommentMenuList(props: Props) {
</MenuItem>
)}
{activeChannelClaim &&
{!disableRemove &&
activeChannelClaim &&
(activeChannelClaim.permanent_url === authorUri ||
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
@@ -97,7 +97,7 @@ function CommentMenuList(props: Props) {
</MenuItem>
)}
{commentIsMine && activeChannelClaim && activeChannelClaim.permanent_url === authorUri && (
{commentIsMine && activeChannelClaim && activeChannelClaim.permanent_url === authorUri && !disableEdit && (
<MenuItem className="comment__menu-option menu__link" onSelect={handleEditComment}>
<Icon aria-hidden icon={ICONS.EDIT} />
{__('Edit')}
+10 -8
View File
@@ -16,8 +16,8 @@ import Empty from 'component/common/empty';
type Props = {
comments: Array<Comment>,
fetchComments: string => void,
fetchReacts: string => Promise<any>,
fetchComments: (string) => void,
fetchReacts: (string) => Promise<any>,
uri: string,
claimIsMine: boolean,
myChannels: ?Array<ChannelClaim>,
@@ -58,6 +58,7 @@ function CommentList(props: Props) {
const [readyToDisplayComments, setReadyToDisplayComments] = React.useState(
Boolean(reactionsById) || !ENABLE_COMMENT_REACTIONS
);
const [justCommented] = React.useState([]);
const linkedCommentId = linkedComment && linkedComment.comment_id;
const hasNoComments = !totalComments;
const moreBelow = totalComments - end > 0;
@@ -129,11 +130,11 @@ function CommentList(props: Props) {
if (linkedComment) {
if (!linkedComment.parent_id) {
orderedComments = arrayOfComments.filter(c => c.comment_id !== linkedComment.comment_id);
orderedComments = arrayOfComments.filter((c) => c.comment_id !== linkedComment.comment_id);
orderedComments.unshift(linkedComment);
} else {
const parentComment = arrayOfComments.find(c => c.comment_id === linkedComment.parent_id);
orderedComments = arrayOfComments.filter(c => c.comment_id !== linkedComment.parent_id);
const parentComment = arrayOfComments.find((c) => c.comment_id === linkedComment.parent_id);
orderedComments = arrayOfComments.filter((c) => c.comment_id !== linkedComment.parent_id);
if (parentComment) {
orderedComments.unshift(parentComment);
@@ -146,7 +147,7 @@ function CommentList(props: Props) {
}
// Default to newest first for apps that don't have comment reactions
const sortedComments = reactionsById ? sortComments({ comments, reactionsById, sort, isMyComment }) : [];
const sortedComments = reactionsById ? sortComments({ comments, reactionsById, sort, isMyComment, justCommented }) : [];
const displayedComments = readyToDisplayComments
? prepareComments(sortedComments, linkedComment).slice(start, end)
: [];
@@ -209,7 +210,7 @@ function CommentList(props: Props) {
}
actions={
<>
<CommentCreate uri={uri} />
<CommentCreate uri={uri} justCommented={justCommented} />
{!isFetchingComments && hasNoComments && (
<Empty padded text={__('That was pretty deep. What do you think?')} />
@@ -218,7 +219,7 @@ function CommentList(props: Props) {
<ul className="comments" ref={commentRef}>
{comments &&
displayedComments &&
displayedComments.map(comment => {
displayedComments.map((comment) => {
return (
<CommentView
isTopLevel
@@ -235,6 +236,7 @@ function CommentList(props: Props) {
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
linkedComment={linkedComment}
isPinned={comment.is_pinned}
supportAmount={comment.support_amount}
/>
);
})}
+2 -1
View File
@@ -22,7 +22,7 @@ function CommentsReplies(props: Props) {
const sortedComments = comments ? [...comments].reverse() : [];
const numberOfComments = comments ? comments.length : 0;
const linkedCommentId = linkedComment ? linkedComment.comment_id : '';
const commentsIndexOfLInked = comments && sortedComments.findIndex(e => e.comment_id === linkedCommentId);
const commentsIndexOfLInked = comments && sortedComments.findIndex((e) => e.comment_id === linkedCommentId);
function showMore() {
if (start > 0) {
@@ -105,6 +105,7 @@ function CommentsReplies(props: Props) {
linkedComment={linkedComment}
commentingEnabled={commentingEnabled}
handleCommentDone={handleCommentDone}
supportAmount={comment.support_amount}
/>
);
})}
+67 -51
View File
@@ -21,7 +21,8 @@ type Props = {
nag?: Node,
smallTitle?: boolean,
onClick?: () => void,
children?: any, // not sure how this works
children?: Node,
secondPane?: Node,
};
export default function Card(props: Props) {
@@ -41,74 +42,89 @@ export default function Card(props: Props) {
nag,
onClick,
children,
secondPane,
} = props;
const [expanded, setExpanded] = useState(defaultExpand);
const expandable = defaultExpand !== undefined;
return (
<section
className={classnames(className, 'card')}
onClick={() => {
role={onClick ? 'button' : undefined}
className={classnames(className, 'card', {
'card__multi-pane': Boolean(secondPane),
})}
onClick={(e) => {
if (onClick) {
onClick();
e.stopPropagation();
}
}}
>
{(title || subtitle) && (
<div
className={classnames('card__header--between', {
'card__header--nowrap': noTitleWrap,
})}
>
<div>
{(title || subtitle) && (
<div
className={classnames('card__title-section', {
'card__title-section--body-list': isBodyList,
'card__title-section--small': smallTitle,
className={classnames('card__header--between', {
'card__header--nowrap': noTitleWrap,
})}
>
{icon && <Icon sectionIcon icon={icon} />}
<div>
{isPageTitle && <h1 className="card__title">{title}</h1>}
{!isPageTitle && (
<h2 className={classnames('card__title', { 'card__title--small': smallTitle })}>{title}</h2>
)}
{subtitle && <div className="card__subtitle">{subtitle}</div>}
</div>
</div>
<div>
{titleActions && <div className="card__title-actions">{titleActions}</div>}
{expandable && (
<div className="card__title-actions">
<Button
button="alt"
aria-expanded={expanded}
aria-label={expanded ? __('Less') : __('More')}
icon={expanded ? ICONS.SUBTRACT : ICONS.ADD}
onClick={() => setExpanded(!expanded)}
/>
</div>
)}
</div>
</div>
)}
{(!expandable || (expandable && expanded)) && (
<>
{body && (
<div
className={classnames('card__body', {
'card__body--no-title': !title && !subtitle,
'card__body--list': isBodyList,
className={classnames('card__title-section', {
'card__title-section--body-list': isBodyList,
'card__title-section--small': smallTitle,
})}
>
{body}
{icon && <Icon sectionIcon icon={icon} />}
<div>
{isPageTitle && <h1 className="card__title">{title}</h1>}
{!isPageTitle && (
<h2 className={classnames('card__title', { 'card__title--small': smallTitle })}>{title}</h2>
)}
{subtitle && <div className="card__subtitle">{subtitle}</div>}
</div>
</div>
)}
{actions && <div className="card__main-actions">{actions}</div>}
{children && <div className="card__main-actions">{children}</div>}
</>
)}
{nag}
<div className="card__title-actions-container">
{titleActions && (
<div
className={classnames('card__title-actions', {
'card__title-actions--small': smallTitle,
})}
>
{titleActions}
</div>
)}
{expandable && (
<div className="card__title-actions">
<Button
button="alt"
aria-expanded={expanded}
aria-label={expanded ? __('Less') : __('More')}
icon={expanded ? ICONS.SUBTRACT : ICONS.ADD}
onClick={() => setExpanded(!expanded)}
/>
</div>
)}
</div>
</div>
)}
{(!expandable || (expandable && expanded)) && (
<>
{body && (
<div
className={classnames('card__body', {
'card__body--no-title': !title && !subtitle,
'card__body--list': isBodyList,
})}
>
{body}
</div>
)}
{actions && <div className="card__main-actions">{actions}</div>}
{children && <div className="card__main-actions">{children}</div>}
</>
)}
{nag}
</div>
{secondPane && <div className="card__second-pane">{secondPane}</div>}
</section>
);
}
+14 -3
View File
@@ -15,6 +15,9 @@ type Props = {
fee?: boolean,
className?: string,
noFormat?: boolean,
size?: number,
superChat?: boolean,
superChatLight?: boolean,
};
class CreditAmount extends React.PureComponent<Props> {
@@ -39,8 +42,10 @@ class CreditAmount extends React.PureComponent<Props> {
showLBC,
className,
noFormat,
size,
superChat,
superChatLight,
} = this.props;
const minimumRenderableAmount = 10 ** (-1 * precision);
const fullPrice = formatFullPrice(amount, 2);
const isFree = parseFloat(amount) === 0;
@@ -66,7 +71,7 @@ class CreditAmount extends React.PureComponent<Props> {
}
if (showLBC) {
amountText = <LbcSymbol postfix={amountText} />;
amountText = <LbcSymbol postfix={amountText} size={size} />;
}
if (fee) {
@@ -75,7 +80,13 @@ class CreditAmount extends React.PureComponent<Props> {
}
return (
<span title={fullPrice} className={classnames(className, {})}>
<span
title={fullPrice}
className={classnames(className, {
'super-chat': superChat,
'super-chat--light': superChatLight,
})}
>
<span className="credit-amount">{amountText}</span>
{isEstimate ? (
+66 -72
View File
@@ -3,92 +3,86 @@ import * as ICONS from 'constants/icons';
import React from 'react';
import Button from 'component/button';
import parseData from 'util/parse-data';
import { remote } from 'electron';
import path from 'path';
// @if TARGET='app'
import fs from 'fs';
// @endif
import Spinner from 'component/spinner';
type Props = {
data: Array<any>,
title: string,
data: any,
label: string,
defaultPath?: string,
filters: Array<string>,
onFileCreated?: string => void,
disabled: boolean,
tooltip?: string,
defaultFileName?: string,
filters?: Array<string>,
onFetch?: () => void,
progressMsg?: string,
disabled?: boolean,
};
class FileExporter extends React.PureComponent<Props> {
static defaultProps = {
filters: [],
};
constructor() {
super();
(this: any).handleButtonClick = this.handleButtonClick.bind(this);
(this: any).handleDownload = this.handleDownload.bind(this);
}
handleFileCreation(filename: string, data: any) {
const { onFileCreated } = this.props;
// @if TARGET='app'
fs.writeFile(filename, data, err => {
if (err) throw err;
// Do something after creation
handleDownload() {
const { data, defaultFileName } = this.props;
if (onFileCreated) {
onFileCreated(filename);
}
});
// @endif
}
handleButtonClick() {
const { title, data, defaultPath, filters } = this.props;
const options = {
title,
defaultPath,
filters: [
{
name: 'CSV',
extensions: ['csv'],
},
{
name: 'JSON',
extensions: ['json'],
},
],
};
remote.dialog.showSaveDialog(remote.getCurrentWindow(), options, filename => {
// User hit cancel so do nothing:
if (!filename) return;
// Get extension and remove initial dot
// @if TARGET='app'
const format = path.extname(filename).replace(/\./g, '');
// @endif
// Parse data to string with the chosen format
const parsed = parseData(data, format, filters);
// Write file
if (parsed) {
this.handleFileCreation(filename, parsed);
}
});
const element = document.createElement('a');
const file = new Blob([data], { type: 'text/plain' });
element.href = URL.createObjectURL(file);
element.download = defaultFileName || 'file.txt';
// $FlowFixMe
document.body.appendChild(element);
element.click();
// $FlowFixMe
document.body.removeChild(element);
}
render() {
const { label, disabled } = this.props;
return (
<Button
button="primary"
disabled={disabled}
icon={ICONS.DOWNLOAD}
label={label || __('Export')}
onClick={this.handleButtonClick}
/>
);
const { data, label, tooltip, disabled, onFetch, progressMsg } = this.props;
if (onFetch) {
return (
<>
{!progressMsg && (
<div className="button-group">
<Button
button="alt"
disabled={disabled}
icon={ICONS.FETCH}
label={label}
aria-label={tooltip}
onClick={() => onFetch()}
/>
{data && (
<Button
button="alt"
disabled={disabled}
icon={ICONS.DOWNLOAD}
aria-label={__('Download fetched file')}
onClick={this.handleDownload}
/>
)}
</div>
)}
{progressMsg && (
<>
{__(progressMsg)}
<Spinner type="small" />
</>
)}
</>
);
} else {
return (
<Button
button="primary"
disabled={disabled}
icon={ICONS.DOWNLOAD}
label={label || __('Export')}
aria-label={tooltip}
onClick={this.handleDownload}
/>
);
}
}
}
@@ -3,13 +3,13 @@ import * as React from 'react';
import { FormField } from './form-field';
type FormPrice = {
amount: ?number,
amount: number,
currency: string,
};
type Props = {
price: FormPrice,
onChange: FormPrice => void,
onChange: (FormPrice) => void,
placeholder: number,
min: number,
disabled: boolean,
@@ -27,7 +27,7 @@ export class FormFieldPrice extends React.PureComponent<Props> {
handleAmountChange(event: SyntheticInputEvent<*>) {
const { price, onChange } = this.props;
const amount = event.target.value ? parseFloat(event.target.value) : undefined;
const amount = event.target.value ? parseFloat(event.target.value) : 0;
onChange({
currency: price.currency,
amount,
@@ -54,7 +54,7 @@ export class FormFieldPrice extends React.PureComponent<Props> {
className="form-field--price-amount"
min={min}
value={price.amount}
onWheel={e => e.preventDefault()}
onWheel={(e) => e.preventDefault()}
onChange={this.handleAmountChange}
placeholder={placeholder || 5}
disabled={disabled}
@@ -8,6 +8,15 @@ import { openEditorMenu, stopContextMenu } from 'util/context-menu';
import { FF_MAX_CHARS_DEFAULT } from 'constants/form-field';
import 'easymde/dist/easymde.min.css';
import Button from 'component/button';
import emoji from 'emoji-dictionary';
const QUICK_EMOJIS = [
emoji.getUnicode('rocket'),
emoji.getUnicode('jeans'),
emoji.getUnicode('fire'),
emoji.getUnicode('heart'),
emoji.getUnicode('open_mouth'),
];
type Props = {
name: string,
@@ -26,9 +35,6 @@ type Props = {
affixClass?: string, // class applied to prefix/postfix label
autoFocus?: boolean,
labelOnLeft: boolean,
inputProps?: {
disabled?: boolean,
},
inputButton?: React$Node,
blockWrap: boolean,
charCount?: number,
@@ -38,6 +44,10 @@ type Props = {
max?: number,
quickActionLabel?: string,
quickActionHandler?: (any) => any,
disabled?: boolean,
onChange: (any) => void,
value?: string | number,
noEmojis?: boolean,
};
export class FormField extends React.PureComponent<Props> {
@@ -83,6 +93,7 @@ export class FormField extends React.PureComponent<Props> {
textAreaMaxLength,
quickActionLabel,
quickActionHandler,
noEmojis,
...inputProps
} = this.props;
const errorMessage = typeof error === 'object' ? error.message : error;
@@ -262,7 +273,25 @@ export class FormField extends React.PureComponent<Props> {
ref={this.input}
{...inputProps}
/>
{countInfo}
<div className="form-field__textarea-info">
{!noEmojis && <div className="form-field__quick-emojis">
{QUICK_EMOJIS.map((emoji) => (
<Button
key={emoji}
disabled={inputProps.disabled}
type="button"
className="button--emoji"
label={emoji}
onClick={() => {
inputProps.onChange({
target: { value: inputProps.value ? `${inputProps.value} ${emoji}` : emoji },
});
}}
/>
))}
</div>}
{countInfo}
</div>
</fieldset-section>
);
} else {
+379 -18
View File
@@ -7,6 +7,7 @@ import { v4 as uuid } from 'uuid';
type IconProps = {
size: number,
color: string,
title?: string,
};
type CustomProps = {
@@ -18,7 +19,7 @@ type CustomProps = {
// Icons with tooltips need to use this function so the ref can be properly forwarded
const buildIcon = (iconStrokes: React$Node, customSvgValues = {}) =>
forwardRef((props: IconProps, ref) => {
const { size = 24, color = 'currentColor', ...otherProps } = props;
const { size = 24, color = 'currentColor', title, ...otherProps } = props;
return (
<svg
ref={ref}
@@ -35,6 +36,7 @@ const buildIcon = (iconStrokes: React$Node, customSvgValues = {}) =>
{...customSvgValues}
>
{iconStrokes}
{title && <title>{title}</title>}
</svg>
);
});
@@ -181,6 +183,13 @@ export const icons = {
/>
</g>
),
[ICONS.FETCH]: buildIcon(
<g fill="none" fillRule="evenodd" strokeLinecap="round">
<polyline points="8 17 12 21 16 17" />
<line x1="12" y1="12" x2="12" y2="21" />
<path d="M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29" />
</g>
),
[ICONS.SUBSCRIBE]: buildIcon(
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
),
@@ -193,6 +202,19 @@ export const icons = {
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" />
</g>
),
[ICONS.FILTER]: buildIcon(
<g>
<line x1="4" y1="21" x2="4" y2="14" />
<line x1="4" y1="10" x2="4" y2="3" />
<line x1="12" y1="21" x2="12" y2="12" />
<line x1="12" y1="8" x2="12" y2="3" />
<line x1="20" y1="21" x2="20" y2="16" />
<line x1="20" y1="12" x2="20" y2="3" />
<line x1="1" y1="14" x2="7" y2="14" />
<line x1="9" y1="8" x2="15" y2="8" />
<line x1="17" y1="16" x2="23" y2="16" />
</g>
),
[ICONS.ACCOUNT]: buildIcon(
<g>
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
@@ -206,6 +228,12 @@ export const icons = {
<line x1="1" y1="10" x2="23" y2="10" />
</g>
),
[ICONS.COIN_SWAP]: buildIcon(
<g>
<path d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" />
</g>
),
[ICONS.LIBRARY]: buildIcon(<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />),
[ICONS.EDIT]: buildIcon(
<g>
@@ -357,6 +385,13 @@ export const icons = {
<line x1="12" y1="16" x2="12" y2="16" />
</g>
),
[ICONS.INFO]: buildIcon(
<g>
<circle cx="12" cy="12" r="10" />
<line x1="12" y1="8" x2="12" y2="8" />
<line x1="12" y1="12" x2="12" y2="16" />
</g>
),
[ICONS.UNLOCK]: buildIcon(
<g>
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
@@ -520,6 +555,13 @@ export const icons = {
<circle cx="12" cy="19" r="1" />
</g>
),
[ICONS.MORE]: buildIcon(
<g transform="rotate(90 12 12)">
<circle cx="12" cy="5" r="1" />
<circle cx="12" cy="12" r="1" />
<circle cx="12" cy="19" r="1" />
</g>
),
[ICONS.VALIDATED]: buildIcon(
<g>
<polyline points="20 6 9 17 4 12" />
@@ -708,22 +750,6 @@ export const icons = {
viewBox: '0 0 60 60',
}
),
[ICONS.MORE]: buildIcon(
<g>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M0 30C0 13.4315 13.4315 0 30 0C46.5685 0 60 13.4315 60 30C60 46.5685 46.5685 60 30 60C13.4315 60 0 46.5685 0 30Z"
fill="#eee"
/>
<circle cx="20" cy="30" r="2" stroke="black" fill="black" />
<circle cx="30" cy="30" r="2" stroke="black" fill="black" />
<circle cx="40" cy="30" r="2" stroke="black" fill="black" />
</g>,
{
viewBox: '0 0 60 60',
}
),
[ICONS.SHARE_LINK]: buildIcon(
<g>
<path
@@ -1645,6 +1671,36 @@ export const icons = {
</g>
</svg>
),
[ICONS.MIND_BLOWN]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 25 24"
width={props.size || '18'}
height={props.size || '16'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g transform="matrix(1,0,0,1,0,0)">
<path
d="M21.2,5a3.034,3.034,0,0,0-3.067-3,3.077,3.077,0,0,0-1.847.62,5.392,5.392,0,0,0-8.572,0A3.077,3.077,0,0,0,5.867,2,3.034,3.034,0,0,0,2.8,5"
fill="none"
/>
<path d="M2.8,5a2.251,2.251,0,1,0,0,4.5H5.5" fill="none" />
<path d="M21.2,5a2.251,2.251,0,1,1,0,4.5H18.5" fill="none" />
<path d="M8.5,7.5V9.366A3.134,3.134,0,0,1,5.366,12.5" fill="none" />
<path d="M15.5,7.5V9.366A3.134,3.134,0,0,0,18.634,12.5" fill="none" />
<path d="M10.5 8.5L10.5 10.5" fill="none" />
<path d="M13.5 8.5L13.5 10.5" fill="none" />
<path d="M8.5,15.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25" fill="none" />
<path d="M15.5,15.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25" fill="none" />
<path d="M12,17.5A1.5,1.5,0,0,0,10.5,19v1a1.5,1.5,0,0,0,3,0V19A1.5,1.5,0,0,0,12,17.5Z" fill="none" />
<path d="M18.634,12.5S18,13.5,12,13.5s-6.634-1-6.634-1a7.5,7.5,0,1,0,13.268,0Z" fill="none" />
</g>
</svg>
),
[ICONS.MOVIES]: (props: CustomProps) => (
<svg
{...props}
@@ -1681,6 +1737,7 @@ export const icons = {
viewBox="0 0 36 36"
width={props.size || '18'}
height={props.size || '16'}
className={props.className}
>
<g id="XMLID_505_">
<linearGradient
@@ -1720,7 +1777,8 @@ export const icons = {
d="M-506.9,1532.1c1.8-1.8,2.9-4.3,2.9-7.1c0-2.6-1-4.9-2.5-6.7L-506.9,1532.1z"
/>
</g>
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" /> {/* }//fill="#FFFFFF" */}
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" />
{/* }//fill="#FFFFFF" */}
<linearGradient
id="XMLID_421_"
gradientUnits="userSpaceOnUse"
@@ -1931,4 +1989,307 @@ export const icons = {
/>
</svg>
),
[ICONS.LIVESTREAM]: (props: CustomProps) => (
<svg
version="1.1"
id="Layer_1"
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
x="0px"
y="0px"
viewBox="0 0 36 36"
width={props.size || '18'}
height={props.size || '16'}
>
<g id="XMLID_505_">
<linearGradient
id="XMLID_420_"
gradientUnits="userSpaceOnUse"
x1="-519.065"
y1="1525.4059"
x2="-508.6628"
y2="1525.4059"
>
<stop offset="1.970443e-002" stopColor="#FFC200" />
<stop offset="0.3866" stopColor="#FF31BD" />
<stop offset="0.6245" stopColor="#8E31BD" />
<stop offset="0.7758" stopColor="#6E8EDE" />
<stop offset="1" stopColor="#57EABA" />
</linearGradient>
<circle
id="XMLID_508_"
fill="none"
stroke="url(XMLID_420_)"
strokeWidth="2.4678"
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit="10"
cx="-513.9"
cy="1525.4"
r="4"
/>
<path
id="XMLID_507_"
fill="#FF7B5B"
d="M-521,1518.3c-1.8,1.8-2.9,4.3-2.9,7.1c0,2.6,1,4.9,2.5,6.7L-521,1518.3z"
/>
<path
id="XMLID_506_"
fill="#FF7B5B"
d="M-506.9,1532.1c1.8-1.8,2.9-4.3,2.9-7.1c0-2.6-1-4.9-2.5-6.7L-506.9,1532.1z"
/>
</g>
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" />
{/* }//fill="#FFFFFF" */}
<linearGradient
id="XMLID_421_"
gradientUnits="userSpaceOnUse"
x1="-1625.151"
y1="-2518.4661"
x2="-1596.6696"
y2="-2518.4661"
gradientTransform="matrix(-1 0 0 -1 -1589.489 -2500.4661)"
>
<stop offset="1.970443e-002" stopColor="#FFC200" />
<stop offset="0.4731" stopColor="#FF31BD" />
<stop offset="0.6947" stopColor="#8E31BD" />
<stop offset="1" stopColor="#57EABA" />
</linearGradient>
<path
id="XMLID_124_"
fill="none"
stroke="url(#XMLID_421_)"
strokeWidth="2.94"
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit="10"
d="M21.4,5.2L21.4,5.2c7.1,0,12.8,5.7,12.8,12.8v0c0,7.1-5.7,12.8-12.8,12.8H8.7V18C8.7,10.9,14.4,5.2,21.4,5.2z"
/>
<linearGradient id="XMLID_422_" gradientUnits="userSpaceOnUse" x1="18.041" y1="32.147" x2="38.7776" y2="-0.9289">
<stop offset="1.970443e-002" stopColor="#FFC200" />
<stop offset="0.4731" stopColor="#FF31BD" />
<stop offset="0.6947" stopColor="#8E31BD" />
<stop offset="1" stopColor="#57EABA" />
</linearGradient>
<rect id="XMLID_123_" x="26.9" y="13.8" fill="url(#XMLID_422_)" stroke="none" width="2.8" height="3.8" />
<linearGradient
id="XMLID_423_"
gradientUnits="userSpaceOnUse"
x1="13.0856"
y1="29.0402"
x2="33.8223"
y2="-4.0356"
>
<stop offset="1.970443e-002" stopColor="#FFC200" />
<stop offset="0.4731" stopColor="#FF31BD" />
<stop offset="0.6947" stopColor="#8E31BD" />
<stop offset="1" stopColor="#57EABA" />
</linearGradient>
<rect id="XMLID_122_" x="20" y="13.8" fill="url(#XMLID_422_)" stroke="none" width="2.8" height="3.8" />
<linearGradient id="XMLID_424_" gradientUnits="userSpaceOnUse" x1="0.338" y1="17.7555" x2="17.2654" y2="17.7555">
<stop offset="1.970443e-002" stopColor="#FFC200" />
<stop offset="0.4731" stopColor="#FF31BD" />
<stop offset="0.6947" stopColor="#8E31BD" />
<stop offset="1" stopColor="#57EABA" />
</linearGradient>
<circle
id="XMLID_121_"
fill="none"
stroke="#6E8EDE"
strokeWidth="2.94"
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit="10"
cx="8.8"
cy="17.8"
r="6"
/>
</svg>
),
[ICONS.LIVESTREAM_SOLID]: (props: CustomProps) => (
<svg
id="prefix__Layer_1"
xmlns="http://www.w3.org/2000/svg"
x={0}
y={0}
fill="none"
width={props.size || '18'}
height={props.size || '16'}
viewBox="0 0 36 36"
xmlSpace="preserve"
{...props}
>
<style>{'.prefix__st1{fill:#ff7b5b}.prefix__st3{fill:#79d1b6}'}</style>
<g id="prefix__XMLID_505_">
<linearGradient
id="prefix__XMLID_410_"
gradientUnits="userSpaceOnUse"
x1={-571.815}
y1={1525.406}
x2={-561.413}
y2={1525.406}
>
<stop offset={0.02} stopColor="#ffc200" />
<stop offset={0.387} stopColor="#ff31bd" />
<stop offset={0.625} stopColor="#8e31bd" />
<stop offset={0.776} stopColor="#6e8ede" />
<stop offset={1} stopColor="#57eaba" />
</linearGradient>
<circle
id="prefix__XMLID_508_"
cx={-566.6}
cy={1525.4}
r={4}
fill="none"
stroke="url(#prefix__XMLID_410_)"
strokeWidth={2.468}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
<path
id="prefix__XMLID_507_"
className="prefix__st1"
d="M-573.7 1518.3c-1.8 1.8-2.9 4.3-2.9 7.1 0 2.6 1 4.9 2.5 6.7l.4-13.8z"
/>
<path
id="prefix__XMLID_506_"
className="prefix__st1"
d="M-559.6 1532.1c1.8-1.8 2.9-4.3 2.9-7.1 0-2.6-1-4.9-2.5-6.7l-.4 13.8z"
/>
</g>
<path
id="prefix__XMLID_20_"
d="M21.4 5.2h0c7.1 0 12.8 5.7 12.8 12.8v0c0 7.1-5.7 12.8-12.8 12.8H8.7V18c0-7.1 5.7-12.8 12.7-12.8z"
fill="none"
stroke="#e729e1"
strokeWidth={2.94}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
<path id="prefix__XMLID_19_" className="prefix__st3" stroke="none" d="M26.9 13.8h2.8v3.8h-2.8z" />
<path id="prefix__XMLID_18_" className="prefix__st3" stroke="none" d="M20 13.8h2.8v3.8H20z" />
<circle
id="prefix__XMLID_17_"
cx={8.8}
cy={17.8}
r={6}
fill="none"
stroke="#ffa100"
strokeWidth={2.94}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
</svg>
),
[ICONS.LIVESTREAM_MONOCHROME]: (props: CustomProps) => (
<svg
id="prefix__Layer_1"
xmlns="http://www.w3.org/2000/svg"
x={0}
y={0}
fill="currentColor"
stroke="currentColor"
width={props.size || '18'}
height={props.size || '16'}
viewBox="0 0 36 36"
xmlSpace="preserve"
{...props}
>
<g id="prefix__XMLID_505_">
<linearGradient
id="prefix__XMLID_410_"
gradientUnits="userSpaceOnUse"
x1={-571.815}
y1={1525.406}
x2={-561.413}
y2={1525.406}
>
<stop offset={0.02} stopColor="#ffc200" />
<stop offset={0.387} stopColor="#ff31bd" />
<stop offset={0.625} stopColor="#8e31bd" />
<stop offset={0.776} stopColor="#6e8ede" />
<stop offset={1} stopColor="#57eaba" />
</linearGradient>
<circle
id="prefix__XMLID_508_"
cx={-566.6}
cy={1525.4}
r={4}
fill="none"
strokeWidth={2.468}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
<path id="prefix__XMLID_507_" d="M-573.7 1518.3c-1.8 1.8-2.9 4.3-2.9 7.1 0 2.6 1 4.9 2.5 6.7l.4-13.8z" />
<path id="prefix__XMLID_506_" d="M-559.6 1532.1c1.8-1.8 2.9-4.3 2.9-7.1 0-2.6-1-4.9-2.5-6.7l-.4 13.8z" />
</g>
<path
id="prefix__XMLID_20_"
d="M21.4 5.2h0c7.1 0 12.8 5.7 12.8 12.8v0c0 7.1-5.7 12.8-12.8 12.8H8.7V18c0-7.1 5.7-12.8 12.7-12.8z"
fill="none"
strokeWidth={2.94}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
<path id="prefix__XMLID_19_" d="M26.9 13.8h2.8v3.8h-2.8z" />
<path id="prefix__XMLID_18_" d="M20 13.8h2.8v3.8H20z" />
<circle
id="prefix__XMLID_17_"
cx={8.8}
cy={17.8}
r={6}
fill="none"
strokeWidth={2.94}
strokeLinecap="round"
strokeLinejoin="round"
strokeMiterlimit={10}
/>
</svg>
),
[ICONS.STACK]: (props: CustomProps) => (
<svg
{...props}
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '18'}
xmlns="http://www.w3.org/2000/svg"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
stroke="currentColor"
fill="none"
>
<g transform="matrix(1,0,0,1,0,0)">
<path d="M22.91,6.953,12.7,1.672a1.543,1.543,0,0,0-1.416,0L1.076,6.953a.615.615,0,0,0,0,1.094l10.209,5.281a1.543,1.543,0,0,0,1.416,0L22.91,8.047a.616.616,0,0,0,0-1.094Z" />
<path d="M.758,12.75l10.527,5.078a1.543,1.543,0,0,0,1.416,0L23.258,12.75" />
<path d="M.758,17.25l10.527,5.078a1.543,1.543,0,0,0,1.416,0L23.258,17.25" />
</g>
</svg>
),
[ICONS.TIME]: (props: CustomProps) => (
<svg
{...props}
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '18'}
xmlns="http://www.w3.org/2000/svg"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
stroke="currentColor"
fill="none"
>
<g transform="matrix(1,0,0,1,0,0)">
<path d="M1.500 12.000 A10.500 10.500 0 1 0 22.500 12.000 A10.500 10.500 0 1 0 1.500 12.000 Z" />
<path d="M12 12L12 8.25" />
<path d="M12 12L16.687 16.688" />
</g>
</svg>
),
};
+1 -1
View File
@@ -71,7 +71,7 @@ class IconComponent extends React.PureComponent<Props> {
<Icon
title={tooltipText}
size={size || (sectionIcon ? 20 : 16)}
className={classnames(`icon icon--${icon}`, className)}
className={classnames(`icon icon--${icon}`, className, { 'color-override': iconColor })}
color={color}
{...rest}
/>
+1 -1
View File
@@ -20,7 +20,7 @@ export default function LbcMessage(props: Props) {
return (
<I18nMessage tokens={{ lbc: amount ? <CreditAmount badge noFormat amount={amount} /> : undefined }}>
{/* Catch any rogue LBC's left */}
{tokenizedMessage.replace(/LBC/g, 'Credits')}
{tokenizedMessage.replace(/\sLBC/g, ' Credits')}
</I18nMessage>
);
}
+51 -3
View File
@@ -13,7 +13,9 @@ import defaultSchema from 'hast-util-sanitize/lib/github.json';
import { formatedLinks, inlineLinks } from 'util/remark-lbry';
import { formattedTimestamp, inlineTimestamp } from 'util/remark-timestamp';
import ZoomableImage from 'component/zoomableImage';
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS } from 'config';
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS, SIMPLE_SITE } from 'config';
import Button from 'component/button';
import * as ICONS from 'constants/icons';
type SimpleTextProps = {
children?: React.Node,
@@ -25,6 +27,13 @@ type SimpleLinkProps = {
children?: React.Node,
};
type ImageLinkProps = {
src: string,
title?: string,
alt?: string,
helpText?: string,
};
type MarkdownProps = {
strip?: boolean,
content: ?string,
@@ -82,6 +91,27 @@ const SimpleLink = (props: SimpleLinkProps) => {
// ****************************************************************************
// ****************************************************************************
const SimpleImageLink = (props: ImageLinkProps) => {
const { src, title, alt, helpText } = props;
if (!src) {
return null;
}
return (
<Button
button="link"
iconRight={ICONS.EXTERNAL}
label={title || alt || src}
title={helpText || title || alt || src}
className="button--external-link"
href={src}
/>
);
};
// ****************************************************************************
// ****************************************************************************
// Use github sanitation schema
const schema = { ...defaultSchema };
@@ -94,6 +124,13 @@ const REPLACE_REGEX = /(<iframe\s+src=["'])(.*?(?=))(["']\s*><\/iframe>)/g;
// ****************************************************************************
// ****************************************************************************
function isStakeEnoughForPreview(stakedLevel) {
return !stakedLevel || stakedLevel >= CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS;
}
// ****************************************************************************
// ****************************************************************************
const MarkdownPreview = (props: MarkdownProps) => {
const { content, strip, simpleLinks, noDataStore, className, parentCommentId, isMarkdownPost, stakedLevel } = props;
const strippedContent = content
@@ -127,12 +164,23 @@ const MarkdownPreview = (props: MarkdownProps) => {
parentCommentId={parentCommentId}
isMarkdownPost={isMarkdownPost}
simpleLinks={simpleLinks}
allowPreview={stakedLevel && stakedLevel >= CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS}
allowPreview={isStakeEnoughForPreview(stakedLevel)}
/>
),
// Workaraund of remarkOptions.Fragment
div: React.Fragment,
img: ZoomableImage,
img: isStakeEnoughForPreview(stakedLevel)
? ZoomableImage
: (imgProps) => (
<SimpleImageLink
src={imgProps.src}
alt={imgProps.alt}
title={imgProps.title}
helpText={
SIMPLE_SITE ? __("This channel isn't staking enough LBRY Credits for inline image previews.") : ''
}
/>
),
},
};
@@ -1,22 +0,0 @@
// @flow
import React from 'react';
import Button from 'component/button';
type Props = {
type?: string,
};
export default function UnsupportedOnWeb(props: Props) {
const { type = 'page' } = props;
return (
IS_WEB && (
<div className="section__subtitle--status">
{type === 'page' && __('This page is not currently supported on the web')}
{type === 'feature' && __('This feature is not currently supported on the web')}.{' '}
<Button button="link" label={__('Download the desktop app')} href="https://lbry.com/get" /> for full feature
support.
</div>
)
);
}
+15 -12
View File
@@ -2,12 +2,12 @@
import React from 'react';
import debounce from 'util/debounce';
const DEBOUNCE_SCROLL_HANDLER_MS = 300;
const DEBOUNCE_SCROLL_HANDLER_MS = 25;
type Props = {
children: any,
lastUpdateDate?: any,
skipWait?: boolean,
placeholder?: any,
};
export default function WaitUntilOnPage(props: Props) {
@@ -15,21 +15,17 @@ export default function WaitUntilOnPage(props: Props) {
const [shouldRender, setShouldRender] = React.useState(false);
React.useEffect(() => {
setShouldRender(false);
}, [props.lastUpdateDate]);
React.useEffect(() => {
const handleDisplayingRef = debounce(e => {
const handleDisplayingRef = debounce((e) => {
const element = ref && ref.current;
if (element) {
const bounding = element.getBoundingClientRect();
if (
bounding.top >= 0 &&
bounding.left >= 0 &&
bounding.bottom >= 0 &&
bounding.right >= 0 &&
// $FlowFixMe
bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
bounding.top <= (window.innerHeight || document.documentElement.clientHeight) &&
// $FlowFixMe
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight)
bounding.left <= (window.innerWidth || document.documentElement.clientWidth)
) {
setShouldRender(true);
}
@@ -46,5 +42,12 @@ export default function WaitUntilOnPage(props: Props) {
}
}, [ref, setShouldRender, shouldRender]);
return <div ref={ref}>{(props.skipWait || shouldRender) && props.children}</div>;
const render = props.skipWait || shouldRender;
return (
<div ref={ref}>
{render && props.children}
{!render && props.placeholder !== undefined && props.placeholder}
</div>
);
}
+6 -1
View File
@@ -11,10 +11,11 @@ type Props = {
label?: string,
primaryButton?: boolean,
name?: string,
onCopy?: (string) => string,
};
export default function CopyableText(props: Props) {
const { copyable, doToast, snackMessage, label, primaryButton = false, name } = props;
const { copyable, doToast, snackMessage, label, primaryButton = false, name, onCopy } = props;
const input = useRef();
@@ -22,7 +23,11 @@ export default function CopyableText(props: Props) {
const topRef = input.current;
if (topRef && topRef.input && topRef.input.current) {
topRef.input.current.select();
if (onCopy) {
onCopy(topRef.input.current);
}
}
document.execCommand('copy');
}
+3 -1
View File
@@ -1,8 +1,10 @@
import { connect } from 'react-redux';
import { makeSelectDateForUri } from 'lbry-redux';
import { makeSelectDateForUri, SETTINGS } from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import DateTime from './view';
const select = (state, props) => ({
date: props.date || makeSelectDateForUri(props.uri)(state),
clock24h: makeSelectClientSetting(SETTINGS.CLOCK_24H)(state),
});
export default connect(select)(DateTime);
+57 -5
View File
@@ -2,14 +2,29 @@
import React from 'react';
import moment from 'moment';
const DEFAULT_MIN_UPDATE_DELTA_MS = 60 * 1000;
type Props = {
date?: any,
timeAgo?: boolean,
formatOptions: {},
formatOptions?: {},
show?: string,
clock24h?: boolean,
minUpdateDeltaMs?: number,
};
class DateTime extends React.PureComponent<Props> {
type State = {
lastRenderTime: Date,
};
class DateTime extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
lastRenderTime: new Date(),
};
}
static SHOW_DATE = 'date';
static SHOW_TIME = 'time';
@@ -44,21 +59,58 @@ class DateTime extends React.PureComponent<Props> {
return __(strId, { duration });
}
shouldComponentUpdate(nextProps: Props): boolean {
if (
moment(this.props.date).diff(moment(nextProps.date)) !== 0 ||
this.props.clock24h !== nextProps.clock24h ||
this.props.timeAgo !== nextProps.timeAgo ||
this.props.minUpdateDeltaMs !== nextProps.minUpdateDeltaMs ||
this.props.show !== nextProps.show
) {
return true;
}
if (this.props.timeAgo && nextProps.timeAgo) {
const minUpdateDeltaMs = this.props.minUpdateDeltaMs || DEFAULT_MIN_UPDATE_DELTA_MS;
const prev = moment(this.state.lastRenderTime);
const curr = moment(new Date());
const deltaMs = curr.diff(prev);
if (deltaMs > minUpdateDeltaMs) {
return true;
}
}
return false;
}
componentDidUpdate() {
const { timeAgo } = this.props;
if (timeAgo) {
this.setState({ lastRenderTime: new Date() });
}
}
render() {
const { date, timeAgo, show } = this.props;
const { date, timeAgo, show, clock24h } = this.props;
let clockFormat = 'hh:mm A';
if (clock24h) {
clockFormat = 'HH:mm';
}
if (timeAgo) {
if (!date) {
return null;
}
return <span>{DateTime.getTimeAgoStr(date)}</span>;
return <span title={moment(date).format(`MMMM Do, YYYY ${clockFormat}`)}>{DateTime.getTimeAgoStr(date)}</span>;
}
return (
<span>
{date && show === DateTime.SHOW_DATE && moment(date).format('MMMM Do, YYYY')}
{date && show === DateTime.SHOW_TIME && moment(date).format('hh:mm A')}
{date && show === DateTime.SHOW_TIME && moment(date).format(clockFormat)}
{!date && '...'}
</span>
);
Loaded 100 of 385 files, more files were not shown because too many files have changed in this diff. Show more