Compare commits
1
Commits
anton
..
robd-mac-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
916fa7076e |
No files matched your search
+9
-20
@@ -15,17 +15,15 @@ COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||
COMMENT_SERVER_NAME=Odysee
|
||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||
THUMBNAIL_CDN_URL=https://thumbnails.odysee.com/optimize/
|
||||
THUMBNAIL_CARDS_CDN_URL=https://cards.odysee.com/
|
||||
THUMBNAIL_HEIGHT=220
|
||||
THUMBNAIL_WIDTH=390
|
||||
THUMBNAIL_QUALITY=85
|
||||
THUMBNAIL_CDN_URL=https://image-processor.vanwanet.com/optimize/
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# STRIPE
|
||||
# STRIPE_PUBLIC_KEY='pk_test_NoL1JWL7i1ipfhVId5KfDZgo'
|
||||
|
||||
# Analytics
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
|
||||
# OG
|
||||
OG_TITLE_SUFFIX=| lbry.tv
|
||||
@@ -37,11 +35,12 @@ SITE_CANONICAL_URL=https://lbry.tv
|
||||
## Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
SITE_TITLE=lbry.tv
|
||||
SITE_NAME=lbry.tv
|
||||
SITE_TITLE=LBRY
|
||||
SITE_NAME=LBRY
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
SITE_HELP_EMAIL=help@lbry.com
|
||||
LOGO_TITLE=lbry.tv
|
||||
LOGO_TITLE=LBRY
|
||||
CLOUD_CONNECT_SITE_NAME=Odysee
|
||||
## Social media
|
||||
TWITTER_ACCOUNT=LBRYcom
|
||||
BRANDED_SITE=odysee
|
||||
@@ -80,7 +79,7 @@ SIMPLE_SITE=false
|
||||
#BRANDED_SITE
|
||||
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=false
|
||||
ENABLE_FILE_REACTIONS=true
|
||||
ENABLE_CREATOR_REACTIONS=false
|
||||
ENABLE_NO_SOURCE_CLAIMS=false
|
||||
ENABLE_PREROLL_ADS=false
|
||||
@@ -90,7 +89,7 @@ WEB_PUBLISH_SIZE_LIMIT_GB=4
|
||||
LOADING_BAR_COLOR=#2bbb90
|
||||
LIGHTHOUSE_DEFAULT_TYPES=audio,video,text,image,application
|
||||
|
||||
SHOW_ADS=true
|
||||
SHOW_ADS=false
|
||||
|
||||
## SIMPLE_SITE REPLACEMENTS
|
||||
ENABLE_MATURE=true
|
||||
@@ -115,13 +114,3 @@ ENABLE_UI_NOTIFICATIONS=false
|
||||
#MODELS_ENABLED=true
|
||||
|
||||
BRANDED_SITE=odysee
|
||||
|
||||
#FIREBASE
|
||||
FIREBASE_API_KEY=AIzaSyAgc-4QORyglpYZ3qH9E5pDauEDOJXgM3A
|
||||
FIREBASE_AUTH_DOMAIN=lbry-mobile.firebaseapp.com
|
||||
FIREBASE_PROJECT_ID=lbry-mobile
|
||||
FIREBASE_STORAGE_BUCKET=lbry-mobile.appspot.com
|
||||
FIREBASE_MESSAGING_SENDER_ID=638894153788
|
||||
FIREBASE_APP_ID=1:638894153788:web:35b295b15297201bd2e339
|
||||
FIREBASE_MEASUREMENT_ID=G-2MPJGFEEXC
|
||||
FIREBASE_VAPID_KEY=BFayEBpwMTU9GQQpXgitIJkfx-SD8-ltrFb3wLTZWgA27MfBhG4948pe0eERl432NzPrMKsbkXnA7ap_vLPgLYk
|
||||
File renamed without changes.
@@ -35,8 +35,6 @@ module.name_mapper='^web\/effects\(.*\)$' -> '<PROJECT_ROOT>/web/effects\1'
|
||||
module.name_mapper='^web\/page\(.*\)$' -> '<PROJECT_ROOT>/web/page\1'
|
||||
module.name_mapper='^homepage\(.*\)$' -> '<PROJECT_ROOT>/ui/util/homepage\1'
|
||||
module.name_mapper='^scss\/component\(.*\)$' -> '<PROJECT_ROOT>/ui/scss/component/\1'
|
||||
module.name_mapper='^\$web\(.*\)$' -> '<PROJECT_ROOT>/web\1'
|
||||
module.name_mapper='^\$ui\(.*\)$' -> '<PROJECT_ROOT>/ui\1'
|
||||
|
||||
esproposal.optional_chaining=enable
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
---
|
||||
name: "❤️Say thank you"
|
||||
about: If you enjoy using Odysee's website, let us know!
|
||||
title: Odysee rocks!
|
||||
about: If you enjoy using the LBRY app, let us know!
|
||||
title: LBRY rocks!
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
If you are using the Odysee's website - please let us know. We'd love to hear from you!
|
||||
If you are using the LBRY app - please let us know. We'd love to hear from you!
|
||||
|
||||
If you would like to help Nock - any of the following is greatly appreciated.
|
||||
|
||||
- Give the repository a star ⭐️
|
||||
- Help out with issues
|
||||
- Blog about Odysee
|
||||
- Blog about LBRY
|
||||
- Make tutorials
|
||||
- Give talks
|
||||
- Convince other people to use Odysee
|
||||
- Convince other people to use LBRY
|
||||
- Anything your heart desires
|
||||
|
||||
Thank you! 💐
|
||||
@@ -0,0 +1,117 @@
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Borales/actions-yarn@v2.3.0
|
||||
- run: yarn lint
|
||||
|
||||
build:
|
||||
needs: ['lint']
|
||||
name: 'build'
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
# - windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- uses: maxim-lobanov/setup-xcode@v1
|
||||
if: startsWith(runner.os, 'mac')
|
||||
with:
|
||||
xcode-version: '12.4.0'
|
||||
|
||||
- name: Download blockchain headers
|
||||
run: |
|
||||
mkdir -p ./static/daemon
|
||||
curl -o ./static/daemon/headers https://headers.lbry.io/blockchain_headers_latest
|
||||
ls ./static/daemon
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
yarn global add cross-env
|
||||
yarn
|
||||
yarn build
|
||||
node ./build/afterSignHook.js
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
NOTARIZATION_USERNAME: ${{ secrets.NOTARIZATION_USERNAME }}
|
||||
NOTARIZATION_PASSWORD: ${{ secrets.NOTARIZATION_PASSWORD }}
|
||||
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||
ARTIFACTS_BUCKET: ${{ secrets.ARTIFACTS_BUCKET }}
|
||||
ARTIFACTS_KEY: ${{ secrets.ARTIFACTS_KEY }}
|
||||
ARTIFACTS_SECRET: ${{ secrets.ARTIFACTS_SECRET }}
|
||||
ARTIFACTS_REGION: ${{ secrets.ARTIFACTS_REGION }}
|
||||
|
||||
WIN_CSC_LINK: https://raw.githubusercontent.com/lbryio/lbry-desktop/master/build/win-csc-2021-2022-08.p12
|
||||
CSC_LINK: https://s3.amazonaws.com/files.lbry.io/cert/osx-csc-2021-2022.p12
|
||||
|
||||
# UI
|
||||
MATOMO_URL: https://analytics.lbry.com/
|
||||
MATOMO_ID: 4
|
||||
WELCOME_VERSION: 1.0
|
||||
DOMAIN: lbry.tv
|
||||
URL: https://lbry.tv
|
||||
SHARE_DOMAIN_URL: https://open.lbry.com
|
||||
SITE_TITLE: lbry.tv
|
||||
SITE_NAME: lbry.tv
|
||||
SHOW_ADS: false
|
||||
YRBL_HAPPY_IMG_URL: https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL: https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
ENABLE_COMMENT_REACTIONS: true
|
||||
ENABLE_NO_SOURCE_CLAIMS: false
|
||||
|
||||
DEFAULT_LANGUAGE: en
|
||||
KNOWN_APP_DOMAINS: lbry.tv,lbry.lat,odysee.com
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: 0
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: |
|
||||
startsWith(runner.os, 'linux')
|
||||
with:
|
||||
name: Linux
|
||||
path: ./dist/electron/*.*
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: |
|
||||
startsWith(runner.os, 'mac')
|
||||
with:
|
||||
name: macOS
|
||||
path: ./dist/electron/*.*
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: |
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
with:
|
||||
name: Windows
|
||||
path: ./dist/electron/*.*
|
||||
- uses: jakejarvis/s3-sync-action@master
|
||||
if: |
|
||||
startsWith(runner.os, 'linux')
|
||||
with:
|
||||
args: --acl public-read --follow-symlinks --exclude '*' --include '*.deb' --include '*.AppImage' --include '*.dmg'
|
||||
env:
|
||||
AWS_S3_BUCKET: ${{ secrets.ARTIFACTS_BUCKET }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.ARTIFACTS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.ARTIFACTS_SECRET }}
|
||||
AWS_REGION: 'us-east-1'
|
||||
SOURCE_DIR: 'dist/electron'
|
||||
DEST_DIR: 'app/release'
|
||||
@@ -1,57 +0,0 @@
|
||||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: Borales/actions-yarn@v2.3.0
|
||||
- run: yarn lint
|
||||
|
||||
build:
|
||||
needs: ['lint']
|
||||
name: 'build'
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
os:
|
||||
- ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
yarn global add cross-env
|
||||
yarn
|
||||
yarn compile:web
|
||||
env:
|
||||
# UI
|
||||
WELCOME_VERSION: 1.0
|
||||
DOMAIN: odysee.com
|
||||
URL: https://odysee.com
|
||||
SHARE_DOMAIN_URL: https://odysee.com
|
||||
SITE_TITLE: Odysee
|
||||
SITE_NAME: Odysee
|
||||
SHOW_ADS: false
|
||||
YRBL_HAPPY_IMG_URL: https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-happy/7aa50a7e5adaf48691935d55e45d697547392929/839d9a
|
||||
YRBL_SAD_IMG_URL: https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649633d974e5ffb503925e1f17d951f1bd0f/f262dd
|
||||
ENABLE_COMMENT_REACTIONS: true
|
||||
ENABLE_NO_SOURCE_CLAIMS: true
|
||||
DEFAULT_LANGUAGE: en
|
||||
KNOWN_APP_DOMAINS: lbry.tv,lbry.lat,odysee.com
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: 4
|
||||
+1
-2
@@ -33,7 +33,6 @@ package-lock.json
|
||||
!/custom/robots.disallowall
|
||||
!/custom/robots.allowall
|
||||
.env
|
||||
.env.ody
|
||||
!.env.ody
|
||||
.env.desktop
|
||||
.env.lbrytv
|
||||
analyzeResults*.html
|
||||
+2
-6
@@ -1,11 +1,7 @@
|
||||
{
|
||||
"linters": {
|
||||
"ui/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"extras/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"web/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"extras/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"web/**/*.{js,jsx}": ["eslint", "git add"]
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"]
|
||||
},
|
||||
"ignore": ["node_modules", "web/dist/**/*", "dist/**/*", "package-lock.json"]
|
||||
"ignore": ["node_modules", "dist/**/*", "package-lock.json"]
|
||||
}
|
||||
+27
-5
@@ -4,20 +4,39 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased for Desktop]
|
||||
## [0.52.0] - [2021-10-24]
|
||||
|
||||
### Compatibility
|
||||
- Mac <= 10.13 (High Sierra) and Ubuntu <= 16 (Xenial) are no longer supported. If you upgrade, you will need to manually build and install your own lbrynet SDK
|
||||
|
||||
### Added
|
||||
- Added direct replying to notifications _community pr!_ ([#6935](https://github.com/lbryio/lbry-desktop/pull/6935))
|
||||
- Direct replying to notifications _community pr!_ ([#6935](https://github.com/lbryio/lbry-desktop/pull/6935))
|
||||
- Added "Replay" option on autoplay countdown ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added "Loop" option on Lists ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added "Shuffle" option on Lists ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added Play Next/Previous buttons (with shortcuts SHIFT+N/SHIFT+P) ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added separate control for autoplay next on video player ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Added Channel Mention selection ability while creating a comment ([#7151](https://github.com/lbryio/lbry-desktop/pull/7151))
|
||||
- Separate control for autoplay next on video player ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Channel Mention selection ability while creating a comment ([#7151](https://github.com/lbryio/lbry-desktop/pull/7151))
|
||||
- Disk space setting under Data Hosting ([#7266](https://github.com/lbryio/lbry-desktop/pull/7266))
|
||||
- Paginated 'All Playlists' page ([#7268](https://github.com/lbryio/lbry-desktop/pull/7268))
|
||||
- Expanded playlist ordering tools ([#7305](https://github.com/lbryio/lbry-desktop/pull/7305))
|
||||
- Setting to upgrade to alpha prerelease builds ([#7353](https://github.com/lbryio/lbry-desktop/pull/7353))
|
||||
- Support for macOS arm64
|
||||
|
||||
### Changed
|
||||
- Changing the supported language from Filipino to Tagalog _community pr!_ ([#6951](https://github.com/lbryio/lbry-desktop/pull/6951))
|
||||
- Don't show countdown to next item in list ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- Changed "View List" popup option to link, so can be opened on a new tab ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
- App reorganized to remove lbry-redux and lbryinc repository dependencies ([#7240](https://github.com/lbryio/lbry-desktop/pull/7240))
|
||||
- Styling cleanup for file reactions ([#7251](https://github.com/lbryio/lbry-desktop/pull/7251))
|
||||
- Change share url to odysee and allow custom share url in settings ([#7258](https://github.com/lbryio/lbry-desktop/pull/7258))
|
||||
- Change Sign in/up to Cloud Connect for Odysee ([#7260](https://github.com/lbryio/lbry-desktop/pull/7260))
|
||||
- Upgraded to lbrynet v0.106.0 ([#7315](https://github.com/lbryio/lbry-desktop/pull/7315))
|
||||
- Upgraded Electron to v11.5.0 ([#7276](https://github.com/lbryio/lbry-desktop/pull/7276))
|
||||
- Cleaner Discover page filters ([#7306](https://github.com/lbryio/lbry-desktop/pull/7306))
|
||||
- Scroll bar styling ([#7314](https://github.com/lbryio/lbry-desktop/pull/7314))
|
||||
- Remove pages for obsolete features like invites, rewards, swap ([#7330](https://github.com/lbryio/lbry-desktop/pull/7330))
|
||||
- Change file repost to modal _community pr!_ ([#7341](https://github.com/lbryio/lbry-desktop/pull/7341))
|
||||
|
||||
### Fixed
|
||||
- Clicking on the title of a floating player will take you back to the list ([#6921](https://github.com/lbryio/lbry-desktop/pull/6921))
|
||||
@@ -27,6 +46,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Fix playlist preview thumbnail ([#7178](https://github.com/lbryio/lbry-desktop/pull/7178)
|
||||
- Fixed “Your Account” popup on mobile ([#7172](https://github.com/lbryio/lbry-desktop/pull/7172))
|
||||
- Fix disable-support for comments ([#7245](https://github.com/lbryio/lbry-desktop/pull/7245))
|
||||
- Fix Electron taking over .html files on linux ([#7291](https://github.com/lbryio/lbry-desktop/pull/7291))
|
||||
- Fix floating player play/pause on drag _community pr!_ ([#7339](https://github.com/lbryio/lbry-desktop/pull/7339))
|
||||
- Fix card dropdown menus triggering menu actions _community pr!_ ([#7335](https://github.com/lbryio/lbry-desktop/pull/7335))
|
||||
|
||||
## [0.51.2] - [2021-08-20]
|
||||
|
||||
@@ -735,7 +757,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
### Added
|
||||
|
||||
- Channels page above Publishes which lists all your channels ([#2925](https://github.com/lbryio/lbry-desktop/pull/2925))
|
||||
- YouTube channel claiming and transfer ([#2925](https://github.com/lbryio/lbry-desktop/pull/2925)). See our [YouTube FAQ](https://odysee.com/@OdyseeHelp:b/youtube-sync:b) for more information.
|
||||
- YouTube channel claiming and transfer ([#2925](https://github.com/lbryio/lbry-desktop/pull/2925)). See our [YouTube FAQ](https://lbry.com/faq/youtube) for more information.
|
||||
- New user sign in flow now includes automatic redeeming of 1 LBC and channel creation ([#2925](https://github.com/lbryio/lbry-desktop/pull/2925))
|
||||
- Ability to save wallet encryption password ([#2925](https://github.com/lbryio/lbry-desktop/pull/2925))
|
||||
- Sync your balance (only for users with new wallets) and preferences (subscriptions and tags) between devices ([#2925](https://github.com/lbryio/lbry-desktop/pull/2925)). See our [FAQ for more information](https://lbry.com/faq/account-sync)
|
||||
@@ -890,7 +912,7 @@ This release includes a breaking change that will reset many of your settings. T
|
||||
|
||||
### Added
|
||||
|
||||
- New app design for better [content discovery](https://odysee.com/@OdyseeHelp:b/OdyseeBasics:c) with infinite scroll ([#2477](https://github.com/lbryio/lbry-desktop/pull/2477))
|
||||
- New app design for better [content discovery](https://lbry.com/faq/trending) with infinite scroll ([#2477](https://github.com/lbryio/lbry-desktop/pull/2477))
|
||||
- First implementation of comments ([#2510](https://github.com/lbryio/lbry-desktop/pull/2510))
|
||||
- Ability to edit channels with new metadata and tags ([#2584](https://github.com/lbryio/lbry-desktop/pull/2584))
|
||||
- Tagging content on publish page ([#2593](https://github.com/lbryio/lbry-desktop/pull/2593))
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<img width="40%" src="https://miro.medium.com/max/5198/1*bTVuL2THG_0mpwmE-n7Ezg.png" />
|
||||
|
||||
# Odysee Frontend - Odysee.com
|
||||
# LBRY App
|
||||
|
||||
This repo contains the UI and front end code that powers Odysee.com.
|
||||
This repo contains the UI code that powers the official LBRY desktop app. The LBRY app is a graphical browser for the decentralized content marketplace provided by the
|
||||
[LBRY](https://lbry.com) protocol. It is essentially the
|
||||
[lbry daemon](https://github.com/lbryio/lbry) bundled with a UI using
|
||||
[Electron](https://electron.atom.io/).
|
||||
|
||||
<a href="https://github.com/lbryio/lbry-desktop/blob/master/LICENSE" title="MIT licensed">
|
||||
<img alt="npm" src="https://img.shields.io/dub/l/vibe-d.svg?style=flat">
|
||||
@@ -25,23 +29,52 @@ This repo contains the UI and front end code that powers Odysee.com.
|
||||
</a>
|
||||
</h2>
|
||||
|
||||

|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Usage](#usage)
|
||||
2. [Running from Source](#running-from-source)
|
||||
3. [Contributing](#contributing)
|
||||
4. [License](#license)
|
||||
5. [Security](#security)
|
||||
6. [Contact](#contact)
|
||||
1. [Install](#install)
|
||||
2. [Usage](#usage)
|
||||
3. [Running from Source](#running-from-source)
|
||||
4. [Contributing](#contributing)
|
||||
5. [License](#license)
|
||||
6. [Security](#security)
|
||||
7. [Contact](#contact)
|
||||
|
||||
## Install
|
||||
|
||||
[](https://lbry.com/get/lbry.exe)
|
||||
[](https://lbry.com/get/lbry.deb)
|
||||
[](https://lbry.com/get/lbry.dmg)
|
||||
|
||||
We provide installers for Windows, macOS (v10.12.4, Sierra, or greater), and Debian-based Linux. See community maintained builds section for alternative Linux installations.
|
||||
|
||||
| | Windows | macOS | Linux |
|
||||
| --------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- |
|
||||
| Latest Stable Release | [Download](https://lbry.com/get/lbry.exe) | [Download](https://lbry.com/get/lbry.dmg) | [Download](https://lbry.com/get/lbry.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.
|
||||
_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.
|
||||
|
||||
**Community maintained** builds for Arch Linux and Flatpak are available, see below. These installs will need to be updated manually as the in-app update process only supports Debian installs at this time.
|
||||
_Note: If coming from a deb install, the directory structure is different and you'll need to [migrate data](https://lbry.com/faq/backup-data)._
|
||||
|
||||
| | Flatpak | Arch | Nixpkgs | ARM/ARM64 |
|
||||
| -------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------- |
|
||||
| Latest Release | [FlatHub Page](https://flathub.org/apps/details/io.lbry.lbry-app) | [AUR Package](https://aur.archlinux.org/packages/lbry-app-bin/) | [Nixpkgs](https://search.nixos.org/packages?channel=unstable&show=lbry&query=lbry) | [Build Guide](https://lbry.tv/@LBRYarm:5) |
|
||||
| Maintainers | [@kcSeb](https://keybase.io/kcseb) | [@kcSeb](https://keybase.io/kcseb) | [@Enderger](https://github.com/enderger) | [@Madiator2011](https://github.com/kodxana) |
|
||||
|
||||
## Usage
|
||||
|
||||
Go to the website to interact on this frontend.
|
||||
Double click the installed application to interact with the LBRY network.
|
||||
|
||||
## Running from Source
|
||||
|
||||
You can run the web version (odysee.com), via running onto your host machine, or go to the website itself.
|
||||
You can run the web version (lbry.tv), the electron app, or both at the same time.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
@@ -49,58 +82,15 @@ You can run the web version (odysee.com), via running onto your host machine, or
|
||||
- [Node.js](https://nodejs.org/en/download/) (v14 required)
|
||||
- [Yarn](https://yarnpkg.com/en/docs/install)
|
||||
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/OdyseeTeam/odysee-frontend`
|
||||
2. Change directory into the cloned repository: `cd odysee-frontend`
|
||||
1. Clone (or [fork](https://help.github.com/articles/fork-a-repo/)) this repository: `git clone https://github.com/lbryio/lbry-desktop`
|
||||
2. Change directory into the cloned repository: `cd lbry-desktop`
|
||||
3. Install the dependencies: `yarn`
|
||||
|
||||
#### Run the web app for development
|
||||
#### Run the electron app
|
||||
|
||||
`yarn dev:web`
|
||||
`yarn dev`
|
||||
|
||||
- This uses webpack-dev-server and includes hot-reloading. If you want to debug the [web server we use in production](https://github.com/OdyseeTeam/odysee-frontend/blob/master/web/index.js) you can run `yarn dev:web-server`. This starts a server at `localhost:1337` and does not include hot reloading.
|
||||
|
||||
#### Customize the web app
|
||||
|
||||
- In root directory, duplicate the .env.default file and rename it to .env then copy the code below and paste it anywhere in the .env file.
|
||||
|
||||
```
|
||||
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
|
||||
|
||||
- To specify your own channels to be followed on first run
|
||||
`AUTO_FOLLOW_URLS=lbry://@chan#123...a lbry://@chan2#456...a`
|
||||
|
||||
- If you want to customize the homepage content
|
||||
|
||||
1. add `CUSTOM_HOMEPAGE=true` to the '.env' file
|
||||
2. copy `/custom/homepage.example.js` to `/custom/homepage.js` and make desired changes to `homepage.js`
|
||||
|
||||
- If you want up to two custom sidebar links
|
||||
|
||||
```
|
||||
PINNED_URI_1=@someurl#2/someclaim#4
|
||||
PINNED_LABEL_1=Linktext
|
||||
|
||||
PINNED_URI_2=$/discover?t=tag&[queryparams]
|
||||
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._
|
||||
|
||||
#### Deploy the web app (_experimental_)
|
||||
|
||||
1. Create a server with a domain name and a reverse proxy https to port 1337.
|
||||
2. Install pm2, node v10, yarn
|
||||
3. Clone this repo
|
||||
4. Make any customizations as above
|
||||
5. Run `yarn` to install
|
||||
6. Run `NODE_ENV=production yarn compile:web` to build
|
||||
7. Set up pm2 to start ./web/index.js
|
||||
- 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.
|
||||
|
||||
#### Resetting your Packages
|
||||
|
||||
@@ -110,9 +100,9 @@ If you _really_ think something might have gone wrong, you can force your repo t
|
||||
|
||||
## Contributing
|
||||
|
||||
We :heart: contributions from everyone and contributions to this project are encouraged, and compensated. We welcome [bug reports](https://github.com/OdyseeTeam/odysee-frontend/issues/), [bug fixes](https://github.com/OdyseeTeam/odysee-frontend/pulls) and feedback is always appreciated. For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
We :heart: contributions from everyone and contributions to this project are encouraged, and compensated. We welcome [bug reports](https://github.com/lbryio/lbry-desktop/issues/), [bug fixes](https://github.com/lbryio/lbry-desktop/pulls) and feedback is always appreciated. For more details, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
|
||||
## [](https://github.com/OdyseeTeam/odysee-frontend/issues) [](https://GitHub.com/OdyseeTeam/odysee-frontend/graphs/contributors/)
|
||||
## [](https://github.com/lbryio/lbry-desktop/issues) [](https://GitHub.com/lbryio/lbry-desktop/graphs/contributors/)
|
||||
|
||||
## License
|
||||
|
||||
@@ -120,6 +110,9 @@ This project is MIT licensed. For the full license, see [LICENSE](LICENSE).
|
||||
|
||||
## Security
|
||||
|
||||
We take security seriously. Please contact security@odysee.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).
|
||||
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 [@jessopb](https://github.com/jessopb).
|
||||
Binary file not shown.
@@ -3,6 +3,8 @@
|
||||
require('dotenv-defaults').config({ silent: false });
|
||||
|
||||
const config = {
|
||||
MATOMO_URL: process.env.MATOMO_URL,
|
||||
MATOMO_ID: process.env.MATOMO_ID,
|
||||
WEBPACK_WEB_PORT: process.env.WEBPACK_WEB_PORT,
|
||||
WEBPACK_ELECTRON_PORT: process.env.WEBPACK_ELECTRON_PORT,
|
||||
WEB_SERVER_PORT: process.env.WEB_SERVER_PORT,
|
||||
@@ -12,6 +14,7 @@ const config = {
|
||||
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
|
||||
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
|
||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||
CLOUD_CONNECT_SITE_NAME: process.env.CLOUD_CONNECT_SITE_NAME,
|
||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||
COMMENT_SERVER_NAME: process.env.COMMENT_SERVER_NAME,
|
||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||
@@ -20,10 +23,6 @@ const config = {
|
||||
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
|
||||
URL: process.env.URL,
|
||||
THUMBNAIL_CDN_URL: process.env.THUMBNAIL_CDN_URL,
|
||||
THUMBNAIL_CARDS_CDN_URL: process.env.THUMBNAIL_CARDS_CDN_URL,
|
||||
THUMBNAIL_HEIGHT: process.env.THUMBNAIL_HEIGHT,
|
||||
THUMBNAIL_WIDTH: process.env.THUMBNAIL_WIDTH,
|
||||
THUMBNAIL_QUALITY: process.env.THUMBNAIL_QUALITY,
|
||||
SITE_TITLE: process.env.SITE_TITLE,
|
||||
SITE_NAME: process.env.SITE_NAME,
|
||||
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
|
||||
@@ -75,17 +74,6 @@ const config = {
|
||||
SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true',
|
||||
LIGHTHOUSE_DEFAULT_TYPES: process.env.LIGHTHOUSE_DEFAULT_TYPES,
|
||||
BRANDED_SITE: process.env.BRANDED_SITE,
|
||||
|
||||
// FIREBASE SDK
|
||||
FIREBASE_API_KEY: process.env.FIREBASE_API_KEY,
|
||||
FIREBASE_AUTH_DOMAIN: process.env.FIREBASE_AUTH_DOMAIN,
|
||||
FIREBASE_PROJECT_ID: process.env.FIREBASE_PROJECT_ID,
|
||||
FIREBASE_STORAGE_BUCKET: process.env.FIREBASE_STORAGE_BUCKET,
|
||||
FIREBASE_MESSAGING_SENDER_ID: process.env.FIREBASE_MESSAGING_SENDER_ID,
|
||||
FIREBASE_APP_ID: process.env.FIREBASE_APP_ID,
|
||||
FIREBASE_MEASUREMENT_ID: process.env.FIREBASE_MEASUREMENT_ID,
|
||||
FIREBASE_VAPID_KEY: process.env.FIREBASE_VAPID_KEY,
|
||||
|
||||
};
|
||||
|
||||
config.URL_DEV = `http://localhost:${config.WEBPACK_WEB_PORT}`;
|
||||
|
||||
+12
-8
@@ -20,11 +20,6 @@
|
||||
"to": "static/daemon/",
|
||||
"filter": ["**/*"]
|
||||
},
|
||||
{
|
||||
"from": "./static/lbry-first/",
|
||||
"to": "static/lbry-first/",
|
||||
"filter": ["**/*"]
|
||||
},
|
||||
{
|
||||
"from": "./static/img",
|
||||
"to": "static/img",
|
||||
@@ -42,7 +37,16 @@
|
||||
}
|
||||
],
|
||||
"mac": {
|
||||
"category": "public.app-category.entertainment"
|
||||
"category": "public.app-category.entertainment",
|
||||
"target": [
|
||||
{
|
||||
"target": "default",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
"dmg": {
|
||||
"iconSize": 128,
|
||||
@@ -64,7 +68,7 @@
|
||||
"width": 500,
|
||||
"height": 300
|
||||
},
|
||||
"background": "./build/background.png"
|
||||
"background": "./build/background.png",
|
||||
},
|
||||
"protocols": [
|
||||
{
|
||||
@@ -82,7 +86,7 @@
|
||||
}
|
||||
},
|
||||
"deb": {
|
||||
"depends": ["gconf2", "gconf-service", "libnotify4", "libappindicator1", "libxtst6", "libnss3"]
|
||||
"depends": ["gconf2", "gconf-service", "libnotify4", "libxtst6", "libnss3"]
|
||||
},
|
||||
"nsis": {
|
||||
"perMachine": true,
|
||||
|
||||
@@ -54,6 +54,7 @@ export default appState => {
|
||||
webSecurity: !isDev,
|
||||
plugins: true,
|
||||
nodeIntegration: true,
|
||||
enableRemoteModule: true, // see about removing this
|
||||
},
|
||||
};
|
||||
const lbryProto = 'lbry://';
|
||||
|
||||
+21
-2
@@ -4,7 +4,7 @@
|
||||
import '@babel/polyfill';
|
||||
import SemVer from 'semver';
|
||||
import https from 'https';
|
||||
import { app, dialog, ipcMain, session, shell } from 'electron';
|
||||
import { app, dialog, ipcMain, session, shell, BrowserWindow } from 'electron';
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
import Lbry from 'lbry';
|
||||
import LbryFirstInstance from './LbryFirstInstance';
|
||||
@@ -17,6 +17,7 @@ import startSandbox from './startSandbox';
|
||||
import installDevtools from './installDevtools';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
const { download } = require('electron-dl');
|
||||
const filePath = path.join(process.resourcesPath, 'static', 'upgradeDisabled');
|
||||
let upgradeDisabled;
|
||||
try {
|
||||
@@ -52,7 +53,7 @@ if (isDev && process.platform === 'win32') {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [
|
||||
path.resolve(process.argv[1]),
|
||||
]);
|
||||
} else {
|
||||
} else if (process.platform !== 'linux') {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL);
|
||||
}
|
||||
|
||||
@@ -283,6 +284,20 @@ app.on('before-quit', () => {
|
||||
appState.isQuitting = true;
|
||||
});
|
||||
|
||||
ipcMain.on('download-upgrade', async (event, params) => {
|
||||
const { url, options } = params;
|
||||
const dir = fs.mkdtempSync(app.getPath('temp') + path.sep);
|
||||
options.onProgress = function(p) {
|
||||
rendererWindow.webContents.send('download-progress-update', p);
|
||||
};
|
||||
options.directory = dir;
|
||||
options.onCompleted = function(c) {
|
||||
rendererWindow.webContents.send('download-update-complete', c);
|
||||
};
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
await download(win, url, options).catch(e => console.log('e', e));
|
||||
});
|
||||
|
||||
ipcMain.on('upgrade', (event, installerPath) => {
|
||||
app.on('quit', () => {
|
||||
console.log('Launching upgrade installer at', installerPath);
|
||||
@@ -297,6 +312,10 @@ ipcMain.on('upgrade', (event, installerPath) => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
ipcMain.on('check-for-updates', () => {
|
||||
autoUpdater.checkForUpdates();
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
autoUpdateDownloaded = true;
|
||||
});
|
||||
|
||||
@@ -17,6 +17,9 @@ export const FETCH_CHANNEL_LIST_STARTED = 'FETCH_CHANNEL_LIST_STARTED';
|
||||
export const FETCH_CHANNEL_LIST_COMPLETED = 'FETCH_CHANNEL_LIST_COMPLETED';
|
||||
export const CREATE_CHANNEL_STARTED = 'CREATE_CHANNEL_STARTED';
|
||||
export const CREATE_CHANNEL_COMPLETED = 'CREATE_CHANNEL_COMPLETED';
|
||||
export const PUBLISH_STARTED = 'PUBLISH_STARTED';
|
||||
export const PUBLISH_COMPLETED = 'PUBLISH_COMPLETED';
|
||||
export const PUBLISH_FAILED = 'PUBLISH_FAILED';
|
||||
export const SET_PLAYING_URI = 'SET_PLAYING_URI';
|
||||
export const SET_CONTENT_POSITION = 'SET_CONTENT_POSITION';
|
||||
export const SET_CONTENT_LAST_VIEWED = 'SET_CONTENT_LAST_VIEWED';
|
||||
@@ -26,8 +29,10 @@ export const CLEAR_CONTENT_HISTORY_ALL = 'CLEAR_CONTENT_HISTORY_ALL';
|
||||
// Subscriptions
|
||||
export const CHANNEL_SUBSCRIBE = 'CHANNEL_SUBSCRIBE';
|
||||
export const CHANNEL_UNSUBSCRIBE = 'CHANNEL_UNSUBSCRIBE';
|
||||
export const CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS = 'CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS';
|
||||
export const CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS = 'CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS';
|
||||
export const CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS =
|
||||
'CHANNEL_SUBSCRIPTION_ENABLE_NOTIFICATIONS';
|
||||
export const CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS =
|
||||
'CHANNEL_SUBSCRIPTION_DISABLE_NOTIFICATIONS';
|
||||
export const HAS_FETCHED_SUBSCRIPTIONS = 'HAS_FETCHED_SUBSCRIPTIONS';
|
||||
export const SET_SUBSCRIPTION_LATEST = 'SET_SUBSCRIPTION_LATEST';
|
||||
export const UPDATE_SUBSCRIPTION_UNREADS = 'UPDATE_SUBSCRIPTION_UNREADS';
|
||||
|
||||
+9
-14
@@ -16,7 +16,6 @@ export { doGenerateAuthToken } from './redux/actions/auth';
|
||||
export { doFetchCostInfoForUri } from './redux/actions/cost_info';
|
||||
export { doBlackListedOutpointsSubscribe } from './redux/actions/blacklist';
|
||||
export { doFilteredOutpointsSubscribe } from './redux/actions/filtered';
|
||||
// export { doFetchFeaturedUris, doFetchTrendingUris } from './redux/actions/homepage';
|
||||
export { doFetchViewCount, doFetchSubCount } from './redux/actions/stats';
|
||||
export {
|
||||
doCheckSync,
|
||||
@@ -27,17 +26,14 @@ export {
|
||||
doResetSync,
|
||||
doSyncEncryptAndDecrypt,
|
||||
} from 'redux/actions/sync';
|
||||
export { doUpdateUploadProgress } from './redux/actions/web';
|
||||
|
||||
// reducers
|
||||
export { authReducer } from './redux/reducers/auth';
|
||||
export { costInfoReducer } from './redux/reducers/cost_info';
|
||||
export { blacklistReducer } from './redux/reducers/blacklist';
|
||||
export { filteredReducer } from './redux/reducers/filtered';
|
||||
// export { homepageReducer } from './redux/reducers/homepage';
|
||||
export { statsReducer } from './redux/reducers/stats';
|
||||
export { syncReducer } from './redux/reducers/sync';
|
||||
export { webReducer } from './redux/reducers/web';
|
||||
|
||||
// selectors
|
||||
export { selectAuthToken, selectIsAuthenticating } from './redux/selectors/auth';
|
||||
@@ -47,16 +43,16 @@ export {
|
||||
selectAllCostInfoByUri,
|
||||
selectFetchingCostInfo,
|
||||
} from './redux/selectors/cost_info';
|
||||
export { selectBlackListedOutpoints, selectBlacklistedOutpointMap } from './redux/selectors/blacklist';
|
||||
export {
|
||||
selectBlackListedOutpoints,
|
||||
selectBlacklistedOutpointMap,
|
||||
} from './redux/selectors/blacklist';
|
||||
export { selectFilteredOutpoints, selectFilteredOutpointMap } from './redux/selectors/filtered';
|
||||
// export {
|
||||
// selectFeaturedUris,
|
||||
// selectFetchingFeaturedUris,
|
||||
// selectTrendingUris,
|
||||
// selectFetchingTrendingUris,
|
||||
// } from './redux/selectors/homepage';
|
||||
export { selectViewCount, makeSelectViewCountForUri, makeSelectSubCountForUri } from './redux/selectors/stats';
|
||||
export { selectBanStateForUri } from './redux/selectors/ban';
|
||||
export {
|
||||
selectViewCount,
|
||||
makeSelectViewCountForUri,
|
||||
makeSelectSubCountForUri,
|
||||
} from './redux/selectors/stats';
|
||||
export {
|
||||
selectHasSyncedWallet,
|
||||
selectSyncData,
|
||||
@@ -70,4 +66,3 @@ export {
|
||||
selectSyncApplyErrorMessage,
|
||||
selectSyncApplyPasswordError,
|
||||
} from './redux/selectors/sync';
|
||||
export { selectCurrentUploads, selectUploadCount } from './redux/selectors/web';
|
||||
+21
-42
@@ -1,7 +1,6 @@
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import Lbry from 'lbry';
|
||||
import querystring from 'querystring';
|
||||
import analytics from 'analytics';
|
||||
|
||||
const Lbryio = {
|
||||
enabled: true,
|
||||
@@ -15,7 +14,7 @@ const EXCHANGE_RATE_TIMEOUT = 20 * 60 * 1000;
|
||||
const INTERNAL_APIS_DOWN = 'internal_apis_down';
|
||||
|
||||
// We can't use env's because they aren't passed into node_modules
|
||||
Lbryio.setLocalApi = (endpoint) => {
|
||||
Lbryio.setLocalApi = endpoint => {
|
||||
Lbryio.CONNECTION_STRING = endpoint.replace(/\/*$/, '/'); // exactly one slash at the end;
|
||||
};
|
||||
|
||||
@@ -37,8 +36,8 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||
return Promise.reject(INTERNAL_APIS_DOWN);
|
||||
}
|
||||
|
||||
if (response) {
|
||||
return response.json().then((json) => {
|
||||
if (response)
|
||||
return response.json().then(json => {
|
||||
let error;
|
||||
if (json.error) {
|
||||
error = new Error(json.error);
|
||||
@@ -48,16 +47,15 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||
error.response = response; // This is primarily a hack used in actions/user.js
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeRequest(url, options) {
|
||||
return fetch(url, options).then(checkAndParse);
|
||||
}
|
||||
|
||||
return Lbryio.getAuthToken().then((token) => {
|
||||
return Lbryio.getAuthToken().then(token => {
|
||||
const fullParams = { auth_token: token, ...params };
|
||||
Object.keys(fullParams).forEach((key) => {
|
||||
Object.keys(fullParams).forEach(key => {
|
||||
const value = fullParams[key];
|
||||
if (typeof value === 'object') {
|
||||
fullParams[key] = JSON.stringify(value);
|
||||
@@ -82,21 +80,18 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||
url = `${Lbryio.CONNECTION_STRING}${resource}/${action}`;
|
||||
}
|
||||
|
||||
return makeRequest(url, options).then((response) => {
|
||||
sendCallAnalytics(resource, action, params);
|
||||
return response.data;
|
||||
});
|
||||
return makeRequest(url, options).then(response => response.data);
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.authToken = null;
|
||||
|
||||
Lbryio.getAuthToken = () =>
|
||||
new Promise((resolve) => {
|
||||
new Promise(resolve => {
|
||||
if (Lbryio.authToken) {
|
||||
resolve(Lbryio.authToken);
|
||||
} else if (Lbryio.overrides.getAuthToken) {
|
||||
Lbryio.overrides.getAuthToken().then((token) => {
|
||||
Lbryio.overrides.getAuthToken().then(token => {
|
||||
resolve(token);
|
||||
});
|
||||
} else if (typeof window !== 'undefined') {
|
||||
@@ -127,7 +122,7 @@ Lbryio.authenticate = (domain, language) => {
|
||||
language: language || 'en',
|
||||
};
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return new Promise(resolve => {
|
||||
resolve(params);
|
||||
});
|
||||
}
|
||||
@@ -135,15 +130,15 @@ Lbryio.authenticate = (domain, language) => {
|
||||
if (Lbryio.authenticationPromise === null) {
|
||||
Lbryio.authenticationPromise = new Promise((resolve, reject) => {
|
||||
Lbryio.getAuthToken()
|
||||
.then((token) => {
|
||||
.then(token => {
|
||||
if (!token || token.length > 60) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that token works
|
||||
return Lbryio.getCurrentUser()
|
||||
.then((user) => user)
|
||||
.catch((error) => {
|
||||
.then(user => user)
|
||||
.catch(error => {
|
||||
if (error === INTERNAL_APIS_DOWN) {
|
||||
throw new Error('Internal APIS down');
|
||||
}
|
||||
@@ -151,14 +146,14 @@ Lbryio.authenticate = (domain, language) => {
|
||||
return false;
|
||||
});
|
||||
})
|
||||
.then((user) => {
|
||||
.then(user => {
|
||||
if (user) {
|
||||
return user;
|
||||
}
|
||||
|
||||
return Lbry.status()
|
||||
.then(
|
||||
(status) =>
|
||||
status =>
|
||||
new Promise((res, rej) => {
|
||||
const appId =
|
||||
domain && domain !== 'lbry.tv'
|
||||
@@ -174,7 +169,7 @@ Lbryio.authenticate = (domain, language) => {
|
||||
},
|
||||
'post'
|
||||
)
|
||||
.then((response) => {
|
||||
.then(response => {
|
||||
if (!response.auth_token) {
|
||||
throw new Error('auth_token was not set in the response');
|
||||
}
|
||||
@@ -193,10 +188,10 @@ Lbryio.authenticate = (domain, language) => {
|
||||
Lbryio.authToken = response.auth_token;
|
||||
return res(response);
|
||||
})
|
||||
.catch((error) => rej(error));
|
||||
.catch(error => rej(error));
|
||||
})
|
||||
)
|
||||
.then((newUser) => {
|
||||
.then(newUser => {
|
||||
if (!newUser) {
|
||||
return Lbryio.getCurrentUser();
|
||||
}
|
||||
@@ -216,7 +211,10 @@ Lbryio.getStripeToken = () =>
|
||||
: 'pk_live_e8M4dRNnCCbmpZzduEUZBgJO';
|
||||
|
||||
Lbryio.getExchangeRates = () => {
|
||||
if (!Lbryio.exchangeLastFetched || Date.now() - Lbryio.exchangeLastFetched > EXCHANGE_RATE_TIMEOUT) {
|
||||
if (
|
||||
!Lbryio.exchangeLastFetched ||
|
||||
Date.now() - Lbryio.exchangeLastFetched > EXCHANGE_RATE_TIMEOUT
|
||||
) {
|
||||
Lbryio.exchangePromise = new Promise((resolve, reject) => {
|
||||
Lbryio.call('lbc', 'exchange_rate', {}, 'get', true)
|
||||
.then(({ lbc_usd: LBC_USD, lbc_btc: LBC_BTC, btc_usd: BTC_USD }) => {
|
||||
@@ -237,23 +235,4 @@ Lbryio.setOverride = (methodName, newMethod) => {
|
||||
Lbryio.overrides[methodName] = newMethod;
|
||||
};
|
||||
|
||||
function sendCallAnalytics(resource, action, params) {
|
||||
switch (resource) {
|
||||
case 'customer':
|
||||
if (action === 'tip') {
|
||||
analytics.reportEvent('spend_virtual_currency', {
|
||||
// https://developers.google.com/analytics/devguides/collection/ga4/reference/events#spend_virtual_currency
|
||||
value: params.amount,
|
||||
virtual_currency_name: params.currency.toLowerCase(),
|
||||
item_name: 'tip',
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export default Lbryio;
|
||||
@@ -1,79 +0,0 @@
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { batchActions } from 'util/batch-actions';
|
||||
import { doResolveUris } from 'util/lbryURI';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
export function doFetchFeaturedUris(offloadResolve = false) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FEATURED_CONTENT_STARTED,
|
||||
});
|
||||
|
||||
const success = ({ Uris }) => {
|
||||
let urisToResolve = [];
|
||||
Object.keys(Uris).forEach(category => {
|
||||
urisToResolve = [...urisToResolve, ...Uris[category]];
|
||||
});
|
||||
|
||||
const actions = [
|
||||
{
|
||||
type: ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: Uris,
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
if (urisToResolve.length && !offloadResolve) {
|
||||
actions.push(doResolveUris(urisToResolve));
|
||||
}
|
||||
|
||||
dispatch(batchActions(...actions));
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: {},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.call('file', 'list_homepage').then(success, failure);
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchTrendingUris() {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_CONTENT_STARTED,
|
||||
});
|
||||
|
||||
const success = data => {
|
||||
const urisToResolve = data.map(uri => uri.url);
|
||||
const actions = [
|
||||
doResolveUris(urisToResolve),
|
||||
{
|
||||
type: ACTIONS.FETCH_TRENDING_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: data,
|
||||
success: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
dispatch(batchActions(...actions));
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_CONTENT_COMPLETED,
|
||||
data: {
|
||||
uris: [],
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.call('file', 'list_trending').then(success, failure);
|
||||
};
|
||||
}
|
||||
@@ -2,9 +2,6 @@
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
const FETCH_SUB_COUNT_MIN_INTERVAL_MS = 5 * 60 * 1000;
|
||||
const FETCH_SUB_COUNT_IDLE_FIRE_MS = 100;
|
||||
|
||||
export const doFetchViewCount = (claimIdCsv: string) => (dispatch: Dispatch) => {
|
||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_STARTED });
|
||||
|
||||
@@ -13,56 +10,23 @@ export const doFetchViewCount = (claimIdCsv: string) => (dispatch: Dispatch) =>
|
||||
const viewCounts = result;
|
||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_COMPLETED, data: { claimIdCsv, viewCounts } });
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
dispatch({ type: ACTIONS.FETCH_VIEW_COUNT_FAILED, data: error });
|
||||
});
|
||||
};
|
||||
|
||||
const executeFetchSubCount = (claimIdCsv: string) => (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const subCountLastFetchedById = state.stats.subCountLastFetchedById;
|
||||
const now = Date.now();
|
||||
|
||||
const claimIds = claimIdCsv.split(',').filter((id) => {
|
||||
const prev = subCountLastFetchedById[id];
|
||||
return !prev || now - prev > FETCH_SUB_COUNT_MIN_INTERVAL_MS;
|
||||
});
|
||||
|
||||
if (claimIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
export const doFetchSubCount = (claimId: string) => (dispatch: Dispatch) => {
|
||||
dispatch({ type: ACTIONS.FETCH_SUB_COUNT_STARTED });
|
||||
|
||||
return Lbryio.call('subscription', 'sub_count', { claim_id: claimIds.join(',') })
|
||||
return Lbryio.call('subscription', 'sub_count', { claim_id: claimId })
|
||||
.then((result: Array<number>) => {
|
||||
const subCounts = result;
|
||||
const subCount = result[0];
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_SUB_COUNT_COMPLETED,
|
||||
data: { claimIdCsv, subCounts, fetchDate: now },
|
||||
data: { claimId, subCount },
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
dispatch({ type: ACTIONS.FETCH_SUB_COUNT_FAILED, data: error });
|
||||
});
|
||||
};
|
||||
|
||||
let fetchSubCountTimer;
|
||||
let fetchSubCountQueue = '';
|
||||
|
||||
export const doFetchSubCount = (claimIdCsv: string) => (dispatch: Dispatch) => {
|
||||
if (fetchSubCountTimer) {
|
||||
clearTimeout(fetchSubCountTimer);
|
||||
}
|
||||
|
||||
if (fetchSubCountQueue && !fetchSubCountQueue.endsWith(',')) {
|
||||
fetchSubCountQueue += ',';
|
||||
}
|
||||
|
||||
fetchSubCountQueue += claimIdCsv;
|
||||
|
||||
fetchSubCountTimer = setTimeout(() => {
|
||||
dispatch(executeFetchSubCount(fetchSubCountQueue));
|
||||
fetchSubCountQueue = '';
|
||||
}, FETCH_SUB_COUNT_IDLE_FIRE_MS);
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
export const doUpdateUploadProgress = (
|
||||
progress: string,
|
||||
params: { [key: string]: any },
|
||||
xhr: any
|
||||
) => (dispatch: Dispatch) =>
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_UPLOAD_PROGRESS,
|
||||
data: { progress, params, xhr },
|
||||
});
|
||||
@@ -1,48 +0,0 @@
|
||||
import { handleActions } from 'util/redux-utils';
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
const defaultState = {
|
||||
fetchingFeaturedContent: false,
|
||||
fetchingFeaturedContentFailed: false,
|
||||
featuredUris: undefined,
|
||||
fetchingTrendingContent: false,
|
||||
fetchingTrendingContentFailed: false,
|
||||
trendingUris: undefined,
|
||||
};
|
||||
|
||||
export const homepageReducer = handleActions(
|
||||
{
|
||||
[ACTIONS.FETCH_FEATURED_CONTENT_STARTED]: state => ({
|
||||
...state,
|
||||
fetchingFeaturedContent: true,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_FEATURED_CONTENT_COMPLETED]: (state, action) => {
|
||||
const { uris, success } = action.data;
|
||||
|
||||
return {
|
||||
...state,
|
||||
fetchingFeaturedContent: false,
|
||||
fetchingFeaturedContentFailed: !success,
|
||||
featuredUris: uris,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.FETCH_TRENDING_CONTENT_STARTED]: state => ({
|
||||
...state,
|
||||
fetchingTrendingContent: true,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_TRENDING_CONTENT_COMPLETED]: (state, action) => {
|
||||
const { uris, success } = action.data;
|
||||
|
||||
return {
|
||||
...state,
|
||||
fetchingTrendingContent: false,
|
||||
fetchingTrendingContentFailed: !success,
|
||||
trendingUris: uris,
|
||||
};
|
||||
},
|
||||
},
|
||||
defaultState
|
||||
);
|
||||
@@ -8,18 +8,15 @@ const defaultState = {
|
||||
fetchingSubCount: false,
|
||||
subCountError: undefined,
|
||||
subCountById: {},
|
||||
subCountLastFetchedById: {},
|
||||
};
|
||||
|
||||
export const statsReducer = handleActions(
|
||||
{
|
||||
[ACTIONS.FETCH_VIEW_COUNT_STARTED]: (state) => ({ ...state, fetchingViewCount: true }),
|
||||
|
||||
[ACTIONS.FETCH_VIEW_COUNT_STARTED]: state => ({ ...state, fetchingViewCount: true }),
|
||||
[ACTIONS.FETCH_VIEW_COUNT_FAILED]: (state, action) => ({
|
||||
...state,
|
||||
viewCountError: action.data,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_VIEW_COUNT_COMPLETED]: (state, action) => {
|
||||
const { claimIdCsv, viewCounts } = action.data;
|
||||
|
||||
@@ -38,43 +35,20 @@ export const statsReducer = handleActions(
|
||||
viewCountById,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.FETCH_SUB_COUNT_STARTED]: (state) => ({ ...state, fetchingSubCount: true }),
|
||||
|
||||
[ACTIONS.FETCH_SUB_COUNT_STARTED]: state => ({ ...state, fetchingSubCount: true }),
|
||||
[ACTIONS.FETCH_SUB_COUNT_FAILED]: (state, action) => ({
|
||||
...state,
|
||||
subCountError: action.data,
|
||||
}),
|
||||
|
||||
[ACTIONS.FETCH_SUB_COUNT_COMPLETED]: (state, action) => {
|
||||
const { claimIdCsv, subCounts, fetchDate } = action.data;
|
||||
const { claimId, subCount } = action.data;
|
||||
|
||||
const subCountById = Object.assign({}, state.subCountById);
|
||||
const subCountLastFetchedById = Object.assign({}, state.subCountLastFetchedById);
|
||||
const claimIds = claimIdCsv.split(',');
|
||||
let dataChanged = false;
|
||||
|
||||
if (claimIds.length === subCounts.length) {
|
||||
claimIds.forEach((claimId, index) => {
|
||||
if (subCountById[claimId] !== subCounts[index]) {
|
||||
subCountById[claimId] = subCounts[index];
|
||||
dataChanged = true;
|
||||
}
|
||||
subCountLastFetchedById[claimId] = fetchDate;
|
||||
});
|
||||
}
|
||||
|
||||
const newState = {
|
||||
const subCountById = { ...state.subCountById, [claimId]: subCount };
|
||||
return {
|
||||
...state,
|
||||
fetchingSubCount: false,
|
||||
subCountLastFetchedById,
|
||||
subCountById,
|
||||
};
|
||||
|
||||
if (dataChanged) {
|
||||
newState.subCountById = subCountById;
|
||||
}
|
||||
|
||||
return newState;
|
||||
},
|
||||
},
|
||||
defaultState
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
/*
|
||||
test mock:
|
||||
currentUploads: {
|
||||
'test#upload': {
|
||||
progress: 50,
|
||||
params: {
|
||||
name: 'steve',
|
||||
thumbnail_url: 'https://dev2.spee.ch/4/KMNtoSZ009fawGz59VG8PrID.jpeg',
|
||||
},
|
||||
},
|
||||
},
|
||||
*/
|
||||
|
||||
export type Params = {
|
||||
channel?: string,
|
||||
name: string,
|
||||
thumbnail_url: ?string,
|
||||
title: ?string,
|
||||
};
|
||||
|
||||
export type UploadItem = {
|
||||
progess: string,
|
||||
params: Params,
|
||||
xhr?: any,
|
||||
};
|
||||
|
||||
export type TvState = {
|
||||
currentUploads: { [key: string]: UploadItem },
|
||||
};
|
||||
|
||||
const reducers = {};
|
||||
|
||||
const defaultState: TvState = {
|
||||
currentUploads: {},
|
||||
};
|
||||
|
||||
reducers[ACTIONS.UPDATE_UPLOAD_PROGRESS] = (state: TvState, action) => {
|
||||
const { progress, params, xhr } = action.data;
|
||||
const key = params.channel ? `${params.name}#${params.channel}` : `${params.name}#anonymous`;
|
||||
let currentUploads;
|
||||
if (!progress) {
|
||||
currentUploads = Object.assign({}, state.currentUploads);
|
||||
Object.keys(currentUploads).forEach(k => {
|
||||
if (k === key) {
|
||||
delete currentUploads[key];
|
||||
}
|
||||
});
|
||||
} else {
|
||||
currentUploads = Object.assign({}, state.currentUploads);
|
||||
currentUploads[key] = { progress, params, xhr };
|
||||
}
|
||||
return { ...state, currentUploads };
|
||||
};
|
||||
|
||||
export function webReducer(state: TvState = defaultState, action: any) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
return state;
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
const selectState = (state) => state.auth || {};
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectAuthToken = (state) => selectState(state).authToken;
|
||||
export const selectIsAuthenticating = (state) => selectState(state).authenticating;
|
||||
const selectState = state => state.auth || {};
|
||||
|
||||
export const selectAuthToken = createSelector(selectState, state => state.authToken);
|
||||
|
||||
export const selectIsAuthenticating = createSelector(selectState, state => state.authenticating);
|
||||
@@ -1,96 +0,0 @@
|
||||
// @flow
|
||||
|
||||
// TODO: This should be in 'redux/selectors/claim.js'. Temporarily putting it
|
||||
// here to get past importing issues with 'lbryinc', which the real fix might
|
||||
// involve moving it from 'extras' to 'ui' (big change).
|
||||
|
||||
import { createCachedSelector } from 're-reselect';
|
||||
import { selectClaimForUri } from 'redux/selectors/claims';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { isURIEqual } from 'util/lbryURI';
|
||||
|
||||
const selectClaimExistsForUri = (state, uri) => {
|
||||
return Boolean(selectClaimForUri(state, uri));
|
||||
};
|
||||
|
||||
const selectTxidForUri = (state, uri) => {
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
return signingChannel ? signingChannel.txid : claim ? claim.txid : undefined;
|
||||
};
|
||||
|
||||
const selectNoutForUri = (state, uri) => {
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
return signingChannel ? signingChannel.nout : claim ? claim.nout : undefined;
|
||||
};
|
||||
|
||||
const selectPermanentUrlForUri = (state, uri) => {
|
||||
const claim = selectClaimForUri(state, uri);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
return signingChannel ? signingChannel.permanent_url : claim ? claim.permanent_url : undefined;
|
||||
};
|
||||
|
||||
export const selectBanStateForUri = createCachedSelector(
|
||||
// Break apart 'selectClaimForUri' into 4 cheaper selectors that return
|
||||
// primitives for values that we care about. The Claim object itself is easily
|
||||
// invalidated due to constantly-changing fields like 'confirmation'.
|
||||
selectClaimExistsForUri,
|
||||
selectTxidForUri,
|
||||
selectNoutForUri,
|
||||
selectPermanentUrlForUri,
|
||||
selectBlackListedOutpoints,
|
||||
selectFilteredOutpoints,
|
||||
selectMutedChannels,
|
||||
selectModerationBlockList,
|
||||
(
|
||||
claimExists,
|
||||
txid,
|
||||
nout,
|
||||
permanentUrl,
|
||||
blackListedOutpoints,
|
||||
filteredOutpoints,
|
||||
mutedChannelUris,
|
||||
personalBlocklist
|
||||
) => {
|
||||
const banState = {};
|
||||
|
||||
if (!claimExists) {
|
||||
return banState;
|
||||
}
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level.
|
||||
if (blackListedOutpoints) {
|
||||
if (blackListedOutpoints.some((outpoint) => outpoint.txid === txid && outpoint.nout === nout)) {
|
||||
banState['blacklisted'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// We're checking to see if the stream outpoint or signing channel outpoint
|
||||
// is in the filter list.
|
||||
if (filteredOutpoints) {
|
||||
if (filteredOutpoints.some((outpoint) => outpoint.txid === txid && outpoint.nout === nout)) {
|
||||
banState['filtered'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// block stream claims
|
||||
// block channel claims if we can't control for them in claim search
|
||||
if (mutedChannelUris.length) {
|
||||
if (mutedChannelUris.some((blockedUri) => isURIEqual(blockedUri, permanentUrl))) {
|
||||
banState['muted'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Commentron blocklist
|
||||
if (personalBlocklist.length) {
|
||||
if (personalBlocklist.some((blockedUri) => isURIEqual(blockedUri, permanentUrl))) {
|
||||
banState['blocked'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return banState;
|
||||
}
|
||||
)((state, uri) => String(uri));
|
||||
@@ -1,15 +1,20 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = (state) => state.blacklist || {};
|
||||
export const selectState = state => state.blacklist || {};
|
||||
|
||||
export const selectBlackListedOutpoints = (state) => selectState(state).blackListedOutpoints;
|
||||
export const selectBlackListedOutpoints = createSelector(
|
||||
selectState,
|
||||
state => state.blackListedOutpoints
|
||||
);
|
||||
|
||||
export const selectBlacklistedOutpointMap = createSelector(selectBlackListedOutpoints, (outpoints) =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
export const selectBlacklistedOutpointMap = createSelector(
|
||||
selectBlackListedOutpoints,
|
||||
outpoints =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
);
|
||||
@@ -1,15 +1,20 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = (state) => state.filtered || {};
|
||||
export const selectState = state => state.filtered || {};
|
||||
|
||||
export const selectFilteredOutpoints = (state) => selectState(state).filteredOutpoints;
|
||||
export const selectFilteredOutpoints = createSelector(
|
||||
selectState,
|
||||
state => state.filteredOutpoints
|
||||
);
|
||||
|
||||
export const selectFilteredOutpointMap = createSelector(selectFilteredOutpoints, (outpoints) =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
export const selectFilteredOutpointMap = createSelector(
|
||||
selectFilteredOutpoints,
|
||||
outpoints =>
|
||||
outpoints
|
||||
? outpoints.reduce((acc, val) => {
|
||||
const outpoint = `${val.txid}:${val.nout}`;
|
||||
acc[outpoint] = 1;
|
||||
return acc;
|
||||
}, {})
|
||||
: {}
|
||||
);
|
||||
@@ -1,6 +0,0 @@
|
||||
const selectState = (state) => state.homepage || {};
|
||||
|
||||
export const selectFeaturedUris = (state) => selectState(state).featuredUris;
|
||||
export const selectFetchingFeaturedUris = (state) => selectState(state).fetchingFeaturedContent;
|
||||
export const selectTrendingUris = (state) => selectState(state).trendingUris;
|
||||
export const selectFetchingTrendingUris = (state) => selectState(state).fetchingTrendingContent;
|
||||
@@ -1,13 +1,40 @@
|
||||
const selectState = (state) => state.sync || {};
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectHasSyncedWallet = (state) => selectState(state).hasSyncedWallet;
|
||||
export const selectSyncHash = (state) => selectState(state).syncHash;
|
||||
export const selectSyncData = (state) => selectState(state).syncData;
|
||||
export const selectSetSyncErrorMessage = (state) => selectState(state).setSyncErrorMessage;
|
||||
export const selectGetSyncErrorMessage = (state) => selectState(state).getSyncErrorMessage;
|
||||
export const selectGetSyncIsPending = (state) => selectState(state).getSyncIsPending;
|
||||
export const selectSetSyncIsPending = (state) => selectState(state).setSyncIsPending;
|
||||
export const selectHashChanged = (state) => selectState(state).hashChanged;
|
||||
export const selectSyncApplyIsPending = (state) => selectState(state).syncApplyIsPending;
|
||||
export const selectSyncApplyErrorMessage = (state) => selectState(state).syncApplyErrorMessage;
|
||||
export const selectSyncApplyPasswordError = (state) => selectState(state).syncApplyPasswordError;
|
||||
const selectState = state => state.sync || {};
|
||||
|
||||
export const selectHasSyncedWallet = createSelector(selectState, state => state.hasSyncedWallet);
|
||||
|
||||
export const selectSyncHash = createSelector(selectState, state => state.syncHash);
|
||||
|
||||
export const selectSyncData = createSelector(selectState, state => state.syncData);
|
||||
|
||||
export const selectSetSyncErrorMessage = createSelector(
|
||||
selectState,
|
||||
state => state.setSyncErrorMessage
|
||||
);
|
||||
|
||||
export const selectGetSyncErrorMessage = createSelector(
|
||||
selectState,
|
||||
state => state.getSyncErrorMessage
|
||||
);
|
||||
|
||||
export const selectGetSyncIsPending = createSelector(selectState, state => state.getSyncIsPending);
|
||||
|
||||
export const selectSetSyncIsPending = createSelector(selectState, state => state.setSyncIsPending);
|
||||
|
||||
export const selectHashChanged = createSelector(selectState, state => state.hashChanged);
|
||||
|
||||
export const selectSyncApplyIsPending = createSelector(
|
||||
selectState,
|
||||
state => state.syncApplyIsPending
|
||||
);
|
||||
|
||||
export const selectSyncApplyErrorMessage = createSelector(
|
||||
selectState,
|
||||
state => state.syncApplyErrorMessage
|
||||
);
|
||||
|
||||
export const selectSyncApplyPasswordError = createSelector(
|
||||
selectState,
|
||||
state => state.syncApplyPasswordError
|
||||
);
|
||||
@@ -1,10 +0,0 @@
|
||||
import { createSelector } from 'reselect';
|
||||
|
||||
const selectState = (state) => state.web || {};
|
||||
|
||||
export const selectCurrentUploads = (state) => selectState(state).currentUploads;
|
||||
|
||||
export const selectUploadCount = createSelector(
|
||||
selectCurrentUploads,
|
||||
(currentUploads) => currentUploads && Object.keys(currentUploads).length
|
||||
);
|
||||
@@ -73,7 +73,7 @@ const recsys = {
|
||||
* Called from recommendedContent component
|
||||
*/
|
||||
onRecsLoaded: function (claimId, uris) {
|
||||
if (window && window.store) {
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
if (!recsys.entries[claimId]) {
|
||||
recsys.createRecsysEntry(claimId);
|
||||
@@ -92,10 +92,9 @@ const recsys = {
|
||||
* @param: parentUuid: string (optional)
|
||||
*/
|
||||
createRecsysEntry: function (claimId, parentUuid) {
|
||||
if (window && window.store && claimId) {
|
||||
if (window.store && claimId) {
|
||||
const state = window.store.getState();
|
||||
const user = selectUser(state);
|
||||
const userId = user ? user.id : null;
|
||||
const { id: userId } = selectUser(state);
|
||||
if (parentUuid) {
|
||||
// Make a stub entry that will be filled out on page load
|
||||
recsys.entries[claimId] = {
|
||||
@@ -173,7 +172,7 @@ const recsys = {
|
||||
* if so, send the Entry.
|
||||
*/
|
||||
onPlayerDispose: function (claimId, isEmbedded) {
|
||||
if (window && window.store) {
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const primaryUri = selectPrimaryUri(state);
|
||||
@@ -196,7 +195,7 @@ const recsys = {
|
||||
// * more events until player is disposed. Don't send unless floatingPlayer playingUri
|
||||
// */
|
||||
// onLeaveFilePage: function (primaryUri) {
|
||||
// if (window && window.store) {
|
||||
// if (window.store) {
|
||||
// const state = window.store.getState();
|
||||
// const claim = makeSelectClaimForUri(primaryUri)(state);
|
||||
// const claimId = claim ? claim.claim_id : null;
|
||||
@@ -222,7 +221,7 @@ const recsys = {
|
||||
* Send all claimIds that aren't currently playing.
|
||||
*/
|
||||
onNavigate: function () {
|
||||
if (window && window.store) {
|
||||
if (window.store) {
|
||||
const state = window.store.getState();
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const actualPlayingUri = playingUri && playingUri.uri;
|
||||
|
||||
File renamed without changes.
File renamed without changes.
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// @flow
|
||||
/* eslint-disable no-use-before-define */
|
||||
declare type GetState = () => any;
|
||||
declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
|
||||
declare type Dispatch = (action: {} | Promise<*> | Array<{}> | ThunkAction) => any; // Need to refer to ThunkAction
|
||||
/* eslint-enable */
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
// @flow
|
||||
|
||||
/* eslint-disable no-use-before-define */
|
||||
declare type GetState = () => any;
|
||||
declare type Dispatch = any;
|
||||
/* eslint-enable */
|
||||
+18
-30
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lbry",
|
||||
"version": "0.51.2",
|
||||
"version": "0.52.0-alpha.10",
|
||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||
"keywords": [
|
||||
"lbry"
|
||||
@@ -20,41 +20,36 @@
|
||||
},
|
||||
"main": "./dist/electron/main.js",
|
||||
"scripts": {
|
||||
"analyze": "yarn compile && source-map-explorer --no-border-checks web/dist/public/*.js --html analyzeResults.html",
|
||||
"analyze": "source-map-explorer --only-mapped dist/electron/webpack/ui*.js --html dist/sourceMap.html",
|
||||
"compile:electron": "node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.electron.config.js",
|
||||
"compile:web": "yarn copyenv && cd web && node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js --config webpack.config.js",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron && cross-env NODE_ENV=production yarn compile:web",
|
||||
"compile": "cross-env NODE_ENV=production yarn compile:electron",
|
||||
"copyenv": "copyfiles ./.env* web/",
|
||||
"dev": "yarn dev:electron",
|
||||
"dev:electron": "cross-env NODE_ENV=development node ./electron/devServer.js",
|
||||
"dev:web": "yarn copyenv && cd web && yarn dev",
|
||||
"dev:web-server": "cross-env NODE_ENV=development yarn compile:web && concurrently \"cross-env NODE_ENV=development yarn compile:web --watch\" \"cd web && yarn dev:server\"",
|
||||
"dev:internal-apis": "LBRY_API_URL='http://localhost:8080' yarn dev:electron",
|
||||
"dev:iatv": "LBRY_API_URL='http://localhost:15400' SDK_API_URL='http://localhost:15100' yarn dev:web",
|
||||
"run:web-server": "cross-env NODE_ENV=production yarn compile:web && cd web && yarn dev:server",
|
||||
"pack": "electron-builder --dir",
|
||||
"dist": "electron-builder",
|
||||
"build": "cross-env NODE_ENV=production yarn compile:electron && electron-builder build",
|
||||
"build:dir": "yarn build -- --dir -c.compression=store -c.mac.identity=null",
|
||||
"crossenv": "./node_modules/cross-env/dist/bin/cross-env",
|
||||
"flow": "flow",
|
||||
"lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'extras/**/*.{js,jsx}' && eslint 'web/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow",
|
||||
"lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'extras/**/*.{js,jsx}' && eslint --fix --quiet 'web/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'",
|
||||
"lint": "eslint 'ui/**/*.{js,jsx}' && eslint 'electron/**/*.js' && flow",
|
||||
"lint-fix": "eslint --fix --quiet 'ui/**/*.{js,jsx}' && eslint --fix --quiet 'electron/**/*.js'",
|
||||
"format": "prettier 'src/**/*.{js,jsx,scss,json}' --write",
|
||||
"flow-defs": "flow-typed install",
|
||||
"precommit": "lint-staged",
|
||||
"preinstall": "",
|
||||
"postinstall": "cd web && yarn && cd .. && if-env NODE_ENV=production && yarn postinstall:warning || if-env APP_ENV=web && echo 'Done installing deps' || yarn postinstall:electron",
|
||||
"postinstall:electron": "electron-builder install-app-deps && node ./build/downloadDaemon.js && node ./build/downloadLBRYFirst.js",
|
||||
"preinstall": "yarn cache clean lbry-redux && yarn cache clean lbryinc",
|
||||
"postinstall": "electron-builder install-app-deps && node ./build/downloadDaemon.js",
|
||||
"postinstall:warning": "echo '\n\nWARNING\n\nNot all node modules were installed because NODE_ENV is set to \"production\".\nThis should only be set after installing dependencies with \"yarn\". The app will not work.\n\n'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ungap/from-entries": "^0.2.1",
|
||||
"auto-launch": "^5.0.5",
|
||||
"electron-dl": "^1.11.0",
|
||||
"electron-dl": "^3.2.0",
|
||||
"electron-log": "^2.2.12",
|
||||
"electron-notarize": "^1.0.0",
|
||||
"electron-updater": "^4.2.4",
|
||||
"electron-updater": "^4.6.5",
|
||||
"express": "^4.17.1",
|
||||
"humanize-duration": "^3.27.0",
|
||||
"if-env": "^1.0.4",
|
||||
@@ -63,15 +58,11 @@
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"re-reselect": "^4.0.0",
|
||||
"react-datetime-picker": "^3.2.1",
|
||||
"react-plastic": "^1.1.1",
|
||||
"react-top-loading-bar": "^2.0.1",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"rss": "^1.2.2",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"tempy": "^0.6.0",
|
||||
"videojs-contrib-ads": "^6.9.0",
|
||||
"videojs-ima": "^1.11.0",
|
||||
"videojs-ima-player": "^0.5.6",
|
||||
"videojs-logo": "^2.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -88,6 +79,7 @@
|
||||
"@babel/preset-flow": "^7.12.1",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/register": "^7.0.0",
|
||||
"@datapunt/matomo-tracker-js": "^0.1.4",
|
||||
"@exponent/electron-cookies": "^2.0.0",
|
||||
"@hot-loader/react-dom": "^16.13",
|
||||
"@reach/auto-id": "^0.13.0",
|
||||
@@ -114,7 +106,7 @@
|
||||
"codemirror": "^5.39.2",
|
||||
"concurrently": "^4.1.2",
|
||||
"connected-react-router": "^6.8.0",
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"copy-webpack-plugin": "^6.4.1",
|
||||
"copyfiles": "^2.4.1",
|
||||
"country-data": "^0.0.31",
|
||||
"cross-env": "^7.0.3",
|
||||
@@ -129,8 +121,8 @@
|
||||
"dom-scroll-into-view": "^1.2.1",
|
||||
"dotenv-defaults": "^2.0.1",
|
||||
"dotenv-webpack": "^1.8.0",
|
||||
"electron": "9.4.0",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron": "11.5.0",
|
||||
"electron-builder": "^22.14.5",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-is-dev": "^0.3.0",
|
||||
"electron-webpack": "^2.8.2",
|
||||
@@ -213,7 +205,7 @@
|
||||
"stream-to-blob-url": "^2.1.1",
|
||||
"strip-markdown": "^3.0.3",
|
||||
"style-loader": "^0.23.1",
|
||||
"terser-webpack-plugin": "^1.2.3",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"three": "^0.125.0",
|
||||
"three-full": "^17.1.0",
|
||||
"tiny-relative-date": "^1.3.0",
|
||||
@@ -221,12 +213,12 @@
|
||||
"unist-util-visit": "^2.0.3",
|
||||
"uuid": "^8.3.2",
|
||||
"vast-client": "^3.1.1",
|
||||
"video.js": "^7.13.3",
|
||||
"video.js": "^7.14.3",
|
||||
"videojs-contrib-quality-levels": "^2.0.9",
|
||||
"videojs-event-tracking": "^1.0.1",
|
||||
"villain-react": "^1.0.9",
|
||||
"wavesurfer.js": "^2.2.1",
|
||||
"webpack": "^4.28.4",
|
||||
"webpack": "^4.44.2",
|
||||
"webpack-bundle-analyzer": "^3.1.0",
|
||||
"webpack-cli": "^3.3.10",
|
||||
"webpack-config-utils": "^2.3.1",
|
||||
@@ -243,13 +235,9 @@
|
||||
"yarn": "^1.3"
|
||||
},
|
||||
"lbrySettings": {
|
||||
"lbrynetDaemonVersion": "0.99.0",
|
||||
"lbrynetDaemonVersion": "0.106.0",
|
||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||
"lbrynetDaemonDir": "static/daemon",
|
||||
"lbrynetDaemonFileName": "lbrynet",
|
||||
"LBRYFirstVersion": "0.0.20",
|
||||
"LBRYFirstUrlTemplate": "https://github.com/lbryio/lbry-first/releases/download/vLBRYFIRSTVER/lbry-first_OSNAME_amd64.zip",
|
||||
"LBRYFirstDir": "static/lbry-first",
|
||||
"LBRYFirstFileName": "lbry-first"
|
||||
"lbrynetDaemonFileName": "lbrynet"
|
||||
}
|
||||
}
|
||||
+55
-25
@@ -97,7 +97,6 @@
|
||||
"About --[tab title in Channel Page]--": "About",
|
||||
"About --[link title in Sidebar or Footer]--": "About",
|
||||
"Community Guidelines": "Community Guidelines",
|
||||
"FAQ and Support": "FAQ and Support",
|
||||
"Share Channel": "Share Channel",
|
||||
"Go to page:": "Go to page:",
|
||||
"Enter a URL for your thumbnail.": "Enter a URL for your thumbnail.",
|
||||
@@ -469,8 +468,11 @@
|
||||
"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.",
|
||||
"Invalid claim ID %s.": "Invalid claim ID %s.",
|
||||
"'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead": "'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead",
|
||||
"View Tag": "View Tag",
|
||||
"'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead": "'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead",
|
||||
"Vietnamese": "Vietnamese",
|
||||
"Thai": "Thai",
|
||||
"Arabic": "Arabic",
|
||||
@@ -483,6 +485,7 @@
|
||||
"Greek": "Greek",
|
||||
"Hide": "Hide",
|
||||
"Persian": "Persian",
|
||||
"'contentName' should no longer be used. Use 'streamName' instead": "'contentName' should no longer be used. Use 'streamName' instead",
|
||||
"Sorry, we can't preview this file.": "Sorry, we can't preview this file.",
|
||||
"View File": "View File",
|
||||
"Close": "Close",
|
||||
@@ -2160,8 +2163,6 @@
|
||||
"Bank Accounts": "Bank Accounts",
|
||||
"Connect a bank account to receive tips and compensation in your local currency.": "Connect a bank account to receive tips and compensation in your local currency.",
|
||||
"Payment Methods": "Payment Methods",
|
||||
"Total Received Tips": "Total Received Tips",
|
||||
"Withdrawn": "Withdrawn",
|
||||
"Incoming": "Incoming",
|
||||
"Outgoing": "Outgoing",
|
||||
"Credits --[transactions tab]--": "Credits",
|
||||
@@ -2177,33 +2178,62 @@
|
||||
"Card Last 4": "Card Last 4",
|
||||
"Search blocked channel name": "Search blocked channel name",
|
||||
"Discuss": "Discuss",
|
||||
"Validating...": "Validating...",
|
||||
"[Removed]": "[Removed]",
|
||||
"lbry.tv has been retired. You have been magically transported to Odysee.com. %more%": "lbry.tv has been retired. You have been magically transported to Odysee.com. %more%",
|
||||
"Show more livestreams": "Show more livestreams",
|
||||
"Creator": "Creator",
|
||||
"From comments": "From comments",
|
||||
"From search": "From search",
|
||||
"Manage tags": "Manage tags",
|
||||
"Notification Delivery": "Notification Delivery",
|
||||
"Choose how you'd like to receive your Odysee notifications.": "Choose how you'd like to receive your Odysee notifications.",
|
||||
"Desktop Notifications": "Desktop Notifications",
|
||||
"Browser Notifications": "Browser Notifications",
|
||||
"Receive push notifications in this browser, even when you're not on odysee.com": "Receive push notifications in this browser, even when you're not on odysee.com",
|
||||
"Email Notification Topics": "Email Notification Topics",
|
||||
"Choose which topics you’d like to be emailed about.": "Choose which topics you’d like to be emailed about.",
|
||||
"Email Notifications": "Email Notifications",
|
||||
"Receive notifications to the email address: %email%": "Receive notifications to the email address: %email%",
|
||||
"Realtime push notifications straight to your browser.": "Realtime push notifications straight to your browser.",
|
||||
"Don't miss another notification again.": "Don't miss another notification again.",
|
||||
"Enable Push Notifications": "Enable Push Notifications",
|
||||
"Dismiss": "Dismiss",
|
||||
"Heads up: browser notifications are currently blocked in this browser.": "Heads up: browser notifications are currently blocked in this browser.",
|
||||
"To enable push notifications please configure your browser to allow notifications on odysee.com.": "To enable push notifications please configure your browser to allow notifications on odysee.com.",
|
||||
"Browser notifications aren't supported. Here's a few tips:": "Browser notifications aren't supported. Here's a few tips:",
|
||||
"Notifications aren't available when in incognito or private mode.": "Notifications aren't available when in incognito or private mode.",
|
||||
"On Firefox, notifications won't function if cookies are set to clear on browser close. Please disable or add an exception for Odysee, then refresh.": "On Firefox, notifications won't function if cookies are set to clear on browser close. Please disable or add an exception for Odysee, then refresh.",
|
||||
"For Brave, enable google push notifications in settings.": "For Brave, enable google push notifications in settings.",
|
||||
"Check browser settings to see if notifications are disabled or otherwise restricted.": "Check browser settings to see if notifications are disabled or otherwise restricted.",
|
||||
"No Reposts": "No Reposts",
|
||||
"You haven't reposted anything yet. Do it.": "You haven't reposted anything yet. Do it.",
|
||||
"Claiming credits...": "Claiming credits...",
|
||||
"%totalComments% comments": "%totalComments% comments",
|
||||
"(%lbc_balance% available)": "(%lbc_balance% available)",
|
||||
"Sending...": "Sending...",
|
||||
"Trending for #Art": "Trending for #Art",
|
||||
"Trending for #Btc": "Trending for #Btc",
|
||||
"Trending for #Music": "Trending for #Music",
|
||||
"You sent %lbc% as a tip, Mahalo!": "You sent %lbc% as a tip, Mahalo!",
|
||||
"Export All": "Export All",
|
||||
"Default share url (%name%)": "Default share url (%name%)",
|
||||
"Custom share url": "Custom share url",
|
||||
"Share url": "Share url",
|
||||
"Odysee Connect": "Odysee Connect",
|
||||
"Log in to %CLOUD_CONNECT_SITE_NAME%": "Log in to %CLOUD_CONNECT_SITE_NAME%",
|
||||
"Cloud Connect": "Cloud Connect",
|
||||
"Connect your wallet to Odysee": "Connect your wallet to Odysee",
|
||||
"Minimum time gap in seconds between comments.": "Minimum time gap in seconds between comments.",
|
||||
"Enabling a minimum amount to comment will force all comments to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments to have tips associated with them. This can help prevent spam.",
|
||||
"Comments containing these words will be blocked.": "Comments containing these words will be blocked.",
|
||||
"Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8": "Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8",
|
||||
"Disk Space": "Disk Space",
|
||||
"Data Hosting": "Data Hosting",
|
||||
"Limit": "Limit",
|
||||
"Limit Space Used": "Limit Space Used",
|
||||
"Apply": "Apply",
|
||||
"Limit in GB": "Limit in GB",
|
||||
"If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.": "If you set a limit, playing videos may exceed your limit until cleanup runs every 30 minutes.",
|
||||
"Enable Data Hosting": "Enable Data Hosting",
|
||||
"Data over the limit will be deleted within 30 minutes. This will make the Yrbl cry a little bit.": "Data over the limit will be deleted within 30 minutes. This will make the Yrbl cry a little bit.",
|
||||
"Choose %asset%": "Choose %asset%",
|
||||
"Showing %filtered% results of %total%": "Showing %filtered% results of %total%",
|
||||
"filtered": "filtered",
|
||||
"View All Playlists": "View All Playlists",
|
||||
"Your wallet is not currently using a cloud sync service. You are in control of backing up your wallet.": "Your wallet is not currently using a cloud sync service. You are in control of backing up your wallet.",
|
||||
"Sending": "Sending",
|
||||
"You sent %lbc%": "You sent %lbc%",
|
||||
"Buy LBC": "Buy LBC",
|
||||
"This is information like error logging, performance tracking, and usage statistics. It includes your IP address and basic system details, but no other identifying information (unless you connect to a cloud service)": "This is information like error logging, performance tracking, and usage statistics. It includes your IP address and basic system details, but no other identifying information (unless you connect to a cloud service)",
|
||||
"Use official LBRY wallet servers": "Use official LBRY wallet servers",
|
||||
"Enable Prerelease Updates": "Enable Prerelease Updates",
|
||||
"Enable Upgrade to Test Builds": "Enable Upgrade to Test Builds",
|
||||
"Prereleases may break things and we may not be able to fix them for you.": "Prereleases may break things and we may not be able to fix them for you.",
|
||||
"Limit (GB)": "Limit (GB)",
|
||||
"Limit Hosting for Content you Use": "Limit Hosting for Content you Use",
|
||||
"Allow (GB)": "Allow (GB)",
|
||||
"Content Data Hosting helps to seed things that you watch and download.": "Content Data Hosting helps to seed things that you watch and download.",
|
||||
"Network Data Hosting allows the p2p network to store blobs unrelated to your browsing.": "Network Data Hosting allows the p2p network to store blobs unrelated to your browsing.",
|
||||
"Content: Limit (GB)": "Content: Limit (GB)",
|
||||
"Network: Allow (GB)": "Network: Allow (GB)",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
@@ -1,19 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir="ltr">
|
||||
<head>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-BB8DNPB73F"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('consent', 'default', {
|
||||
'ad_storage': 'denied',
|
||||
'analytics_storage': 'denied',
|
||||
});
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-BB8DNPB73F');
|
||||
</script>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
|
||||
+120
-142
@@ -1,38 +1,15 @@
|
||||
// @flow
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import MatomoTracker from '@datapunt/matomo-tracker-js';
|
||||
import { history } from './store';
|
||||
import { SDK_API_PATH } from './index';
|
||||
|
||||
// --- GA ---
|
||||
// - Events: 500 max (cannot be deleted).
|
||||
// - Dimensions: 25 max (cannot be deleted, but can be "archived"). Usually
|
||||
// tied to an event parameter for reporting purposes.
|
||||
//
|
||||
// Given the limitations above, we need to plan ahead before adding new Events
|
||||
// and Parameters.
|
||||
//
|
||||
// Events:
|
||||
// - Find a Recommended Event that is closest to what you need.
|
||||
// https://support.google.com/analytics/answer/9267735?hl=en
|
||||
// - If doesn't exist, use a Custom Event.
|
||||
//
|
||||
// Parameters:
|
||||
// - Custom parameters don't appear in automated reports until they are tied to
|
||||
// a Dimension.
|
||||
// - Add your entry to GA_DIMENSIONS below -- tt allows us to keep track so that
|
||||
// we don't exceed the limit. Re-use existing parameters if possible.
|
||||
// - Register the Dimension in GA Console to make it visible in reports.
|
||||
|
||||
export const GA_DIMENSIONS = {
|
||||
TYPE: 'type',
|
||||
ACTION: 'action',
|
||||
VALUE: 'value',
|
||||
START_TIME_MS: 'start_time_ms',
|
||||
DURATION_MS: 'duration_ms',
|
||||
END_TIME_MS: 'end_time_ms',
|
||||
};
|
||||
|
||||
// @if TARGET='app'
|
||||
import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
import { generateInitialUrl } from 'util/url';
|
||||
// @endif
|
||||
import { MATOMO_ID, MATOMO_URL } from 'config';
|
||||
// import getConnectionSpeed from 'util/detect-user-bandwidth';
|
||||
|
||||
// let userDownloadBandwidthInBitsPerSecond;
|
||||
@@ -47,23 +24,31 @@ const isProduction = process.env.NODE_ENV === 'production';
|
||||
const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.includes('dev');
|
||||
|
||||
export const SHARE_INTERNAL = 'shareInternal';
|
||||
const SHARE_THIRD_PARTY = 'shareThirdParty';
|
||||
|
||||
const WATCHMAN_BACKEND_ENDPOINT = 'https://watchman.na-backend.odysee.com/reports/playback';
|
||||
const SEND_DATA_TO_WATCHMAN_INTERVAL = 10; // in seconds
|
||||
|
||||
// @if TARGET='app'
|
||||
if (isProduction) {
|
||||
ElectronCookies.enable({
|
||||
origin: 'https://lbry.tv',
|
||||
});
|
||||
}
|
||||
// @endif
|
||||
|
||||
type Analytics = {
|
||||
appStartTime: number,
|
||||
eventStartTime: any,
|
||||
error: (string) => Promise<any>,
|
||||
sentryError: ({} | string, {}) => Promise<any>,
|
||||
pageView: (string, ?string) => void,
|
||||
setUser: (Object) => void,
|
||||
toggleInternal: (boolean, ?boolean) => void,
|
||||
apiLogView: (string, string, string, ?number, ?() => void) => Promise<any>,
|
||||
apiLogPublish: (ChannelClaim | StreamClaim) => void,
|
||||
apiSyncTags: ({}) => void,
|
||||
tagFollowEvent: (string, boolean, ?string) => void,
|
||||
playerLoadedEvent: (string, ?boolean) => void,
|
||||
playerVideoStartedEvent: (?boolean) => void,
|
||||
playerLoadedEvent: (?boolean) => void,
|
||||
playerStartedEvent: (?boolean) => void,
|
||||
videoStartEvent: (string, number, string, number, string, any, number) => void,
|
||||
videoIsPlaying: (boolean, any) => void,
|
||||
videoBufferEvent: (
|
||||
@@ -79,16 +64,15 @@ type Analytics = {
|
||||
}
|
||||
) => Promise<any>,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
emailProvidedEvent: () => void,
|
||||
emailVerifiedEvent: () => void,
|
||||
rewardEligibleEvent: () => void,
|
||||
initAppStartTime: (startTime: number) => void,
|
||||
startupEvent: (time: number) => void,
|
||||
eventStarted: (name: string, time: number, id?: string) => void,
|
||||
eventCompleted: (name: string, time: number, id?: string) => void,
|
||||
startupEvent: () => void,
|
||||
purchaseEvent: (number) => void,
|
||||
readyEvent: (number) => void,
|
||||
openUrlEvent: (string) => void,
|
||||
reportEvent: (string, any) => void,
|
||||
};
|
||||
|
||||
type LogPublishParams = {
|
||||
@@ -100,8 +84,10 @@ type LogPublishParams = {
|
||||
|
||||
let internalAnalyticsEnabled: boolean = IS_WEB || false;
|
||||
// let thirdPartyAnalyticsEnabled: boolean = IS_WEB || false;
|
||||
|
||||
const isGaAllowed = internalAnalyticsEnabled && isProduction;
|
||||
// @if TARGET='app'
|
||||
if (window.localStorage.getItem(SHARE_INTERNAL) === 'true') internalAnalyticsEnabled = true;
|
||||
// if (window.localStorage.getItem(SHARE_THIRD_PARTY) === 'true') thirdPartyAnalyticsEnabled = true;
|
||||
// @endif
|
||||
|
||||
/**
|
||||
* Determine the mobile device type viewing the data
|
||||
@@ -222,14 +208,15 @@ async function sendWatchmanData(body) {
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
return response;
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
console.log('ERROR FROM WATCHMAN BACKEND');
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
const analytics: Analytics = {
|
||||
appStartTime: 0,
|
||||
eventStartTime: {},
|
||||
|
||||
// receive buffer events from tracking plugin and save buffer amounts and times for backend call
|
||||
videoBufferEvent: async (claim, data) => {
|
||||
amountOfBufferEvents = amountOfBufferEvents + 1;
|
||||
@@ -268,7 +255,7 @@ const analytics: Analytics = {
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
}
|
||||
},
|
||||
videoStartEvent: (claimId, timeToStartVideo, poweredBy, passedUserId, canonicalUrl, passedPlayer, videoBitrate) => {
|
||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, passedPlayer, videoBitrate) => {
|
||||
// populate values for watchman when video starts
|
||||
userId = passedUserId;
|
||||
claimUrl = canonicalUrl;
|
||||
@@ -277,7 +264,9 @@ const analytics: Analytics = {
|
||||
videoType = passedPlayer.currentSource().type;
|
||||
videoPlayer = passedPlayer;
|
||||
bitrateAsBitsPerSecond = videoBitrate;
|
||||
sendPromMetric('time_to_start', timeToStartVideo);
|
||||
|
||||
sendPromMetric('time_to_start', duration);
|
||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||
},
|
||||
error: (message) => {
|
||||
return new Promise((resolve) => {
|
||||
@@ -303,17 +292,36 @@ const analytics: Analytics = {
|
||||
}
|
||||
});
|
||||
},
|
||||
pageView: (path, search) => {
|
||||
if (internalAnalyticsEnabled) {
|
||||
const params: { href: string, customDimensions?: Array<{ id: number, value: ?string }> } = { href: `${path}` };
|
||||
const dimensions = [];
|
||||
const searchParams = search && new URLSearchParams(search);
|
||||
|
||||
if (searchParams && searchParams.get('src')) {
|
||||
dimensions.push({ id: 1, value: searchParams.get('src') });
|
||||
}
|
||||
if (dimensions.length) {
|
||||
params['customDimensions'] = dimensions;
|
||||
}
|
||||
MatomoInstance.trackPageView(params);
|
||||
}
|
||||
},
|
||||
setUser: (userId) => {
|
||||
if (isGaAllowed && userId && window.gtag) {
|
||||
window.gtag('set', { user_id: userId });
|
||||
if (internalAnalyticsEnabled && userId) {
|
||||
window._paq.push(['setUserId', String(userId)]);
|
||||
Native.getAppVersionInfo().then(({ localVersion }) => {
|
||||
sendMatomoEvent('Version', 'Desktop-Version', localVersion);
|
||||
});
|
||||
}
|
||||
},
|
||||
toggleInternal: (enabled: boolean): void => {
|
||||
// Always collect analytics on Odysee for now.
|
||||
internalAnalyticsEnabled = enabled;
|
||||
window.localStorage.setItem(SHARE_INTERNAL, enabled);
|
||||
},
|
||||
|
||||
toggleThirdParty: (enabled: boolean): void => {
|
||||
// Always collect analytics on Odysee for now.
|
||||
window.localStorage.setItem(SHARE_THIRD_PARTY, enabled);
|
||||
},
|
||||
|
||||
apiLogView: (uri, outpoint, claimId, timeToStart) => {
|
||||
@@ -330,7 +338,6 @@ const analytics: Analytics = {
|
||||
claim_id: claimId,
|
||||
};
|
||||
|
||||
// lbry.tv streams from AWS so we don't care about the time to start
|
||||
if (timeToStart && !IS_WEB) {
|
||||
params.time_to_start = timeToStart;
|
||||
}
|
||||
@@ -370,108 +377,56 @@ const analytics: Analytics = {
|
||||
}
|
||||
},
|
||||
adsFetchedEvent: () => {
|
||||
sendGaEvent('ad_fetched');
|
||||
sendMatomoEvent('Media', 'AdsFetched');
|
||||
},
|
||||
playerLoadedEvent: (renderMode, embedded) => {
|
||||
const RENDER_MODE_TO_EVENT = (renderMode) => {
|
||||
switch (renderMode) {
|
||||
case RENDER_MODES.VIDEO:
|
||||
return 'loaded_video';
|
||||
case RENDER_MODES.AUDIO:
|
||||
return 'loaded_audio';
|
||||
case RENDER_MODES.MARKDOWN:
|
||||
return 'loaded_markdown';
|
||||
case RENDER_MODES.IMAGE:
|
||||
return 'loaded_image';
|
||||
default:
|
||||
return 'loaded_misc';
|
||||
}
|
||||
};
|
||||
|
||||
sendGaEvent('player', {
|
||||
[GA_DIMENSIONS.ACTION]: RENDER_MODE_TO_EVENT(renderMode),
|
||||
[GA_DIMENSIONS.TYPE]: embedded ? 'embedded' : 'onsite',
|
||||
});
|
||||
adsReceivedEvent: (response) => {
|
||||
sendMatomoEvent('Media', 'AdsReceived', JSON.stringify(response));
|
||||
},
|
||||
playerVideoStartedEvent: (embedded) => {
|
||||
sendGaEvent('player', {
|
||||
[GA_DIMENSIONS.ACTION]: 'started_video',
|
||||
[GA_DIMENSIONS.TYPE]: embedded ? 'embedded' : 'onsite',
|
||||
});
|
||||
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) => {
|
||||
sendGaEvent('tags', {
|
||||
[GA_DIMENSIONS.ACTION]: following ? 'follow' : 'unfollow',
|
||||
[GA_DIMENSIONS.VALUE]: tag,
|
||||
});
|
||||
sendMatomoEvent('Tag', following ? 'Tag-Follow' : 'Tag-Unfollow', tag);
|
||||
},
|
||||
channelBlockEvent: (uri, blocked, location) => {
|
||||
sendMatomoEvent(blocked ? 'Channel-Hidden' : 'Channel-Unhidden', uri);
|
||||
},
|
||||
emailProvidedEvent: () => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'email_provided',
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Email-Provided');
|
||||
},
|
||||
emailVerifiedEvent: () => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'email_verified',
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Email-Verified');
|
||||
},
|
||||
rewardEligibleEvent: () => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'reward_eligible',
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Reward-Eligible');
|
||||
},
|
||||
openUrlEvent: (url: string) => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'open_url',
|
||||
url,
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Open-Url', url);
|
||||
},
|
||||
trendingAlgorithmEvent: (trendingAlgorithm: string) => {
|
||||
sendGaEvent('engagement', {
|
||||
[GA_DIMENSIONS.TYPE]: 'trending_algorithm',
|
||||
trending_algorithm: trendingAlgorithm,
|
||||
});
|
||||
sendMatomoEvent('Engagement', 'Trending-Algorithm', trendingAlgorithm);
|
||||
},
|
||||
initAppStartTime: (startTime: number) => {
|
||||
analytics.appStartTime = startTime;
|
||||
startupEvent: () => {
|
||||
sendMatomoEvent('Startup', 'Startup');
|
||||
},
|
||||
startupEvent: (time: number) => {
|
||||
if (analytics.appStartTime !== 0) {
|
||||
sendGaEvent('diag_app_ready', {
|
||||
[GA_DIMENSIONS.DURATION_MS]: time - analytics.appStartTime,
|
||||
});
|
||||
}
|
||||
},
|
||||
eventStarted: (name: string, time: number, id?: string) => {
|
||||
const key = id || name;
|
||||
analytics.eventStartTime[key] = time;
|
||||
},
|
||||
eventCompleted: (name: string, time: number, id?: string) => {
|
||||
const key = id || name;
|
||||
if (analytics.eventStartTime[key]) {
|
||||
sendGaEvent(name, {
|
||||
[GA_DIMENSIONS.START_TIME_MS]: analytics.eventStartTime[key] - analytics.appStartTime,
|
||||
[GA_DIMENSIONS.DURATION_MS]: time - analytics.eventStartTime[key],
|
||||
[GA_DIMENSIONS.END_TIME_MS]: time - analytics.appStartTime,
|
||||
});
|
||||
|
||||
delete analytics.eventStartTime[key];
|
||||
}
|
||||
readyEvent: (timeToReady: number) => {
|
||||
sendMatomoEvent('Startup', 'App-Ready', 'Time', timeToReady);
|
||||
},
|
||||
purchaseEvent: (purchaseInt: number) => {
|
||||
sendGaEvent('purchase', {
|
||||
// https://developers.google.com/analytics/devguides/collection/ga4/reference/events#purchase
|
||||
[GA_DIMENSIONS.VALUE]: purchaseInt,
|
||||
});
|
||||
},
|
||||
reportEvent: (event: string, params?: { [string]: string | number }) => {
|
||||
sendGaEvent(event, params);
|
||||
sendMatomoEvent('Purchase', 'Purchase-Complete', 'someLabel', purchaseInt);
|
||||
},
|
||||
};
|
||||
|
||||
function sendGaEvent(event: string, params?: { [string]: string | number }) {
|
||||
if (isGaAllowed && window.gtag) {
|
||||
window.gtag('event', event, params);
|
||||
function sendMatomoEvent(category, action, name, value) {
|
||||
if (internalAnalyticsEnabled) {
|
||||
const event = { category, action, name, value };
|
||||
MatomoInstance.trackEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,16 +435,39 @@ function sendPromMetric(name: string, value?: number) {
|
||||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||
const params = { name: name, value: value ? value.toString() : '' };
|
||||
url.search = new URLSearchParams(params).toString();
|
||||
return fetch(url, { method: 'post' }).catch(function(error) {});
|
||||
return fetch(url, { method: 'post' });
|
||||
}
|
||||
}
|
||||
|
||||
// Activate
|
||||
if (isGaAllowed && window.gtag) {
|
||||
window.gtag('consent', 'update', {
|
||||
ad_storage: 'granted',
|
||||
analytics_storage: 'granted',
|
||||
});
|
||||
}
|
||||
const MatomoInstance = new MatomoTracker({
|
||||
urlBase: MATOMO_URL,
|
||||
siteId: MATOMO_ID, // optional, default value: `1`
|
||||
// heartBeat: { // optional, enabled by default
|
||||
// active: true, // optional, default value: true
|
||||
// seconds: 10 // optional, default value: `15
|
||||
// },
|
||||
// linkTracking: false // optional, default value: true
|
||||
});
|
||||
|
||||
// Manually call the first page view
|
||||
// React Router doesn't include this on `history.listen`
|
||||
// @if TARGET='web'
|
||||
analytics.pageView(window.location.pathname + window.location.search, window.location.search);
|
||||
// @endif
|
||||
|
||||
// @if TARGET='app'
|
||||
analytics.pageView(
|
||||
window.location.pathname.split('.html')[1] + window.location.search || generateInitialUrl(window.location.hash)
|
||||
);
|
||||
// @endif;
|
||||
|
||||
// Listen for url changes and report
|
||||
// This will include search queries
|
||||
history.listen((location) => {
|
||||
const { pathname, search } = location;
|
||||
|
||||
const page = `${pathname}${search}`;
|
||||
analytics.pageView(page, search);
|
||||
});
|
||||
|
||||
export default analytics;
|
||||
@@ -1,3 +1,8 @@
|
||||
import { connect } from 'react-redux';
|
||||
import IframeReact from './view';
|
||||
|
||||
export default IframeReact;
|
||||
const select = state => ({});
|
||||
|
||||
const perform = () => ({});
|
||||
|
||||
export default connect(select, perform)(IframeReact);
|
||||
@@ -1,3 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import AbandonedChannelPreview from './view';
|
||||
|
||||
export default AbandonedChannelPreview;
|
||||
const select = (state, props) => ({});
|
||||
|
||||
export default connect(select)(AbandonedChannelPreview);
|
||||
@@ -1,6 +1,5 @@
|
||||
import { hot } from 'react-hot-loader/root';
|
||||
import { connect } from 'react-redux';
|
||||
import { selectUploadCount } from 'lbryinc';
|
||||
import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors/sync';
|
||||
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
||||
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -20,7 +19,6 @@ import {
|
||||
selectAutoUpdateDownloaded,
|
||||
selectModal,
|
||||
selectActiveChannelClaim,
|
||||
selectIsReloadRequired,
|
||||
} from 'redux/selectors/app';
|
||||
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
|
||||
import { doSyncLoop } from 'redux/actions/sync';
|
||||
@@ -43,9 +41,7 @@ const select = (state) => ({
|
||||
languages: selectLoadedLanguages(state),
|
||||
autoUpdateDownloaded: selectAutoUpdateDownloaded(state),
|
||||
isUpgradeAvailable: selectIsUpgradeAvailable(state),
|
||||
isReloadRequired: selectIsReloadRequired(state),
|
||||
syncError: selectGetSyncErrorMessage(state),
|
||||
uploadCount: selectUploadCount(state),
|
||||
rewards: selectUnclaimedRewards(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
currentModal: selectModal(state),
|
||||
|
||||
+21
-161
@@ -1,56 +1,28 @@
|
||||
// @flow
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React, { useEffect, useRef, useState, useLayoutEffect } from 'react';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import analytics from 'analytics';
|
||||
import { buildURI, parseURI } from 'util/lbryURI';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import Router from 'component/router/index';
|
||||
import ModalRouter from 'modal/modalRouter';
|
||||
import ReactModal from 'react-modal';
|
||||
import { openContextMenu } from 'util/context-menu';
|
||||
import useKonamiListener from 'util/enhanced-layout';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import FileRenderFloating from 'component/fileRenderFloating';
|
||||
import { withRouter } from 'react-router';
|
||||
import usePrevious from 'effects/use-previous';
|
||||
import Nag from 'component/common/nag';
|
||||
import REWARDS from 'rewards';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import Spinner from 'component/spinner';
|
||||
import LANGUAGES from 'constants/languages';
|
||||
|
||||
// @if TARGET='app'
|
||||
import useZoom from 'effects/use-zoom';
|
||||
import useHistoryNav from 'effects/use-history-nav';
|
||||
// @endif
|
||||
// @if TARGET='web'
|
||||
import YoutubeWelcome from 'web/component/youtubeReferralWelcome';
|
||||
import {
|
||||
useDegradedPerformance,
|
||||
STATUS_OK,
|
||||
STATUS_DEGRADED,
|
||||
STATUS_FAILING,
|
||||
STATUS_DOWN,
|
||||
} from 'web/effects/use-degraded-performance';
|
||||
// @endif
|
||||
import LANGUAGE_MIGRATIONS from 'constants/language-migrations';
|
||||
|
||||
const FileDrop = lazyImport(() => import('component/fileDrop' /* webpackChunkName: "fileDrop" */));
|
||||
const NagContinueFirstRun = lazyImport(() => import('component/nagContinueFirstRun' /* webpackChunkName: "nagCFR" */));
|
||||
const OpenInAppLink = lazyImport(() => import('web/component/openInAppLink' /* webpackChunkName: "openInAppLink" */));
|
||||
import FileDrop from 'component/fileDrop';
|
||||
import ModalRouter from 'modal/modalRouter';
|
||||
import Nag from 'component/common/nag';
|
||||
|
||||
// @if TARGET='web'
|
||||
const NagDataCollection = lazyImport(() => import('web/component/nag-data-collection' /* webpackChunkName: "nagDC" */));
|
||||
const NagDegradedPerformance = lazyImport(() =>
|
||||
import('web/component/nag-degraded-performance' /* webpackChunkName: "NagDegradedPerformance" */)
|
||||
);
|
||||
const NagNoUser = lazyImport(() => import('web/component/nag-no-user' /* webpackChunkName: "nag-no-user" */));
|
||||
const NagSunset = lazyImport(() => import('web/component/nag-sunset' /* webpackChunkName: "nag-sunset" */));
|
||||
// @endif
|
||||
|
||||
const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* webpackChunkName: "syncFatalError" */));
|
||||
import SyncFatalError from 'component/syncFatalError';
|
||||
import Yrbl from 'component/yrbl';
|
||||
|
||||
// ****************************************************************************
|
||||
|
||||
@@ -61,8 +33,6 @@ export const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
|
||||
const MOUSE_BACK_BTN = 3;
|
||||
const MOUSE_FORWARD_BTN = 4;
|
||||
|
||||
const imaLibraryPath = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js';
|
||||
|
||||
type Props = {
|
||||
language: string,
|
||||
languages: Array<string>,
|
||||
@@ -84,7 +54,6 @@ type Props = {
|
||||
onSignedIn: () => void,
|
||||
setLanguage: (string) => void,
|
||||
isUpgradeAvailable: boolean,
|
||||
isReloadRequired: boolean,
|
||||
autoUpdateDownloaded: boolean,
|
||||
updatePreferences: () => Promise<any>,
|
||||
getWalletSyncPref: () => Promise<any>,
|
||||
@@ -119,7 +88,6 @@ function App(props: Props) {
|
||||
signIn,
|
||||
autoUpdateDownloaded,
|
||||
isUpgradeAvailable,
|
||||
isReloadRequired,
|
||||
requestDownloadUpgrade,
|
||||
uploadCount,
|
||||
history,
|
||||
@@ -154,45 +122,26 @@ function App(props: Props) {
|
||||
const isRewardApproved = user && user.is_reward_approved;
|
||||
const previousHasVerifiedEmail = usePrevious(hasVerifiedEmail);
|
||||
const previousRewardApproved = usePrevious(isRewardApproved);
|
||||
// @if TARGET='web'
|
||||
const [showAnalyticsNag, setShowAnalyticsNag] = usePersistedState('analytics-nag', true);
|
||||
const [lbryTvApiStatus, setLbryTvApiStatus] = useState(STATUS_OK);
|
||||
// @endif
|
||||
const { pathname, hash, search } = props.location;
|
||||
const { pathname, search } = props.location;
|
||||
const [upgradeNagClosed, setUpgradeNagClosed] = useState(false);
|
||||
const [resolvedSubscriptions, setResolvedSubscriptions] = useState(false);
|
||||
const [sidebarOpen] = usePersistedState('sidebar', true);
|
||||
const [seenSunsestMessage, setSeenSunsetMessage] = usePersistedState('lbrytv-sunset', false);
|
||||
const showUpgradeButton =
|
||||
(autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable)) && !upgradeNagClosed;
|
||||
// referral claiming
|
||||
const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const rawReferrerParam = urlParams.get('r');
|
||||
const fromLbrytvParam = urlParams.get('sunset');
|
||||
const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#');
|
||||
const shouldHideNag = pathname.startsWith(`/$/${PAGES.EMBED}`) || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`);
|
||||
const userId = user && user.id;
|
||||
const useCustomScrollbar = !IS_MAC;
|
||||
const hasMyChannels = myChannelUrls && myChannelUrls.length > 0;
|
||||
const hasNoChannels = myChannelUrls && myChannelUrls.length === 0;
|
||||
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
|
||||
const hasActiveChannelClaim = activeChannelClaim !== undefined;
|
||||
const isPersonalized = !IS_WEB || hasVerifiedEmail;
|
||||
const renderFiledrop = !IS_WEB || isAuthenticated;
|
||||
const isPersonalized = hasVerifiedEmail;
|
||||
const renderFiledrop = isAuthenticated;
|
||||
|
||||
let uri;
|
||||
try {
|
||||
const newpath = buildURI(parseURI(pathname.slice(1).replace(/:/g, '#')));
|
||||
uri = newpath + hash;
|
||||
} catch (e) {}
|
||||
|
||||
// @if TARGET='web'
|
||||
function handleAnalyticsDismiss() {
|
||||
setShowAnalyticsNag(false);
|
||||
}
|
||||
|
||||
// @endif
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
analytics.setUser(userId);
|
||||
@@ -323,21 +272,6 @@ function App(props: Props) {
|
||||
}
|
||||
}, [previousRewardApproved, isRewardApproved]);
|
||||
|
||||
// Load IMA3 SDK for aniview
|
||||
// @if TARGET='web'
|
||||
useEffect(() => {
|
||||
const script = document.createElement('script');
|
||||
script.src = imaLibraryPath;
|
||||
script.async = true;
|
||||
// $FlowFixMe
|
||||
document.body.appendChild(script);
|
||||
return () => {
|
||||
// $FlowFixMe
|
||||
document.body.removeChild(script);
|
||||
};
|
||||
}, []);
|
||||
// @endif
|
||||
|
||||
// @if TARGET='app'
|
||||
useEffect(() => {
|
||||
if (updatePreferences && getWalletSyncPref && readyForPrefs) {
|
||||
@@ -353,19 +287,10 @@ function App(props: Props) {
|
||||
// ready for sync syncs, however after signin when hasVerifiedEmail, that syncs too.
|
||||
useEffect(() => {
|
||||
// signInSyncPref is cleared after sharedState loop.
|
||||
const syncLoopWithoutInterval = () => syncLoop(true);
|
||||
if (readyForSync && hasVerifiedEmail) {
|
||||
// In case we are syncing.
|
||||
syncLoop();
|
||||
// @if TARGET='web'
|
||||
window.addEventListener('focus', syncLoopWithoutInterval);
|
||||
// @endif
|
||||
}
|
||||
// @if TARGET='web'
|
||||
return () => {
|
||||
window.removeEventListener('focus', syncLoopWithoutInterval);
|
||||
};
|
||||
// @endif
|
||||
}, [readyForSync, hasVerifiedEmail, syncLoop]);
|
||||
|
||||
// We know someone is logging in or not when we get their user object
|
||||
@@ -403,97 +328,32 @@ function App(props: Props) {
|
||||
}
|
||||
}, [sidebarOpen, isPersonalized, resolvedSubscriptions, subscriptions, resolveUris, setResolvedSubscriptions]);
|
||||
|
||||
// @if TARGET='web'
|
||||
useDegradedPerformance(setLbryTvApiStatus, user);
|
||||
// @endif
|
||||
|
||||
// @if TARGET='web'
|
||||
// Require an internal-api user on lbry.tv
|
||||
// This also prevents the site from loading in the un-authed state while we wait for internal-apis to return for the first time
|
||||
// It's not needed on desktop since there is no un-authed state
|
||||
if (user === undefined) {
|
||||
return (
|
||||
<div className="main--empty">
|
||||
<Spinner delayed />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// @endif
|
||||
|
||||
if (syncFatalError) {
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<SyncFatalError
|
||||
// @if TARGET='web'
|
||||
lbryTvApiStatus={lbryTvApiStatus}
|
||||
// @endif
|
||||
/>
|
||||
</React.Suspense>
|
||||
);
|
||||
return <SyncFatalError />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames(MAIN_WRAPPER_CLASS, {
|
||||
// @if TARGET='app'
|
||||
[`${MAIN_WRAPPER_CLASS}--mac`]: IS_MAC,
|
||||
// @endif
|
||||
[`${MAIN_WRAPPER_CLASS}--scrollbar`]: useCustomScrollbar,
|
||||
})}
|
||||
ref={appRef}
|
||||
onContextMenu={IS_WEB ? undefined : (e) => openContextMenu(e)}
|
||||
>
|
||||
{IS_WEB && lbryTvApiStatus === STATUS_DOWN ? (
|
||||
<Yrbl
|
||||
className="main--empty"
|
||||
title={__('odysee.com is currently down')}
|
||||
subtitle={__('My wheel broke, but the good news is that someone from LBRY is working on it.')}
|
||||
<Router />
|
||||
<ModalRouter />
|
||||
{renderFiledrop && <FileDrop />}
|
||||
<FileRenderFloating />
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
{showUpgradeButton && (
|
||||
<Nag
|
||||
message={__('An upgrade is available.')}
|
||||
actionText={__('Install Now')}
|
||||
onClick={requestDownloadUpgrade}
|
||||
onClose={() => setUpgradeNagClosed(true)}
|
||||
/>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<Router />
|
||||
<ModalRouter />
|
||||
<React.Suspense fallback={null}>{renderFiledrop && <FileDrop />}</React.Suspense>
|
||||
<FileRenderFloating />
|
||||
<React.Suspense fallback={null}>
|
||||
{isEnhancedLayout && <Yrbl className="yrbl--enhanced" />}
|
||||
|
||||
{/* @if TARGET='app' */}
|
||||
{showUpgradeButton && (
|
||||
<Nag
|
||||
message={__('An upgrade is available.')}
|
||||
actionText={__('Install Now')}
|
||||
onClick={requestDownloadUpgrade}
|
||||
onClose={() => setUpgradeNagClosed(true)}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
{/* @if TARGET='web' */}
|
||||
<YoutubeWelcome />
|
||||
{!SIMPLE_SITE && !shouldHideNag && <OpenInAppLink uri={uri} />}
|
||||
{!shouldHideNag && <NagContinueFirstRun />}
|
||||
{fromLbrytvParam && !seenSunsestMessage && !shouldHideNag && (
|
||||
<NagSunset email={hasVerifiedEmail} onClose={() => setSeenSunsetMessage(true)} />
|
||||
)}
|
||||
{(lbryTvApiStatus === STATUS_DEGRADED || lbryTvApiStatus === STATUS_FAILING) && !shouldHideNag && (
|
||||
<NagDegradedPerformance onClose={() => setLbryTvApiStatus(STATUS_OK)} />
|
||||
)}
|
||||
{!SIMPLE_SITE && lbryTvApiStatus === STATUS_OK && showAnalyticsNag && !shouldHideNag && (
|
||||
<NagDataCollection onClose={handleAnalyticsDismiss} />
|
||||
)}
|
||||
{user === null && <NagNoUser />}
|
||||
{/* @endif */}
|
||||
</React.Suspense>
|
||||
|
||||
{isReloadRequired && (
|
||||
<Nag
|
||||
message={__('A new version of Odysee is available.')}
|
||||
actionText={__('Refresh')}
|
||||
onClick={() => window.location.reload()}
|
||||
/>
|
||||
)}
|
||||
</React.Fragment>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// @flow
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import React, { Fragment } from 'react';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import ClaimTags from 'component/claimTags';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import Button from 'component/button';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import DateTime from 'component/dateTime';
|
||||
import YoutubeBadge from 'component/youtubeBadge';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
@@ -94,22 +91,13 @@ function ChannelAbout(props: Props) {
|
||||
<div className="media__info-text media__info-text--constrained">{claim.claim_id}</div>
|
||||
</div>
|
||||
|
||||
<label>{__('Staked Credits')}</label>
|
||||
<label>{__('Staked LBRY Credits')}</label>
|
||||
<div className="media__info-text">
|
||||
<CreditAmount
|
||||
badge={false}
|
||||
amount={parseFloat(claim.amount) + parseFloat(claim.meta.support_amount)}
|
||||
precision={8}
|
||||
/>{' '}
|
||||
{SIMPLE_SITE && (
|
||||
<Button
|
||||
button="link"
|
||||
label={__('view other claims at lbry://%name%', {
|
||||
name: claim.name,
|
||||
})}
|
||||
navigate={`/$/${PAGES.TOP}?name=${claim.name}`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<YoutubeBadge channelClaimId={claimId} />
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// @flow
|
||||
import { SHOW_ADS, SIMPLE_SITE } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React, { Fragment } from 'react';
|
||||
@@ -7,9 +6,7 @@ import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import Button from 'component/button';
|
||||
import ClaimListDiscover from 'component/claimListDiscover';
|
||||
import Ads from 'web/component/ads';
|
||||
import Icon from 'component/common/icon';
|
||||
import LivestreamLink from 'component/livestreamLink';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import { DEBOUNCE_WAIT_DURATION_MS } from 'constants/search';
|
||||
import { lighthouse } from 'redux/actions/search';
|
||||
@@ -46,7 +43,6 @@ function ChannelContent(props: Props) {
|
||||
channelIsBlocked,
|
||||
channelIsBlackListed,
|
||||
claim,
|
||||
isAuthenticated,
|
||||
defaultPageSize = CS.PAGE_SIZE,
|
||||
defaultInfiniteScroll = true,
|
||||
showMature,
|
||||
@@ -118,18 +114,15 @@ function ChannelContent(props: Props) {
|
||||
{!fetching && Boolean(claimsInChannel) && !channelIsBlocked && !channelIsBlackListed && (
|
||||
<HiddenNsfwClaims uri={uri} />
|
||||
)}
|
||||
|
||||
<LivestreamLink uri={uri} />
|
||||
|
||||
{!fetching && channelIsBlackListed && (
|
||||
<section className="card card--section">
|
||||
<p>
|
||||
{__(
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications. Content may also be blocked due to DMCA Red Flag rules which are obvious copyright violations we come across, are discussed in public channels, or reported to us.'
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.'
|
||||
)}
|
||||
</p>
|
||||
<div className="section__actions">
|
||||
<Button button="link" href="https://odysee.com/@OdyseeHelp:b/copyright:f" label={__('Read More')} />
|
||||
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
@@ -152,14 +145,12 @@ function ChannelContent(props: Props) {
|
||||
hideAdvancedFilter={!showFilters}
|
||||
tileLayout={tileLayout}
|
||||
uris={searchResults}
|
||||
streamType={SIMPLE_SITE ? CS.CONTENT_ALL : undefined}
|
||||
channelIds={[claimId]}
|
||||
claimType={claimType}
|
||||
feeAmount={CS.FEE_AMOUNT_ANY}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={defaultPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />}
|
||||
meta={
|
||||
showFilters && (
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
|
||||
File renamed without changes.
@@ -20,7 +20,6 @@ import analytics from 'analytics';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { sortLanguageMap } from 'util/default-languages';
|
||||
import ThumbnailBrokenImage from 'component/selectThumbnail/thumbnail-broken.png';
|
||||
import Gerbil from 'component/channelThumbnail/gerbil.png';
|
||||
@@ -414,7 +413,7 @@ function ChannelForm(props: Props) {
|
||||
<Card
|
||||
body={
|
||||
<TagsSearch
|
||||
suggestMature={!SIMPLE_SITE}
|
||||
suggestMature
|
||||
disableAutoFocus
|
||||
disableControlTags
|
||||
limitSelect={MAX_TAG_SELECT}
|
||||
@@ -19,11 +19,9 @@ type Props = {
|
||||
mentionTerm: string,
|
||||
noTopSuggestion?: boolean,
|
||||
showMature: boolean,
|
||||
isLivestream: boolean,
|
||||
creatorUri: string,
|
||||
commentorUris: Array<string>,
|
||||
subscriptionUris: Array<string>,
|
||||
unresolvedCommentors: Array<string>,
|
||||
unresolvedSubscriptions: Array<string>,
|
||||
canonicalCreator: string,
|
||||
canonicalCommentors: Array<string>,
|
||||
@@ -34,10 +32,8 @@ type Props = {
|
||||
|
||||
export default function ChannelMentionSuggestions(props: Props) {
|
||||
const {
|
||||
unresolvedCommentors,
|
||||
unresolvedSubscriptions,
|
||||
canonicalCreator,
|
||||
isLivestream,
|
||||
creatorUri,
|
||||
inputRef,
|
||||
showMature,
|
||||
@@ -184,11 +180,6 @@ export default function ChannelMentionSuggestions(props: Props) {
|
||||
}
|
||||
}, [doResolveUris, stringifiedResults]);
|
||||
|
||||
// Only resolve commentors on Livestreams when actually mentioning/looking for it
|
||||
React.useEffect(() => {
|
||||
if (isLivestream && unresolvedCommentors && mentionTerm) doResolveUris(unresolvedCommentors);
|
||||
}, [doResolveUris, isLivestream, mentionTerm, unresolvedCommentors]);
|
||||
|
||||
// Only resolve the subscriptions that match the mention term, instead of all
|
||||
React.useEffect(() => {
|
||||
if (isTyping) return;
|
||||
|
||||
@@ -49,7 +49,7 @@ function ChannelThumbnail(props: Props) {
|
||||
ThumbUploadError,
|
||||
} = props;
|
||||
const [thumbLoadError, setThumbLoadError] = React.useState(ThumbUploadError);
|
||||
const shouldResolve = !isResolving && claim === undefined;
|
||||
const shouldResolve = claim === undefined;
|
||||
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
|
||||
const thumbnailPreview = rawThumbnailPreview && rawThumbnailPreview.trim().replace(/^http:\/\//i, 'https://');
|
||||
const defaultAvatar = AVATAR_DEFAULT || Gerbil;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// @flow
|
||||
import { INLINE_PLAYER_WRAPPER_CLASS } from 'component/fileRenderFloating/view';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import * as React from 'react';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
@@ -110,13 +109,7 @@ class ClaimLink extends React.Component<Props> {
|
||||
<Button button="link" className="preview-link__url" label={uri} navigate={uri} />
|
||||
</div>
|
||||
) : (
|
||||
<Button
|
||||
button="link"
|
||||
title={SIMPLE_SITE ? __("This channel isn't staking enough Credits for link previews.") : children}
|
||||
label={children}
|
||||
className="button--external-link"
|
||||
navigate={uri}
|
||||
/>
|
||||
<Button button="link" title={children} label={children} className="button--external-link" navigate={uri} />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ type Props = {
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
onClick?: (e: any, claim?: ?Claim, index?: number) => void,
|
||||
noEmpty: boolean,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
@@ -74,6 +75,7 @@ export default function ClaimList(props: Props) {
|
||||
collectionId,
|
||||
showNoSourceClaims,
|
||||
onClick,
|
||||
noEmpty,
|
||||
} = props;
|
||||
|
||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||
@@ -94,21 +96,11 @@ export default function ClaimList(props: Props) {
|
||||
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
|
||||
}
|
||||
|
||||
const handleClaimClicked = React.useCallback(
|
||||
(e, claim, index) => {
|
||||
if (onClick) {
|
||||
onClick(e, claim, index);
|
||||
}
|
||||
},
|
||||
[onClick]
|
||||
);
|
||||
|
||||
const customShouldHide = React.useCallback((claim: StreamClaim) => {
|
||||
// Hack to hide spee.ch thumbnail publishes
|
||||
// If it meets these requirements, it was probably uploaded here:
|
||||
// https://github.com/lbryio/lbry-redux/blob/master/src/redux/actions/publish.js#L74-L79
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
}, []);
|
||||
function handleClaimClicked(e, claim, index) {
|
||||
if (onClick) {
|
||||
onClick(e, claim, index);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = debounce((e) => {
|
||||
@@ -144,7 +136,9 @@ export default function ClaimList(props: Props) {
|
||||
showNoSourceClaims={showNoSourceClaims}
|
||||
/>
|
||||
))}
|
||||
{!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>}
|
||||
{!timedOut && urisLength === 0 && !loading && !noEmpty && (
|
||||
<div className="empty main--empty">{empty || noResultMsg}</div>
|
||||
)}
|
||||
{timedOut && timedOutMessage && <div className="empty main--empty">{timedOutMessage}</div>}
|
||||
</section>
|
||||
) : (
|
||||
@@ -205,15 +199,22 @@ export default function ClaimList(props: Props) {
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
collectionId={collectionId}
|
||||
showNoSourceClaims={showNoSourceClaims}
|
||||
customShouldHide={customShouldHide}
|
||||
onClick={handleClaimClicked}
|
||||
customShouldHide={(claim: StreamClaim) => {
|
||||
// Hack to hide spee.ch thumbnail publishes
|
||||
// If it meets these requirements, it was probably uploaded here:
|
||||
// https://github.com/lbryio/lbry-redux/blob/master/src/redux/actions/publish.js#L74-L79
|
||||
return claim.name.length === 24 && !claim.name.includes(' ') && claim.value.author === 'Spee.ch';
|
||||
}}
|
||||
onClick={(e, claim, index) => handleClaimClicked(e, claim, index)}
|
||||
/>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{!timedOut && urisLength === 0 && !loading && <div className="empty empty--centered">{empty || noResultMsg}</div>}
|
||||
{!timedOut && urisLength === 0 && !loading && !noEmpty && (
|
||||
<div className="empty empty--centered">{empty || noResultMsg}</div>
|
||||
)}
|
||||
{!loading && timedOut && timedOutMessage && <div className="empty empty--centered">{timedOutMessage}</div>}
|
||||
</section>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import type { Node } from 'react';
|
||||
import * as CS from 'constants/claim_search';
|
||||
import React from 'react';
|
||||
@@ -125,8 +125,8 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType,
|
||||
pageSize,
|
||||
defaultClaimType,
|
||||
streamType = SIMPLE_SITE ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined,
|
||||
defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE
|
||||
streamType,
|
||||
defaultStreamType, // add param for DEFAULT_STREAM_TYPE
|
||||
freshness,
|
||||
defaultFreshness = CS.FRESH_WEEK,
|
||||
renderProperties,
|
||||
@@ -452,9 +452,7 @@ function ClaimListDiscover(props: Props) {
|
||||
<p>
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
contact_support: (
|
||||
<Button button="link" label={__('contact support')} href="https://odysee.com/@OdyseeHelp:b?view=about" />
|
||||
),
|
||||
contact_support: <Button button="link" label={__('contact support')} href="https://lbry.com/faq/support" />,
|
||||
}}
|
||||
>
|
||||
If you continue to have issues, please %contact_support%.
|
||||
|
||||
@@ -76,7 +76,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 && claimType === CS.CLAIM_COLLECTION);
|
||||
const showDuration = !claimType || (claimType && claimType !== CS.CLAIM_CHANNEL && claimType !== CS.CLAIM_COLLECTION);
|
||||
const isFiltered = () =>
|
||||
Boolean(
|
||||
urlParams.get(CS.FRESH_KEY) ||
|
||||
@@ -106,13 +106,6 @@ function ClaimListHeader(props: Props) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (hideAdvancedFilter) {
|
||||
setExpanded(false);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
let orderParam = orderBy || urlParams.get(CS.ORDER_BY_KEY) || defaultOrderBy;
|
||||
if (!orderParam) {
|
||||
if (action === 'POP') {
|
||||
@@ -284,7 +277,7 @@ function ClaimListHeader(props: Props) {
|
||||
</div>
|
||||
{expanded && (
|
||||
<>
|
||||
<div className={classnames(`card claim-search__menus`)}>
|
||||
<div className={classnames(`claim-search__menus`)}>
|
||||
{/* FRESHNESS FIELD */}
|
||||
{orderParam === CS.ORDER_BY_TOP && (
|
||||
<div className="claim-search__input-container">
|
||||
@@ -367,7 +360,7 @@ function ClaimListHeader(props: Props) {
|
||||
)}
|
||||
|
||||
{/* LANGUAGE FIELD */}
|
||||
{!claimType && (
|
||||
{
|
||||
<div
|
||||
className={classnames('claim-search__input-container', {
|
||||
'claim-search__input-container--selected': shouldHighlight,
|
||||
@@ -401,7 +394,7 @@ function ClaimListHeader(props: Props) {
|
||||
})}
|
||||
</FormField>
|
||||
</div>
|
||||
)}
|
||||
}
|
||||
|
||||
{/* DURATIONS FIELD */}
|
||||
{showDuration && (
|
||||
@@ -441,30 +434,31 @@ function ClaimListHeader(props: Props) {
|
||||
)}
|
||||
|
||||
{/* PAID FIELD */}
|
||||
<div className={'claim-search__input-container'}>
|
||||
<FormField
|
||||
className={classnames('claim-search__dropdown', {
|
||||
'claim-search__dropdown--selected':
|
||||
feeAmountParam === CS.FEE_AMOUNT_ONLY_FREE || feeAmountParam === CS.FEE_AMOUNT_ONLY_PAID,
|
||||
})}
|
||||
label={__('Price')}
|
||||
type="select"
|
||||
name="paidcontent"
|
||||
value={feeAmountParam}
|
||||
onChange={(e) =>
|
||||
handleChange({
|
||||
key: CS.FEE_AMOUNT_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value={CS.FEE_AMOUNT_ANY}>{__('Any')}</option>
|
||||
<option value={CS.FEE_AMOUNT_ONLY_FREE}>{__('Free')}</option>
|
||||
<option value={CS.FEE_AMOUNT_ONLY_PAID}>{__('Paid')}</option>
|
||||
))}
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
{claimType !== CS.CLAIM_CHANNEL && (
|
||||
<div className={'claim-search__input-container'}>
|
||||
<FormField
|
||||
className={classnames('claim-search__dropdown', {
|
||||
'claim-search__dropdown--selected':
|
||||
feeAmountParam === CS.FEE_AMOUNT_ONLY_FREE || feeAmountParam === CS.FEE_AMOUNT_ONLY_PAID,
|
||||
})}
|
||||
label={__('Price')}
|
||||
type="select"
|
||||
name="paidcontent"
|
||||
value={feeAmountParam}
|
||||
onChange={(e) =>
|
||||
handleChange({
|
||||
key: CS.FEE_AMOUNT_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value={CS.FEE_AMOUNT_ANY}>{__('Any')}</option>
|
||||
<option value={CS.FEE_AMOUNT_ONLY_FREE}>{__('Free')}</option>
|
||||
<option value={CS.FEE_AMOUNT_ONLY_PAID}>{__('Paid')}</option>
|
||||
))}
|
||||
</FormField>
|
||||
</div>
|
||||
)}
|
||||
{/* SORT FIELD */}
|
||||
{orderParam === CS.ORDER_BY_NEW && (
|
||||
<div className={'claim-search__input-container'}>
|
||||
|
||||
@@ -265,15 +265,34 @@ function ClaimMenuList(props: Props) {
|
||||
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
|
||||
}
|
||||
|
||||
// changes MenuButton behavior to show/hide MenuList not on press but on click event
|
||||
let isEventSimulated = false;
|
||||
const menuButtonHandler = (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault();
|
||||
e.type = 'click';
|
||||
}
|
||||
if (!isEventSimulated && e.type === 'mousedown') {
|
||||
e.preventDefault();
|
||||
} else if (e.type === 'click') {
|
||||
isEventSimulated = true;
|
||||
e.target.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
|
||||
isEventSimulated = false;
|
||||
}
|
||||
};
|
||||
|
||||
const shouldShow = !IS_WEB || (IS_WEB && isAuthenticated);
|
||||
return (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
className={classnames('menu__button', { 'claim__menu-button': !inline, 'claim__menu-button--inline': inline })}
|
||||
onMouseDown={menuButtonHandler}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
menuButtonHandler(e);
|
||||
}}
|
||||
onKeyDown={menuButtonHandler}
|
||||
>
|
||||
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
type Props = {
|
||||
collectionIndex?: number,
|
||||
editCollection: (string, CollectionEditParams) => void,
|
||||
listId?: string,
|
||||
lastCollectionIndex?: number,
|
||||
claim: ?Claim,
|
||||
};
|
||||
|
||||
function CollectionButtons(props: Props) {
|
||||
const { collectionIndex, editCollection, listId, lastCollectionIndex, claim } = props;
|
||||
const [confirmDelete, setConfirmDelete] = React.useState(false);
|
||||
return (
|
||||
<div className="collection-preview__edit-buttons">
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
className={'button-collection-manage top-left'}
|
||||
icon={ICONS.UP_TOP}
|
||||
disabled={collectionIndex === 0}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: 0 },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
className={'button-collection-manage bottom-left'}
|
||||
icon={ICONS.DOWN_BOTTOM}
|
||||
disabled={collectionIndex === lastCollectionIndex}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: lastCollectionIndex },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
className={'button-collection-manage'}
|
||||
disabled={collectionIndex === 0}
|
||||
icon={ICONS.UP}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex) - 1 },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
className={'button-collection-manage'}
|
||||
icon={ICONS.DOWN}
|
||||
disabled={collectionIndex === lastCollectionIndex}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex + 1) },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{!confirmDelete && (
|
||||
<div className="collection-preview__edit-group collection-preview__delete ">
|
||||
<Button
|
||||
className={'button-collection-manage button-collection-delete top-right bottom-right'}
|
||||
icon={ICONS.DELETE}
|
||||
onClick={(e) => {
|
||||
setConfirmDelete(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{confirmDelete && (
|
||||
<div className="collection-preview__edit-group collection-preview__delete">
|
||||
<Button
|
||||
className={'button-collection-manage button-collection-delete-cancel top-right'}
|
||||
icon={ICONS.REMOVE}
|
||||
onClick={(e) => {
|
||||
setConfirmDelete(false);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
className={'button-collection-manage button-collection-delete-confirm bottom-right'}
|
||||
icon={ICONS.DELETE}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// $FlowFixMe
|
||||
if (editCollection) editCollection(listId, { claims: [claim], remove: true });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CollectionButtons;
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectReflectingClaimForUri,
|
||||
makeSelectClaimWasPurchased,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectTitleForUri,
|
||||
selectDateForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
@@ -21,11 +20,12 @@ import {
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { doCollectionEdit } from 'redux/actions/collections';
|
||||
import { doFileGet } from 'redux/actions/file';
|
||||
import { selectBanStateForUri } from 'lbryinc';
|
||||
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
|
||||
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import { selectModerationBlockList } from 'redux/selectors/comments';
|
||||
import ClaimPreview from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
@@ -46,13 +46,15 @@ const select = (state, props) => {
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
||||
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
||||
banState: selectBanStateForUri(state, props.uri),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
mutedUris: selectMutedChannels(state),
|
||||
blockedUris: selectModerationBlockList(state),
|
||||
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
||||
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
||||
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
||||
|
||||
@@ -3,15 +3,13 @@ import type { Node } from 'react';
|
||||
import React, { useEffect, forwardRef } from 'react';
|
||||
import { NavLink, withRouter } from 'react-router-dom';
|
||||
import { isEmpty } from 'util/object';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import { isURIValid } from 'util/lbryURI';
|
||||
import { isURIEqual, isURIValid } from 'util/lbryURI';
|
||||
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import ClaimTags from 'component/claimTags';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
@@ -24,17 +22,12 @@ import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
||||
import PublishPending from 'component/publishPending';
|
||||
import ClaimMenuList from 'component/claimMenuList';
|
||||
import ClaimPreviewReset from 'component/claimPreviewReset';
|
||||
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';
|
||||
import CollectionEditButtons from './collection-buttons';
|
||||
|
||||
const AbandonedChannelPreview = lazyImport(() =>
|
||||
import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */)
|
||||
);
|
||||
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
||||
|
||||
// preview images used on the landing page and on the channel page
|
||||
type Props = {
|
||||
@@ -53,9 +46,18 @@ type Props = {
|
||||
nsfw: boolean,
|
||||
placeholder: string,
|
||||
type: string,
|
||||
banState: { blacklisted?: boolean, filtered?: boolean, muted?: boolean, blocked?: boolean },
|
||||
hasVisitedUri: boolean,
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
filteredOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
mutedUris: Array<string>,
|
||||
blockedUris: Array<string>,
|
||||
channelIsBlocked: boolean,
|
||||
actions: boolean | Node | string | number,
|
||||
properties: boolean | Node | string | number | ((Claim) => Node),
|
||||
empty?: Node,
|
||||
@@ -73,8 +75,6 @@ type Props = {
|
||||
hideRepostLabel?: boolean,
|
||||
repostUrl?: string,
|
||||
hideMenu?: boolean,
|
||||
isLivestream?: boolean,
|
||||
isLivestreamActive: boolean,
|
||||
collectionId?: string,
|
||||
editCollection: (string, CollectionEditParams) => void,
|
||||
isCollectionMine: boolean,
|
||||
@@ -105,6 +105,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
streamingUrl,
|
||||
mediaDuration,
|
||||
// user properties
|
||||
channelIsBlocked,
|
||||
hasVisitedUri,
|
||||
// component
|
||||
history,
|
||||
@@ -130,13 +131,14 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
properties,
|
||||
onClick,
|
||||
actions,
|
||||
banState,
|
||||
mutedUris,
|
||||
blockedUris,
|
||||
blackListedOutpoints,
|
||||
filteredOutpoints,
|
||||
includeSupportAction,
|
||||
renderActions,
|
||||
hideMenu = false,
|
||||
// repostUrl,
|
||||
isLivestream, // need both? CHECK
|
||||
isLivestreamActive,
|
||||
collectionId,
|
||||
collectionIndex,
|
||||
editCollection,
|
||||
@@ -148,7 +150,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
} = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
const listId = collectionId || collectionClaimId;
|
||||
const listId = collectionId || collectionClaimId || null;
|
||||
const WrapperElement = wrapperElement || 'li';
|
||||
const shouldFetch =
|
||||
claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending);
|
||||
@@ -168,7 +170,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
</span>
|
||||
);
|
||||
}, [channelSubCount]);
|
||||
const isValid = uri && isURIValid(uri, false);
|
||||
const isValid = uri && isURIValid(uri);
|
||||
|
||||
// $FlowFixMe
|
||||
const isPlayable =
|
||||
@@ -234,13 +236,28 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
((abandoned && !showUnresolvedClaim) || (!claimIsMine && obscureNsfw && nsfw));
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level
|
||||
if (!shouldHide && !claimIsMine && (banState.blacklisted || banState.filtered)) {
|
||||
shouldHide = true;
|
||||
if (claim && !claimIsMine && !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 && !claimIsMine && !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 (!shouldHide && !showUserBlocked && (banState.muted || banState.blocked)) {
|
||||
shouldHide = true;
|
||||
if (claim && !shouldHide && !showUserBlocked && mutedUris.length && signingChannel) {
|
||||
shouldHide = mutedUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
}
|
||||
if (claim && !shouldHide && !showUserBlocked && blockedUris.length && signingChannel) {
|
||||
shouldHide = blockedUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
}
|
||||
|
||||
if (!shouldHide && customShouldHide && claim) {
|
||||
@@ -272,7 +289,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
}
|
||||
}, [isValid, uri, isResolvingUri, shouldFetch, resolveUri]);
|
||||
|
||||
if ((shouldHide && !showNullPlaceholder) || (isLivestream && !ENABLE_NO_SOURCE_CLAIMS)) {
|
||||
if (shouldHide && !showNullPlaceholder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -299,21 +316,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
}
|
||||
|
||||
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && isChannelUri && claim === null) {
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<AbandonedChannelPreview uri={uri} type />
|
||||
</React.Suspense>
|
||||
);
|
||||
return <AbandonedChannelPreview uri={uri} type />;
|
||||
}
|
||||
if (placeholder === 'publish' && !claim && uri.startsWith('lbry://@')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let liveProperty = null;
|
||||
if (isLivestreamActive === true) {
|
||||
liveProperty = (claim) => <>LIVE</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<WrapperElement
|
||||
ref={ref}
|
||||
@@ -323,7 +331,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
'claim-preview__wrapper--channel': isChannelUri && type !== 'inline',
|
||||
'claim-preview__wrapper--inline': type === 'inline',
|
||||
'claim-preview__wrapper--small': type === 'small',
|
||||
'claim-preview__live': isLivestreamActive,
|
||||
'claim-preview__active': active,
|
||||
})}
|
||||
>
|
||||
@@ -339,8 +346,18 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
'claim-preview--channel': isChannelUri,
|
||||
'claim-preview--visited': !isChannelUri && !claimIsMine && hasVisitedUri,
|
||||
'claim-preview--pending': pending,
|
||||
'claim-preview--collection-mine': isMyCollection && listId && type === 'listview',
|
||||
})}
|
||||
>
|
||||
{isMyCollection && listId && type === 'listview' && (
|
||||
<CollectionEditButtons
|
||||
collectionIndex={collectionIndex}
|
||||
editCollection={editCollection}
|
||||
listId={listId}
|
||||
lastCollectionIndex={lastCollectionIndex}
|
||||
claim={claim}
|
||||
/>
|
||||
)}
|
||||
{isChannelUri && claim ? (
|
||||
<UriIndicator focusable={false} uri={uri} link>
|
||||
<ChannelThumbnail uri={uri} small={type === 'inline'} />
|
||||
@@ -360,11 +377,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
</div>
|
||||
{/* @endif */}
|
||||
{(!isLivestream || isLivestreamActive) && (
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
|
||||
</div>
|
||||
)}
|
||||
</FileThumbnail>
|
||||
</NavLink>
|
||||
) : (
|
||||
@@ -393,58 +405,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
{!pending && (
|
||||
<>
|
||||
{renderActions && claim && renderActions(claim)}
|
||||
{Boolean(isMyCollection && listId) && (
|
||||
<>
|
||||
<div className="collection-preview__edit-buttons">
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
button="alt"
|
||||
className={'button-collection-order'}
|
||||
disabled={collectionIndex === 0}
|
||||
icon={ICONS.UP}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex) - 1 },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
className={'button-collection-order'}
|
||||
icon={ICONS.DOWN}
|
||||
disabled={collectionIndex === lastCollectionIndex}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(listId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex + 1) },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
button="alt"
|
||||
icon={ICONS.DELETE}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// $FlowFixMe
|
||||
if (editCollection) editCollection(listId, { claims: [claim], remove: true });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{shouldHideActions || renderActions ? null : actions !== undefined ? (
|
||||
actions
|
||||
) : (
|
||||
@@ -455,7 +415,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isChannelUri && !banState.muted && !claimIsMine && (
|
||||
{isChannelUri && !channelIsBlocked && !claimIsMine && (
|
||||
<SubscribeButton
|
||||
uri={repostedChannelUri || (uri.startsWith('lbry://') ? uri : `lbry://${uri}`)}
|
||||
/>
|
||||
@@ -481,13 +441,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{claimIsMine && isLivestream && (
|
||||
<div className={'claim-preview__hints'}>
|
||||
<ClaimPreviewReset />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!hideMenu && <ClaimMenuList uri={uri} collectionId={listId} />}
|
||||
</>
|
||||
</WrapperElement>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import ClaimPreviewReset from './view';
|
||||
|
||||
const select = (state) => {
|
||||
const { claim_id: channelId, name: channelName } = selectActiveChannelClaim(state) || {};
|
||||
return {
|
||||
channelName,
|
||||
channelId,
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doToast: (props) => dispatch(doToast(props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreviewReset);
|
||||
@@ -1,87 +0,0 @@
|
||||
// @flow
|
||||
|
||||
import React from 'react';
|
||||
import Lbry from 'lbry';
|
||||
import { LIVESTREAM_KILL } from 'constants/livestream';
|
||||
import { SITE_HELP_EMAIL } from 'config';
|
||||
import { toHex } from 'util/hex';
|
||||
import Button from 'component/button';
|
||||
import 'scss/component/claim-preview-reset.scss';
|
||||
|
||||
// @Todo: move out of component.
|
||||
const getStreamData = async (channelId: string, channelName: string) => {
|
||||
if (!channelId || !channelName) throw new Error('Invalid channel data provided.');
|
||||
|
||||
const channelNameHex = toHex(channelName);
|
||||
let channelSignature;
|
||||
|
||||
try {
|
||||
channelSignature = await Lbry.channel_sign({ channel_id: channelId, hexdata: channelNameHex });
|
||||
if (!channelSignature || !channelSignature.signature || !channelSignature.signing_ts) {
|
||||
throw new Error('Error getting channel signature.');
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return {
|
||||
d: channelNameHex,
|
||||
s: channelSignature.signature,
|
||||
t: channelSignature.signing_ts,
|
||||
};
|
||||
};
|
||||
|
||||
// @Todo: move out of component.
|
||||
const killStream = async (channelId: string, payload: any) => {
|
||||
fetch(`${LIVESTREAM_KILL}/${channelId}`, {
|
||||
method: 'POST',
|
||||
mode: 'no-cors',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: new URLSearchParams(payload),
|
||||
})
|
||||
.then((res) => {
|
||||
if (!res.status === 200) throw new Error('Kill stream API failed.');
|
||||
})
|
||||
.catch((e) => {
|
||||
throw e;
|
||||
});
|
||||
};
|
||||
|
||||
type Props = {
|
||||
channelId: string,
|
||||
channelName: string,
|
||||
doToast: ({ message: string, isError?: boolean }) => void,
|
||||
};
|
||||
|
||||
const ClaimPreviewReset = (props: Props) => {
|
||||
const { channelId, channelName, doToast } = props;
|
||||
|
||||
const handleClick = async () => {
|
||||
try {
|
||||
const streamData = await getStreamData(channelId, channelName);
|
||||
await killStream(channelId, streamData);
|
||||
doToast({ message: __('Live stream successfully reset.'), isError: false });
|
||||
} catch {
|
||||
doToast({ message: __('There was an error resetting the live stream.'), isError: true });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<p className={'claimPreviewReset'}>
|
||||
<span className={'claimPreviewReset__hint'}>
|
||||
{__(
|
||||
"If you're having trouble starting a stream or if your stream shows that you're live but aren't, try a reset. If the problem persists, please reach out at %SITE_HELP_EMAIL%.",
|
||||
{ SITE_HELP_EMAIL }
|
||||
)}
|
||||
</span>
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('Reset stream')}
|
||||
className={'claimPreviewReset__button'}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
};
|
||||
|
||||
export default ClaimPreviewReset;
|
||||
@@ -1,26 +1,14 @@
|
||||
import * as PAGES from 'constants/pages';
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectClaimForUri,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsPending } from 'redux/selectors/claims';
|
||||
import { doClearPublish, doPrepareEdit } from 'redux/actions/publish';
|
||||
import { push } from 'connected-react-router';
|
||||
import ClaimPreviewSubtitle from './view';
|
||||
import { doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = selectClaimForUri(state, props.uri);
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
|
||||
return {
|
||||
claim,
|
||||
pending: makeSelectClaimIsPending(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
subCount: isChannel ? makeSelectSubCountForUri(props.uri)(state) : 0,
|
||||
};
|
||||
};
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
pending: makeSelectClaimIsPending(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
beginPublish: (name) => {
|
||||
@@ -28,7 +16,6 @@ const perform = (dispatch) => ({
|
||||
dispatch(doPrepareEdit({ name }));
|
||||
dispatch(push(`/$/${PAGES.UPLOAD}`));
|
||||
},
|
||||
fetchSubCount: (claimId) => dispatch(doFetchSubCount(claimId)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreviewSubtitle);
|
||||
@@ -1,5 +1,4 @@
|
||||
// @flow
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import React from 'react';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import DateTime from 'component/dateTime';
|
||||
@@ -13,29 +12,17 @@ type Props = {
|
||||
pending?: boolean,
|
||||
type: string,
|
||||
beginPublish: (?string) => void,
|
||||
isLivestream: boolean,
|
||||
fetchSubCount: (string) => void,
|
||||
subCount: number,
|
||||
};
|
||||
|
||||
// previews used in channel overview and homepage (and other places?)
|
||||
function ClaimPreviewSubtitle(props: Props) {
|
||||
const { pending, uri, claim, type, beginPublish, isLivestream, fetchSubCount, subCount } = props;
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
const { pending, uri, claim, type, beginPublish } = props;
|
||||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
|
||||
const claimId = (claim && claim.claim_id) || '0';
|
||||
const formattedSubCount = Number(subCount).toLocaleString();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (isChannel) {
|
||||
fetchSubCount(claimId);
|
||||
}
|
||||
}, [isChannel, fetchSubCount, claimId]);
|
||||
|
||||
let isChannel;
|
||||
let name;
|
||||
try {
|
||||
({ streamName: name } = parseURI(uri));
|
||||
({ streamName: name, isChannel } = parseURI(uri));
|
||||
} catch (e) {}
|
||||
|
||||
return (
|
||||
@@ -45,24 +32,16 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||
<UriIndicator uri={uri} link />{' '}
|
||||
{!pending && claim && (
|
||||
<>
|
||||
{isChannel && type !== 'inline' && (
|
||||
{isChannel &&
|
||||
type !== 'inline' &&
|
||||
`${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||
|
||||
{!isChannel && (
|
||||
<>
|
||||
<span className="claim-preview-metadata-sub-upload">
|
||||
{subCount === 1 ? __('1 Follower') : __('%formattedSubCount% Followers', { formattedSubCount })}
|
||||
• {claimsInChannel} {claimsInChannel === 1 ? __('upload') : __('uploads')}
|
||||
</span>
|
||||
<FileViewCountInline uri={uri} />
|
||||
<DateTime timeAgo uri={uri} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{!isChannel &&
|
||||
(isLivestream && ENABLE_NO_SOURCE_CLAIMS ? (
|
||||
__('Livestream')
|
||||
) : (
|
||||
<>
|
||||
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
||||
<DateTime timeAgo uri={uri} />
|
||||
</>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</React.Fragment>
|
||||
|
||||
@@ -6,13 +6,12 @@ import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
selectDateForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { doFileGet } from 'redux/actions/file';
|
||||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { makeSelectViewCountForUri, selectBanStateForUri } from 'lbryinc';
|
||||
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { makeSelectViewCountForUri, selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import ClaimPreviewTile from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
@@ -30,11 +29,11 @@ const select = (state, props) => {
|
||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||
thumbnail: props.uri && makeSelectThumbnailForUri(props.uri)(state),
|
||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
||||
banState: selectBanStateForUri(state, props.uri),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state),
|
||||
viewCount: makeSelectViewCountForUri(props.uri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import SubscribeButton from 'component/subscribeButton';
|
||||
import useGetThumbnail from 'effects/use-get-thumbnail';
|
||||
import { formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import { parseURI, isURIEqual } from 'util/lbryURI';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import FileWatchLaterLink from 'component/fileWatchLaterLink';
|
||||
@@ -33,7 +33,15 @@ type Props = {
|
||||
thumbnail: string,
|
||||
title: string,
|
||||
placeholder: boolean,
|
||||
banState: { blacklisted?: boolean, filtered?: boolean, muted?: boolean, blocked?: boolean },
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
filteredOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
blockedChannelUris: Array<string>,
|
||||
getFile: (string) => void,
|
||||
streamingUrl: string,
|
||||
isMature: boolean,
|
||||
@@ -41,10 +49,7 @@ type Props = {
|
||||
showHiddenByUser?: boolean,
|
||||
properties?: (Claim) => void,
|
||||
collectionId?: string,
|
||||
showNoSourceClaims?: boolean,
|
||||
isLivestream: boolean,
|
||||
viewCount: string,
|
||||
isLivestreamActive: boolean,
|
||||
};
|
||||
|
||||
// preview image cards used in related video functionality, channel overview page and homepage
|
||||
@@ -59,16 +64,15 @@ function ClaimPreviewTile(props: Props) {
|
||||
resolveUri,
|
||||
claim,
|
||||
placeholder,
|
||||
banState,
|
||||
blackListedOutpoints,
|
||||
filteredOutpoints,
|
||||
getFile,
|
||||
streamingUrl,
|
||||
blockedChannelUris,
|
||||
isMature,
|
||||
showMature,
|
||||
showHiddenByUser,
|
||||
properties,
|
||||
showNoSourceClaims,
|
||||
isLivestream,
|
||||
isLivestreamActive,
|
||||
collectionId,
|
||||
mediaDuration,
|
||||
viewCount,
|
||||
@@ -135,18 +139,43 @@ function ClaimPreviewTile(props: Props) {
|
||||
// Unfortunately needed until this is resolved
|
||||
// https://github.com/lbryio/lbry-sdk/issues/2785
|
||||
shouldHide = true;
|
||||
} else {
|
||||
shouldHide =
|
||||
banState.blacklisted || banState.filtered || (!showHiddenByUser && (banState.muted || banState.blocked));
|
||||
}
|
||||
|
||||
if (shouldHide || (isLivestream && !showNoSourceClaims)) {
|
||||
// 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 && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
}
|
||||
// block channel claims if we can't control for them in claim search
|
||||
// e.g. fetchRecommendedSubscriptions
|
||||
if (claim && isChannel && !shouldHide && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => isURIEqual(blockedUri, signingChannel.permanent_url));
|
||||
}
|
||||
|
||||
if (shouldHide) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isChannelPage = window.location.pathname.startsWith('/@');
|
||||
|
||||
const shouldShowViewCount = !(!viewCount || (claim && claim.repost_url) || isLivestream || !isChannelPage);
|
||||
const shouldShowViewCount = !(!viewCount || (claim && claim.repost_url) || !isChannelPage);
|
||||
|
||||
if (placeholder || (!claim && isResolvingUri)) {
|
||||
return (
|
||||
@@ -167,16 +196,12 @@ function ClaimPreviewTile(props: Props) {
|
||||
}
|
||||
|
||||
let liveProperty = null;
|
||||
if (isLivestreamActive === true) {
|
||||
liveProperty = (claim) => <>LIVE</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<li
|
||||
onClick={handleClick}
|
||||
className={classnames('card claim-preview--tile', {
|
||||
'claim-preview__wrapper--channel': isChannel,
|
||||
'claim-preview__live': isLivestreamActive,
|
||||
})}
|
||||
>
|
||||
<NavLink {...navLinkProps} role="none" tabIndex={-1} aria-hidden>
|
||||
@@ -238,7 +263,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
<div className="claim-tile__about">
|
||||
<UriIndicator uri={uri} link />
|
||||
<div className="claim-tile__about--counts">
|
||||
<FileViewCountInline uri={uri} isLivestream={isLivestream} />
|
||||
<FileViewCountInline uri={uri} />
|
||||
<DateTime timeAgo uri={uri} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -255,4 +280,34 @@ function ClaimPreviewTile(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
export default withRouter(ClaimPreviewTile);
|
||||
export default React.memo<Props>(withRouter(ClaimPreviewTile), areEqual);
|
||||
|
||||
const BLOCKLIST_KEYS = ['blackListedOutpoints', 'filteredOutpoints', 'blockedChannelUris'];
|
||||
const HANDLED_KEYS = [...BLOCKLIST_KEYS, 'date'];
|
||||
|
||||
function areEqual(prev: Props, next: Props) {
|
||||
for (let i = 0; i < BLOCKLIST_KEYS.length; ++i) {
|
||||
const key = BLOCKLIST_KEYS[i];
|
||||
const a = prev[key];
|
||||
const b = next[key];
|
||||
|
||||
if (((!a || !b) && a !== b) || (a && b && a.length !== b.length)) {
|
||||
// The arrays are huge, so just compare the length instead of each entry.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Number(prev.date) !== Number(next.date)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const propKeys = Object.keys(next);
|
||||
for (let i = 0; i < propKeys.length; ++i) {
|
||||
const pk = propKeys[i];
|
||||
if (!HANDLED_KEYS.includes(pk) && prev[pk] !== next[pk]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import ClaimReportButton from './view';
|
||||
|
||||
export default connect(null, { doOpenModal, doToast })(ClaimReportButton);
|
||||
@@ -0,0 +1,44 @@
|
||||
// @flow
|
||||
import { SITE_NAME } from 'config';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
hasChannels: boolean,
|
||||
doOpenModal: (string, {}) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
};
|
||||
|
||||
export default function ClaimRepostButton(props: Props) {
|
||||
const { uri, claim, hasChannels, doOpenModal, doToast } = props;
|
||||
const [contentUri, setContentUri] = React.useState('');
|
||||
const [repostUri, setRepostUri] = React.useState('');
|
||||
|
||||
return (
|
||||
<Button
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPOST}
|
||||
label={
|
||||
claim.meta.reposted > 1 ? __(`%repost_total% Reposts`, { repost_total: claim.meta.reposted }) : __('Repost')
|
||||
}
|
||||
description={__('Repost')}
|
||||
requiresAuth={IS_WEB}
|
||||
onClick={() => {
|
||||
if (!hasChannels) {
|
||||
doToast({
|
||||
message: __('A channel is required to repost on %SITE_NAME%', { SITE_NAME }),
|
||||
linkText: __('Create Channel'),
|
||||
linkTarget: '/channel/new',
|
||||
});
|
||||
} else {
|
||||
doOpenModal(MODALS.REPOST, { uri, contentUri, setContentUri, repostUri, setRepostUri, isModal: true });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { doFetchViewCount } from 'lbryinc';
|
||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||
import { makeSelectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { selectMutedAndBlockedChannelIds } from 'redux/selectors/blocked';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS, SIMPLE_SITE } from 'config';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import * as CS from 'constants/claim_search';
|
||||
|
||||
import ClaimListDiscover from './view';
|
||||
@@ -68,7 +68,7 @@ function resolveSearchOptions(props) {
|
||||
let streamTypesParam;
|
||||
if (streamTypes) {
|
||||
streamTypesParam = streamTypes;
|
||||
} else if (SIMPLE_SITE && !hasNoSource && streamTypes !== null) {
|
||||
} else if (!hasNoSource && streamTypes !== null) {
|
||||
streamTypesParam = [CS.FILE_VIDEO, CS.FILE_AUDIO];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsStreamPlaceholder } from 'redux/selectors/claims';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
import FileType from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(FileType);
|
||||
@@ -22,6 +22,8 @@ type Props = {
|
||||
collectionId: string,
|
||||
showInfo: boolean,
|
||||
setShowInfo: (boolean) => void,
|
||||
showEdit: boolean,
|
||||
setShowEdit: (boolean) => void,
|
||||
collectionHasEdits: boolean,
|
||||
isBuiltin: boolean,
|
||||
doToggleShuffleList: (string, boolean) => void,
|
||||
@@ -44,6 +46,8 @@ function CollectionActions(props: Props) {
|
||||
doToggleShuffleList,
|
||||
playNextUri,
|
||||
firstItem,
|
||||
showEdit,
|
||||
setShowEdit,
|
||||
} = props;
|
||||
const [doShuffle, setDoShuffle] = React.useState(false);
|
||||
const { push } = useHistory();
|
||||
@@ -158,6 +162,17 @@ function CollectionActions(props: Props) {
|
||||
/>
|
||||
);
|
||||
|
||||
const showEditButton = (
|
||||
<Button
|
||||
title={__('Edit')}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': showEdit,
|
||||
})}
|
||||
icon={ICONS.EDIT}
|
||||
onClick={() => setShowEdit(!showEdit)}
|
||||
/>
|
||||
);
|
||||
|
||||
if (isMobile) {
|
||||
return (
|
||||
<div className="media__actions">
|
||||
@@ -173,7 +188,12 @@ function CollectionActions(props: Props) {
|
||||
{lhsSection}
|
||||
{rhsSection}
|
||||
</div>
|
||||
{uri && <>{infoButton}</>}
|
||||
{uri && (
|
||||
<div className="section">
|
||||
{infoButton}
|
||||
{showEditButton}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,12 @@ function CollectionForm(props: Props) {
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ClaimList uris={collectionUrls} collectionId={collectionId} empty={__('This list has no items.')} />
|
||||
<ClaimList
|
||||
uris={collectionUrls}
|
||||
collectionId={collectionId}
|
||||
empty={__('This list has no items.')}
|
||||
type={'listview'}
|
||||
/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
|
||||
@@ -10,7 +10,7 @@ import { doFetchItemsInCollection } from 'redux/actions/collections';
|
||||
import CollectionPreviewOverlay from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri)(state));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import CollectionPreviewTile from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri)(state));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const ALL = 'All';
|
||||
const PRIVATE = 'Private';
|
||||
const PUBLIC = 'Public';
|
||||
const COLLECTION_FILTERS = [ALL, PRIVATE, PUBLIC];
|
||||
const COLLECTION_SHOW_COUNT = 24;
|
||||
const COLLECTION_SHOW_COUNT = 12;
|
||||
|
||||
export default function CollectionsListMine(props: Props) {
|
||||
const {
|
||||
@@ -43,6 +43,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
const [filterType, setFilterType] = React.useState(ALL);
|
||||
const [searchText, setSearchText] = React.useState('');
|
||||
|
||||
const playlistPageUrl = `/$/${PAGES.PLAYLISTS}?type=${filterType}`;
|
||||
let collectionsToShow = [];
|
||||
if (filterType === ALL) {
|
||||
collectionsToShow = unpublishedCollectionsList.concat(publishedList);
|
||||
@@ -68,6 +69,10 @@ export default function CollectionsListMine(props: Props) {
|
||||
filteredCollections = collectionsToShow.slice(0, COLLECTION_SHOW_COUNT) || [];
|
||||
}
|
||||
|
||||
const totalLength = collectionsToShow ? collectionsToShow.length : 0;
|
||||
const filteredLength = filteredCollections.length;
|
||||
const isTruncated = totalLength > filteredLength;
|
||||
|
||||
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];
|
||||
@@ -133,7 +138,19 @@ export default function CollectionsListMine(props: Props) {
|
||||
<div className="claim-grid__wrapper">
|
||||
<div className="claim-grid__header section">
|
||||
<h1 className="claim-grid__title">
|
||||
{__('Playlists')}
|
||||
<Button
|
||||
className="claim-grid__title"
|
||||
button="link"
|
||||
navigate={playlistPageUrl}
|
||||
label={
|
||||
<span className="claim-grid__title-span">
|
||||
{__('Playlists')}
|
||||
<div className="claim-grid__title--empty">
|
||||
<Icon className="icon--margin-right" icon={ICONS.STACK} />
|
||||
</div>
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
{!hasCollections && !fetchingCollections && (
|
||||
<div className="claim-grid__title--empty">{__('(Empty) --[indicates empty playlist]--')}</div>
|
||||
)}
|
||||
@@ -142,38 +159,55 @@ export default function CollectionsListMine(props: Props) {
|
||||
)}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="section__header--actions">
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__menu-group">
|
||||
{COLLECTION_FILTERS.map((value) => (
|
||||
<Button
|
||||
label={__(value)}
|
||||
key={value}
|
||||
button="alt"
|
||||
onClick={() => setFilterType(value)}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': filterType === value,
|
||||
})}
|
||||
/>
|
||||
))}
|
||||
<div className="section__header-action-stack">
|
||||
<div className="section__header--actions">
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__menu-group">
|
||||
{COLLECTION_FILTERS.map((value) => (
|
||||
<Button
|
||||
label={__(value)}
|
||||
key={value}
|
||||
button="alt"
|
||||
onClick={() => setFilterType(value)}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': filterType === value,
|
||||
})}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
className="wunderbar__input--inline"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
</Form>
|
||||
</div>
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
className="wunderbar__input--inline"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
type="text"
|
||||
placeholder={__('Search')}
|
||||
<p className="collection-grid__results-summary">
|
||||
{isTruncated && (
|
||||
<>
|
||||
{__(`Showing %filtered% results of %total%`, {
|
||||
filtered: filteredLength,
|
||||
total: totalLength,
|
||||
})}
|
||||
{`${searchText ? ' (' + __('filtered') + ') ' : ' '}`}
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
button="link"
|
||||
navigate={playlistPageUrl}
|
||||
label={<span className="claim-grid__title-span">{__('View All Playlists')}</span>}
|
||||
/>
|
||||
</Form>
|
||||
</p>
|
||||
</div>
|
||||
{Boolean(hasCollections) && (
|
||||
<div>
|
||||
{/* TODO: fix above spacing hack */}
|
||||
<div className="claim-grid">
|
||||
{filteredCollections &&
|
||||
filteredCollections.length > 0 &&
|
||||
|
||||
@@ -5,7 +5,7 @@ import * as KEYCODES from 'constants/keycodes';
|
||||
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
||||
import { SORT_BY, COMMENT_PAGE_SIZE_REPLIES } from 'constants/comment';
|
||||
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
|
||||
import { SITE_NAME, SIMPLE_SITE, ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import { SITE_NAME, ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { parseURI } from 'util/lbryURI';
|
||||
import DateTime from 'component/dateTime';
|
||||
@@ -26,8 +26,6 @@ import CommentCreate from 'component/commentCreate';
|
||||
import CommentMenuList from 'component/commentMenuList';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import { parseSticker } from 'util/comments';
|
||||
|
||||
const AUTO_EXPAND_ALL_REPLIES = false;
|
||||
|
||||
@@ -119,19 +117,12 @@ function Comment(props: Props) {
|
||||
location: { pathname, search },
|
||||
} = useHistory();
|
||||
|
||||
const isLinkedComment = linkedCommentId && linkedCommentId === commentId;
|
||||
const isInLinkedCommentChain =
|
||||
linkedCommentId &&
|
||||
linkedCommentAncestors[linkedCommentId] &&
|
||||
linkedCommentAncestors[linkedCommentId].includes(commentId);
|
||||
const showRepliesOnMount = isInLinkedCommentChain || AUTO_EXPAND_ALL_REPLIES;
|
||||
|
||||
const [isReplying, setReplying] = React.useState(false);
|
||||
const [isEditing, setEditing] = useState(false);
|
||||
const [editedMessage, setCommentValue] = useState(message);
|
||||
const [charCount, setCharCount] = useState(editedMessage.length);
|
||||
const [showReplies, setShowReplies] = useState(showRepliesOnMount);
|
||||
const [page, setPage] = useState(showRepliesOnMount ? 1 : 0);
|
||||
const [showReplies, setShowReplies] = useState(false);
|
||||
const [page, setPage] = useState(0);
|
||||
const [advancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const [displayDeadComment, setDisplayDeadComment] = React.useState(false);
|
||||
const hasChannels = myChannels && myChannels.length > 0;
|
||||
@@ -140,7 +131,6 @@ function Comment(props: Props) {
|
||||
const totalLikesAndDislikes = likesCount + dislikesCount;
|
||||
const slimedToDeath = totalLikesAndDislikes >= 5 && dislikesCount / totalLikesAndDislikes > 0.8;
|
||||
const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri;
|
||||
const stickerFromMessage = parseSticker(message);
|
||||
|
||||
let channelOwnerOfContent;
|
||||
try {
|
||||
@@ -150,6 +140,19 @@ function Comment(props: Props) {
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
// Auto-expand (limited to linked-comments for now, but can be for all)
|
||||
useEffect(() => {
|
||||
const isInLinkedCommentChain =
|
||||
linkedCommentId &&
|
||||
linkedCommentAncestors[linkedCommentId] &&
|
||||
linkedCommentAncestors[linkedCommentId].includes(commentId);
|
||||
|
||||
if (isInLinkedCommentChain || AUTO_EXPAND_ALL_REPLIES) {
|
||||
setShowReplies(true);
|
||||
setPage(1);
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
if (isEditing) {
|
||||
setCharCount(editedMessage.length);
|
||||
@@ -177,7 +180,7 @@ function Comment(props: Props) {
|
||||
}, [page, uri, commentId, fetchReplies]);
|
||||
|
||||
function handleEditMessageChanged(event) {
|
||||
setCommentValue(!SIMPLE_SITE && advancedEditor ? event : event.target.value);
|
||||
setCommentValue(advancedEditor ? event : event.target.value);
|
||||
}
|
||||
|
||||
function handleEditComment() {
|
||||
@@ -209,18 +212,6 @@ function Comment(props: Props) {
|
||||
replace(`${pathname}?${urlParams.toString()}`);
|
||||
}
|
||||
|
||||
const linkedCommentRef = React.useCallback((node) => {
|
||||
if (node !== null && window.pendingLinkedCommentScroll) {
|
||||
const ROUGH_HEADER_HEIGHT = 125; // @see: --header-height
|
||||
delete window.pendingLinkedCommentScroll;
|
||||
window.scrollTo({
|
||||
top: node.getBoundingClientRect().top + window.scrollY - ROUGH_HEADER_HEIGHT,
|
||||
left: 0,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<li
|
||||
className={classnames('comment', {
|
||||
@@ -231,9 +222,8 @@ function Comment(props: Props) {
|
||||
id={commentId}
|
||||
>
|
||||
<div
|
||||
ref={isLinkedComment ? linkedCommentRef : undefined}
|
||||
className={classnames('comment__content', {
|
||||
[COMMENT_HIGHLIGHTED]: isLinkedComment,
|
||||
[COMMENT_HIGHLIGHTED]: linkedCommentId && linkedCommentId === commentId,
|
||||
'comment--slimed': slimedToDeath && !displayDeadComment,
|
||||
})}
|
||||
>
|
||||
@@ -316,7 +306,7 @@ function Comment(props: Props) {
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormField
|
||||
className="comment__edit-input"
|
||||
type={!SIMPLE_SITE && advancedEditor ? 'markdown' : 'textarea'}
|
||||
type={advancedEditor ? 'markdown' : 'textarea'}
|
||||
name="editing_comment"
|
||||
value={editedMessage}
|
||||
charCount={charCount}
|
||||
@@ -341,10 +331,6 @@ function Comment(props: Props) {
|
||||
<div onClick={() => setDisplayDeadComment(true)} className="comment__dead">
|
||||
{__('This comment was slimed to death.')} <Icon icon={ICONS.SLIME_ACTIVE} />
|
||||
</div>
|
||||
) : stickerFromMessage ? (
|
||||
<div className="sticker__comment">
|
||||
<OptimizedImage src={stickerFromMessage.url} waitLoad />
|
||||
</div>
|
||||
) : editedMessage.length >= LENGTH_TO_COLLAPSE ? (
|
||||
<Expandable>
|
||||
<MarkdownPreview
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
// @flow
|
||||
import 'scss/component/_emote-selector.scss';
|
||||
import { EMOTES_24px as EMOTES } from 'constants/emotes';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import EMOJIS from 'emoji-dictionary';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import React from 'react';
|
||||
|
||||
const OLD_QUICK_EMOJIS = [
|
||||
EMOJIS.getUnicode('rocket'),
|
||||
EMOJIS.getUnicode('jeans'),
|
||||
EMOJIS.getUnicode('fire'),
|
||||
EMOJIS.getUnicode('heart'),
|
||||
EMOJIS.getUnicode('open_mouth'),
|
||||
];
|
||||
|
||||
type Props = { commentValue: string, setCommentValue: (string) => void, closeSelector: () => void };
|
||||
|
||||
export default function EmoteSelector(props: Props) {
|
||||
const { commentValue, setCommentValue, closeSelector } = props;
|
||||
|
||||
function addEmoteToComment(emote: string) {
|
||||
setCommentValue(
|
||||
commentValue + (commentValue && commentValue.charAt(commentValue.length - 1) !== ' ' ? ` ${emote} ` : `${emote} `)
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="emoteSelector">
|
||||
<Button button="close" icon={ICONS.REMOVE} onClick={closeSelector} />
|
||||
|
||||
<div className="emoteSelector__list">
|
||||
<div className="emoteSelector__listRow">
|
||||
<div className="emoteSelector__listRowTitle">{__('Global Emotes')}</div>
|
||||
|
||||
<div className="emoteSelector__listRowItems">
|
||||
{OLD_QUICK_EMOJIS.map((emoji) => (
|
||||
<Button
|
||||
key={emoji}
|
||||
label={emoji}
|
||||
title={`:${EMOJIS.getName(emoji)}:`}
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
onClick={() => addEmoteToComment(emoji)}
|
||||
/>
|
||||
))}
|
||||
{EMOTES.map((emote) => {
|
||||
const emoteName = emote.name.toLowerCase();
|
||||
|
||||
return (
|
||||
<Button
|
||||
key={String(emote)}
|
||||
title={emoteName}
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
onClick={() => addEmoteToComment(emoteName)}
|
||||
>
|
||||
<OptimizedImage src={emote.url} waitLoad />
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -6,45 +6,31 @@ import {
|
||||
selectFetchingMyChannels,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { CommentCreate } from './view';
|
||||
import { DISABLE_SUPPORT_TAG } from 'constants/tags';
|
||||
import { doSendTip } from 'redux/actions/wallet';
|
||||
import { doCommentCreate, doFetchCreatorSettings, doCommentById } from 'redux/actions/comments';
|
||||
import { doSendTip, doSendCashTip } from 'redux/actions/wallet';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectSettingsByChannelId } from 'redux/selectors/comments';
|
||||
import { CommentCreate } from './view';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { DISABLE_SUPPORT_TAG } from 'constants/tags';
|
||||
|
||||
const select = (state, props) => ({
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
channels: selectMyChannelClaims(state),
|
||||
isFetchingChannels: selectFetchingMyChannels(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
settingsByChannelId: selectSettingsByChannelId(state),
|
||||
supportDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
createComment: (comment, claimId, parentId, txid, payment_intent_id, environment, sticker) =>
|
||||
dispatch(
|
||||
doCommentCreate(
|
||||
comment,
|
||||
claimId,
|
||||
parentId,
|
||||
ownProps.uri,
|
||||
ownProps.livestream,
|
||||
txid,
|
||||
payment_intent_id,
|
||||
environment,
|
||||
sticker
|
||||
)
|
||||
),
|
||||
doFetchCreatorSettings: (channelClaimId) => dispatch(doFetchCreatorSettings(channelClaimId)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
fetchComment: (commentId) => dispatch(doCommentById(commentId, false)),
|
||||
sendCashTip: (tipParams, userParams, claimId, environment, successCallback) =>
|
||||
dispatch(doSendCashTip(tipParams, false, userParams, claimId, environment, successCallback)),
|
||||
createComment: (comment, claimId, parentId, txid, payment_intent_id, environment) =>
|
||||
dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri, txid, payment_intent_id, environment)),
|
||||
sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
doFetchCreatorSettings: (channelClaimId) => dispatch(doFetchCreatorSettings(channelClaimId)),
|
||||
fetchComment: (commentId) => dispatch(doCommentById(commentId, false)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentCreate);
|
||||
@@ -1,94 +0,0 @@
|
||||
// @flow
|
||||
import 'scss/component/_sticker-selector.scss';
|
||||
import { FREE_GLOBAL_STICKERS, PAID_GLOBAL_STICKERS } from 'constants/stickers';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import React from 'react';
|
||||
|
||||
const buildStickerSideLink = (section: string, icon: string) => ({ section, icon });
|
||||
|
||||
const STICKER_SIDE_LINKS = [
|
||||
buildStickerSideLink(__('Free'), ICONS.TAG),
|
||||
buildStickerSideLink(__('Tips'), ICONS.FINANCE),
|
||||
// Future work may include Channel, Subscriptions, ...
|
||||
];
|
||||
|
||||
type Props = { claimIsMine: boolean, onSelect: (any) => void };
|
||||
|
||||
export default function StickerSelector(props: Props) {
|
||||
const { claimIsMine, onSelect } = props;
|
||||
|
||||
function scrollToStickerSection(section: string) {
|
||||
const listBodyEl = document.querySelector('.stickerSelector__listBody');
|
||||
const sectionToScroll = document.getElementById(section);
|
||||
|
||||
if (listBodyEl && sectionToScroll) {
|
||||
// $FlowFixMe
|
||||
listBodyEl.scrollTo({
|
||||
top: sectionToScroll.offsetTop - sectionToScroll.getBoundingClientRect().height * 2,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const getListRow = (rowTitle: string, rowStickers: any) => (
|
||||
<div className="stickerSelector__listBody-row">
|
||||
<div id={rowTitle} className="stickerSelector__listBody-rowTitle">
|
||||
{rowTitle}
|
||||
</div>
|
||||
<div className="stickerSelector__listBody-rowItems">
|
||||
{rowStickers.map((sticker) => (
|
||||
<Button
|
||||
key={sticker.name}
|
||||
title={sticker.name}
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
onClick={() => onSelect(sticker)}
|
||||
>
|
||||
<OptimizedImage src={sticker.url} waitLoad />
|
||||
{sticker.price && sticker.price > 0 && (
|
||||
<CreditAmount superChatLight amount={sticker.price} size={2} isFiat />
|
||||
)}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="stickerSelector">
|
||||
<div className="stickerSelector__header card__header--between">
|
||||
<div className="stickerSelector__headerTitle card__title-section--small">{__('Stickers')}</div>
|
||||
</div>
|
||||
|
||||
<div className="stickerSelector__list">
|
||||
<div className="stickerSelector__listBody">
|
||||
{getListRow(__('Free'), FREE_GLOBAL_STICKERS)}
|
||||
{!claimIsMine && getListRow(__('Tips'), PAID_GLOBAL_STICKERS)}
|
||||
</div>
|
||||
|
||||
<div className="navigation__wrapper">
|
||||
<ul className="navigation-links">
|
||||
{STICKER_SIDE_LINKS.map(
|
||||
(linkProps) =>
|
||||
((claimIsMine && linkProps.section !== 'Tips') || !claimIsMine) && (
|
||||
<li key={linkProps.section}>
|
||||
<Button
|
||||
label={__(linkProps.section)}
|
||||
title={__(linkProps.section)}
|
||||
icon={linkProps.icon}
|
||||
iconSize={1}
|
||||
className="navigation-link"
|
||||
onClick={() => scrollToStickerSection(linkProps.section)}
|
||||
/>
|
||||
</li>
|
||||
)
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+306
-351
@@ -1,10 +1,8 @@
|
||||
// @flow
|
||||
import 'scss/component/_comment-create.scss';
|
||||
import { buildValidSticker } from 'util/comments';
|
||||
import { FF_MAX_CHARS_IN_COMMENT, FF_MAX_CHARS_IN_LIVESTREAM_COMMENT } from 'constants/form-field';
|
||||
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
|
||||
import { FormField, Form } from 'component/common/form';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { Lbryio } from 'lbryinc';
|
||||
import { useHistory } from 'react-router';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
@@ -14,115 +12,96 @@ import ChannelMentionSuggestions from 'component/channelMentionSuggestions';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import classnames from 'classnames';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import EmoteSelector from './emote-selector';
|
||||
import Empty from 'component/common/empty';
|
||||
import FilePrice from 'component/filePrice';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import Icon from 'component/common/icon';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
import React from 'react';
|
||||
import SelectChannel from 'component/selectChannel';
|
||||
import StickerSelector from './sticker-selector';
|
||||
import type { ElementRef } from 'react';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import WalletTipAmountSelector from 'component/walletTipAmountSelector';
|
||||
|
||||
import { getStripeEnvironment } from 'util/stripe';
|
||||
const stripeEnvironment = getStripeEnvironment();
|
||||
let stripeEnvironment = getStripeEnvironment();
|
||||
|
||||
const TAB_FIAT = 'TabFiat';
|
||||
const TAB_LBC = 'TabLBC';
|
||||
const MENTION_DEBOUNCE_MS = 100;
|
||||
|
||||
type TipParams = { tipAmount: number, tipChannelName: string, channelClaimId: string };
|
||||
type UserParams = { activeChannelName: ?string, activeChannelId: ?string };
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
channels: ?Array<ChannelClaim>,
|
||||
isNested: boolean,
|
||||
isFetchingChannels: boolean,
|
||||
parentId: string,
|
||||
isReply: boolean,
|
||||
activeChannel: string,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
bottom: boolean,
|
||||
channels: ?Array<ChannelClaim>,
|
||||
claim: StreamClaim,
|
||||
claimIsMine: boolean,
|
||||
embed?: boolean,
|
||||
isFetchingChannels: boolean,
|
||||
isNested: boolean,
|
||||
isReply: boolean,
|
||||
livestream?: boolean,
|
||||
parentId: string,
|
||||
claimIsMine: boolean,
|
||||
supportDisabled: boolean,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
shouldFetchComment: boolean,
|
||||
supportDisabled: boolean,
|
||||
uri: string,
|
||||
createComment: (string, string, string, ?string, ?string, ?string, boolean) => Promise<any>,
|
||||
doFetchCreatorSettings: (channelId: string) => Promise<any>,
|
||||
doToast: ({ message: string }) => void,
|
||||
fetchComment: (commentId: string) => Promise<any>,
|
||||
onCancelReplying?: () => void,
|
||||
createComment: (string, string, string, ?string, ?string, ?string) => Promise<any>,
|
||||
onDoneReplying?: () => void,
|
||||
sendCashTip: (TipParams, UserParams, string, ?string, (any) => void) => string,
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
setQuickReply: (any) => void,
|
||||
onCancelReplying?: () => void,
|
||||
toast: (string) => void,
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
doFetchCreatorSettings: (channelId: string) => Promise<any>,
|
||||
setQuickReply: (any) => void,
|
||||
fetchComment: (commentId: string) => Promise<any>,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
claim,
|
||||
channels,
|
||||
isNested,
|
||||
isFetchingChannels,
|
||||
isReply,
|
||||
parentId,
|
||||
activeChannelClaim,
|
||||
bottom,
|
||||
channels,
|
||||
claim,
|
||||
claimIsMine,
|
||||
embed,
|
||||
isFetchingChannels,
|
||||
isNested,
|
||||
isReply,
|
||||
livestream,
|
||||
parentId,
|
||||
settingsByChannelId,
|
||||
shouldFetchComment,
|
||||
supportDisabled,
|
||||
uri,
|
||||
createComment,
|
||||
doFetchCreatorSettings,
|
||||
shouldFetchComment,
|
||||
doToast,
|
||||
fetchComment,
|
||||
onCancelReplying,
|
||||
createComment,
|
||||
onDoneReplying,
|
||||
sendCashTip,
|
||||
onCancelReplying,
|
||||
sendTip,
|
||||
doFetchCreatorSettings,
|
||||
setQuickReply,
|
||||
fetchComment,
|
||||
} = props;
|
||||
|
||||
const formFieldRef: ElementRef<any> = React.useRef();
|
||||
const formFieldInputRef = formFieldRef && formFieldRef.current && formFieldRef.current.input;
|
||||
const selectionIndex = formFieldInputRef && formFieldInputRef.current && formFieldInputRef.current.selectionStart;
|
||||
const buttonRef: ElementRef<any> = React.useRef();
|
||||
|
||||
const {
|
||||
push,
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
|
||||
const [isSubmitting, setSubmitting] = React.useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
||||
const [commentFailure, setCommentFailure] = React.useState(false);
|
||||
const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });
|
||||
const [isSupportComment, setIsSupportComment] = React.useState();
|
||||
const [isReviewingSupportComment, setReviewingSupportComment] = React.useState();
|
||||
const [isReviewingStickerComment, setReviewingStickerComment] = React.useState();
|
||||
const [selectedSticker, setSelectedSticker] = React.useState();
|
||||
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
|
||||
const [tipAmount, setTipAmount] = React.useState(1);
|
||||
const [convertedAmount, setConvertedAmount] = React.useState();
|
||||
const [commentValue, setCommentValue] = React.useState('');
|
||||
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
|
||||
const [stickerSelector, setStickerSelector] = React.useState();
|
||||
const [activeTab, setActiveTab] = React.useState('');
|
||||
const [tipError, setTipError] = React.useState();
|
||||
const [deletedComment, setDeletedComment] = React.useState(false);
|
||||
const [pauseQuickSend, setPauseQuickSend] = React.useState(false);
|
||||
const [showEmotes, setShowEmotes] = React.useState(false);
|
||||
const [disableReviewButton, setDisableReviewButton] = React.useState();
|
||||
const [shouldDisableReviewButton, setShouldDisableReviewButton] = React.useState();
|
||||
|
||||
const selectedMentionIndex =
|
||||
commentValue.indexOf('@', selectionIndex) === selectionIndex
|
||||
@@ -142,7 +121,8 @@ export function CommentCreate(props: Props) {
|
||||
: '';
|
||||
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channelUri = claim && (claim.signing_channel ? claim.signing_channel.permanent_url : claim.permanent_url);
|
||||
const signingChannel = (claim && claim.signing_channel) || claim;
|
||||
const channelUri = signingChannel && signingChannel.permanent_url;
|
||||
const hasChannels = channels && channels.length;
|
||||
const charCount = commentValue ? commentValue.length : 0;
|
||||
const disabled = deletedComment || isSubmitting || isFetchingChannels || !commentValue.length || pauseQuickSend;
|
||||
@@ -156,29 +136,37 @@ export function CommentCreate(props: Props) {
|
||||
const minAmountRef = React.useRef(minAmount);
|
||||
minAmountRef.current = minAmount;
|
||||
|
||||
const MinAmountNotice = minAmount ? (
|
||||
<div className="help--notice comment--min-amount-notice">
|
||||
<I18nMessage tokens={{ lbc: <CreditAmount noFormat amount={minAmount} /> }}>
|
||||
{minTip ? 'Comment min: %lbc%' : minSuper ? 'HyperChat min: %lbc%' : ''}
|
||||
</I18nMessage>
|
||||
<Icon
|
||||
customTooltipText={
|
||||
minTip
|
||||
? __('This channel requires a minimum tip for each comment.')
|
||||
: minSuper
|
||||
? __('This channel requires a minimum amount for HyperChats to be visible.')
|
||||
: ''
|
||||
}
|
||||
className="icon--help"
|
||||
icon={ICONS.HELP}
|
||||
tooltip
|
||||
size={16}
|
||||
/>
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
// **************************************************************************
|
||||
// Functions
|
||||
// **************************************************************************
|
||||
|
||||
function handleSelectSticker(sticker: any) {
|
||||
// $FlowFixMe
|
||||
setSelectedSticker(sticker);
|
||||
setReviewingStickerComment(true);
|
||||
setTipAmount(sticker.price || 0);
|
||||
setStickerSelector(false);
|
||||
|
||||
if (sticker.price && sticker.price > 0) {
|
||||
setActiveTab(TAB_FIAT);
|
||||
setIsSupportComment(true);
|
||||
}
|
||||
}
|
||||
|
||||
function handleCommentChange(event) {
|
||||
let commentValue;
|
||||
if (isReply) {
|
||||
commentValue = event.target.value;
|
||||
} else {
|
||||
commentValue = !SIMPLE_SITE && advancedEditor ? event : event.target.value;
|
||||
commentValue = advancedEditor ? event : event.target.value;
|
||||
}
|
||||
|
||||
setCommentValue(commentValue);
|
||||
@@ -188,7 +176,6 @@ export function CommentCreate(props: Props) {
|
||||
let newMentionValue = mentionValue.replace('lbry://', '');
|
||||
if (newMentionValue.includes('#')) newMentionValue = newMentionValue.replace('#', ':');
|
||||
|
||||
if (livestream && key !== KEYCODES.TAB) setPauseQuickSend(true);
|
||||
setCommentValue(
|
||||
commentValue.substring(0, selectedMentionIndex) +
|
||||
`${newMentionValue}` +
|
||||
@@ -199,14 +186,30 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
|
||||
function altEnterListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if ((livestream || e.ctrlKey || e.metaKey) && e.keyCode === KEYCODES.ENTER) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.keyCode === KEYCODES.ENTER) {
|
||||
e.preventDefault();
|
||||
buttonRef.current.click();
|
||||
}
|
||||
}
|
||||
|
||||
function onTextareaFocus() {
|
||||
window.addEventListener('keydown', altEnterListener);
|
||||
}
|
||||
|
||||
function onTextareaBlur() {
|
||||
window.removeEventListener('keydown', altEnterListener);
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (activeChannelClaim && commentValue.length) {
|
||||
handleCreateComment();
|
||||
}
|
||||
}
|
||||
|
||||
function handleSupportComment() {
|
||||
if (!activeChannelClaim) return;
|
||||
if (!activeChannelClaim) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!channelId) {
|
||||
doToast({
|
||||
@@ -234,7 +237,7 @@ export function CommentCreate(props: Props) {
|
||||
message: __('The creator just updated the minimum setting. Please revise or double-check your tip amount.'),
|
||||
isError: true,
|
||||
});
|
||||
setReviewingSupportComment(false);
|
||||
setIsReviewingSupportComment(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -243,17 +246,33 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
|
||||
function doSubmitTip() {
|
||||
if (!activeChannelClaim) return;
|
||||
if (!activeChannelClaim) {
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
amount: tipAmount,
|
||||
claim_id: claimId,
|
||||
channel_id: activeChannelClaim.claim_id,
|
||||
};
|
||||
|
||||
const params = { amount: tipAmount, claim_id: claimId, channel_id: activeChannelClaim.claim_id };
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||
|
||||
// setup variables for tip API
|
||||
const channelClaimId = claim.signing_channel ? claim.signing_channel.claim_id : claim.claim_id;
|
||||
const tipChannelName = claim.signing_channel ? claim.signing_channel.name : claim.name;
|
||||
let channelClaimId, tipChannelName;
|
||||
// if there is a signing channel it's on a file
|
||||
if (claim.signing_channel) {
|
||||
channelClaimId = claim.signing_channel.claim_id;
|
||||
tipChannelName = claim.signing_channel.name;
|
||||
|
||||
setSubmitting(true);
|
||||
// otherwise it's on the channel page
|
||||
} else {
|
||||
channelClaimId = claim.claim_id;
|
||||
tipChannelName = claim.name;
|
||||
}
|
||||
|
||||
setIsSubmitting(true);
|
||||
|
||||
if (activeTab === TAB_LBC) {
|
||||
// call sendTip and then run the callback from the response
|
||||
@@ -268,34 +287,72 @@ export function CommentCreate(props: Props) {
|
||||
}, 1500);
|
||||
|
||||
doToast({
|
||||
message: __("You sent %tipAmount% Credits as a tip to %tipChannelName%, I'm sure they appreciate it!", {
|
||||
tipAmount: tipAmount, // force show decimal places
|
||||
tipChannelName,
|
||||
}),
|
||||
message: __(
|
||||
"You sent %tipAmount% LBRY Credits as a tip to %tipChannelName%, I'm sure they appreciate it!",
|
||||
{
|
||||
tipAmount: tipAmount, // force show decimal places
|
||||
tipChannelName,
|
||||
}
|
||||
),
|
||||
});
|
||||
|
||||
setSuccessTip({ txid, tipAmount });
|
||||
},
|
||||
() => {
|
||||
// reset the frontend so people can send a new comment
|
||||
setSubmitting(false);
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
const tipParams: TipParams = { tipAmount: Math.round(tipAmount * 100) / 100, tipChannelName, channelClaimId };
|
||||
const userParams: UserParams = { activeChannelName, activeChannelId };
|
||||
const sourceClaimId = claim.claim_id;
|
||||
const roundedAmount = Math.round(tipAmount * 100) / 100;
|
||||
|
||||
sendCashTip(tipParams, userParams, claim.claim_id, stripeEnvironment, (customerTipResponse) => {
|
||||
const { payment_intent_id } = customerTipResponse;
|
||||
Lbryio.call(
|
||||
'customer',
|
||||
'tip',
|
||||
{
|
||||
// round to deal with floating point precision
|
||||
amount: Math.round(100 * roundedAmount), // convert from dollars to cents
|
||||
creator_channel_name: tipChannelName, // creator_channel_name
|
||||
creator_channel_claim_id: channelClaimId,
|
||||
tipper_channel_name: activeChannelName,
|
||||
tipper_channel_claim_id: activeChannelId,
|
||||
currency: 'USD',
|
||||
anonymous: false,
|
||||
source_claim_id: sourceClaimId,
|
||||
environment: stripeEnvironment,
|
||||
},
|
||||
'post'
|
||||
)
|
||||
.then((customerTipResponse) => {
|
||||
const paymentIntendId = customerTipResponse.payment_intent_id;
|
||||
|
||||
handleCreateComment(null, payment_intent_id, stripeEnvironment);
|
||||
handleCreateComment(null, paymentIntendId, stripeEnvironment);
|
||||
|
||||
setCommentValue('');
|
||||
setReviewingSupportComment(false);
|
||||
setIsSupportComment(false);
|
||||
setCommentFailure(false);
|
||||
setSubmitting(false);
|
||||
});
|
||||
setCommentValue('');
|
||||
setIsReviewingSupportComment(false);
|
||||
setIsSupportComment(false);
|
||||
setCommentFailure(false);
|
||||
setIsSubmitting(false);
|
||||
|
||||
doToast({
|
||||
message: __("You sent $%formattedAmount% as a tip to %tipChannelName%, I'm sure they appreciate it!", {
|
||||
formattedAmount: roundedAmount.toFixed(2), // force show decimal places
|
||||
tipChannelName,
|
||||
}),
|
||||
});
|
||||
|
||||
// handleCreateComment(null);
|
||||
})
|
||||
.catch((error) => {
|
||||
doToast({
|
||||
message:
|
||||
error.message !== 'payment intent failed to confirm'
|
||||
? error.message
|
||||
: 'Sorry, there was an error in processing your payment!',
|
||||
isError: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,18 +363,16 @@ export function CommentCreate(props: Props) {
|
||||
* @param {string} [environment] Optional environment for Stripe (test|live)
|
||||
*/
|
||||
function handleCreateComment(txid, payment_intent_id, environment) {
|
||||
setShowEmotes(false);
|
||||
setSubmitting(true);
|
||||
const stickerValue = selectedSticker && buildValidSticker(selectedSticker.name);
|
||||
setIsSubmitting(true);
|
||||
|
||||
createComment(stickerValue || commentValue, claimId, parentId, txid, payment_intent_id, environment, !!stickerValue)
|
||||
createComment(commentValue, claimId, parentId, txid, payment_intent_id, environment)
|
||||
.then((res) => {
|
||||
setSubmitting(false);
|
||||
setIsSubmitting(false);
|
||||
if (setQuickReply) setQuickReply(res);
|
||||
|
||||
if (res && res.signature) {
|
||||
setCommentValue('');
|
||||
setReviewingSupportComment(false);
|
||||
setIsReviewingSupportComment(false);
|
||||
setIsSupportComment(false);
|
||||
setCommentFailure(false);
|
||||
|
||||
@@ -327,7 +382,7 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
setSubmitting(false);
|
||||
setIsSubmitting(false);
|
||||
setCommentFailure(true);
|
||||
|
||||
if (channelId) {
|
||||
@@ -374,10 +429,6 @@ export function CommentCreate(props: Props) {
|
||||
// Render
|
||||
// **************************************************************************
|
||||
|
||||
const getActionButton = (title: string, icon: string, handleClick: () => void) => (
|
||||
<Button title={title} button="alt" icon={icon} onClick={handleClick} />
|
||||
);
|
||||
|
||||
if (channelSettings && !channelSettings.comments_enabled) {
|
||||
return <Empty padded text={__('This channel has disabled comments on their page.')} />;
|
||||
}
|
||||
@@ -387,138 +438,36 @@ export function CommentCreate(props: Props) {
|
||||
<div
|
||||
role="button"
|
||||
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);
|
||||
}
|
||||
push(pathPlusRedirect);
|
||||
}}
|
||||
>
|
||||
<FormField type="textarea" name={'comment_signup_prompt'} placeholder={__('Say something about this...')} />
|
||||
<div className="section__actions--no-margin">
|
||||
<Button disabled button="primary" label={__('Post --[button to submit something]--')} requiresAuth />
|
||||
<Button disabled button="primary" label={__('Post --[button to submit something]--')} requiresAuth={IS_WEB} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Form
|
||||
className={classnames('commentCreate', {
|
||||
'commentCreate--reply': isReply,
|
||||
'commentCreate--nestedReply': isNested,
|
||||
'commentCreate--bottom': bottom,
|
||||
})}
|
||||
>
|
||||
{/* Input Box/Preview Box */}
|
||||
{stickerSelector ? (
|
||||
<StickerSelector onSelect={(sticker) => handleSelectSticker(sticker)} claimIsMine={claimIsMine} />
|
||||
) : isReviewingStickerComment && activeChannelClaim && selectedSticker ? (
|
||||
<div className="commentCreate__stickerPreview">
|
||||
<div className="commentCreate__stickerPreviewInfo">
|
||||
<ChannelThumbnail xsmall uri={activeChannelClaim.canonical_url} />
|
||||
<UriIndicator uri={activeChannelClaim.canonical_url} link />
|
||||
</div>
|
||||
|
||||
<div className="commentCreate__stickerPreviewImage">
|
||||
<OptimizedImage src={selectedSticker && selectedSticker.url} waitLoad />
|
||||
</div>
|
||||
|
||||
{selectedSticker.price && <FilePrice customPrice={selectedSticker.price} isFiat />}
|
||||
</div>
|
||||
) : isReviewingSupportComment && activeChannelClaim ? (
|
||||
<div className="commentCreate__supportCommentPreview">
|
||||
if (isReviewingSupportComment && activeChannelClaim) {
|
||||
return (
|
||||
<div className="comment__create">
|
||||
<div className="comment__sc-preview">
|
||||
<CreditAmount
|
||||
amount={tipAmount}
|
||||
className="commentCreate__supportCommentPreviewAmount"
|
||||
className="comment__sc-preview-amount"
|
||||
isFiat={activeTab === TAB_FIAT}
|
||||
amount={tipAmount}
|
||||
size={activeTab === TAB_LBC ? 18 : 2}
|
||||
/>
|
||||
|
||||
<ChannelThumbnail xsmall uri={activeChannelClaim.canonical_url} />
|
||||
<div className="commentCreate__supportCommentBody">
|
||||
<UriIndicator uri={activeChannelClaim.canonical_url} link />
|
||||
<div>
|
||||
<UriIndicator uri={activeChannelClaim.name} link />
|
||||
<div>{commentValue}</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{showEmotes && (
|
||||
<EmoteSelector
|
||||
commentValue={commentValue}
|
||||
setCommentValue={setCommentValue}
|
||||
closeSelector={() => setShowEmotes(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!advancedEditor && (
|
||||
<ChannelMentionSuggestions
|
||||
uri={uri}
|
||||
isLivestream={livestream}
|
||||
inputRef={formFieldInputRef}
|
||||
mentionTerm={channelMention}
|
||||
creatorUri={channelUri}
|
||||
customSelectAction={handleSelectMention}
|
||||
/>
|
||||
)}
|
||||
|
||||
<FormField
|
||||
disabled={isFetchingChannels}
|
||||
type={SIMPLE_SITE ? 'textarea' : advancedEditor && !isReply ? 'markdown' : 'textarea'}
|
||||
name={isReply ? 'content_reply' : 'content_description'}
|
||||
ref={formFieldRef}
|
||||
className={isReply ? 'content_reply' : 'content_comment'}
|
||||
label={
|
||||
<span className="commentCreate__labelWrapper">
|
||||
{!livestream && (
|
||||
<div className="commentCreate__label">{isReply ? __('Replying as ') : __('Comment as ')}</div>
|
||||
)}
|
||||
<SelectChannel tiny />
|
||||
</span>
|
||||
}
|
||||
quickActionLabel={
|
||||
!SIMPLE_SITE && (isReply ? undefined : advancedEditor ? __('Simple Editor') : __('Advanced Editor'))
|
||||
}
|
||||
quickActionHandler={() => !SIMPLE_SITE && setAdvancedEditor(!advancedEditor)}
|
||||
openEmoteMenu={() => setShowEmotes(!showEmotes)}
|
||||
onFocus={() => window.addEventListener('keydown', altEnterListener)}
|
||||
onBlur={() => window.removeEventListener('keydown', altEnterListener)}
|
||||
placeholder={__('Say something about this...')}
|
||||
value={commentValue}
|
||||
charCount={charCount}
|
||||
onChange={handleCommentChange}
|
||||
autoFocus={isReply}
|
||||
textAreaMaxLength={livestream ? FF_MAX_CHARS_IN_LIVESTREAM_COMMENT : FF_MAX_CHARS_IN_COMMENT}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{(isSupportComment || (isReviewingStickerComment && selectedSticker && selectedSticker.price)) && (
|
||||
<WalletTipAmountSelector
|
||||
activeTab={activeTab}
|
||||
amount={tipAmount}
|
||||
claim={claim}
|
||||
convertedAmount={convertedAmount}
|
||||
customTipAmount={selectedSticker && selectedSticker.price}
|
||||
fiatConversion={selectedSticker && !!selectedSticker.price}
|
||||
onChange={(amount) => setTipAmount(amount)}
|
||||
setConvertedAmount={setConvertedAmount}
|
||||
setDisableSubmitButton={setDisableReviewButton}
|
||||
setTipError={setTipError}
|
||||
tipError={tipError}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Bottom Action Buttons */}
|
||||
<div className="section__actions section__actions--no-margin">
|
||||
{/* Submit Button */}
|
||||
{isReviewingSupportComment ? (
|
||||
<div className="section__actions--no-margin">
|
||||
<Button
|
||||
autoFocus
|
||||
button="primary"
|
||||
@@ -532,146 +481,152 @@ export function CommentCreate(props: Props) {
|
||||
}
|
||||
onClick={handleSupportComment}
|
||||
/>
|
||||
) : isReviewingStickerComment && selectedSticker ? (
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('Send')}
|
||||
disabled={
|
||||
(isSupportComment && (tipError || disableReviewButton)) ||
|
||||
(selectedSticker &&
|
||||
selectedSticker.price &&
|
||||
(activeTab === TAB_FIAT
|
||||
? tipAmount < selectedSticker.price
|
||||
: convertedAmount && convertedAmount < selectedSticker.price))
|
||||
}
|
||||
onClick={() => {
|
||||
if (isSupportComment) {
|
||||
handleSupportComment();
|
||||
} else {
|
||||
handleCreateComment();
|
||||
}
|
||||
setSelectedSticker(null);
|
||||
setReviewingStickerComment(false);
|
||||
setStickerSelector(false);
|
||||
setIsSupportComment(false);
|
||||
}}
|
||||
/>
|
||||
) : isSupportComment ? (
|
||||
<Button
|
||||
disabled={disabled || tipError || disableReviewButton || !minAmountMet}
|
||||
type="button"
|
||||
button="primary"
|
||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
||||
label={__('Review')}
|
||||
onClick={() => setReviewingSupportComment(true)}
|
||||
requiresAuth
|
||||
/>
|
||||
) : (
|
||||
(!minTip || claimIsMine) && (
|
||||
<Button
|
||||
ref={buttonRef}
|
||||
button="primary"
|
||||
disabled={disabled || stickerSelector}
|
||||
type="submit"
|
||||
label={
|
||||
isReply
|
||||
? isSubmitting
|
||||
? __('Replying...')
|
||||
: __('Reply')
|
||||
: isSubmitting
|
||||
? __('Commenting...')
|
||||
: __('Comment --[button to submit something]--')
|
||||
}
|
||||
requiresAuth
|
||||
onClick={() => activeChannelClaim && commentValue.length && handleCreateComment()}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
|
||||
{/** Stickers/Support Buttons **/}
|
||||
{!supportDisabled && !stickerSelector && (
|
||||
<>
|
||||
{isReviewingStickerComment ? (
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Different Sticker')}
|
||||
onClick={() => {
|
||||
setReviewingStickerComment(false);
|
||||
setIsSupportComment(false);
|
||||
setStickerSelector(true);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
getActionButton(__('Stickers'), ICONS.TAG, () => {
|
||||
setIsSupportComment(false);
|
||||
setStickerSelector(true);
|
||||
})
|
||||
)}
|
||||
{!claimIsMine &&
|
||||
getActionButton(__('LBC'), ICONS.LBC, () => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
})}
|
||||
{!claimIsMine &&
|
||||
stripeEnvironment &&
|
||||
getActionButton(__('Cash'), ICONS.FINANCE, () => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Cancel Button */}
|
||||
{(isSupportComment ||
|
||||
isReviewingSupportComment ||
|
||||
stickerSelector ||
|
||||
isReviewingStickerComment ||
|
||||
(isReply && !minTip)) && (
|
||||
<Button
|
||||
disabled={isSupportComment && isSubmitting}
|
||||
disabled={isSubmitting}
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={() => {
|
||||
if (isSupportComment || isReviewingSupportComment) {
|
||||
if (!isReviewingSupportComment) setIsSupportComment(false);
|
||||
setReviewingSupportComment(false);
|
||||
if (selectedSticker && selectedSticker.price) {
|
||||
setReviewingStickerComment(false);
|
||||
setStickerSelector(false);
|
||||
setSelectedSticker(null);
|
||||
}
|
||||
} else if (stickerSelector || isReviewingStickerComment) {
|
||||
setReviewingStickerComment(false);
|
||||
setStickerSelector(false);
|
||||
} else if (isReply && !minTip && onCancelReplying) {
|
||||
onCancelReplying();
|
||||
}
|
||||
}}
|
||||
onClick={() => setIsReviewingSupportComment(false)}
|
||||
/>
|
||||
)}
|
||||
{MinAmountNotice}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
{/* Help Text */}
|
||||
{deletedComment && <div className="error__text">{__('This comment has been deleted.')}</div>}
|
||||
{!!minAmount && (
|
||||
<div className="help--notice commentCreate__minAmountNotice">
|
||||
<I18nMessage tokens={{ lbc: <CreditAmount noFormat amount={minAmount} /> }}>
|
||||
{minTip ? 'Comment min: %lbc%' : minSuper ? 'HyperChat min: %lbc%' : ''}
|
||||
</I18nMessage>
|
||||
<Icon
|
||||
customTooltipText={
|
||||
minTip
|
||||
? __('This channel requires a minimum tip for each comment.')
|
||||
: minSuper
|
||||
? __('This channel requires a minimum amount for HyperChats to be visible.')
|
||||
: ''
|
||||
}
|
||||
className="icon--help"
|
||||
icon={ICONS.HELP}
|
||||
tooltip
|
||||
size={16}
|
||||
return (
|
||||
<Form
|
||||
onSubmit={handleSubmit}
|
||||
className={classnames('comment__create', {
|
||||
'comment__create--reply': isReply,
|
||||
'comment__create--nested-reply': isNested,
|
||||
'comment__create--bottom': bottom,
|
||||
})}
|
||||
>
|
||||
{!advancedEditor && (
|
||||
<ChannelMentionSuggestions
|
||||
uri={uri}
|
||||
inputRef={formFieldInputRef}
|
||||
mentionTerm={channelMention}
|
||||
creatorUri={channelUri}
|
||||
customSelectAction={handleSelectMention}
|
||||
/>
|
||||
)}
|
||||
<FormField
|
||||
disabled={isFetchingChannels}
|
||||
type={advancedEditor ? 'markdown' : 'textarea'}
|
||||
name={isReply ? 'content_reply' : 'content_description'}
|
||||
ref={formFieldRef}
|
||||
className={isReply ? 'content_reply' : 'content_comment'}
|
||||
label={
|
||||
<span className="comment-new__label-wrapper">
|
||||
<div className="comment-new__label">{isReply ? __('Replying as') + ' ' : __('Comment as') + ' '}</div>
|
||||
<SelectChannel tiny />
|
||||
</span>
|
||||
}
|
||||
quickActionLabel={isReply ? undefined : advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
|
||||
quickActionHandler={() => setAdvancedEditor(!advancedEditor)}
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
placeholder={__('Say something about this...')}
|
||||
value={commentValue}
|
||||
charCount={charCount}
|
||||
onChange={handleCommentChange}
|
||||
autoFocus={isReply}
|
||||
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
|
||||
/>
|
||||
{isSupportComment && (
|
||||
<WalletTipAmountSelector
|
||||
onTipErrorChange={setTipError}
|
||||
shouldDisableReviewButton={setShouldDisableReviewButton}
|
||||
claim={claim}
|
||||
activeTab={activeTab}
|
||||
amount={tipAmount}
|
||||
onChange={(amount) => setTipAmount(amount)}
|
||||
/>
|
||||
)}
|
||||
<div className="section__actions section__actions--no-margin">
|
||||
{isSupportComment ? (
|
||||
<>
|
||||
<Button
|
||||
disabled={disabled || tipError || shouldDisableReviewButton || !minAmountMet}
|
||||
type="button"
|
||||
button="primary"
|
||||
icon={activeTab === TAB_LBC ? ICONS.LBC : ICONS.FINANCE}
|
||||
label={__('Review')}
|
||||
onClick={() => setIsReviewingSupportComment(true)}
|
||||
requiresAuth={IS_WEB}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
disabled={isSubmitting}
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={() => setIsSupportComment(false)}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{(!minTip || claimIsMine) && (
|
||||
<Button
|
||||
ref={buttonRef}
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
type="submit"
|
||||
label={
|
||||
isReply
|
||||
? isSubmitting
|
||||
? __('Replying...')
|
||||
: __('Reply')
|
||||
: isSubmitting
|
||||
? __('Commenting...')
|
||||
: __('Comment --[button to submit something]--')
|
||||
}
|
||||
requiresAuth={IS_WEB}
|
||||
/>
|
||||
)}
|
||||
{!supportDisabled && !claimIsMine && (
|
||||
<>
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="alt"
|
||||
className="thatButton"
|
||||
icon={ICONS.LBC}
|
||||
onClick={() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_LBC);
|
||||
}}
|
||||
/>
|
||||
{/* @if TARGET='web' */}
|
||||
{stripeEnvironment && (
|
||||
<Button
|
||||
disabled={disabled}
|
||||
button="alt"
|
||||
className="thisButton"
|
||||
icon={ICONS.FINANCE}
|
||||
onClick={() => {
|
||||
setIsSupportComment(true);
|
||||
setActiveTab(TAB_FIAT);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{/* @endif */}
|
||||
</>
|
||||
)}
|
||||
{isReply && !minTip && (
|
||||
<Button
|
||||
button="link"
|
||||
label={__('Cancel')}
|
||||
onClick={() => {
|
||||
if (onCancelReplying) {
|
||||
onCancelReplying();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{deletedComment && <div className="error__text">{__('This comment has been deleted.')}</div>}
|
||||
{MinAmountNotice}
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -20,7 +20,6 @@ type Props = {
|
||||
disableEdit?: boolean,
|
||||
disableRemove?: boolean,
|
||||
supportAmount?: any,
|
||||
isLiveComment: boolean,
|
||||
// --- select ---
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
@@ -55,7 +54,6 @@ function CommentMenuList(props: Props) {
|
||||
disableEdit,
|
||||
disableRemove,
|
||||
supportAmount,
|
||||
isLiveComment,
|
||||
doToast,
|
||||
handleEditComment,
|
||||
openModal,
|
||||
@@ -231,7 +229,7 @@ function CommentMenuList(props: Props) {
|
||||
</>
|
||||
)}
|
||||
|
||||
{IS_WEB && !isLiveComment && (
|
||||
{IS_WEB && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyCommentLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { ENABLE_CREATOR_REACTIONS, SIMPLE_SITE } from 'config';
|
||||
import { ENABLE_CREATOR_REACTIONS } from 'config';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
@@ -72,16 +72,8 @@ export default function CommentReactions(props: Props) {
|
||||
};
|
||||
const shouldHide = !canCreatorReact && hideCreatorLike;
|
||||
const creatorLiked = getCountForReact(REACTION_TYPES.CREATOR_LIKE) > 0;
|
||||
const likeIcon = SIMPLE_SITE
|
||||
? myReacts && myReacts.includes(REACTION_TYPES.LIKE)
|
||||
? ICONS.FIRE_ACTIVE
|
||||
: ICONS.FIRE
|
||||
: ICONS.UPVOTE;
|
||||
const dislikeIcon = SIMPLE_SITE
|
||||
? myReacts && myReacts.includes(REACTION_TYPES.DISLIKE)
|
||||
? ICONS.SLIME_ACTIVE
|
||||
: ICONS.SLIME
|
||||
: ICONS.DOWNVOTE;
|
||||
const likeIcon = ICONS.UPVOTE;
|
||||
const dislikeIcon = ICONS.DOWNVOTE;
|
||||
|
||||
function handleCommentLike() {
|
||||
if (activeChannelId) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsMine,
|
||||
selectFetchingMyChannels,
|
||||
selectMyClaimIdsRaw,
|
||||
selectMyChannelClaims,
|
||||
} from 'redux/selectors/claims';
|
||||
import {
|
||||
selectTopLevelCommentsForUri,
|
||||
@@ -35,7 +35,7 @@ const select = (state, props) => {
|
||||
return {
|
||||
topLevelComments,
|
||||
resolvedComments,
|
||||
myChannelIds: selectMyClaimIdsRaw(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
allCommentIds: makeSelectCommentIdsForUri(props.uri)(state),
|
||||
pinnedComments: selectPinnedCommentsForUri(state, props.uri),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// @flow
|
||||
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL, SORT_BY } from 'constants/comment';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
@@ -14,6 +15,7 @@ import debounce from 'util/debounce';
|
||||
import Empty from 'component/common/empty';
|
||||
import React, { useEffect } from 'react';
|
||||
import Spinner from 'component/spinner';
|
||||
import useFetched from 'effects/use-fetched';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
@@ -30,12 +32,11 @@ type Props = {
|
||||
allCommentIds: any,
|
||||
pinnedComments: Array<Comment>,
|
||||
topLevelComments: Array<Comment>,
|
||||
resolvedComments: Array<Comment>,
|
||||
topLevelTotalPages: number,
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
myChannelIds: ?Array<string>,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
isFetchingComments: boolean,
|
||||
isFetchingCommentsById: boolean,
|
||||
isFetchingReacts: boolean,
|
||||
@@ -46,9 +47,8 @@ type Props = {
|
||||
othersReactsById: ?{ [string]: { [REACTION_TYPES.LIKE | REACTION_TYPES.DISLIKE]: number } },
|
||||
activeChannelId: ?string,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
commentsAreExpanded?: boolean,
|
||||
fetchReacts: (Array<string>) => Promise<any>,
|
||||
doResolveUris: (Array<string>) => void,
|
||||
commentsAreExpanded?: boolean,
|
||||
fetchTopLevelComments: (string, number, number, number) => void,
|
||||
fetchComment: (string) => void,
|
||||
resetComments: (string) => void,
|
||||
@@ -60,12 +60,12 @@ function CommentList(props: Props) {
|
||||
uri,
|
||||
pinnedComments,
|
||||
topLevelComments,
|
||||
resolvedComments,
|
||||
topLevelTotalPages,
|
||||
claim,
|
||||
claimIsMine,
|
||||
myChannelIds,
|
||||
myChannels,
|
||||
isFetchingComments,
|
||||
isFetchingCommentsById,
|
||||
isFetchingReacts,
|
||||
linkedCommentId,
|
||||
totalComments,
|
||||
@@ -74,9 +74,8 @@ function CommentList(props: Props) {
|
||||
othersReactsById,
|
||||
activeChannelId,
|
||||
settingsByChannelId,
|
||||
commentsAreExpanded,
|
||||
fetchReacts,
|
||||
doResolveUris,
|
||||
commentsAreExpanded,
|
||||
fetchTopLevelComments,
|
||||
fetchComment,
|
||||
resetComments,
|
||||
@@ -84,21 +83,19 @@ function CommentList(props: Props) {
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
const isMediumScreen = useIsMediumScreen();
|
||||
const desktopView = !isMobile && !isMediumScreen;
|
||||
const spinnerRef = React.useRef();
|
||||
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
|
||||
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
|
||||
const [page, setPage] = React.useState(0);
|
||||
const [commentsToDisplay, setCommentsToDisplay] = React.useState(topLevelComments);
|
||||
const hasDefaultExpansion = commentsAreExpanded || desktopView;
|
||||
const fetchedCommentsOnce = useFetched(isFetchingComments);
|
||||
const fetchedReactsOnce = useFetched(isFetchingReacts);
|
||||
const fetchedLinkedComment = useFetched(isFetchingCommentsById);
|
||||
const hasDefaultExpansion = commentsAreExpanded || (!isMobile && !isMediumScreen);
|
||||
const [expandedComments, setExpandedComments] = React.useState(hasDefaultExpansion);
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
||||
const moreBelow = page < topLevelTotalPages;
|
||||
const isResolvingComments = topLevelComments && resolvedComments.length !== topLevelComments.length;
|
||||
const alreadyResolved = !isResolvingComments && resolvedComments.length !== 0;
|
||||
const canDisplayComments = commentsToDisplay && commentsToDisplay.length === topLevelComments.length;
|
||||
|
||||
// Display comments immediately if not fetching reactions
|
||||
// If not, wait to show comments until reactions are fetched
|
||||
@@ -170,13 +167,19 @@ function CommentList(props: Props) {
|
||||
|
||||
// Scroll to linked-comment
|
||||
useEffect(() => {
|
||||
if (linkedCommentId) {
|
||||
window.pendingLinkedCommentScroll = true;
|
||||
} else {
|
||||
delete window.pendingLinkedCommentScroll;
|
||||
if (fetchedLinkedComment && fetchedCommentsOnce && fetchedReactsOnce) {
|
||||
const elems = document.getElementsByClassName(COMMENT_HIGHLIGHTED);
|
||||
if (elems.length > 0) {
|
||||
const ROUGH_HEADER_HEIGHT = 125; // @see: --header-height
|
||||
const linkedComment = elems[0];
|
||||
window.scrollTo({
|
||||
top: linkedComment.getBoundingClientRect().top + window.scrollY - ROUGH_HEADER_HEIGHT,
|
||||
left: 0,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
}, [fetchedLinkedComment, fetchedCommentsOnce, fetchedReactsOnce]);
|
||||
|
||||
// Infinite scroll
|
||||
useEffect(() => {
|
||||
@@ -203,12 +206,12 @@ function CommentList(props: Props) {
|
||||
}
|
||||
|
||||
const handleCommentScroll = debounce(() => {
|
||||
if (shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
if (hasDefaultExpansion && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
||||
|
||||
if (hasDefaultExpansion && !isFetchingComments && canDisplayComments && readyToDisplayComments && moreBelow) {
|
||||
if (!isFetchingComments && readyToDisplayComments && moreBelow && spinnerRef && spinnerRef.current) {
|
||||
if (shouldFetchNextPage(page, topLevelTotalPages, window, document, 0)) {
|
||||
setPage(page + 1);
|
||||
} else {
|
||||
@@ -216,34 +219,10 @@ function CommentList(props: Props) {
|
||||
return () => window.removeEventListener('scroll', handleCommentScroll);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
canDisplayComments,
|
||||
hasDefaultExpansion,
|
||||
isFetchingComments,
|
||||
moreBelow,
|
||||
page,
|
||||
readyToDisplayComments,
|
||||
topLevelTotalPages,
|
||||
]);
|
||||
}, [hasDefaultExpansion, isFetchingComments, moreBelow, page, readyToDisplayComments, topLevelTotalPages]);
|
||||
|
||||
// Wait to only display topLevelComments after resolved or else
|
||||
// other components will try to resolve again, like channelThumbnail
|
||||
useEffect(() => {
|
||||
if (!isResolvingComments) setCommentsToDisplay(topLevelComments);
|
||||
}, [isResolvingComments, topLevelComments]);
|
||||
|
||||
// Batch resolve comment channel urls
|
||||
useEffect(() => {
|
||||
if (!topLevelComments || alreadyResolved) return;
|
||||
|
||||
const urisToResolve = [];
|
||||
topLevelComments.map(({ channel_url }) => channel_url !== undefined && urisToResolve.push(channel_url));
|
||||
|
||||
if (urisToResolve.length > 0) doResolveUris(urisToResolve);
|
||||
}, [alreadyResolved, doResolveUris, topLevelComments]);
|
||||
|
||||
const getCommentElems = (comments) =>
|
||||
comments.map((comment) => (
|
||||
const getCommentElems = (comments) => {
|
||||
return comments.map((comment) => (
|
||||
<CommentView
|
||||
isTopLevel
|
||||
threadDepth={3}
|
||||
@@ -256,7 +235,9 @@ function CommentList(props: Props) {
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={comment.channel_id && myChannelIds && myChannelIds.includes(comment.channel_id)}
|
||||
commentIsMine={
|
||||
comment.channel_id && myChannels && myChannels.some(({ claim_id }) => claim_id === comment.channel_id)
|
||||
}
|
||||
linkedCommentId={linkedCommentId}
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
@@ -266,19 +247,22 @@ function CommentList(props: Props) {
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
));
|
||||
};
|
||||
|
||||
const sortButton = (label, icon, sortOption) => (
|
||||
<Button
|
||||
button="alt"
|
||||
label={label}
|
||||
icon={icon}
|
||||
iconSize={18}
|
||||
onClick={() => changeSort(sortOption)}
|
||||
className={classnames(`button-toggle`, {
|
||||
'button-toggle--active': sort === sortOption,
|
||||
})}
|
||||
/>
|
||||
);
|
||||
const sortButton = (label, icon, sortOption) => {
|
||||
return (
|
||||
<Button
|
||||
button="alt"
|
||||
label={label}
|
||||
icon={icon}
|
||||
iconSize={18}
|
||||
onClick={() => changeSort(sortOption)}
|
||||
className={classnames(`button-toggle`, {
|
||||
'button-toggle--active': sort === sortOption,
|
||||
})}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
@@ -286,7 +270,7 @@ function CommentList(props: Props) {
|
||||
title={
|
||||
(totalComments === 0 && __('Leave a comment')) ||
|
||||
(totalComments === 1 && __('1 comment')) ||
|
||||
__('%total_comments% comments', { total_comments: totalComments })
|
||||
__('%totalComments% comments', { totalComments })
|
||||
}
|
||||
titleActions={
|
||||
<>
|
||||
@@ -310,15 +294,15 @@ function CommentList(props: Props) {
|
||||
|
||||
<ul
|
||||
className={classnames({
|
||||
comments: desktopView || expandedComments,
|
||||
'comments--contracted': !desktopView && !expandedComments,
|
||||
comments: expandedComments,
|
||||
'comments--contracted': !expandedComments,
|
||||
})}
|
||||
>
|
||||
{readyToDisplayComments && pinnedComments && getCommentElems(pinnedComments)}
|
||||
{readyToDisplayComments && commentsToDisplay && getCommentElems(commentsToDisplay)}
|
||||
{readyToDisplayComments && topLevelComments && getCommentElems(topLevelComments)}
|
||||
</ul>
|
||||
|
||||
{!hasDefaultExpansion && (
|
||||
{!hasDefaultExpansion && topLevelComments && Boolean(topLevelComments.length) && (
|
||||
<div className="card__bottom-actions--comments">
|
||||
{(!expandedComments || moreBelow) && (
|
||||
<Button
|
||||
@@ -339,7 +323,7 @@ function CommentList(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(isFetchingComments || (hasDefaultExpansion && moreBelow) || !canDisplayComments) && (
|
||||
{(isFetchingComments || (hasDefaultExpansion && moreBelow)) && (
|
||||
<div className="main--empty" ref={spinnerRef}>
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import Comment from 'component/comment';
|
||||
import React from 'react';
|
||||
import Comment from 'component/comment';
|
||||
import Button from 'component/button';
|
||||
import Spinner from 'component/spinner';
|
||||
|
||||
type Props = {
|
||||
fetchedReplies: Array<Comment>,
|
||||
resolvedReplies: Array<Comment>,
|
||||
fetchedReplies: Array<any>,
|
||||
uri: string,
|
||||
parentId: string,
|
||||
claimIsMine: boolean,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
linkedCommentId?: string,
|
||||
userCanComment: boolean,
|
||||
commentingEnabled: boolean,
|
||||
threadDepth: number,
|
||||
numDirectReplies: number, // Total replies for parentId as reported by 'comment[replies]'. Includes blocked items.
|
||||
isFetchingByParentId: { [string]: boolean },
|
||||
onShowMore?: () => void,
|
||||
hasMore: boolean,
|
||||
supportDisabled: boolean,
|
||||
doResolveUris: (Array<string>) => void,
|
||||
onShowMore?: () => void,
|
||||
};
|
||||
|
||||
function CommentsReplies(props: Props) {
|
||||
@@ -28,108 +26,102 @@ function CommentsReplies(props: Props) {
|
||||
uri,
|
||||
parentId,
|
||||
fetchedReplies,
|
||||
resolvedReplies,
|
||||
claimIsMine,
|
||||
myChannels,
|
||||
linkedCommentId,
|
||||
userCanComment,
|
||||
commentingEnabled,
|
||||
threadDepth,
|
||||
numDirectReplies,
|
||||
isFetchingByParentId,
|
||||
onShowMore,
|
||||
hasMore,
|
||||
supportDisabled,
|
||||
doResolveUris,
|
||||
onShowMore,
|
||||
} = props;
|
||||
|
||||
const [isExpanded, setExpanded] = React.useState(true);
|
||||
const [commentsToDisplay, setCommentsToDisplay] = React.useState(fetchedReplies);
|
||||
const isResolvingReplies = fetchedReplies && resolvedReplies.length !== fetchedReplies.length;
|
||||
const alreadyResolved = !isResolvingReplies && resolvedReplies.length !== 0;
|
||||
const canDisplayComments = commentsToDisplay && commentsToDisplay.length === fetchedReplies.length;
|
||||
|
||||
// Batch resolve comment channel urls
|
||||
React.useEffect(() => {
|
||||
if (!fetchedReplies || alreadyResolved) return;
|
||||
function showMore() {
|
||||
if (onShowMore) {
|
||||
onShowMore();
|
||||
}
|
||||
}
|
||||
|
||||
const urisToResolve = [];
|
||||
fetchedReplies.map(({ channel_url }) => channel_url !== undefined && urisToResolve.push(channel_url));
|
||||
// todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine
|
||||
function isMyComment(channelId: string) {
|
||||
if (myChannels != null && channelId != null) {
|
||||
for (let i = 0; i < myChannels.length; i++) {
|
||||
if (myChannels[i].claim_id === channelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (urisToResolve.length > 0) doResolveUris(urisToResolve);
|
||||
}, [alreadyResolved, doResolveUris, fetchedReplies]);
|
||||
const displayedComments = fetchedReplies;
|
||||
|
||||
// Wait to only display topLevelComments after resolved or else
|
||||
// other components will try to resolve again, like channelThumbnail
|
||||
React.useEffect(() => {
|
||||
if (!isResolvingReplies) setCommentsToDisplay(fetchedReplies);
|
||||
}, [isResolvingReplies, fetchedReplies]);
|
||||
|
||||
return !numDirectReplies ? null : (
|
||||
<div className="comment__replies-container">
|
||||
{!isExpanded ? (
|
||||
<div className="comment__actions--nested">
|
||||
<Button
|
||||
className="comment__action"
|
||||
label={__('Show Replies')}
|
||||
onClick={() => setExpanded(!isExpanded)}
|
||||
icon={isExpanded ? ICONS.UP : ICONS.DOWN}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="comment__replies">
|
||||
<Button className="comment__threadline" aria-label="Hide Replies" onClick={() => setExpanded(false)} />
|
||||
|
||||
<ul className="comments--replies">
|
||||
{!isResolvingReplies &&
|
||||
commentsToDisplay &&
|
||||
commentsToDisplay.length > 0 &&
|
||||
commentsToDisplay.map((comment) => (
|
||||
<Comment
|
||||
threadDepth={threadDepth}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
key={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={
|
||||
comment.channel_id &&
|
||||
myChannels &&
|
||||
myChannels.some(({ claim_id }) => claim_id === comment.channel_id)
|
||||
}
|
||||
linkedCommentId={linkedCommentId}
|
||||
commentingEnabled={userCanComment}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
supportDisabled={supportDisabled}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
{isExpanded && fetchedReplies && hasMore && (
|
||||
<div className="comment__actions--nested">
|
||||
<Button
|
||||
button="link"
|
||||
label={__('Show more')}
|
||||
onClick={() => onShowMore && onShowMore()}
|
||||
className="button--uri-indicator"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{(isFetchingByParentId[parentId] || isResolvingReplies || !canDisplayComments) && (
|
||||
<div className="comment__replies-container">
|
||||
return (
|
||||
Boolean(numDirectReplies) && (
|
||||
<div className="comment__replies-container">
|
||||
{Boolean(numDirectReplies) && !isExpanded && (
|
||||
<div className="comment__actions--nested">
|
||||
<Spinner type="small" />
|
||||
<Button
|
||||
className="comment__action"
|
||||
label={__('Show Replies')}
|
||||
onClick={() => setExpanded(!isExpanded)}
|
||||
icon={isExpanded ? ICONS.UP : ICONS.DOWN}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{isExpanded && (
|
||||
<div>
|
||||
<div className="comment__replies">
|
||||
<Button className="comment__threadline" aria-label="Hide Replies" onClick={() => setExpanded(false)} />
|
||||
|
||||
<ul className="comments--replies">
|
||||
{displayedComments &&
|
||||
displayedComments.map((comment) => {
|
||||
return (
|
||||
<Comment
|
||||
threadDepth={threadDepth}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
key={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
linkedCommentId={linkedCommentId}
|
||||
commentingEnabled={commentingEnabled}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
supportDisabled={supportDisabled}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{isExpanded && fetchedReplies && hasMore && (
|
||||
<div className="comment__actions--nested">
|
||||
<Button button="link" label={__('Show more')} onClick={showMore} className="button--uri-indicator" />
|
||||
</div>
|
||||
)}
|
||||
{isFetchingByParentId[parentId] && (
|
||||
<div className="comment__replies-container">
|
||||
<div className="comment__actions--nested">
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,33 @@
|
||||
// @flow
|
||||
import 'easymde/dist/easymde.min.css';
|
||||
import { FF_MAX_CHARS_DEFAULT } from 'constants/form-field';
|
||||
import { openEditorMenu, stopContextMenu } from 'util/context-menu';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
import type { ElementRef, Node } from 'react';
|
||||
import React from 'react';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
import SimpleMDE from 'react-simplemde-editor';
|
||||
import type { ElementRef, Node } from 'react';
|
||||
import MarkdownPreview from 'component/common/markdown-preview';
|
||||
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,
|
||||
label?: string | Node,
|
||||
render?: () => React$Node,
|
||||
prefix?: string,
|
||||
postfix?: string,
|
||||
error?: string | boolean,
|
||||
helper?: string | React$Node,
|
||||
type?: string,
|
||||
onChange?: (any) => any,
|
||||
defaultValue?: string | number,
|
||||
placeholder?: string | number,
|
||||
children?: React$Node,
|
||||
@@ -33,17 +43,18 @@ type Props = {
|
||||
min?: number,
|
||||
max?: number,
|
||||
quickActionLabel?: string,
|
||||
quickActionHandler?: (any) => any,
|
||||
disabled?: boolean,
|
||||
onChange: (any) => void,
|
||||
value?: string | number,
|
||||
noEmojis?: boolean,
|
||||
render?: () => React$Node,
|
||||
onChange?: (any) => any,
|
||||
quickActionHandler?: (any) => any,
|
||||
openEmoteMenu?: () => void,
|
||||
};
|
||||
|
||||
export class FormField extends React.PureComponent<Props> {
|
||||
static defaultProps = { labelOnLeft: false, blockWrap: true };
|
||||
static defaultProps = {
|
||||
labelOnLeft: false,
|
||||
blockWrap: true,
|
||||
};
|
||||
|
||||
input: { current: ElementRef<any> };
|
||||
|
||||
@@ -56,11 +67,14 @@ export class FormField extends React.PureComponent<Props> {
|
||||
const { autoFocus } = this.props;
|
||||
const input = this.input.current;
|
||||
|
||||
if (input && autoFocus) input.focus();
|
||||
if (input && autoFocus) {
|
||||
input.focus();
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
render,
|
||||
label,
|
||||
prefix,
|
||||
postfix,
|
||||
@@ -78,24 +92,11 @@ export class FormField extends React.PureComponent<Props> {
|
||||
charCount,
|
||||
textAreaMaxLength,
|
||||
quickActionLabel,
|
||||
noEmojis,
|
||||
render,
|
||||
quickActionHandler,
|
||||
openEmoteMenu,
|
||||
noEmojis,
|
||||
...inputProps
|
||||
} = this.props;
|
||||
|
||||
const errorMessage = typeof error === 'object' ? error.message : error;
|
||||
|
||||
// Ideally, the character count should (and can) be appended to the
|
||||
// SimpleMDE's "options::status" bar. However, I couldn't figure out how
|
||||
// to pass the current value to it's callback, nor query the current
|
||||
// text length from the callback. So, we'll use our own widget.
|
||||
const hasCharCount = charCount !== undefined && charCount >= 0;
|
||||
const countInfo = hasCharCount && textAreaMaxLength !== undefined && (
|
||||
<span className="comment__char-count-mde">{`${charCount || '0'}/${textAreaMaxLength}`}</span>
|
||||
);
|
||||
|
||||
const Wrapper = blockWrap
|
||||
? ({ children: innerChildren }) => <fieldset-section class="radio">{innerChildren}</fieldset-section>
|
||||
: ({ children: innerChildren }) => <span className="radio">{innerChildren}</span>;
|
||||
@@ -107,164 +108,207 @@ export class FormField extends React.PureComponent<Props> {
|
||||
</div>
|
||||
) : null;
|
||||
|
||||
const inputSimple = (type: string) => (
|
||||
<>
|
||||
<input id={name} type={type} {...inputProps} />
|
||||
<label htmlFor={name}>{label}</label>
|
||||
</>
|
||||
);
|
||||
let input;
|
||||
if (type) {
|
||||
if (type === 'radio') {
|
||||
input = (
|
||||
<Wrapper>
|
||||
<input id={name} type="radio" {...inputProps} />
|
||||
<label htmlFor={name}>{label}</label>
|
||||
</Wrapper>
|
||||
);
|
||||
} else if (type === 'checkbox') {
|
||||
input = (
|
||||
<div className="checkbox">
|
||||
<input id={name} type="checkbox" {...inputProps} />
|
||||
<label htmlFor={name}>{label}</label>
|
||||
</div>
|
||||
);
|
||||
} else if (type === 'range') {
|
||||
input = (
|
||||
<div>
|
||||
<input id={name} type="range" {...inputProps} />
|
||||
<label htmlFor={name}>{label}</label>
|
||||
</div>
|
||||
);
|
||||
} else if (type === 'select') {
|
||||
input = (
|
||||
<fieldset-section>
|
||||
{(label || errorMessage) && (
|
||||
<label htmlFor={name}>{errorMessage ? <span className="error__text">{errorMessage}</span> : label}</label>
|
||||
)}
|
||||
<select id={name} {...inputProps}>
|
||||
{children}
|
||||
</select>
|
||||
</fieldset-section>
|
||||
);
|
||||
} else if (type === 'select-tiny') {
|
||||
input = (
|
||||
<fieldset-section class="select--slim">
|
||||
{(label || errorMessage) && (
|
||||
<label htmlFor={name}>{errorMessage ? <span className="error__text">{errorMessage}</span> : label}</label>
|
||||
)}
|
||||
<select id={name} {...inputProps}>
|
||||
{children}
|
||||
</select>
|
||||
</fieldset-section>
|
||||
);
|
||||
} else if (type === 'markdown') {
|
||||
const handleEvents = {
|
||||
contextmenu: openEditorMenu,
|
||||
};
|
||||
|
||||
const inputSelect = (selectClass: string) => (
|
||||
<fieldset-section class={selectClass}>
|
||||
{(label || errorMessage) && (
|
||||
<label htmlFor={name}>{errorMessage ? <span className="error__text">{errorMessage}</span> : label}</label>
|
||||
)}
|
||||
<select id={name} {...inputProps}>
|
||||
{children}
|
||||
</select>
|
||||
</fieldset-section>
|
||||
);
|
||||
const getInstance = (editor) => {
|
||||
// SimpleMDE max char check
|
||||
editor.codemirror.on('beforeChange', (instance, changes) => {
|
||||
if (textAreaMaxLength && changes.update) {
|
||||
var str = changes.text.join('\n');
|
||||
var delta = str.length - (instance.indexFromPos(changes.to) - instance.indexFromPos(changes.from));
|
||||
if (delta <= 0) {
|
||||
return;
|
||||
}
|
||||
delta = instance.getValue().length + delta - textAreaMaxLength;
|
||||
if (delta > 0) {
|
||||
str = str.substr(0, str.length - delta);
|
||||
changes.update(changes.from, changes.to, str.split('\n'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const input = () => {
|
||||
switch (type) {
|
||||
case 'radio':
|
||||
return <Wrapper>{inputSimple('radio')}</Wrapper>;
|
||||
case 'checkbox':
|
||||
return <div className="checkbox">{inputSimple('checkbox')}</div>;
|
||||
case 'range':
|
||||
return <div>{inputSimple('range')}</div>;
|
||||
case 'select':
|
||||
return inputSelect('');
|
||||
case 'select-tiny':
|
||||
return inputSelect('select--slim');
|
||||
case 'markdown':
|
||||
const handleEvents = { contextmenu: openEditorMenu };
|
||||
// "Create Link (Ctrl-K)": highlight URL instead of label:
|
||||
editor.codemirror.on('changes', (instance, changes) => {
|
||||
try {
|
||||
// Grab the last change from the buffered list. I assume the
|
||||
// buffered one ('changes', instead of 'change') is more efficient,
|
||||
// and that "Create Link" will always end up last in the list.
|
||||
const lastChange = changes[changes.length - 1];
|
||||
if (lastChange.origin === '+input') {
|
||||
// https://github.com/Ionaru/easy-markdown-editor/blob/8fa54c496f98621d5f45f57577ce630bee8c41ee/src/js/easymde.js#L765
|
||||
const EASYMDE_URL_PLACEHOLDER = '(https://)';
|
||||
|
||||
const getInstance = (editor) => {
|
||||
// SimpleMDE max char check
|
||||
editor.codemirror.on('beforeChange', (instance, changes) => {
|
||||
if (textAreaMaxLength && changes.update) {
|
||||
var str = changes.text.join('\n');
|
||||
var delta = str.length - (instance.indexFromPos(changes.to) - instance.indexFromPos(changes.from));
|
||||
// The URL placeholder is always placed last, so just look at the
|
||||
// last text in the array to also cover the multi-line case:
|
||||
const urlLineText = lastChange.text[lastChange.text.length - 1];
|
||||
|
||||
if (delta <= 0) return;
|
||||
if (urlLineText.endsWith(EASYMDE_URL_PLACEHOLDER) && urlLineText !== '[]' + EASYMDE_URL_PLACEHOLDER) {
|
||||
const from = lastChange.from;
|
||||
const to = lastChange.to;
|
||||
const isSelectionMultiline = lastChange.text.length > 1;
|
||||
const baseIndex = isSelectionMultiline ? 0 : from.ch;
|
||||
|
||||
delta = instance.getValue().length + delta - textAreaMaxLength;
|
||||
if (delta > 0) {
|
||||
str = str.substr(0, str.length - delta);
|
||||
changes.update(changes.from, changes.to, str.split('\n'));
|
||||
// Everything works fine for the [Ctrl-K] case, but for the
|
||||
// [Button] case, this handler happens before the original
|
||||
// code, thus our change got wiped out.
|
||||
// Add a small delay to handle that case.
|
||||
setTimeout(() => {
|
||||
instance.setSelection(
|
||||
{ line: to.line, ch: baseIndex + urlLineText.lastIndexOf('(') + 1 },
|
||||
{ line: to.line, ch: baseIndex + urlLineText.lastIndexOf(')') }
|
||||
);
|
||||
}, 25);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
// Do nothing (revert to original behavior)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// "Create Link (Ctrl-K)": highlight URL instead of label:
|
||||
editor.codemirror.on('changes', (instance, changes) => {
|
||||
try {
|
||||
// Grab the last change from the buffered list. I assume the
|
||||
// buffered one ('changes', instead of 'change') is more efficient,
|
||||
// and that "Create Link" will always end up last in the list.
|
||||
const lastChange = changes[changes.length - 1];
|
||||
if (lastChange.origin === '+input') {
|
||||
// https://github.com/Ionaru/easy-markdown-editor/blob/8fa54c496f98621d5f45f57577ce630bee8c41ee/src/js/easymde.js#L765
|
||||
const EASYMDE_URL_PLACEHOLDER = '(https://)';
|
||||
// Ideally, the character count should (and can) be appended to the
|
||||
// SimpleMDE's "options::status" bar. However, I couldn't figure out how
|
||||
// to pass the current value to it's callback, nor query the current
|
||||
// text length from the callback. So, we'll use our own widget.
|
||||
const hasCharCount = charCount !== undefined && charCount >= 0;
|
||||
const countInfo = hasCharCount && textAreaMaxLength !== undefined && (
|
||||
<span className="comment__char-count-mde">{`${charCount || '0'}/${textAreaMaxLength}`}</span>
|
||||
);
|
||||
|
||||
// The URL placeholder is always placed last, so just look at the
|
||||
// last text in the array to also cover the multi-line case:
|
||||
const urlLineText = lastChange.text[lastChange.text.length - 1];
|
||||
|
||||
if (urlLineText.endsWith(EASYMDE_URL_PLACEHOLDER) && urlLineText !== '[]' + EASYMDE_URL_PLACEHOLDER) {
|
||||
const from = lastChange.from;
|
||||
const to = lastChange.to;
|
||||
const isSelectionMultiline = lastChange.text.length > 1;
|
||||
const baseIndex = isSelectionMultiline ? 0 : from.ch;
|
||||
|
||||
// Everything works fine for the [Ctrl-K] case, but for the
|
||||
// [Button] case, this handler happens before the original
|
||||
// code, thus our change got wiped out.
|
||||
// Add a small delay to handle that case.
|
||||
setTimeout(() => {
|
||||
instance.setSelection(
|
||||
{ line: to.line, ch: baseIndex + urlLineText.lastIndexOf('(') + 1 },
|
||||
{ line: to.line, ch: baseIndex + urlLineText.lastIndexOf(')') }
|
||||
);
|
||||
}, 25);
|
||||
}
|
||||
}
|
||||
} catch (e) {} // Do nothing (revert to original behavior)
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="form-field--SimpleMDE" onContextMenu={stopContextMenu}>
|
||||
<fieldset-section>
|
||||
<div className="form-field__two-column">
|
||||
<div>
|
||||
<label htmlFor={name}>{label}</label>
|
||||
</div>
|
||||
{quickAction}
|
||||
</div>
|
||||
<SimpleMDE
|
||||
{...inputProps}
|
||||
id={name}
|
||||
type="textarea"
|
||||
events={handleEvents}
|
||||
getMdeInstance={getInstance}
|
||||
options={{
|
||||
spellChecker: true,
|
||||
hideIcons: ['heading', 'image', 'fullscreen', 'side-by-side'],
|
||||
previewRender(plainText) {
|
||||
const preview = <MarkdownPreview content={plainText} noDataStore />;
|
||||
return ReactDOMServer.renderToString(preview);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
{countInfo}
|
||||
</fieldset-section>
|
||||
</div>
|
||||
);
|
||||
case 'textarea':
|
||||
return (
|
||||
input = (
|
||||
<div className="form-field--SimpleMDE" onContextMenu={stopContextMenu}>
|
||||
<fieldset-section>
|
||||
{(label || quickAction) && (
|
||||
<div className="form-field__two-column">
|
||||
<div className="form-field__two-column">
|
||||
<div>
|
||||
<label htmlFor={name}>{label}</label>
|
||||
{quickAction}
|
||||
</div>
|
||||
{quickAction}
|
||||
</div>
|
||||
<SimpleMDE
|
||||
{...inputProps}
|
||||
id={name}
|
||||
type="textarea"
|
||||
events={handleEvents}
|
||||
getMdeInstance={getInstance}
|
||||
options={{
|
||||
spellChecker: true,
|
||||
hideIcons: ['heading', 'image', 'fullscreen', 'side-by-side'],
|
||||
previewRender(plainText) {
|
||||
const preview = <MarkdownPreview content={plainText} noDataStore />;
|
||||
return ReactDOMServer.renderToString(preview);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
{countInfo}
|
||||
</fieldset-section>
|
||||
</div>
|
||||
);
|
||||
} else if (type === 'textarea') {
|
||||
const hasCharCount = charCount !== undefined && charCount >= 0;
|
||||
const countInfo = hasCharCount && textAreaMaxLength !== undefined && (
|
||||
<span className="comment__char-count">{`${charCount || '0'}/${textAreaMaxLength}`}</span>
|
||||
);
|
||||
input = (
|
||||
<fieldset-section>
|
||||
{(label || quickAction) && (
|
||||
<div className="form-field__two-column">
|
||||
<div>
|
||||
<label htmlFor={name}>{label}</label>
|
||||
</div>
|
||||
{quickAction}
|
||||
</div>
|
||||
)}
|
||||
<textarea
|
||||
type={type}
|
||||
id={name}
|
||||
maxLength={textAreaMaxLength || FF_MAX_CHARS_DEFAULT}
|
||||
ref={this.input}
|
||||
{...inputProps}
|
||||
/>
|
||||
<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>
|
||||
)}
|
||||
<textarea
|
||||
type={type}
|
||||
id={name}
|
||||
maxLength={textAreaMaxLength || FF_MAX_CHARS_DEFAULT}
|
||||
ref={this.input}
|
||||
{...inputProps}
|
||||
/>
|
||||
<div className="form-field__textarea-info">
|
||||
{!noEmojis && (
|
||||
<Button
|
||||
type="alt"
|
||||
className="button--file-action"
|
||||
title="Emotes"
|
||||
onClick={openEmoteMenu}
|
||||
icon={ICONS.EMOJI}
|
||||
iconSize={20}
|
||||
/>
|
||||
)}
|
||||
{countInfo}
|
||||
</div>
|
||||
</fieldset-section>
|
||||
);
|
||||
default:
|
||||
const inputElement = <input type={type} id={name} {...inputProps} ref={this.input} />;
|
||||
const inner = inputButton ? (
|
||||
<input-submit>
|
||||
{inputElement}
|
||||
{inputButton}
|
||||
</input-submit>
|
||||
) : (
|
||||
inputElement
|
||||
);
|
||||
{countInfo}
|
||||
</div>
|
||||
</fieldset-section>
|
||||
);
|
||||
} else {
|
||||
const inputElement = <input type={type} id={name} {...inputProps} ref={this.input} />;
|
||||
const inner = inputButton ? (
|
||||
<input-submit>
|
||||
{inputElement}
|
||||
{inputButton}
|
||||
</input-submit>
|
||||
) : (
|
||||
inputElement
|
||||
);
|
||||
|
||||
return (
|
||||
input = (
|
||||
<React.Fragment>
|
||||
<fieldset-section>
|
||||
{(label || errorMessage) && (
|
||||
<label htmlFor={name}>
|
||||
@@ -274,15 +318,17 @@ export class FormField extends React.PureComponent<Props> {
|
||||
{prefix && <label htmlFor={name}>{prefix}</label>}
|
||||
{inner}
|
||||
</fieldset-section>
|
||||
);
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{type && input()}
|
||||
<React.Fragment>
|
||||
{input}
|
||||
|
||||
{helper && <div className="form-field__help">{helper}</div>}
|
||||
</>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,7 +382,21 @@ export const icons = {
|
||||
[ICONS.NO]: buildIcon(
|
||||
<path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17" />
|
||||
),
|
||||
[ICONS.UP]: buildIcon(<polyline transform="matrix(1,0,0,-1,0,24.707107)" points="6 9 12 15 18 9" />),
|
||||
[ICONS.UP]: buildIcon(
|
||||
<g>
|
||||
<polyline transform="matrix(1,0,0,-1,0,24.707107)" points="6 9 12 15 18 9" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.UP_TOP]: buildIcon(
|
||||
<g>
|
||||
<path d="m6 16 6-6 6 6M6 8h12" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.DOWN_BOTTOM]: buildIcon(
|
||||
<g>
|
||||
<path d="m6 8 6 6 6-6M6 16h12" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.DOWN]: buildIcon(<polyline points="6 9 12 15 18 9" />),
|
||||
[ICONS.FULLSCREEN]: buildIcon(
|
||||
<path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" />
|
||||
@@ -1767,532 +1781,6 @@ export const icons = {
|
||||
</g>
|
||||
</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'}
|
||||
className={props.className}
|
||||
>
|
||||
<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.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}
|
||||
@@ -2526,12 +2014,4 @@ export const icons = {
|
||||
<line x1="19" y1="20.5" x2="20" y2="20.5" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.EMOJI]: buildIcon(
|
||||
<g>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M8 14s1.5 2 4 2 4-2 4-2" />
|
||||
<line x1="9" y1="9" x2="9.01" y2="9" />
|
||||
<line x1="15" y1="9" x2="15.01" y2="9" />
|
||||
</g>
|
||||
),
|
||||
};
|
||||
@@ -10,16 +10,12 @@ import remarkFrontMatter from 'remark-frontmatter';
|
||||
import reactRenderer from 'remark-react';
|
||||
import MarkdownLink from 'component/markdownLink';
|
||||
import defaultSchema from 'hast-util-sanitize/lib/github.json';
|
||||
import { formattedLinks, inlineLinks } from 'util/remark-lbry';
|
||||
import { formatedLinks, inlineLinks } from 'util/remark-lbry';
|
||||
import { formattedTimestamp, inlineTimestamp } from 'util/remark-timestamp';
|
||||
import { formattedEmote, inlineEmote } from 'util/remark-emote';
|
||||
import ZoomableImage from 'component/zoomableImage';
|
||||
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS, SIMPLE_SITE } from 'config';
|
||||
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import OptimizedImage from 'component/optimizedImage';
|
||||
|
||||
const RE_EMOTE = /:\+1:|:-1:|:[\w-]+:/;
|
||||
|
||||
type SimpleTextProps = {
|
||||
children?: React.Node,
|
||||
@@ -46,7 +42,6 @@ type MarkdownProps = {
|
||||
className?: string,
|
||||
parentCommentId?: string,
|
||||
isMarkdownPost?: boolean,
|
||||
disableTimestamps?: boolean,
|
||||
stakedLevel?: number,
|
||||
};
|
||||
|
||||
@@ -98,15 +93,10 @@ const SimpleLink = (props: SimpleLinkProps) => {
|
||||
|
||||
const SimpleImageLink = (props: ImageLinkProps) => {
|
||||
const { src, title, alt, helpText } = props;
|
||||
|
||||
if (!src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (title && RE_EMOTE.test(title) && src.includes('static.odycdn.com/emoticons')) {
|
||||
return <OptimizedImage title={title} src={src} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
button="link"
|
||||
@@ -142,20 +132,9 @@ function isStakeEnoughForPreview(stakedLevel) {
|
||||
// ****************************************************************************
|
||||
|
||||
const MarkdownPreview = (props: MarkdownProps) => {
|
||||
const {
|
||||
content,
|
||||
strip,
|
||||
simpleLinks,
|
||||
noDataStore,
|
||||
className,
|
||||
parentCommentId,
|
||||
isMarkdownPost,
|
||||
disableTimestamps,
|
||||
stakedLevel,
|
||||
} = props;
|
||||
|
||||
const { content, strip, simpleLinks, noDataStore, className, parentCommentId, isMarkdownPost, stakedLevel } = props;
|
||||
const strippedContent = content
|
||||
? content.replace(REPLACE_REGEX, (iframeHtml) => {
|
||||
? content.replace(REPLACE_REGEX, (iframeHtml, y, iframeSrc) => {
|
||||
// Let the browser try to create an iframe to see if the markup is valid
|
||||
const outer = document.createElement('div');
|
||||
outer.innerHTML = iframeHtml;
|
||||
@@ -173,10 +152,6 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
})
|
||||
: '';
|
||||
|
||||
const initialQuote = strippedContent.split(' ').find((word) => word.length > 0 || word.charAt(0) === '>');
|
||||
let stripQuote;
|
||||
if (initialQuote && initialQuote.charAt(0) === '>') stripQuote = true;
|
||||
|
||||
const remarkOptions: Object = {
|
||||
sanitize: schema,
|
||||
fragment: React.Fragment,
|
||||
@@ -196,16 +171,7 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
div: React.Fragment,
|
||||
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.") : ''
|
||||
}
|
||||
/>
|
||||
),
|
||||
: (imgProps) => <SimpleImageLink src={imgProps.src} alt={imgProps.alt} title={imgProps.title} />,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -217,22 +183,10 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
};
|
||||
|
||||
// Strip all content and just render text
|
||||
if (strip || stripQuote) {
|
||||
if (strip) {
|
||||
// Remove new lines and extra space
|
||||
remarkOptions.remarkReactComponents.p = SimpleText;
|
||||
return stripQuote ? (
|
||||
<span dir="auto" className="markdown-preview">
|
||||
<blockquote>
|
||||
{
|
||||
remark()
|
||||
.use(remarkStrip)
|
||||
.use(remarkFrontMatter, ['yaml'])
|
||||
.use(reactRenderer, remarkOptions)
|
||||
.processSync(content).contents
|
||||
}
|
||||
</blockquote>
|
||||
</span>
|
||||
) : (
|
||||
return (
|
||||
<span dir="auto" className="markdown-preview">
|
||||
{
|
||||
remark()
|
||||
@@ -252,13 +206,11 @@ const MarkdownPreview = (props: MarkdownProps) => {
|
||||
.use(remarkAttr, remarkAttrOpts)
|
||||
// Remark plugins for lbry urls
|
||||
// Note: The order is important
|
||||
.use(formattedLinks)
|
||||
.use(formatedLinks)
|
||||
.use(inlineLinks)
|
||||
.use(disableTimestamps || isMarkdownPost ? null : inlineTimestamp)
|
||||
.use(disableTimestamps || isMarkdownPost ? null : formattedTimestamp)
|
||||
.use(isMarkdownPost ? null : inlineTimestamp)
|
||||
.use(isMarkdownPost ? null : formattedTimestamp)
|
||||
// Emojis
|
||||
.use(inlineEmote)
|
||||
.use(formattedEmote)
|
||||
.use(remarkEmoji)
|
||||
// Render new lines without needing spaces.
|
||||
.use(remarkBreaks)
|
||||
|
||||
@@ -20,7 +20,8 @@ function Paginate(props: Props) {
|
||||
const { search } = location;
|
||||
const [textValue, setTextValue] = React.useState('');
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const initialPage = disableHistory ? 1 : Number(urlParams.get(PAGINATE_PARAM)) || 1;
|
||||
const urlParamPage = Number(urlParams.get(PAGINATE_PARAM));
|
||||
const initialPage = disableHistory ? 1 : urlParamPage || 1;
|
||||
const [currentPage, setCurrentPage] = React.useState(initialPage);
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
@@ -47,6 +48,12 @@ function Paginate(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (urlParamPage) {
|
||||
setCurrentPage(urlParamPage);
|
||||
}
|
||||
}, [urlParamPage, setCurrentPage]);
|
||||
|
||||
return (
|
||||
// Hide the paginate controls if we are loading or there is only one page
|
||||
// It should still be rendered to trigger the onPageChange callback
|
||||
|
||||
@@ -35,12 +35,6 @@ class ErrorBoundary extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
componentDidCatch(error, errorInfo) {
|
||||
// @if TARGET='web'
|
||||
analytics.sentryError(error, errorInfo).then((sentryEventId) => {
|
||||
this.setState({ sentryEventId });
|
||||
});
|
||||
// @endif
|
||||
|
||||
// @if TARGET='app'
|
||||
let errorMessage = 'Uncaught error\n';
|
||||
Native.getAppVersionInfo().then(({ localVersion }) => {
|
||||
@@ -105,9 +99,6 @@ class ErrorBoundary extends React.Component<Props, State> {
|
||||
|
||||
{errorWasReported && (
|
||||
<div className="error__wrapper">
|
||||
{/* @if TARGET='web' */}
|
||||
<span className="error__text">{__('Error ID: %sentryEventId%', { sentryEventId })}</span>
|
||||
{/* @endif */}
|
||||
{/* @if TARGET='app' */}
|
||||
<span className="error__text">{__('This error was reported and will be fixed.')}</span>
|
||||
{/* @endif */}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import Expandable from './view';
|
||||
|
||||
export default Expandable;
|
||||
export default connect(
|
||||
null,
|
||||
null
|
||||
)(Expandable);
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimForUri,
|
||||
selectMyChannelClaims,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectStreamingUrlForUri, makeSelectFileInfoForUri } from 'redux/selectors/file_info';
|
||||
@@ -24,7 +23,6 @@ const select = (state, props) => ({
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
isLivestreamClaim: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
reactionsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { SITE_NAME, ENABLE_FILE_REACTIONS } from 'config';
|
||||
import { ENABLE_FILE_REACTIONS } from 'config';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as ICONS from 'constants/icons';
|
||||
@@ -16,7 +16,7 @@ import { useHistory } from 'react-router';
|
||||
import FileReactions from 'component/fileReactions';
|
||||
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import { webDownloadClaim } from 'util/downloadClaim';
|
||||
import ClaimRepostButton from 'component/claimRepostButton';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -28,10 +28,7 @@ type Props = {
|
||||
costInfo: ?{ cost: number },
|
||||
renderMode: string,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
doToast: ({ message: string }) => void,
|
||||
clearPlayingUri: () => void,
|
||||
hideRepost?: boolean,
|
||||
isLivestreamClaim: boolean,
|
||||
reactionsDisabled: boolean,
|
||||
download: (string) => void,
|
||||
streamingUrl: ?string,
|
||||
@@ -48,17 +45,12 @@ function FileActions(props: Props) {
|
||||
renderMode,
|
||||
prepareEdit,
|
||||
myChannels,
|
||||
clearPlayingUri,
|
||||
doToast,
|
||||
hideRepost,
|
||||
isLivestreamClaim,
|
||||
reactionsDisabled,
|
||||
download,
|
||||
streamingUrl,
|
||||
} = props;
|
||||
const {
|
||||
push,
|
||||
location: { pathname, search },
|
||||
location: { search },
|
||||
} = useHistory();
|
||||
const isMobile = useIsMobile();
|
||||
const webShareable = costInfo && costInfo.cost === 0 && RENDER_MODES.WEB_SHAREABLE_MODES.includes(renderMode);
|
||||
@@ -67,7 +59,6 @@ function FileActions(props: Props) {
|
||||
const claimId = claim && claim.claim_id;
|
||||
const { signing_channel: signingChannel } = claim;
|
||||
const channelName = signingChannel && signingChannel.name;
|
||||
const fileName = claim && claim.value && claim.value.source && claim.value.source.name;
|
||||
|
||||
// We want to use the short form uri for editing
|
||||
// This is what the user is used to seeing, they don't care about the claim id
|
||||
@@ -88,50 +79,13 @@ function FileActions(props: Props) {
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
||||
|
||||
// @if TARGET='web'
|
||||
const [downloadClicked, setDownloadClicked] = React.useState(false);
|
||||
|
||||
function handleWebDownload() {
|
||||
// download() causes 'streamingUrl' to be populated.
|
||||
download(uri);
|
||||
setDownloadClicked(true);
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (downloadClicked && streamingUrl) {
|
||||
webDownloadClaim(streamingUrl, fileName);
|
||||
setDownloadClicked(false);
|
||||
}
|
||||
}, [downloadClicked, streamingUrl, fileName]);
|
||||
// @endif
|
||||
|
||||
function handleRepostClick() {
|
||||
if (!hasChannels) {
|
||||
clearPlayingUri();
|
||||
push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`);
|
||||
doToast({ message: __('A channel is required to repost on %SITE_NAME%', { SITE_NAME }) });
|
||||
} else {
|
||||
push(`/$/${PAGES.REPOST_NEW}?from=${encodeURIComponent(uri)}&redirect=${pathname}`);
|
||||
}
|
||||
}
|
||||
|
||||
const lhsSection = (
|
||||
<>
|
||||
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} livestream={isLivestreamClaim} />}
|
||||
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} />}
|
||||
<ClaimSupportButton uri={uri} fileAction />
|
||||
<ClaimCollectionAddButton uri={uri} fileAction />
|
||||
{!hideRepost && (
|
||||
<Button
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPOST}
|
||||
label={
|
||||
claim.meta.reposted > 1 ? __(`%repost_total% Reposts`, { repost_total: claim.meta.reposted }) : __('Repost')
|
||||
}
|
||||
description={__('Repost')}
|
||||
requiresAuth={IS_WEB}
|
||||
onClick={handleRepostClick}
|
||||
/>
|
||||
<ClaimRepostButton uri={uri} claim={claim} hasChannels={hasChannels} />
|
||||
)}
|
||||
<Button
|
||||
className="button--file-action"
|
||||
@@ -145,14 +99,12 @@ function FileActions(props: Props) {
|
||||
|
||||
const rhsSection = (
|
||||
<>
|
||||
{/* @if TARGET='app' */}
|
||||
<FileDownloadLink uri={uri} />
|
||||
{/* @endif */}
|
||||
{claimIsMine && (
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.EDIT}
|
||||
label={isLivestreamClaim ? __('Update') : __('Edit')}
|
||||
label={__('Edit')}
|
||||
navigate={`/$/${PAGES.UPLOAD}`}
|
||||
onClick={() => {
|
||||
prepareEdit(claim, editUri, fileInfo);
|
||||
@@ -168,7 +120,7 @@ function FileActions(props: Props) {
|
||||
onClick={() => openModal(MODALS.CONFIRM_FILE_REMOVE, { uri })}
|
||||
/>
|
||||
)}
|
||||
{(!isLivestreamClaim || !claimIsMine) && (
|
||||
{!claimIsMine && (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
className="button--file-action"
|
||||
@@ -180,27 +132,15 @@ function FileActions(props: Props) {
|
||||
<Icon size={20} icon={ICONS.MORE} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
{/* @if TARGET='web' */}
|
||||
{!isLivestreamClaim && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleWebDownload}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DOWNLOAD} />
|
||||
{__('Download')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{!claimIsMine && (
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.REPORT_CONTENT}?claimId=${claimId}`)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.REPORT} />
|
||||
{__('Report content')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.REPORT_CONTENT}?claimId=${claimId}`)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.REPORT} />
|
||||
{__('Report content')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
)}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectTagsForUri,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'redux/selectors/claims';
|
||||
import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet';
|
||||
@@ -14,6 +15,7 @@ const select = (state, props) => ({
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||
user: selectUser(state),
|
||||
tags: makeSelectTagsForUri(props.uri)(state),
|
||||
pendingAmount: makeSelectPendingAmountByUri(props.uri)(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ type Props = {
|
||||
claim: StreamClaim,
|
||||
metadata: StreamMetadata,
|
||||
user: ?any,
|
||||
tags: any,
|
||||
pendingAmount: number,
|
||||
doOpenModal: (id: string, {}) => void,
|
||||
claimIsMine: boolean,
|
||||
@@ -26,7 +27,7 @@ function FileDescription(props: Props) {
|
||||
const { uri, claim, metadata, pendingAmount, doOpenModal, claimIsMine, expandOverride } = props;
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
const [showCreditDetails, setShowCreditDetails] = React.useState(false);
|
||||
const amount = parseFloat(claim.amount) + parseFloat(pendingAmount || claim.meta.support_amount);
|
||||
const amount = claim ? parseFloat(claim.amount) + parseFloat(pendingAmount || claim.meta.support_amount) : undefined;
|
||||
const formattedAmount = formatCredits(amount, 2, true);
|
||||
const hasSupport = claim && claim.meta && claim.meta.support_amount && Number(claim.meta.support_amount) > 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// @flow
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import React, { PureComponent } from 'react';
|
||||
import Button from 'component/button';
|
||||
import path from 'path';
|
||||
@@ -49,46 +48,44 @@ class FileDetails extends PureComponent<Props> {
|
||||
<span>{claim.claim_id}</span>
|
||||
</div>
|
||||
|
||||
{!SIMPLE_SITE && (
|
||||
<>
|
||||
{languages && (
|
||||
<div className="media__details">
|
||||
<span>{__('Languages')}</span>
|
||||
<span>{languages.join(' ')}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{mediaType && (
|
||||
<div className="media__details">
|
||||
<span>{__('Media Type')}</span>
|
||||
<span>{mediaType}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<>
|
||||
{languages && (
|
||||
<div className="media__details">
|
||||
<span>{__('License')}</span>
|
||||
<span>{license}</span>
|
||||
<span>{__('Languages')}</span>
|
||||
<span>{languages.join(' ')}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{downloadPath && (
|
||||
<div className="media__details">
|
||||
<span>{__('Downloaded to')}</span>
|
||||
<span>
|
||||
<Button
|
||||
button="link"
|
||||
className="button--download-link"
|
||||
onClick={() => {
|
||||
if (downloadPath) {
|
||||
openFolder(downloadPath);
|
||||
}
|
||||
}}
|
||||
label={downloadNote || downloadPath.replace(/(.{10})/g, '$1\u200b')}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{mediaType && (
|
||||
<div className="media__details">
|
||||
<span>{__('Media Type')}</span>
|
||||
<span>{mediaType}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="media__details">
|
||||
<span>{__('License')}</span>
|
||||
<span>{license}</span>
|
||||
</div>
|
||||
|
||||
{downloadPath && (
|
||||
<div className="media__details">
|
||||
<span>{__('Downloaded to')}</span>
|
||||
<span>
|
||||
<Button
|
||||
button="link"
|
||||
className="button--download-link"
|
||||
onClick={() => {
|
||||
if (downloadPath) {
|
||||
openFolder(downloadPath);
|
||||
}
|
||||
}}
|
||||
label={downloadNote || downloadPath.replace(/(.{10})/g, '$1\u200b')}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
{fileSize && (
|
||||
<div className="media__details">
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { webDownloadClaim } from 'util/downloadClaim';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -40,23 +39,9 @@ function FileDownloadLink(props: Props) {
|
||||
showLabel = false,
|
||||
hideOpenButton = false,
|
||||
hideDownloadStatus = false,
|
||||
streamingUrl,
|
||||
} = props;
|
||||
|
||||
const [didClickDownloadButton, setDidClickDownloadButton] = useState(false);
|
||||
const fileName = claim && claim.value && claim.value.source && claim.value.source.name;
|
||||
|
||||
// @if TARGET='web'
|
||||
React.useEffect(() => {
|
||||
if (didClickDownloadButton && streamingUrl) {
|
||||
webDownloadClaim(streamingUrl, fileName);
|
||||
setDidClickDownloadButton(false);
|
||||
}
|
||||
}, [streamingUrl, didClickDownloadButton, fileName]);
|
||||
// @endif
|
||||
|
||||
function handleDownload(e) {
|
||||
setDidClickDownloadButton(true);
|
||||
e.preventDefault();
|
||||
download(uri);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,15 @@ import { makeSelectCostInfoForUri, doFetchCostInfoForUri, makeSelectFetchingCost
|
||||
import FilePrice from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
fetching: makeSelectFetchingCostInfoForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, { doFetchCostInfoForUri })(FilePrice);
|
||||
const perform = (dispatch) => ({
|
||||
fetchCostInfo: (uri) => dispatch(doFetchCostInfoForUri(uri)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FilePrice);
|
||||
@@ -1,30 +1,30 @@
|
||||
// @flow
|
||||
import 'scss/component/_file-price.scss';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import Icon from 'component/common/icon';
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
claim: ?{},
|
||||
claimIsMine: boolean,
|
||||
claimWasPurchased: boolean,
|
||||
costInfo?: ?{ includesData: boolean, cost: number },
|
||||
fetching: boolean,
|
||||
showFullPrice: boolean,
|
||||
type?: string,
|
||||
costInfo: ?{ includesData: boolean, cost: number },
|
||||
fetchCostInfo: string => void,
|
||||
uri: string,
|
||||
fetching: boolean,
|
||||
claim: ?{},
|
||||
claimWasPurchased: boolean,
|
||||
claimIsMine: boolean,
|
||||
type?: string,
|
||||
// below props are just passed to <CreditAmount />
|
||||
customPrice: number,
|
||||
hideFree?: boolean, // hide the file price if it's free
|
||||
isFiat?: boolean,
|
||||
inheritStyle?: boolean,
|
||||
showLBC?: boolean,
|
||||
doFetchCostInfoForUri: (string) => void,
|
||||
hideFree?: boolean, // hide the file price if it's free
|
||||
};
|
||||
|
||||
class FilePrice extends React.PureComponent<Props> {
|
||||
static defaultProps = { showFullPrice: false };
|
||||
static defaultProps = {
|
||||
showFullPrice: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.fetchCost(this.props);
|
||||
@@ -35,44 +35,40 @@ class FilePrice extends React.PureComponent<Props> {
|
||||
}
|
||||
|
||||
fetchCost = (props: Props) => {
|
||||
const { costInfo, uri, fetching, claim, doFetchCostInfoForUri } = props;
|
||||
const { costInfo, fetchCostInfo, uri, fetching, claim } = props;
|
||||
|
||||
if (uri && costInfo === undefined && !fetching && claim) doFetchCostInfoForUri(uri);
|
||||
if (costInfo === undefined && !fetching && claim) {
|
||||
fetchCostInfo(uri);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
costInfo,
|
||||
showFullPrice,
|
||||
showLBC,
|
||||
isFiat,
|
||||
hideFree,
|
||||
claimWasPurchased,
|
||||
type,
|
||||
claimIsMine,
|
||||
customPrice,
|
||||
} = this.props;
|
||||
const { costInfo, showFullPrice, showLBC, hideFree, claimWasPurchased, type, claimIsMine } = this.props;
|
||||
|
||||
if (!customPrice && (claimIsMine || !costInfo || !costInfo.cost || (!costInfo.cost && hideFree))) return null;
|
||||
|
||||
const className = classnames(claimWasPurchased ? 'filePrice__key' : 'filePrice', {
|
||||
'filePrice--filepage': type === 'filepage',
|
||||
'filePrice--modal': type === 'modal',
|
||||
});
|
||||
if (claimIsMine || !costInfo || !costInfo.cost || (!costInfo.cost && hideFree)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return claimWasPurchased ? (
|
||||
<span className={className}>
|
||||
<span
|
||||
className={classnames('file-price__key', {
|
||||
'file-price__key--filepage': type === 'filepage',
|
||||
'file-price__key--modal': type === 'modal',
|
||||
})}
|
||||
>
|
||||
<Icon icon={ICONS.PURCHASED} size={type === 'filepage' ? 22 : undefined} />
|
||||
</span>
|
||||
) : (
|
||||
<CreditAmount
|
||||
amount={costInfo ? costInfo.cost : customPrice}
|
||||
className={className}
|
||||
isEstimate={!!costInfo && !costInfo.includesData}
|
||||
isFiat={isFiat}
|
||||
className={classnames('file-price', {
|
||||
'file-price--filepage': type === 'filepage',
|
||||
'file-price--modal': type === 'modal',
|
||||
})}
|
||||
showFree
|
||||
showFullPrice={showFullPrice}
|
||||
showLBC={showLBC}
|
||||
amount={costInfo.cost}
|
||||
isEstimate={!costInfo.includesData}
|
||||
showFullPrice={showFullPrice}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import { formatNumberWithCommas } from 'util/number';
|
||||
import NudgeFloating from 'component/nudgeFloating';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
@@ -17,7 +16,6 @@ type Props = {
|
||||
likeCount: number,
|
||||
dislikeCount: number,
|
||||
myReaction: ?string,
|
||||
livestream?: boolean,
|
||||
};
|
||||
|
||||
function FileReactions(props: Props) {
|
||||
@@ -30,38 +28,22 @@ function FileReactions(props: Props) {
|
||||
myReaction,
|
||||
likeCount,
|
||||
dislikeCount,
|
||||
livestream,
|
||||
} = props;
|
||||
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channel = claim && claim.signing_channel && claim.signing_channel.name;
|
||||
const isCollection = claim && claim.value_type === 'collection'; // hack because nudge gets cut off by card on cols.
|
||||
const likeIcon = SIMPLE_SITE ? (myReaction === REACTION_TYPES.LIKE ? ICONS.FIRE_ACTIVE : ICONS.FIRE) : ICONS.UPVOTE;
|
||||
const dislikeIcon = SIMPLE_SITE
|
||||
? myReaction === REACTION_TYPES.DISLIKE
|
||||
? ICONS.SLIME_ACTIVE
|
||||
: ICONS.SLIME
|
||||
: ICONS.DOWNVOTE;
|
||||
const likeIcon = ICONS.UPVOTE;
|
||||
const dislikeIcon = ICONS.DOWNVOTE;
|
||||
React.useEffect(() => {
|
||||
function fetchReactions() {
|
||||
doFetchReactions(claimId);
|
||||
}
|
||||
|
||||
let fetchInterval;
|
||||
if (claimId) {
|
||||
fetchReactions();
|
||||
|
||||
if (livestream) {
|
||||
fetchInterval = setInterval(fetchReactions, 45000);
|
||||
}
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (fetchInterval) {
|
||||
clearInterval(fetchInterval);
|
||||
}
|
||||
};
|
||||
}, [claimId, doFetchReactions, livestream]);
|
||||
}, [claimId, doFetchReactions]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -74,22 +56,24 @@ function FileReactions(props: Props) {
|
||||
|
||||
<Button
|
||||
title={__('I like this')}
|
||||
requiresAuth={IS_WEB}
|
||||
authSrc="filereaction_like"
|
||||
className={classnames('button--file-action', { 'button--fire': myReaction === REACTION_TYPES.LIKE })}
|
||||
className={classnames('button--file-action', {
|
||||
'button--file-action-active': myReaction === REACTION_TYPES.LIKE,
|
||||
})}
|
||||
label={
|
||||
<>
|
||||
{myReaction === REACTION_TYPES.LIKE && SIMPLE_SITE && (
|
||||
<>
|
||||
<div className="button__fire-glow" />
|
||||
<div className="button__fire-particle1" />
|
||||
<div className="button__fire-particle2" />
|
||||
<div className="button__fire-particle3" />
|
||||
<div className="button__fire-particle4" />
|
||||
<div className="button__fire-particle5" />
|
||||
<div className="button__fire-particle6" />
|
||||
</>
|
||||
)}
|
||||
{/* Be nice to have animated Likes */}
|
||||
{/* {myReaction === REACTION_TYPES.LIKE && SIMPLE_SITE && ( */}
|
||||
{/* <> */}
|
||||
{/* <div className="button__fire-glow" /> */}
|
||||
{/* <div className="button__fire-particle1" /> */}
|
||||
{/* <div className="button__fire-particle2" /> */}
|
||||
{/* <div className="button__fire-particle3" /> */}
|
||||
{/* <div className="button__fire-particle4" /> */}
|
||||
{/* <div className="button__fire-particle5" /> */}
|
||||
{/* <div className="button__fire-particle6" /> */}
|
||||
{/* </> */}
|
||||
{/* )} */}
|
||||
{formatNumberWithCommas(likeCount, 0)}
|
||||
</>
|
||||
}
|
||||
@@ -101,19 +85,10 @@ function FileReactions(props: Props) {
|
||||
requiresAuth={IS_WEB}
|
||||
authSrc={'filereaction_dislike'}
|
||||
title={__('I dislike this')}
|
||||
className={classnames('button--file-action', { 'button--slime': myReaction === REACTION_TYPES.DISLIKE })}
|
||||
label={
|
||||
<>
|
||||
{myReaction === REACTION_TYPES.DISLIKE && SIMPLE_SITE && (
|
||||
<>
|
||||
<div className="button__slime-stain" />
|
||||
<div className="button__slime-drop1" />
|
||||
<div className="button__slime-drop2" />
|
||||
</>
|
||||
)}
|
||||
{formatNumberWithCommas(dislikeCount, 0)}
|
||||
</>
|
||||
}
|
||||
className={classnames('button--file-action', {
|
||||
'button--file-action-active': myReaction === REACTION_TYPES.DISLIKE,
|
||||
})}
|
||||
label={<>{formatNumberWithCommas(dislikeCount, 0)}</>}
|
||||
iconSize={18}
|
||||
icon={dislikeIcon}
|
||||
onClick={() => doReactionDislike(uri)}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// @flow
|
||||
import { remote } from 'electron';
|
||||
import React from 'react';
|
||||
import { lazyImport } from 'util/lazyImport';
|
||||
import classnames from 'classnames';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import * as KEYCODES from 'constants/keycodes';
|
||||
@@ -12,22 +11,19 @@ import analytics from 'analytics';
|
||||
|
||||
import DocumentViewer from 'component/viewers/documentViewer';
|
||||
|
||||
// @if TARGET='app'
|
||||
// should match
|
||||
import DocxViewer from 'component/viewers/docxViewer';
|
||||
import ComicBookViewer from 'component/viewers/comicBookViewer';
|
||||
import ThreeViewer from 'component/viewers/threeViewer';
|
||||
// @endif
|
||||
|
||||
const AppViewer = lazyImport(() => import('component/viewers/appViewer' /* webpackChunkName: "appViewer" */));
|
||||
const HtmlViewer = lazyImport(() => import('component/viewers/htmlViewer' /* webpackChunkName: "htmlViewer" */));
|
||||
const ImageViewer = lazyImport(() => import('component/viewers/imageViewer' /* webpackChunkName: "imageViewer" */));
|
||||
const PdfViewer = lazyImport(() => import('component/viewers/pdfViewer' /* webpackChunkName: "pdfViewer" */));
|
||||
import AppViewer from 'component/viewers/appViewer';
|
||||
import HtmlViewer from 'component/viewers/htmlViewer';
|
||||
import ImageViewer from 'component/viewers/imageViewer';
|
||||
import PdfViewer from 'component/viewers/pdfViewer';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
streamingUrl: string,
|
||||
embedded?: boolean,
|
||||
contentType: string,
|
||||
claim: StreamClaim,
|
||||
currentTheme: string,
|
||||
@@ -48,9 +44,8 @@ class FileRender extends React.PureComponent<Props> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { renderMode, embedded } = this.props;
|
||||
window.addEventListener('keydown', this.escapeListener, true);
|
||||
analytics.playerLoadedEvent(renderMode, embedded);
|
||||
analytics.playerLoadedEvent();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@@ -60,7 +55,9 @@ class FileRender extends React.PureComponent<Props> {
|
||||
escapeListener(e: SyntheticKeyboardEvent<*>) {
|
||||
if (e.keyCode === KEYCODES.ESCAPE) {
|
||||
e.preventDefault();
|
||||
|
||||
this.exitFullscreen();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -94,17 +91,9 @@ class FileRender extends React.PureComponent<Props> {
|
||||
/>
|
||||
);
|
||||
case RENDER_MODES.IMAGE:
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<ImageViewer uri={uri} source={source} />
|
||||
</React.Suspense>
|
||||
);
|
||||
return <ImageViewer uri={uri} source={source} />;
|
||||
case RENDER_MODES.HTML:
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<HtmlViewer source={downloadPath || source} />
|
||||
</React.Suspense>
|
||||
);
|
||||
return <HtmlViewer source={downloadPath || source} />;
|
||||
case RENDER_MODES.DOCUMENT:
|
||||
case RENDER_MODES.MARKDOWN:
|
||||
return (
|
||||
@@ -124,11 +113,7 @@ class FileRender extends React.PureComponent<Props> {
|
||||
case RENDER_MODES.DOCX:
|
||||
return <DocxViewer source={downloadPath} />;
|
||||
case RENDER_MODES.PDF:
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<PdfViewer source={downloadPath || source} />
|
||||
</React.Suspense>
|
||||
);
|
||||
return <PdfViewer source={downloadPath || source} />;
|
||||
case RENDER_MODES.CAD:
|
||||
return (
|
||||
<ThreeViewer
|
||||
@@ -152,24 +137,19 @@ class FileRender extends React.PureComponent<Props> {
|
||||
/>
|
||||
);
|
||||
case RENDER_MODES.APPLICATION:
|
||||
return (
|
||||
<React.Suspense fallback={null}>
|
||||
<AppViewer uri={uri} />
|
||||
</React.Suspense>
|
||||
);
|
||||
return <AppViewer uri={uri} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { embedded, renderMode, className } = this.props;
|
||||
const { renderMode, className } = this.props;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('file-render', className, {
|
||||
'file-render--document': RENDER_MODES.TEXT_MODES.includes(renderMode) && !embedded,
|
||||
'file-render--embed': embedded,
|
||||
'file-render--document': RENDER_MODES.TEXT_MODES.includes(renderMode),
|
||||
'file-render--video': renderMode === RENDER_MODES.VIDEO || renderMode === RENDER_MODES.AUDIO,
|
||||
})}
|
||||
>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import Card from 'component/common/card';
|
||||
import Button from 'component/button';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -11,30 +9,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function FileRenderDownload(props: Props) {
|
||||
const { uri, renderMode } = props;
|
||||
|
||||
// @if TARGET='web'
|
||||
if (RENDER_MODES.UNSUPPORTED_IN_THIS_APP.includes(renderMode)) {
|
||||
return (
|
||||
<Card
|
||||
title={__('Download or get the app')}
|
||||
subtitle={
|
||||
<p>
|
||||
{__(
|
||||
'This content can be downloaded from odysee.com, but not displayed. It will display in LBRY Desktop, an app for desktop computers.'
|
||||
)}
|
||||
</p>
|
||||
}
|
||||
actions={
|
||||
<div className="section__actions">
|
||||
<FileDownloadLink uri={uri} buttonType="primary" showLabel />
|
||||
<Button button={'link'} label={__('Get the App')} href="https://lbry.com/get" />
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
// @endif
|
||||
const { uri } = props;
|
||||
|
||||
return <Card title={__('Download')} actions={<FileDownloadLink uri={uri} buttonType="primary" showLabel />} />;
|
||||
}
|
||||
Loaded 100 of 460 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user