Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94d625f41e |
No files matched your search
@@ -0,0 +1,92 @@
|
||||
# Copy this file to .env to make modifications
|
||||
|
||||
# Base config
|
||||
|
||||
WEBPACK_WEB_PORT=9090
|
||||
WEBPACK_ELECTRON_PORT=9091
|
||||
WEB_SERVER_PORT=1337
|
||||
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# Custom Site info
|
||||
DOMAIN=lbry.tv
|
||||
URL=https://lbry.tv
|
||||
|
||||
# UI
|
||||
SITE_TITLE=lbry.tv
|
||||
SITE_NAME=local.lbry.tv
|
||||
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
|
||||
LOGO_TITLE=local.lbry.tv
|
||||
|
||||
##### ODYSEE SETTINGS #######
|
||||
|
||||
MATOMO_URL=https://analytics.lbry.com/
|
||||
MATOMO_ID=4
|
||||
|
||||
# Base config
|
||||
WEBPACK_WEB_PORT=9090
|
||||
WEBPACK_ELECTRON_PORT=9091
|
||||
WEB_SERVER_PORT=1337
|
||||
|
||||
## APIS
|
||||
LBRY_API_URL=https://api.odysee.com
|
||||
#LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||
#LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||
# deprecated:
|
||||
#LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||
#COMMENT_SERVER_API=https://comments.lbry.com/api/v2
|
||||
WELCOME_VERSION=1.0
|
||||
|
||||
# STRIPE
|
||||
STRIPE_PUBLIC_KEY='pk_live_e8M4dRNnCCbmpZzduEUZBgJO'
|
||||
|
||||
## UI
|
||||
|
||||
LOADING_BAR_COLOR=#e50054
|
||||
|
||||
# IMAGE ASSETS
|
||||
YRBL_HAPPY_IMG_URL=https://spee.ch/spaceman-happy:a.png
|
||||
YRBL_SAD_IMG_URL=https://spee.ch/spaceman-sad:d.png
|
||||
LOGIN_IMG_URL=https://spee.ch/login:b.png
|
||||
LOGO=https://spee.ch/odysee-logo-png:3.png
|
||||
LOGO_TEXT_LIGHT=https://spee.ch/odysee-white-png:f.png
|
||||
LOGO_TEXT_DARK=https://spee.ch/odysee-png:2.png
|
||||
AVATAR_DEFAULT=https://spee.ch/spaceman-png:2.png
|
||||
FAVICON=https://spee.ch/favicon-png:c.png
|
||||
|
||||
# LOCALE
|
||||
DEFAULT_LANGUAGE=en
|
||||
|
||||
## LINKED CONTENT WHITELIST
|
||||
KNOWN_APP_DOMAINS=open.lbry.com,lbry.tv,lbry.lat,odysee.com
|
||||
|
||||
## CUSTOM CONTENT
|
||||
# If the following is true, copy custom/homepage.example.js to custom/homepage.js and modify
|
||||
CUSTOM_HOMEPAGE=true
|
||||
|
||||
# Add channels to auto-follow on firstrun (space delimited)
|
||||
AUTO_FOLLOW_CHANNELS=lbry://@Odysee#80d2590ad04e36fb1d077a9b9e3a8bba76defdf8 lbry://@OdyseeHelp#b58dfaeab6c70754d792cdd9b56ff59b90aea334
|
||||
|
||||
## FEATURES AND LIMITS
|
||||
SIMPLE_SITE=true
|
||||
BRANDED_SITE=odysee
|
||||
# SIMPLE_SITE REPLACEMENTS
|
||||
ENABLE_MATURE=false
|
||||
ENABLE_UI_NOTIFICATIONS=true
|
||||
ENABLE_WILD_WEST=true
|
||||
SHOW_TAGS_INTRO=false
|
||||
|
||||
# CENTRALIZED FEATURES
|
||||
ENABLE_COMMENT_REACTIONS=true
|
||||
ENABLE_FILE_REACTIONS=true
|
||||
ENABLE_CREATOR_REACTIONS=true
|
||||
ENABLE_NO_SOURCE_CLAIMS=true
|
||||
ENABLE_PREROLL_ADS=false
|
||||
SHOW_ADS=true
|
||||
|
||||
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
|
||||
CHANNEL_STAKED_LEVEL_LIVESTREAM=3
|
||||
WEB_PUBLISH_SIZE_LIMIT_GB=4
|
||||
|
||||
#SEARCH TYPES - comma-delimited
|
||||
LIGHTHOUSE_DEFAULT_TYPES=audio,video
|
||||
@@ -43,6 +43,8 @@ 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'
|
||||
|
||||
esproposal.optional_chaining=enable
|
||||
|
||||
; Extensions
|
||||
module.file_ext=.js
|
||||
module.file_ext=.jsx
|
||||
@@ -51,4 +53,5 @@ module.file_ext=.css
|
||||
module.file_ext=.scss
|
||||
|
||||
|
||||
|
||||
[strict]
|
||||
+1
-1
@@ -33,6 +33,6 @@ package-lock.json
|
||||
!/custom/robots.disallowall
|
||||
!/custom/robots.allowall
|
||||
.env
|
||||
.env.ody
|
||||
!.env.ody
|
||||
.env.desktop
|
||||
.env.lbrytv
|
||||
Vendored
+2
-63
@@ -20,13 +20,6 @@ declare type Comment = {
|
||||
is_fiat?: boolean,
|
||||
};
|
||||
|
||||
declare type CommentronAuth = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type PerChannelSettings = {
|
||||
words?: Array<string>,
|
||||
comments_enabled?: boolean,
|
||||
@@ -75,10 +68,6 @@ declare type CommentsState = {
|
||||
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
||||
fetchingSettings: boolean,
|
||||
fetchingBlockedWords: boolean,
|
||||
sblMine: any,
|
||||
sblInvited: Array<any>,
|
||||
fetchingSblMine: boolean,
|
||||
fetchingSblInvited: boolean,
|
||||
};
|
||||
|
||||
declare type CommentReactParams = {
|
||||
@@ -122,14 +111,14 @@ declare type ReactionListResponse = {
|
||||
declare type CommentListParams = {
|
||||
page: number, // pagination: which page of results
|
||||
page_size: number, // pagination: nr of comments to show in a page (max 200)
|
||||
claim_id: string, // claim id of claim being commented on
|
||||
claim_id?: string, // claim id of claim being commented on
|
||||
channel_name?: string, // signing channel name of claim (enables 'commentsEnabled' check)
|
||||
channel_id?: string, // signing channel claim id of claim (enables 'commentsEnabled' check)
|
||||
author_claim_id?: string, // filters comments to just this author
|
||||
parent_id?: string, // filters comments to those under this thread
|
||||
top_level?: boolean, // filters to only top level comments
|
||||
hidden?: boolean, // if true, will show hidden comments as well
|
||||
sort_by?: number, // NEWEST=0, OLDEST=1, CONTROVERSY=2, POPULARITY=3,
|
||||
sort_by?: number, // @see: ui/constants/comments.js::SORT_BY
|
||||
};
|
||||
|
||||
declare type CommentListResponse = {
|
||||
@@ -309,53 +298,3 @@ declare type BlockWordParams = {
|
||||
signing_ts: string,
|
||||
words: string, // CSV list of containing words to block comment on content
|
||||
};
|
||||
|
||||
declare type SblUpdate = {
|
||||
name?: string, // A user friendly identifier for the owner/users.
|
||||
category?: string, // The category of block list this is so others search
|
||||
description?: string,
|
||||
member_invite_enabled?: boolean, // Can members invite others contributors?
|
||||
// Strikes are number of hours a user should be banned for if
|
||||
// part of this blocked list. Strikes 1,2,3 are intended to be
|
||||
// progressively higher. Strike 3 is the highest.
|
||||
strike_one?: number,
|
||||
strike_two?: number,
|
||||
strike_three?: number,
|
||||
invite_expiration?: number, // The number of hours until a sent invite expires.
|
||||
// Curse jar allows automatic appeals. If they tip the owner of
|
||||
// the shared blocked list their appeal is automatically accepted.
|
||||
curse_jar_amount?: number,
|
||||
remove?: boolean,
|
||||
};
|
||||
|
||||
declare type SharedBlockedListUpdateArgs = CommentronAuth & SblUpdate;
|
||||
|
||||
declare type SblGet = {
|
||||
blocked_list_id?: number,
|
||||
status: number, // @see: SBL_INVITE_STATUS
|
||||
};
|
||||
|
||||
declare type SharedBlockedListGetArgs = ?CommentronAuth & SblGet;
|
||||
|
||||
declare type SblInvite = {
|
||||
blocked_list_id?: number,
|
||||
invitee_channel_name: string,
|
||||
invitee_channel_id: string,
|
||||
message: string,
|
||||
};
|
||||
|
||||
declare type SharedBlockedListInviteArgs = CommentronAuth & SblInvite;
|
||||
|
||||
declare type SblInviteAccept = {
|
||||
blocked_list_id: number,
|
||||
accepted: boolean,
|
||||
};
|
||||
|
||||
declare type SharedBlockedListInviteAcceptArgs = CommentronAuth & SblInviteAccept;
|
||||
|
||||
declare type SblRescind = {
|
||||
invited_channel_name: string,
|
||||
invited_channel_id: string,
|
||||
};
|
||||
|
||||
declare type SharedBlockedListRescindArgs = CommentronAuth & SblRescind;
|
||||
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// @flow
|
||||
|
||||
declare type FileListItem = {
|
||||
metadata: StreamMetadata,
|
||||
added_on: number,
|
||||
blobs_completed: number,
|
||||
blobs_in_stream: number,
|
||||
blobs_remaining: number,
|
||||
channel_claim_id: string,
|
||||
channel_name: string,
|
||||
claim_id: string,
|
||||
claim_name: string,
|
||||
completed: false,
|
||||
content_fee?: { txid: string },
|
||||
purchase_receipt?: { txid: string, amount: string },
|
||||
download_directory: string,
|
||||
download_path: string,
|
||||
file_name: string,
|
||||
key: string,
|
||||
mime_type: string,
|
||||
nout: number,
|
||||
outpoint: string,
|
||||
points_paid: number,
|
||||
protobuf: string,
|
||||
reflector_progress: number,
|
||||
sd_hash: string,
|
||||
status: string,
|
||||
stopped: false,
|
||||
stream_hash: string,
|
||||
stream_name: string,
|
||||
streaming_url: string,
|
||||
suggested_file_name: string,
|
||||
total_bytes: number,
|
||||
total_bytes_lower_bound: number,
|
||||
is_fully_reflected: boolean,
|
||||
// TODO: sdk plans to change `tx`
|
||||
// It isn't currently used by the apps
|
||||
tx: {},
|
||||
txid: string,
|
||||
uploading_to_reflector: boolean,
|
||||
written_bytes: number,
|
||||
};
|
||||
|
||||
declare type FileState = {
|
||||
failedPurchaseUris: Array<string>,
|
||||
purchasedUris: Array<string>,
|
||||
};
|
||||
|
||||
declare type PurchaseUriCompleted = {
|
||||
type: ACTIONS.PURCHASE_URI_COMPLETED,
|
||||
data: {
|
||||
uri: string,
|
||||
streamingUrl: string,
|
||||
},
|
||||
};
|
||||
|
||||
declare type PurchaseUriFailed = {
|
||||
type: ACTIONS.PURCHASE_URI_FAILED,
|
||||
data: {
|
||||
uri: string,
|
||||
error: any,
|
||||
},
|
||||
};
|
||||
|
||||
declare type PurchaseUriStarted = {
|
||||
type: ACTIONS.PURCHASE_URI_STARTED,
|
||||
data: {
|
||||
uri: string,
|
||||
streamingUrl: string,
|
||||
},
|
||||
};
|
||||
|
||||
declare type DeletePurchasedUri = {
|
||||
type: ACTIONS.CLEAR_PURCHASED_URI_SUCCESS,
|
||||
data: {
|
||||
uri: string,
|
||||
},
|
||||
};
|
||||
@@ -75,6 +75,7 @@
|
||||
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.3.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.2.3",
|
||||
"@babel/plugin-transform-runtime": "^7.4.3",
|
||||
|
||||
@@ -209,6 +209,9 @@
|
||||
"Failed to copy.": "Failed to copy.",
|
||||
"The publisher has chosen to charge %lbc% to view this content. Your balance is currently too low to view it. Check out %reward_link% for free %lbc% or send more %lbc% to your wallet. You can also %buy_link% more %lbc%.": "The publisher has chosen to charge %lbc% to view this content. Your balance is currently too low to view it. Check out %reward_link% for free %lbc% or send more %lbc% to your wallet. You can also %buy_link% more %lbc%.",
|
||||
"Connecting...": "Connecting...",
|
||||
"Your comments": "Your comments",
|
||||
"View your past comments.": "View your past comments.",
|
||||
"Content or channel was deleted.": "Content or channel was deleted.",
|
||||
"Comments": "Comments",
|
||||
"Comment": "Comment",
|
||||
"Comment --[button to submit something]--": "Comment",
|
||||
@@ -1460,6 +1463,7 @@
|
||||
"Staked LBRY Credits": "Staked LBRY Credits",
|
||||
"1 comment": "1 comment",
|
||||
"%total_comments% comments": "%total_comments% comments",
|
||||
"No comments": "No comments",
|
||||
"Upvote": "Upvote",
|
||||
"Downvote": "Downvote",
|
||||
"You loved this": "You loved this",
|
||||
@@ -1634,6 +1638,7 @@
|
||||
"This link leads to an external website.": "This link leads to an external website.",
|
||||
"No Content Found": "No Content Found",
|
||||
"No Lists Found": "No Lists Found",
|
||||
"No matching playlists": "No matching playlists",
|
||||
"You have no lists! Create one from any playable content.": "You have no lists! Create one from any playable content.",
|
||||
"Pick": "Pick",
|
||||
"You have unpublished lists! %pick% one and publish it!": "You have unpublished lists! %pick% one and publish it!",
|
||||
@@ -2054,6 +2059,8 @@
|
||||
"MyAwesomeList": "MyAwesomeList",
|
||||
"My Awesome List": "My Awesome List",
|
||||
"This list has no items.": "This list has no items.",
|
||||
"1 item": "1 item",
|
||||
"%collectionCount% items": "%collectionCount% items",
|
||||
"Select File": "Select File",
|
||||
"File Selected": "File Selected",
|
||||
"Url": "Url",
|
||||
@@ -2141,11 +2148,8 @@
|
||||
"%title% by %channelTitle%": "%title% by %channelTitle%",
|
||||
"%title% by %channelTitle% %ariaDate%": "%title% by %channelTitle% %ariaDate%",
|
||||
"%title% by %channelTitle% %ariaDate%, %mediaDuration%": "%title% by %channelTitle% %ariaDate%, %mediaDuration%",
|
||||
"Collapse Thread": "Collapse Thread",
|
||||
"Collapse": "Collapse",
|
||||
"Expand Comments": "Expand Comments",
|
||||
"Expand": "Expand",
|
||||
"Load More": "Load More",
|
||||
"%formattedSubCount% Followers": "%formattedSubCount% Followers",
|
||||
"1 Follower": "1 Follower",
|
||||
"Collection": "Collection",
|
||||
@@ -2179,5 +2183,6 @@
|
||||
"Creator": "Creator",
|
||||
"From comments": "From comments",
|
||||
"From search": "From search",
|
||||
"Manage tags": "Manage tags",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -13,6 +13,8 @@
|
||||
<link rel="preload" href="/public/font/v1/700.woff" as="font" type="font/woff" crossorigin />
|
||||
<link rel="preload" href="/public/font/v1/700i.woff" as="font" type="font/woff" crossorigin />
|
||||
|
||||
<link rel="shortcut icon" href="/public/favicon-spaceman.png">
|
||||
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'Inter';
|
||||
|
||||
+20
-4
@@ -10,6 +10,15 @@ 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;
|
||||
// async function getUserBandwidth() {
|
||||
// userDownloadBandwidthInBitsPerSecond = await getConnectionSpeed();
|
||||
// }
|
||||
|
||||
// get user bandwidth every minute, starting after an initial one minute wait
|
||||
// setInterval(getUserBandwidth, 1000 * 60);
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const devInternalApis = process.env.LBRY_API_URL && process.env.LBRY_API_URL.includes('dev');
|
||||
@@ -40,7 +49,7 @@ type Analytics = {
|
||||
tagFollowEvent: (string, boolean, ?string) => void,
|
||||
playerLoadedEvent: (?boolean) => void,
|
||||
playerStartedEvent: (?boolean) => void,
|
||||
videoStartEvent: (string, number, string, number, string, any) => void,
|
||||
videoStartEvent: (string, number, string, number, string, any, number) => void,
|
||||
videoIsPlaying: (boolean, any) => void,
|
||||
videoBufferEvent: (
|
||||
StreamClaim,
|
||||
@@ -111,7 +120,7 @@ function getDeviceType() {
|
||||
// variables initialized for watchman
|
||||
let amountOfBufferEvents = 0;
|
||||
let amountOfBufferTimeInMS = 0;
|
||||
let videoType, userId, claimUrl, playerPoweredBy, videoPlayer;
|
||||
let videoType, userId, claimUrl, playerPoweredBy, videoPlayer, bitrateAsBitsPerSecond;
|
||||
let lastSentTime;
|
||||
|
||||
// calculate data for backend, send them, and reset buffer data for next interval
|
||||
@@ -130,6 +139,9 @@ async function sendAndResetWatchmanData() {
|
||||
let protocol;
|
||||
if (videoType === 'application/x-mpegURL') {
|
||||
protocol = 'hls';
|
||||
// get bandwidth if it exists from the texttrack (so it's accurate if user changes quality)
|
||||
// $FlowFixMe
|
||||
bitrateAsBitsPerSecond = videoPlayer.textTracks?.().tracks_[0]?.activeCues[0]?.value?.bandwidth;
|
||||
} else {
|
||||
protocol = 'stb';
|
||||
}
|
||||
@@ -152,6 +164,9 @@ async function sendAndResetWatchmanData() {
|
||||
user_id: userId.toString(),
|
||||
position: Math.round(positionInVideo),
|
||||
rel_position: Math.round((positionInVideo / (totalDurationInSeconds * 1000)) * 100),
|
||||
bitrate: bitrateAsBitsPerSecond,
|
||||
bandwidth: undefined,
|
||||
// ...(userDownloadBandwidthInBitsPerSecond && {bandwidth: userDownloadBandwidthInBitsPerSecond}), // add bandwidth if populated
|
||||
};
|
||||
|
||||
// post to watchman
|
||||
@@ -202,7 +217,7 @@ async function sendWatchmanData(body) {
|
||||
}
|
||||
|
||||
const analytics: Analytics = {
|
||||
// receive buffer events from tracking plugin and jklj
|
||||
// receive buffer events from tracking plugin and save buffer amounts and times for backend call
|
||||
videoBufferEvent: async (claim, data) => {
|
||||
amountOfBufferEvents = amountOfBufferEvents + 1;
|
||||
amountOfBufferTimeInMS = amountOfBufferTimeInMS + data.bufferDuration;
|
||||
@@ -240,7 +255,7 @@ const analytics: Analytics = {
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
}
|
||||
},
|
||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, passedPlayer) => {
|
||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, passedPlayer, videoBitrate) => {
|
||||
// populate values for watchman when video starts
|
||||
userId = passedUserId;
|
||||
claimUrl = canonicalUrl;
|
||||
@@ -248,6 +263,7 @@ const analytics: Analytics = {
|
||||
|
||||
videoType = passedPlayer.currentSource().type;
|
||||
videoPlayer = passedPlayer;
|
||||
bitrateAsBitsPerSecond = videoBitrate;
|
||||
|
||||
sendPromMetric('time_to_start', duration);
|
||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||
|
||||
@@ -36,12 +36,6 @@ const Comments = {
|
||||
setting_update: (params: UpdateSettingsParams) => fetchCommentsApi('setting.Update', params),
|
||||
setting_get: (params: SettingsParams) => fetchCommentsApi('setting.Get', params),
|
||||
super_list: (params: SuperListParams) => fetchCommentsApi('comment.SuperChatList', params),
|
||||
sbl_update: (params: SharedBlockedListUpdateArgs) => fetchCommentsApi('blockedlist.Update', params),
|
||||
sbl_get: (params: SharedBlockedListGetArgs) => fetchCommentsApi('blockedlist.Get', params),
|
||||
sbl_invite: (params: SharedBlockedListInviteArgs) => fetchCommentsApi('blockedlist.Invite', params),
|
||||
sbl_list_invites: (params: CommentronAuth) => fetchCommentsApi('blockedlist.ListInvites', params),
|
||||
sbl_accept: (params: SharedBlockedListInviteAcceptArgs) => fetchCommentsApi('blockedlist.Accept', params),
|
||||
sbl_rescind: (params: SharedBlockedListRescindArgs) => fetchCommentsApi('blockedlist.Rescind', params),
|
||||
};
|
||||
|
||||
function fetchCommentsApi(method: string, params: {}) {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doSblGet, doSblAccept, doSblListInvites, doSblRescind, doSblDelete } from 'redux/actions/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import {
|
||||
selectSblMine,
|
||||
selectFetchingSblMine,
|
||||
selectFetchingSblInvited,
|
||||
selectSblInvited,
|
||||
} from 'redux/selectors/comments';
|
||||
|
||||
import BlockListShared from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
sblMine: selectSblMine(state),
|
||||
sblInvited: selectSblInvited(state),
|
||||
fetchingSblMine: selectFetchingSblMine(state),
|
||||
fetchingSblInvited: selectFetchingSblInvited(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doSblGet: (channelClaim, params) => dispatch(doSblGet(channelClaim, params)),
|
||||
doSblListInvites: (channelClaim) => dispatch(doSblListInvites(channelClaim)),
|
||||
doSblAccept: (channelClaim, params, onComplete) => dispatch(doSblAccept(channelClaim, params, onComplete)),
|
||||
doSblRescind: (channelClaim, params, onComplete) => dispatch(doSblRescind(channelClaim, params, onComplete)),
|
||||
doSblDelete: (channelClaim) => dispatch(doSblDelete(channelClaim)),
|
||||
doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(BlockListShared);
|
||||
@@ -1,452 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import CreditAmount from 'component/common/credit-amount';
|
||||
import Empty from 'component/common/empty';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import TruncatedText from 'component/common/truncated-text';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
import ClaimList from 'component/claimList';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import Spinner from 'component/spinner';
|
||||
import { SBL_INVITE_STATUS } from 'constants/comment';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import useFetched from 'effects/use-fetched';
|
||||
import { getHoursStr, getYesNoStr } from 'util/string';
|
||||
import { isURIValid } from 'lbry-redux';
|
||||
|
||||
const PARAM_BLOCKLIST_ID = 'id';
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
sblMine: any,
|
||||
sblInvited: any,
|
||||
fetchingSblMine: boolean,
|
||||
fetchingSblInvited: boolean,
|
||||
doSblGet: (channelClaim: ?ChannelClaim, params: SblGet) => void,
|
||||
doSblListInvites: (channelClaim: ChannelClaim) => void,
|
||||
doSblAccept: (channelClaim: ChannelClaim, params: SblInviteAccept, onComplete: (err: string) => void) => void,
|
||||
doSblRescind: (channelClaim: ChannelClaim, params: SblRescind, onComplete: (err: string) => void) => void,
|
||||
doSblDelete: (channelClaim: ChannelClaim) => void,
|
||||
doOpenModal: (string, {}) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
};
|
||||
|
||||
export default function BlockListShared(props: Props) {
|
||||
const {
|
||||
activeChannelClaim,
|
||||
sblMine,
|
||||
sblInvited,
|
||||
fetchingSblMine,
|
||||
fetchingSblInvited,
|
||||
doSblGet,
|
||||
doSblListInvites,
|
||||
doSblAccept,
|
||||
doSblRescind,
|
||||
doSblDelete,
|
||||
doOpenModal,
|
||||
doToast,
|
||||
} = props;
|
||||
const { push } = useHistory();
|
||||
|
||||
const [showMembers, setShowMembers] = React.useState(false);
|
||||
const [expandInvite, setExpandInvite] = React.useState({});
|
||||
|
||||
const members = sblMine && sblMine.invited_members;
|
||||
const memberUris = members && members.map((m) => `lbry://${m.invited_channel_name}#${m.invited_channel_id}`);
|
||||
|
||||
// I think the only way to check if my SBL is active is by checking whether we accepted any invites to other SBLs.
|
||||
const isMySblActive = sblMine && (!sblInvited || !sblInvited.some((i) => i.invitation.status === 'accepted'));
|
||||
const mySblId = sblMine && sblMine.shared_blocked_list.id;
|
||||
|
||||
const isUpdating = fetchingSblMine || fetchingSblInvited;
|
||||
const fetchedOnce = useFetched(isUpdating);
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
function fetchSblInfo() {
|
||||
if (activeChannelClaim) {
|
||||
doSblGet(activeChannelClaim, {
|
||||
blocked_list_id: undefined,
|
||||
status: SBL_INVITE_STATUS.ALL,
|
||||
});
|
||||
|
||||
doSblListInvites(activeChannelClaim);
|
||||
}
|
||||
}
|
||||
|
||||
function handleSblDelete() {
|
||||
doOpenModal(MODALS.CONFIRM, {
|
||||
title: __('Delete'),
|
||||
body: (
|
||||
<>
|
||||
<p>{__('Are you sure you want to delete the shared blocklist?')}</p>
|
||||
<p className="empty__text">{sblMine.shared_blocked_list.name.substring(0, 256)}</p>
|
||||
</>
|
||||
),
|
||||
onConfirm: (closeModal) => {
|
||||
if (activeChannelClaim) {
|
||||
doSblDelete(activeChannelClaim);
|
||||
}
|
||||
closeModal();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleSblAccept(sblId: number, accepted: boolean) {
|
||||
doOpenModal(MODALS.CONFIRM, {
|
||||
title: accepted ? __('Accept invite') : __('Reject invite'),
|
||||
body: accepted ? (
|
||||
<>
|
||||
<p>{__('Participate in the selected shared blocklist?')}</p>
|
||||
<p className="help">{__('Any channels that you block in the future will be added to the list.')}</p>
|
||||
<p className="help">
|
||||
{__(
|
||||
'This will become the active shared blocklist, replacing your own (if exists) or any shared blocklist that you are currently participating.'
|
||||
)}
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p>{__('Stop participating from the selected shared blocklist?')}</p>
|
||||
</>
|
||||
),
|
||||
onConfirm: (closeModal, setIsBusy) => {
|
||||
if (activeChannelClaim) {
|
||||
const params = {
|
||||
blocked_list_id: sblId,
|
||||
accepted: accepted,
|
||||
};
|
||||
|
||||
setIsBusy(true);
|
||||
|
||||
doSblAccept(activeChannelClaim, params, (err: string) => {
|
||||
if (err) {
|
||||
doToast({ message: err, isError: true });
|
||||
} else {
|
||||
fetchSblInfo();
|
||||
setTimeout(() => {
|
||||
setIsBusy(false);
|
||||
closeModal();
|
||||
doToast({ message: accepted ? __('Invite accepted.') : __('Invite rejected.') });
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleRescind(memberClaim, expired) {
|
||||
doOpenModal(MODALS.CONFIRM, {
|
||||
title: expired ? __('Remove') : __('Rescind'),
|
||||
body: (
|
||||
<>
|
||||
{expired && <p>{__('Remove the invitation for the following member?')}</p>}
|
||||
{!expired && <p>{__('Rescind the invitation for the following member?')}</p>}
|
||||
<p className="empty__text">{memberClaim.name.substring(0, 256)}</p>
|
||||
</>
|
||||
),
|
||||
onConfirm: (closeModal, setIsBusy) => {
|
||||
if (activeChannelClaim) {
|
||||
const params = {
|
||||
invited_channel_name: memberClaim.name,
|
||||
invited_channel_id: memberClaim.claim_id,
|
||||
};
|
||||
|
||||
setIsBusy(true);
|
||||
|
||||
doSblRescind(activeChannelClaim, params, (/* err */) => {
|
||||
// Fetch the new data and wait a bit before we dismiss the modal.
|
||||
// If you hate the hardcoded timeout, then add a callback for the
|
||||
// fetch actions.
|
||||
fetchSblInfo();
|
||||
setTimeout(() => {
|
||||
setIsBusy(false);
|
||||
closeModal();
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getHelpElem() {
|
||||
return (
|
||||
<I18nMessage
|
||||
// TODO: Need URL
|
||||
tokens={{
|
||||
learn_more: <Button button="link" label={__('Learn more')} href="https://odysee.com/@OdyseeHelp:b" />,
|
||||
}}
|
||||
>
|
||||
Shared blocklists allow a group of creators to all mutually manage a set of blocks that applies to all of their
|
||||
channels. %learn_more%
|
||||
</I18nMessage>
|
||||
);
|
||||
}
|
||||
|
||||
function getRowElem(label: string, value: any, truncate: boolean = false) {
|
||||
return (
|
||||
<tr>
|
||||
<td>{label}</td>
|
||||
{truncate && (
|
||||
<td>
|
||||
<TruncatedText lines={1} text={value} showTooltip />
|
||||
</td>
|
||||
)}
|
||||
{!truncate && <td>{value}</td>}
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
||||
function getSwearJarAmountElem(amount: number) {
|
||||
return (amount && <CreditAmount amount={amount} precision={4} />) || <LbcSymbol prefix={__('---')} size={14} />;
|
||||
}
|
||||
|
||||
function getSblStatusElem(active) {
|
||||
if (active) {
|
||||
return (
|
||||
<div className="sbl-status--active" title={__('This is the current active shared blocklist.')}>
|
||||
{__('Active')}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div
|
||||
className="sbl-status--inactive"
|
||||
title={__('This blocklist is currently inactive. Only 1 blocklist can be active at a time.')}
|
||||
>
|
||||
{__('Inactive')}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getSblInfoElem(sbl) {
|
||||
const expanded = expandInvite[sbl.id] || sbl.id === mySblId;
|
||||
return (
|
||||
<div className="sbl-info">
|
||||
{expanded && (
|
||||
<table className="table table--condensed table--publish-preview table--no-row-lines">
|
||||
<tbody>
|
||||
{getRowElem(__('Name'), sbl.name)}
|
||||
{getRowElem(__('Description'), sbl.description)}
|
||||
{getRowElem(__('Category'), sbl.category)}
|
||||
{getRowElem(__('Strike 1'), getHoursStr(sbl.strike_one))}
|
||||
{getRowElem(__('Strike 2'), getHoursStr(sbl.strike_two))}
|
||||
{getRowElem(__('Strike 3'), getHoursStr(sbl.strike_three))}
|
||||
{getRowElem(__('Auto-appeal minimum'), getSwearJarAmountElem(sbl.curse_jar_amount))}
|
||||
{getRowElem(__('Invite expiration'), getHoursStr(sbl.invite_expiration))}
|
||||
{getRowElem(__('Allow members to invite others'), getYesNoStr(sbl.member_invite_enabled))}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
{sbl.id !== mySblId && (
|
||||
<Button
|
||||
button="link"
|
||||
className="expandable__button"
|
||||
icon={expanded ? ICONS.UP : ICONS.DOWN}
|
||||
onClick={() => setExpandInvite({ ...expandInvite, [sbl.id]: !expanded })}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function getMySblElem() {
|
||||
if (sblMine) {
|
||||
const sbl = sblMine.shared_blocked_list;
|
||||
return (
|
||||
<Card
|
||||
title={
|
||||
<div>
|
||||
{__('Your Shared Blocklist')}
|
||||
{isUpdating && <Spinner type="small" />}
|
||||
</div>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions--between">
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Invite')}
|
||||
title={__('Invite others to your shared blocklist.')}
|
||||
icon={ICONS.INVITE}
|
||||
navigate={`/$/${PAGES.SHARED_BLOCKLIST_INVITE}?${PARAM_BLOCKLIST_ID}=${sbl.id}`}
|
||||
disabled={!isMySblActive}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Edit')}
|
||||
title={__('Make changes to your shared blocklist.')}
|
||||
icon={ICONS.EDIT}
|
||||
onClick={() => {
|
||||
push({
|
||||
pathname: `/$/${PAGES.SHARED_BLOCKLIST_EDIT}`,
|
||||
state: sbl,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Delete')}
|
||||
title={__('Delete your shared blocklist.')}
|
||||
icon={ICONS.DELETE}
|
||||
onClick={handleSblDelete}
|
||||
/>
|
||||
</div>
|
||||
{getSblStatusElem(isMySblActive)}
|
||||
</div>
|
||||
|
||||
<div className="section__actions">{getSblInfoElem(sbl)}</div>
|
||||
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="link"
|
||||
label={showMembers ? __('Hide members') : __('Show members')}
|
||||
icon={showMembers ? ICONS.UP : ICONS.DOWN}
|
||||
onClick={() => setShowMembers(!showMembers)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="section">{getMembersElem()}</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Card
|
||||
title={__('Your Shared Blocklist')}
|
||||
actions={<Button button="primary" label={__('Create list')} navigate={`/$/${PAGES.SHARED_BLOCKLIST_EDIT}`} />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getMembersElem() {
|
||||
if (!showMembers) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const getInviteStatus = (members, claim) => {
|
||||
const member = members.find((x) => x.invited_channel_id === claim.claim_id);
|
||||
return member && member.status;
|
||||
};
|
||||
|
||||
// This is required until Commentron filters bad invites.
|
||||
const sanitizedMemberUris = memberUris && memberUris.filter((uri) => isURIValid(uri));
|
||||
|
||||
if (sanitizedMemberUris && sanitizedMemberUris.length > 0) {
|
||||
return (
|
||||
<ClaimList
|
||||
uris={sanitizedMemberUris}
|
||||
hideMenu
|
||||
renderProperties={(claim) => {
|
||||
const status = getInviteStatus(members, claim);
|
||||
return status === 'expired' ? (
|
||||
<div className="sbl_invite_expired">{__('Expired')}</div>
|
||||
) : status === 'accepted' ? (
|
||||
<div className="sbl_invite_accepted">{__('Accepted')}</div>
|
||||
) : null;
|
||||
}}
|
||||
renderActions={(claim) => {
|
||||
const expired = getInviteStatus(members, claim) === 'expired';
|
||||
return (
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button={expired ? 'alt' : 'secondary'}
|
||||
icon={ICONS.REMOVE}
|
||||
label={expired ? __('Remove') : __('Rescind')}
|
||||
onClick={() => handleRescind(claim, expired)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return <Empty text={__('No members invited.')} />;
|
||||
}
|
||||
}
|
||||
|
||||
function getInvitedSblElem() {
|
||||
if (sblInvited && sblInvited.length > 0) {
|
||||
return (
|
||||
<Card
|
||||
title={__('Invitations')}
|
||||
isBodyList
|
||||
body={
|
||||
<>
|
||||
{sblInvited.map((i) => {
|
||||
return (
|
||||
<div key={i.shared_blocked_list.id} className="card__main-actions">
|
||||
<div className="section__actions--between">
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="alt"
|
||||
label={i.invitation.status === 'accepted' ? __('Disable') : __('Enable')}
|
||||
title={
|
||||
i.invitation.status === 'accepted'
|
||||
? __('Stop using this blocklist.')
|
||||
: __('Accept and activate this blocklist.')
|
||||
}
|
||||
icon={i.invitation.status === 'accepted' ? ICONS.REMOVE : undefined}
|
||||
onClick={() => handleSblAccept(i.shared_blocked_list.id, i.invitation.status !== 'accepted')}
|
||||
/>
|
||||
{i.invitation.status === 'accepted' && i.shared_blocked_list.member_invite_enabled && (
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Invite')}
|
||||
title={__('Invite others to this shared blocklist on behalf of the owner.')}
|
||||
icon={ICONS.INVITE}
|
||||
navigate={`/$/${PAGES.SHARED_BLOCKLIST_INVITE}?${PARAM_BLOCKLIST_ID}=${i.shared_blocked_list.id}`}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{getSblStatusElem(i.invitation.status === 'accepted')}
|
||||
</div>
|
||||
|
||||
<div className="section">
|
||||
<table className="table table--condensed table--publish-preview table--no-row-lines">
|
||||
<tbody>
|
||||
{getRowElem(__('From'), i.invitation.invited_by_channel_name)}
|
||||
{getRowElem(__('Message'), i.invitation.message, !expandInvite[i.shared_blocked_list.id])}
|
||||
</tbody>
|
||||
</table>
|
||||
{getSblInfoElem(i.shared_blocked_list)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
React.useEffect(() => {
|
||||
fetchSblInfo();
|
||||
}, [activeChannelClaim, doSblGet, doSblListInvites]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<div className={!fetchedOnce ? 'card--disabled' : isUpdating ? 'card--disable-interaction' : ''}>
|
||||
<div className="section help--notice">{getHelpElem()}</div>
|
||||
<div className="section">
|
||||
<ChannelSelector hideAnon />
|
||||
</div>
|
||||
<div className="section sbl">{getMySblElem()}</div>
|
||||
<div className="section sbl">{getInvitedSblElem()}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -56,7 +56,8 @@ function ChannelContent(props: Props) {
|
||||
claimType,
|
||||
empty,
|
||||
} = props;
|
||||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
// const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
const claimsInChannel = 9999;
|
||||
const [searchQuery, setSearchQuery] = React.useState('');
|
||||
const [searchResults, setSearchResults] = React.useState(undefined);
|
||||
const {
|
||||
|
||||
@@ -17,7 +17,7 @@ function ChannelDiscussion(props: Props) {
|
||||
}
|
||||
return (
|
||||
<section className="section">
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} />
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doResolveUri, makeSelectClaimForUri, makeSelectIsUriResolving } from 'lbry-redux';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { punctuationMarks } from 'util/remark-lbry';
|
||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import ClaimLink from './view';
|
||||
@@ -11,7 +12,7 @@ const select = (state, props) => {
|
||||
|
||||
function getValidClaim(testUri) {
|
||||
claim = makeSelectClaimForUri(testUri)(state);
|
||||
if (claim === null) {
|
||||
if (claim === null && punctuationMarks.includes(testUri.charAt(testUri.length - 1))) {
|
||||
getValidClaim(testUri.substring(0, testUri.length - 1));
|
||||
} else {
|
||||
uri = testUri;
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectClaimIsNsfw,
|
||||
doFileGet,
|
||||
makeSelectReflectingClaimForUri,
|
||||
makeSelectClaimWasPurchased,
|
||||
makeSelectStreamingUrlForUri,
|
||||
@@ -25,7 +24,7 @@ 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 { doFileGet } from 'redux/actions/file';
|
||||
import ClaimPreview from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ type Props = {
|
||||
streamingUrl: ?string,
|
||||
getFile: (string) => void,
|
||||
customShouldHide?: (Claim) => boolean,
|
||||
searchParams?: { [string]: string },
|
||||
showUnresolvedClaim?: boolean,
|
||||
showNullPlaceholder?: boolean,
|
||||
includeSupportAction?: boolean,
|
||||
@@ -125,6 +126,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
// modifiers
|
||||
active,
|
||||
customShouldHide,
|
||||
searchParams,
|
||||
showNullPlaceholder,
|
||||
// value from show mature content user setting
|
||||
// true if the user doesn't wanna see nsfw content
|
||||
@@ -221,6 +223,11 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
if (listId) {
|
||||
navigateSearch.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
}
|
||||
if (searchParams) {
|
||||
Object.keys(searchParams).forEach((key) => {
|
||||
navigateSearch.set(key, searchParams[key]);
|
||||
});
|
||||
}
|
||||
|
||||
const handleNavLinkClick = (e) => {
|
||||
if (onClick) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
doFileGet,
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { makeSelectViewCountForUri, selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
|
||||
import { doFileGet } from 'redux/actions/file';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import ClaimPreviewTile from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
||||
@@ -65,7 +65,7 @@ export default function CollectionContent(props: Props) {
|
||||
titleActions={
|
||||
<div className="card__title-actions--link">
|
||||
{/* TODO: BUTTON TO SAVE COLLECTION - Probably save/copy modal */}
|
||||
<Button label={'View List'} button="link" navigate={`/$/${PAGES.LIST}/${id}`} />
|
||||
<Button label={__('View List')} button="link" navigate={`/$/${PAGES.LIST}/${id}`} />
|
||||
</div>
|
||||
}
|
||||
body={
|
||||
|
||||
@@ -175,7 +175,7 @@ export default function CollectionsListMine(props: Props) {
|
||||
{filteredCollections &&
|
||||
filteredCollections.length > 0 &&
|
||||
filteredCollections.map((key) => <CollectionPreviewTile tileLayout collectionId={key} key={key} />)}
|
||||
{!filteredCollections.length && <div className="empty main--empty">{__('No matching collections')}</div>}
|
||||
{!filteredCollections.length && <div className="empty main--empty">{__('No matching playlists')}</div>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -52,6 +52,7 @@ type Props = {
|
||||
doToast: ({ message: string }) => void,
|
||||
isTopLevel?: boolean,
|
||||
threadDepth: number,
|
||||
hideActions?: boolean,
|
||||
isPinned: boolean,
|
||||
othersReacts: ?{
|
||||
like: number,
|
||||
@@ -95,6 +96,7 @@ function Comment(props: Props) {
|
||||
doToast,
|
||||
isTopLevel,
|
||||
threadDepth,
|
||||
hideActions,
|
||||
isPinned,
|
||||
othersReacts,
|
||||
playingUri,
|
||||
@@ -348,18 +350,20 @@ function Comment(props: Props) {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="comment__actions">
|
||||
{threadDepth !== 0 && (
|
||||
<Button
|
||||
requiresAuth={IS_WEB}
|
||||
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
|
||||
className="comment__action"
|
||||
onClick={handleCommentReply}
|
||||
icon={ICONS.REPLY}
|
||||
/>
|
||||
)}
|
||||
{ENABLE_COMMENT_REACTIONS && <CommentReactions uri={uri} commentId={commentId} />}
|
||||
</div>
|
||||
{!hideActions && (
|
||||
<div className="comment__actions">
|
||||
{threadDepth !== 0 && (
|
||||
<Button
|
||||
requiresAuth={IS_WEB}
|
||||
label={commentingEnabled ? __('Reply') : __('Log in to reply')}
|
||||
className="comment__action"
|
||||
onClick={handleCommentReply}
|
||||
icon={ICONS.REPLY}
|
||||
/>
|
||||
)}
|
||||
{ENABLE_COMMENT_REACTIONS && <CommentReactions uri={uri} commentId={commentId} />}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{numDirectReplies > 0 && !showReplies && (
|
||||
<div className="comment__actions">
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doCommentPin, doCommentModAddDelegate } from 'redux/actions/comments';
|
||||
import { doChannelMute } from 'redux/actions/blocked';
|
||||
// import { doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doCommentPin, doCommentModAddDelegate } from 'redux/actions/comments';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import { selectModerationDelegatorsById } from 'redux/selectors/comments';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import CommentMenuList from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
@@ -24,9 +24,9 @@ const perform = (dispatch) => ({
|
||||
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
muteChannel: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
pinComment: (commentId, claimId, remove) => dispatch(doCommentPin(commentId, claimId, remove)),
|
||||
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
|
||||
commentModAddDelegate: (modChanId, modChanName, creatorChannelClaim) =>
|
||||
dispatch(doCommentModAddDelegate(modChanId, modChanName, creatorChannelClaim, true)),
|
||||
doToast: (props) => dispatch(doToast(props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentMenuList);
|
||||
@@ -1,12 +1,14 @@
|
||||
// @flow
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
import { MenuList, MenuItem } from '@reach/menu-button';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import { URL } from 'config';
|
||||
import { useHistory } from 'react-router';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React from 'react';
|
||||
import { MenuList, MenuItem } from '@reach/menu-button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import Icon from 'component/common/icon';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
import React from 'react';
|
||||
|
||||
type Props = {
|
||||
uri: ?string,
|
||||
@@ -18,7 +20,6 @@ type Props = {
|
||||
disableEdit?: boolean,
|
||||
disableRemove?: boolean,
|
||||
supportAmount?: any,
|
||||
handleEditComment: () => void,
|
||||
// --- select ---
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
@@ -27,6 +28,8 @@ type Props = {
|
||||
playingUri: ?PlayingUri,
|
||||
moderationDelegatorsById: { [string]: { global: boolean, delegators: { name: string, claimId: string } } },
|
||||
// --- perform ---
|
||||
doToast: ({ message: string }) => void,
|
||||
handleEditComment: () => void,
|
||||
openModal: (id: string, {}) => void,
|
||||
clearPlayingUri: () => void,
|
||||
muteChannel: (string) => void,
|
||||
@@ -42,24 +45,29 @@ function CommentMenuList(props: Props) {
|
||||
authorUri,
|
||||
commentIsMine,
|
||||
commentId,
|
||||
muteChannel,
|
||||
pinComment,
|
||||
clearPlayingUri,
|
||||
activeChannelClaim,
|
||||
contentChannelPermanentUrl,
|
||||
isTopLevel,
|
||||
isPinned,
|
||||
handleEditComment,
|
||||
commentModAddDelegate,
|
||||
playingUri,
|
||||
moderationDelegatorsById,
|
||||
disableEdit,
|
||||
disableRemove,
|
||||
openModal,
|
||||
supportAmount,
|
||||
doToast,
|
||||
handleEditComment,
|
||||
openModal,
|
||||
clearPlayingUri,
|
||||
muteChannel,
|
||||
pinComment,
|
||||
commentModAddDelegate,
|
||||
setQuickReply,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
location: { pathname, search },
|
||||
} = useHistory();
|
||||
|
||||
const contentChannelClaim = getChannelFromClaim(claim);
|
||||
const activeModeratorInfo = activeChannelClaim && moderationDelegatorsById[activeChannelClaim.claim_id];
|
||||
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
|
||||
@@ -70,10 +78,6 @@ function CommentMenuList(props: Props) {
|
||||
activeModeratorInfo &&
|
||||
Object.values(activeModeratorInfo.delegators).includes(contentChannelClaim.claim_id);
|
||||
|
||||
function handlePinComment(commentId, claimId, remove) {
|
||||
pinComment(commentId, claimId, remove);
|
||||
}
|
||||
|
||||
function handleDeleteComment() {
|
||||
if (playingUri && playingUri.source === 'comment') {
|
||||
clearPlayingUri();
|
||||
@@ -87,14 +91,6 @@ function CommentMenuList(props: Props) {
|
||||
});
|
||||
}
|
||||
|
||||
function handleCommentBlock() {
|
||||
openModal(MODALS.BLOCK_CHANNEL, { contentUri: uri, commenterUri: authorUri });
|
||||
}
|
||||
|
||||
function handleCommentMute() {
|
||||
muteChannel(authorUri);
|
||||
}
|
||||
|
||||
function assignAsModerator() {
|
||||
if (activeChannelClaim && authorUri) {
|
||||
const { channelName, channelClaimId } = parseURI(authorUri);
|
||||
@@ -155,6 +151,15 @@ function CommentMenuList(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
function handleCopyCommentLink() {
|
||||
const urlParams = new URLSearchParams(search);
|
||||
urlParams.delete('lc');
|
||||
urlParams.append('lc', commentId);
|
||||
navigator.clipboard
|
||||
.writeText(`${URL}${pathname}?${urlParams.toString()}`)
|
||||
.then(() => doToast({ message: __('Link copied.') }));
|
||||
}
|
||||
|
||||
return (
|
||||
<MenuList className="menu__list">
|
||||
{activeChannelIsCreator && <div className="comment__menu-title">{__('Creator tools')}</div>}
|
||||
@@ -162,7 +167,7 @@ function CommentMenuList(props: Props) {
|
||||
{activeChannelIsCreator && isTopLevel && (
|
||||
<MenuItem
|
||||
className="comment__menu-option menu__link"
|
||||
onSelect={() => handlePinComment(commentId, claim ? claim.claim_id : '', isPinned)}
|
||||
onSelect={() => pinComment(commentId, claim ? claim.claim_id : '', isPinned)}
|
||||
>
|
||||
<span className={'button__content'}>
|
||||
<Icon aria-hidden icon={ICONS.PIN} className={'icon'} />
|
||||
@@ -205,20 +210,31 @@ function CommentMenuList(props: Props) {
|
||||
)}
|
||||
|
||||
{!commentIsMine && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCommentBlock}>
|
||||
{getBlockOptionElem()}
|
||||
</MenuItem>
|
||||
<>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.BLOCK_CHANNEL, { contentUri: uri, commenterUri: authorUri })}
|
||||
>
|
||||
{getBlockOptionElem()}
|
||||
</MenuItem>
|
||||
<MenuItem className="comment__menu-option" onSelect={() => muteChannel(authorUri)}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.MUTE} />
|
||||
{__('Mute')}
|
||||
</div>
|
||||
{activeChannelIsCreator && (
|
||||
<span className="comment__menu-help">{__('Hide this channel for you only.')}</span>
|
||||
)}
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
|
||||
{!commentIsMine && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCommentMute}>
|
||||
{IS_WEB && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyCommentLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.MUTE} />
|
||||
{__('Mute')}
|
||||
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
||||
{__('Copy Link')}
|
||||
</div>
|
||||
{activeChannelIsCreator && (
|
||||
<span className="comment__menu-help">{__('Hide this channel for you only.')}</span>
|
||||
)}
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ const perform = (dispatch) => ({
|
||||
fetchTopLevelComments: (uri, page, pageSize, sortBy) => dispatch(doCommentList(uri, '', page, pageSize, sortBy)),
|
||||
fetchComment: (commentId) => dispatch(doCommentById(commentId)),
|
||||
fetchReacts: (commentIds) => dispatch(doCommentReactList(commentIds)),
|
||||
resetComments: (uri) => dispatch(doCommentReset(uri)),
|
||||
resetComments: (claimId) => dispatch(doCommentReset(claimId)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CommentsList);
|
||||
@@ -1,22 +1,22 @@
|
||||
// @flow
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL, SORT_BY } from 'constants/comment';
|
||||
import React, { useEffect } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import CommentView from 'component/comment';
|
||||
import Spinner from 'component/spinner';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import classnames from 'classnames';
|
||||
import CommentCreate from 'component/commentCreate';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
||||
import Empty from 'component/common/empty';
|
||||
import CommentView from 'component/comment';
|
||||
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 { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import { getChannelIdFromClaim } from 'util/claim';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
||||
|
||||
@@ -33,10 +33,6 @@ type Props = {
|
||||
pinnedComments: Array<Comment>,
|
||||
topLevelComments: Array<Comment>,
|
||||
topLevelTotalPages: number,
|
||||
fetchTopLevelComments: (string, number, number, number) => void,
|
||||
fetchComment: (string) => void,
|
||||
fetchReacts: (Array<string>) => Promise<any>,
|
||||
resetComments: (string) => void,
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
claimIsMine: boolean,
|
||||
@@ -51,15 +47,16 @@ type Props = {
|
||||
othersReactsById: ?{ [string]: { [REACTION_TYPES.LIKE | REACTION_TYPES.DISLIKE]: number } },
|
||||
activeChannelId: ?string,
|
||||
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
||||
fetchReacts: (Array<string>) => Promise<any>,
|
||||
commentsAreExpanded?: boolean,
|
||||
fetchTopLevelComments: (string, number, number, number) => void,
|
||||
fetchComment: (string) => void,
|
||||
resetComments: (string) => void,
|
||||
};
|
||||
|
||||
function CommentList(props: Props) {
|
||||
const {
|
||||
allCommentIds,
|
||||
fetchTopLevelComments,
|
||||
fetchComment,
|
||||
fetchReacts,
|
||||
resetComments,
|
||||
uri,
|
||||
pinnedComments,
|
||||
topLevelComments,
|
||||
@@ -77,21 +74,28 @@ function CommentList(props: Props) {
|
||||
othersReactsById,
|
||||
activeChannelId,
|
||||
settingsByChannelId,
|
||||
fetchReacts,
|
||||
commentsAreExpanded,
|
||||
fetchTopLevelComments,
|
||||
fetchComment,
|
||||
resetComments,
|
||||
} = props;
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
const isMediumScreen = useIsMediumScreen();
|
||||
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 isMobile = useIsMobile();
|
||||
const isMediumScreen = useIsMediumScreen();
|
||||
const [expandedComments, setExpandedComments] = React.useState(!isMobile && !isMediumScreen);
|
||||
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
||||
const channelId = getChannelIdFromClaim(claim);
|
||||
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
||||
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;
|
||||
|
||||
// Display comments immediately if not fetching reactions
|
||||
// If not, wait to show comments until reactions are fetched
|
||||
@@ -99,20 +103,6 @@ function CommentList(props: Props) {
|
||||
Boolean(othersReactsById) || !ENABLE_COMMENT_REACTIONS
|
||||
);
|
||||
|
||||
const hasNoComments = !totalComments;
|
||||
const moreBelow = page < topLevelTotalPages;
|
||||
|
||||
const isMyComment = (channelId: string): boolean => {
|
||||
if (myChannels != null && channelId != null) {
|
||||
for (let i = 0; i < myChannels.length; i++) {
|
||||
if (myChannels[i].claim_id === channelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function changeSort(newSort) {
|
||||
if (sort !== newSort) {
|
||||
setSort(newSort);
|
||||
@@ -120,41 +110,16 @@ function CommentList(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function getCommentElems(comments) {
|
||||
return comments.map((comment) => {
|
||||
return (
|
||||
<CommentView
|
||||
isTopLevel
|
||||
threadDepth={3}
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={comment.channel_id && isMyComment(comment.channel_id)}
|
||||
linkedCommentId={linkedCommentId}
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Reset comments
|
||||
useEffect(() => {
|
||||
if (page === 0) {
|
||||
resetComments(uri);
|
||||
if (claim) {
|
||||
resetComments(claim.claim_id);
|
||||
}
|
||||
setPage(1);
|
||||
}
|
||||
}, [page, uri, resetComments]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [page, uri, resetComments]); // 'claim' is derived from 'uri'
|
||||
|
||||
// Fetch top-level comments
|
||||
useEffect(() => {
|
||||
@@ -165,7 +130,7 @@ function CommentList(props: Props) {
|
||||
|
||||
fetchTopLevelComments(uri, page, COMMENT_PAGE_SIZE_TOP_LEVEL, sort);
|
||||
}
|
||||
}, [fetchTopLevelComments, uri, page, resetComments, sort, linkedCommentId, fetchComment]);
|
||||
}, [fetchComment, fetchTopLevelComments, linkedCommentId, page, sort, uri]);
|
||||
|
||||
// Fetch reacts
|
||||
useEffect(() => {
|
||||
@@ -190,15 +155,14 @@ function CommentList(props: Props) {
|
||||
}
|
||||
}
|
||||
}, [
|
||||
totalFetchedComments,
|
||||
allCommentIds,
|
||||
othersReactsById,
|
||||
myReactsByCommentId,
|
||||
fetchReacts,
|
||||
uri,
|
||||
activeChannelId,
|
||||
allCommentIds,
|
||||
fetchReacts,
|
||||
fetchingChannels,
|
||||
isFetchingReacts,
|
||||
myReactsByCommentId,
|
||||
othersReactsById,
|
||||
totalFetchedComments,
|
||||
]);
|
||||
|
||||
// Scroll to linked-comment
|
||||
@@ -220,9 +184,7 @@ function CommentList(props: Props) {
|
||||
// Infinite scroll
|
||||
useEffect(() => {
|
||||
function shouldFetchNextPage(page, topLevelTotalPages, window, document, yPrefetchPx = 1000) {
|
||||
if (!spinnerRef || !spinnerRef.current) {
|
||||
return false;
|
||||
}
|
||||
if (!spinnerRef || !spinnerRef.current) return false;
|
||||
|
||||
const rect = spinnerRef.current.getBoundingClientRect(); // $FlowFixMe
|
||||
const windowH = window.innerHeight || document.documentElement.clientHeight; // $FlowFixMe
|
||||
@@ -244,7 +206,7 @@ function CommentList(props: Props) {
|
||||
}
|
||||
|
||||
const handleCommentScroll = debounce(() => {
|
||||
if (!isMobile && !isMediumScreen && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
if (hasDefaultExpansion && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
||||
@@ -257,86 +219,76 @@ function CommentList(props: Props) {
|
||||
return () => window.removeEventListener('scroll', handleCommentScroll);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
isMobile,
|
||||
isMediumScreen,
|
||||
page,
|
||||
moreBelow,
|
||||
spinnerRef,
|
||||
isFetchingComments,
|
||||
readyToDisplayComments,
|
||||
topLevelComments.length,
|
||||
topLevelTotalPages,
|
||||
]);
|
||||
}, [hasDefaultExpansion, isFetchingComments, moreBelow, page, readyToDisplayComments, topLevelTotalPages]);
|
||||
|
||||
// Expand comments
|
||||
useEffect(() => {
|
||||
if (!isMobile && !isMediumScreen && !expandedComments) {
|
||||
setExpandedComments(true);
|
||||
}
|
||||
}, [isMobile, isMediumScreen, expandedComments]);
|
||||
const getCommentElems = (comments) => {
|
||||
return comments.map((comment) => (
|
||||
<CommentView
|
||||
isTopLevel
|
||||
threadDepth={3}
|
||||
key={comment.comment_id}
|
||||
uri={uri}
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
claimId={comment.claim_id}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
claimIsMine={claimIsMine}
|
||||
commentIsMine={
|
||||
comment.channel_id && myChannels && myChannels.some(({ claim_id }) => claim_id === comment.channel_id)
|
||||
}
|
||||
linkedCommentId={linkedCommentId}
|
||||
isPinned={comment.is_pinned}
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={comment.replies}
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
));
|
||||
};
|
||||
|
||||
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
|
||||
className="card--enable-overflow"
|
||||
title={
|
||||
totalComments > 0
|
||||
? totalComments === 1
|
||||
? __('1 comment')
|
||||
: __('%total_comments% comments', { total_comments: totalComments })
|
||||
: __('Leave a comment')
|
||||
(totalComments === 0 && __('Leave a comment')) ||
|
||||
(totalComments === 1 && __('1 comment')) ||
|
||||
__('%totalComments% comments', { totalComments })
|
||||
}
|
||||
titleActions={
|
||||
<>
|
||||
{totalComments > 1 && ENABLE_COMMENT_REACTIONS && (
|
||||
<span className="comment__sort">
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Best')}
|
||||
icon={ICONS.BEST}
|
||||
iconSize={18}
|
||||
onClick={() => changeSort(SORT_BY.POPULARITY)}
|
||||
className={classnames(`button-toggle`, {
|
||||
'button-toggle--active': sort === SORT_BY.POPULARITY,
|
||||
})}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('Controversial')}
|
||||
icon={ICONS.CONTROVERSIAL}
|
||||
iconSize={18}
|
||||
onClick={() => changeSort(SORT_BY.CONTROVERSY)}
|
||||
className={classnames(`button-toggle`, {
|
||||
'button-toggle--active': sort === SORT_BY.CONTROVERSY,
|
||||
})}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
label={__('New')}
|
||||
icon={ICONS.NEW}
|
||||
iconSize={18}
|
||||
onClick={() => changeSort(SORT_BY.NEWEST)}
|
||||
className={classnames(`button-toggle`, {
|
||||
'button-toggle--active': sort === SORT_BY.NEWEST,
|
||||
})}
|
||||
/>
|
||||
{sortButton(__('Best'), ICONS.BEST, SORT_BY.POPULARITY)}
|
||||
{sortButton(__('Controversial'), ICONS.CONTROVERSIAL, SORT_BY.CONTROVERSY)}
|
||||
{sortButton(__('New'), ICONS.NEW, SORT_BY.NEWEST)}
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
button="alt"
|
||||
icon={ICONS.REFRESH}
|
||||
title={__('Refresh')}
|
||||
onClick={() => {
|
||||
setPage(0);
|
||||
}}
|
||||
/>
|
||||
<Button button="alt" icon={ICONS.REFRESH} title={__('Refresh')} onClick={() => setPage(0)} />
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<CommentCreate uri={uri} />
|
||||
|
||||
{channelSettings && channelSettings.comments_enabled && !isFetchingComments && hasNoComments && (
|
||||
{channelSettings && channelSettings.comments_enabled && !isFetchingComments && !totalComments && (
|
||||
<Empty padded text={__('That was pretty deep. What do you think?')} />
|
||||
)}
|
||||
|
||||
@@ -350,36 +302,28 @@ function CommentList(props: Props) {
|
||||
{readyToDisplayComments && topLevelComments && getCommentElems(topLevelComments)}
|
||||
</ul>
|
||||
|
||||
{(isMobile || isMediumScreen) && (
|
||||
{!hasDefaultExpansion && (
|
||||
<div className="card__bottom-actions--comments">
|
||||
{(!expandedComments || moreBelow) && (
|
||||
<Button
|
||||
button="link"
|
||||
title={!expandedComments ? __('Expand Comments') : __('Load More')}
|
||||
title={!expandedComments ? __('Expand') : __('More')}
|
||||
label={!expandedComments ? __('Expand') : __('More')}
|
||||
onClick={() => {
|
||||
if (!expandedComments) {
|
||||
setExpandedComments(true);
|
||||
} else {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}}
|
||||
onClick={() => (!expandedComments ? setExpandedComments(true) : setPage(page + 1))}
|
||||
/>
|
||||
)}
|
||||
{expandedComments && (
|
||||
<Button
|
||||
button="link"
|
||||
title={__('Collapse Thread')}
|
||||
title={__('Collapse')}
|
||||
label={__('Collapse')}
|
||||
onClick={() => {
|
||||
setExpandedComments(false);
|
||||
}}
|
||||
onClick={() => setExpandedComments(false)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(isFetchingComments || (!isMobile && !isMediumScreen && moreBelow)) && (
|
||||
{(isFetchingComments || (hasDefaultExpansion && moreBelow)) && (
|
||||
<div className="main--empty" ref={spinnerRef}>
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
|
||||
@@ -2439,14 +2439,6 @@ export const icons = {
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
[ICONS.APPEAL]: buildIcon(
|
||||
<g>
|
||||
<path d="M13.54,8.58l9.33,8.79a1.31,1.31,0,0,1,0,1.85l-.93.93a1.31,1.31,0,0,1-1.85,0L11.3,10.82" />
|
||||
<path d="M3.85,8.54a19.06,19.06,0,0,0,7.41-7.41,1.31,1.31,0,0,1,1.85,0l3.51,3.51a1.32,1.32,0,0,1,0,1.86,18.09,18.09,0,0,0-7.41,7.4,1.31,1.31,0,0,1-1.85,0L3.85,10.39A1.31,1.31,0,0,1,3.85,8.54Z" />
|
||||
<path d="M12.75,20.75h0a1.5,1.5,0,0,0-1.5-1.5H3.75a1.5,1.5,0,0,0-1.5,1.5h0v2.5h10.5Z" />
|
||||
<line x1="0.75" y1="23.25" x2="14.25" y2="23.25" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.PLAY]: buildIcon(<polygon points="5 3 19 12 5 21 5 3" />),
|
||||
[ICONS.PLAY_PREVIOUS]: buildIcon(
|
||||
<g>
|
||||
|
||||
@@ -27,7 +27,9 @@ export default function CreatorAnalytics(props: Props) {
|
||||
const [error, setError] = React.useState();
|
||||
const [fetchingStats, setFetchingStats] = React.useState(false);
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channelHasClaims = claim && claim.meta && claim.meta.claims_in_channel && claim.meta.claims_in_channel > 0;
|
||||
// TODO: put this back when hubs are fixed
|
||||
// const channelHasClaims = claim && claim.meta && claim.meta.claims_in_channel && claim.meta.claims_in_channel > 0 || true;
|
||||
const channelHasClaims = true;
|
||||
|
||||
React.useEffect(() => {
|
||||
setStats(null);
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import FormFieldDuration from './view';
|
||||
|
||||
export default FormFieldDuration;
|
||||
@@ -1,88 +0,0 @@
|
||||
// @flow
|
||||
import type { Node } from 'react';
|
||||
import React from 'react';
|
||||
import parseDuration from 'parse-duration';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
|
||||
const INPUT_EXAMPLES = '\n- 30s\n- 10m\n- 1h\n- 2d\n- 3mo\n- 1y';
|
||||
const ONE_HUNDRED_YEARS_IN_SECONDS = 3154000000;
|
||||
|
||||
type Props = {
|
||||
name: string,
|
||||
label?: string | Node,
|
||||
placeholder?: string | number,
|
||||
value: string | number,
|
||||
onChange: (any) => void,
|
||||
onResolve: (valueInSeconds: number) => void, // Returns parsed/resolved value in seconds; "-1" for invalid input.
|
||||
maxDurationInSeconds?: number,
|
||||
};
|
||||
|
||||
export default function FormFieldDuration(props: Props) {
|
||||
const { name, label, placeholder, value, onChange, onResolve, maxDurationInSeconds } = props;
|
||||
const [valueSec, setValueSec] = React.useState(-1);
|
||||
const [valueErr, setValueErr] = React.useState('');
|
||||
|
||||
React.useEffect(() => {
|
||||
const handleInvalidInput = (errMsg: string) => {
|
||||
if (valueSec !== -1) {
|
||||
setValueSec(-1);
|
||||
onResolve(-1);
|
||||
}
|
||||
if (valueErr !== errMsg) {
|
||||
setValueErr(errMsg);
|
||||
}
|
||||
};
|
||||
|
||||
const handleValidInput = (seconds) => {
|
||||
if (seconds !== valueSec) {
|
||||
setValueSec(seconds);
|
||||
onResolve(seconds);
|
||||
}
|
||||
if (valueErr) {
|
||||
setValueErr('');
|
||||
}
|
||||
};
|
||||
|
||||
if (!value) {
|
||||
handleValidInput(-1); // Reset
|
||||
return;
|
||||
}
|
||||
|
||||
const seconds = parseDuration(value, 's');
|
||||
if (Number.isInteger(seconds) && seconds > 0) {
|
||||
const max = maxDurationInSeconds || ONE_HUNDRED_YEARS_IN_SECONDS;
|
||||
if (seconds > max) {
|
||||
handleInvalidInput(__('Value exceeded maximum.'));
|
||||
} else {
|
||||
handleValidInput(seconds);
|
||||
}
|
||||
} else {
|
||||
handleInvalidInput(__('Invalid duration.'));
|
||||
}
|
||||
}, [value, valueSec, valueErr, maxDurationInSeconds, onResolve]);
|
||||
|
||||
return (
|
||||
<FormField
|
||||
name={name}
|
||||
type="text"
|
||||
label={
|
||||
<>
|
||||
{label || __('Duration')}
|
||||
<Icon
|
||||
customTooltipText={__('Examples: %examples%', { examples: INPUT_EXAMPLES })}
|
||||
className="icon--help"
|
||||
icon={ICONS.HELP}
|
||||
tooltip
|
||||
size={16}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
placeholder={placeholder || '30s, 10m, 1h, 2d, 3mo, 1y'}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
error={valueErr}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -18,7 +18,10 @@ export default function LivestreamLink(props: Props) {
|
||||
const [livestreamClaim, setLivestreamClaim] = React.useState(false);
|
||||
const [isLivestreaming, setIsLivestreaming] = React.useState(false);
|
||||
const livestreamChannelId = (channelClaim && channelClaim.claim_id) || ''; // TODO: fail in a safer way, probably
|
||||
const isChannelEmpty = !channelClaim || !channelClaim.meta || !channelClaim.meta.claims_in_channel;
|
||||
// TODO: pput this back when hubs claims_in_channel are fixed
|
||||
const isChannelEmpty = !channelClaim || !channelClaim.meta;
|
||||
// ||
|
||||
// !channelClaim.meta.claims_in_channel;
|
||||
|
||||
React.useEffect(() => {
|
||||
// Don't search empty channels
|
||||
|
||||
@@ -37,8 +37,6 @@ const SwapPage = lazyImport(() => import('page/swap' /* webpackChunkName: "secon
|
||||
const WalletPage = lazyImport(() => import('page/wallet' /* webpackChunkName: "secondary" */));
|
||||
|
||||
// Chunk: none
|
||||
const AppealListOffences = lazyImport(() => import('page/appealListOffences' /* webpackChunkName: "appealOffences" */));
|
||||
const AppealReview = lazyImport(() => import('page/appealReview' /* webpackChunkName: "appealReview" */));
|
||||
const NotificationsPage = lazyImport(() => import('page/notifications' /* webpackChunkName: "secondary" */));
|
||||
const CollectionPage = lazyImport(() => import('page/collection' /* webpackChunkName: "secondary" */));
|
||||
const ChannelNew = lazyImport(() => import('page/channelNew' /* webpackChunkName: "secondary" */));
|
||||
@@ -61,6 +59,7 @@ const ListBlockedPage = lazyImport(() => import('page/listBlocked' /* webpackChu
|
||||
const ListsPage = lazyImport(() => import('page/lists' /* webpackChunkName: "secondary" */));
|
||||
const LiveStreamSetupPage = lazyImport(() => import('page/livestreamSetup' /* webpackChunkName: "secondary" */));
|
||||
const LivestreamCurrentPage = lazyImport(() => import('page/livestreamCurrent' /* webpackChunkName: "secondary" */));
|
||||
const OwnComments = lazyImport(() => import('page/ownComments' /* webpackChunkName: "ownComments" */));
|
||||
const PasswordResetPage = lazyImport(() => import('page/passwordReset' /* webpackChunkName: "secondary" */));
|
||||
const PasswordSetPage = lazyImport(() => import('page/passwordSet' /* webpackChunkName: "secondary" */));
|
||||
const PublishPage = lazyImport(() => import('page/publish' /* webpackChunkName: "secondary" */));
|
||||
@@ -79,10 +78,6 @@ const SettingsNotificationsPage = lazyImport(() =>
|
||||
import('page/settingsNotifications' /* webpackChunkName: "secondary" */)
|
||||
);
|
||||
const SettingsPage = lazyImport(() => import('page/settings' /* webpackChunkName: "secondary" */));
|
||||
const SharedBlocklistEdit = lazyImport(() => import('page/sharedBlocklistEdit' /* webpackChunkName: "sblEdit" */));
|
||||
const SharedBlocklistInvite = lazyImport(() =>
|
||||
import('page/sharedBlocklistInvite' /* webpackChunkName: "sblInvite" */)
|
||||
);
|
||||
const ShowPage = lazyImport(() => import('page/show' /* webpackChunkName: "secondary" */));
|
||||
const TagsFollowingManagePage = lazyImport(() =>
|
||||
import('page/tagsFollowingManage' /* webpackChunkName: "secondary" */)
|
||||
@@ -324,10 +319,6 @@ function AppRouter(props: Props) {
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.LISTS}`} component={ListsPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.TAGS_FOLLOWING_MANAGE}`} component={TagsFollowingManagePage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.SETTINGS_BLOCKED_MUTED}`} component={ListBlockedPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.SHARED_BLOCKLIST_EDIT}`} component={SharedBlocklistEdit} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.SHARED_BLOCKLIST_INVITE}`} component={SharedBlocklistInvite} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.APPEAL_LIST_OFFENCES}`} component={AppealListOffences} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.APPEAL_CREATOR_REVIEW}`} component={AppealReview} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.SETTINGS_CREATOR}`} component={SettingsCreatorPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.WALLET}`} exact component={WalletPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.CHANNELS}`} component={ChannelsPage} />
|
||||
@@ -339,6 +330,7 @@ function AppRouter(props: Props) {
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.SWAP}`} component={SwapPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.NOTIFICATIONS}`} component={NotificationsPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.AUTH_WALLET_PASSWORD}`} component={SignInWalletPasswordPage} />
|
||||
<PrivateRoute {...props} path={`/$/${PAGES.SETTINGS_OWN_COMMENTS}`} component={OwnComments} />
|
||||
|
||||
<Route path={`/$/${PAGES.EMBED}/:claimName`} exact component={EmbedWrapperPage} />
|
||||
<Route path={`/$/${PAGES.EMBED}/:claimName/:claimId`} exact component={EmbedWrapperPage} />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doWalletStatus, selectWalletIsEncrypted } from 'lbry-redux';
|
||||
import { doWalletStatus, selectMyChannelClaims, selectWalletIsEncrypted } from 'lbry-redux';
|
||||
import { selectUser, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectLanguage } from 'redux/selectors/settings';
|
||||
|
||||
@@ -9,6 +9,7 @@ const select = (state) => ({
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
walletEncrypted: selectWalletIsEncrypted(state),
|
||||
user: selectUser(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
language: selectLanguage(state),
|
||||
});
|
||||
|
||||
|
||||
@@ -15,12 +15,13 @@ type Props = {
|
||||
isAuthenticated: boolean,
|
||||
walletEncrypted: boolean,
|
||||
user: User,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
// --- perform ---
|
||||
doWalletStatus: () => void,
|
||||
};
|
||||
|
||||
export default function SettingAccount(props: Props) {
|
||||
const { isAuthenticated, walletEncrypted, user, doWalletStatus } = props;
|
||||
const { isAuthenticated, walletEncrypted, user, myChannels, doWalletStatus } = props;
|
||||
const [storedPassword, setStoredPassword] = React.useState(false);
|
||||
|
||||
// Determine if password is stored.
|
||||
@@ -92,6 +93,17 @@ export default function SettingAccount(props: Props) {
|
||||
</SettingsRow>
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
{myChannels && (
|
||||
<SettingsRow title={__('Comments')} subtitle={__('View your past comments.')}>
|
||||
<Button
|
||||
button="inverse"
|
||||
label={__('Manage')}
|
||||
icon={ICONS.ARROW_RIGHT}
|
||||
navigate={`/$/${PAGES.SETTINGS_OWN_COMMENTS}`}
|
||||
/>
|
||||
</SettingsRow>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { selectPurchaseUriSuccess, doClearPurchasedUriSuccess } from 'lbry-redux';
|
||||
import { selectPurchaseUriSuccess } from 'lbry-redux';
|
||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||
import { selectUserVerifiedEmail, selectUser } from 'redux/selectors/user';
|
||||
import { selectHomepageData, selectLanguage } from 'redux/selectors/settings';
|
||||
import { doSignOut } from 'redux/actions/app';
|
||||
import { doClearPurchasedUriSuccess } from 'redux/actions/file';
|
||||
|
||||
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
|
||||
|
||||
import SideNavigation from './view';
|
||||
|
||||
@@ -75,7 +75,8 @@ function SideNavigation(props: Props) {
|
||||
followedTags,
|
||||
} = props;
|
||||
|
||||
const EXTRA_SIDEBAR_LINKS = GetLinksData(homepageData);
|
||||
const EXTRA_SIDEBAR_LINKS = GetLinksData(homepageData).map(({ pinnedUrls, ...theRest }) => theRest);
|
||||
|
||||
const FULL_LINKS: Array<SideNavLink> = [
|
||||
{
|
||||
title: 'Your Tags',
|
||||
|
||||
@@ -7,7 +7,7 @@ import Icon from 'component/common/icon';
|
||||
import LbcMessage from 'component/common/lbc-message';
|
||||
|
||||
type Props = {
|
||||
removeSnack: any => void,
|
||||
removeSnack: (any) => void,
|
||||
snack: ?{
|
||||
linkTarget: ?string,
|
||||
linkText: ?string,
|
||||
@@ -53,9 +53,9 @@ class SnackBar extends React.PureComponent<Props> {
|
||||
<div className="snack-bar__message">
|
||||
<Icon icon={isError ? ICONS.ALERT : ICONS.COMPLETED} size={18} />
|
||||
|
||||
<div>
|
||||
<p className="snack-bar__messageText">
|
||||
<LbcMessage>{message}</LbcMessage>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
{linkText && linkTarget && (
|
||||
// This is a little weird because of `linkTarget` code in `lbry-redux`
|
||||
|
||||
@@ -168,9 +168,17 @@ function VideoViewer(props: Props) {
|
||||
}
|
||||
analytics.playerStartedEvent(embedded);
|
||||
|
||||
// convert bytes to bits, and then divide by seconds
|
||||
const contentInBits = Number(claim.value.source.size) * 8;
|
||||
const durationInSeconds = claim.value.video && claim.value.video.duration;
|
||||
let bitrateAsBitsPerSecond;
|
||||
if (durationInSeconds) {
|
||||
bitrateAsBitsPerSecond = Math.round(contentInBits / durationInSeconds);
|
||||
}
|
||||
|
||||
fetch(source, { method: 'HEAD', cache: 'no-store' }).then((response) => {
|
||||
let playerPoweredBy = response.headers.get('x-powered-by') || '';
|
||||
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim.canonical_url, this);
|
||||
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim.canonical_url, this, bitrateAsBitsPerSecond);
|
||||
});
|
||||
|
||||
doAnalyticsView(uri, timeToStart).then(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router';
|
||||
import WalletSwap from './view';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doAddCoinSwap, doRemoveCoinSwap, doQueryCoinSwapStatus } from 'redux/actions/coinSwap';
|
||||
import { doAddCoinSwap, doQueryCoinSwapStatus } from 'redux/actions/coinSwap';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectCoinSwaps } from 'redux/selectors/coinSwap';
|
||||
import { selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
@@ -18,7 +18,6 @@ const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
addCoinSwap: (coinSwap) => dispatch(doAddCoinSwap(coinSwap)),
|
||||
removeCoinSwap: (chargeCode) => dispatch(doRemoveCoinSwap(chargeCode)),
|
||||
getNewAddress: () => dispatch(doGetNewAddress()),
|
||||
checkAddressIsMine: (address) => dispatch(doCheckAddressIsMine(address)),
|
||||
queryCoinSwapStatus: (sendAddress) => dispatch(doQueryCoinSwapStatus(sendAddress)),
|
||||
|
||||
@@ -59,7 +59,6 @@ type Props = {
|
||||
isAuthenticated: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
addCoinSwap: (CoinSwapInfo) => void,
|
||||
removeCoinSwap: (string) => void,
|
||||
getNewAddress: () => void,
|
||||
checkAddressIsMine: (string) => void,
|
||||
openModal: (string, {}) => void,
|
||||
@@ -73,7 +72,6 @@ function WalletSwap(props: Props) {
|
||||
coinSwaps,
|
||||
isAuthenticated,
|
||||
addCoinSwap,
|
||||
removeCoinSwap,
|
||||
getNewAddress,
|
||||
checkAddressIsMine,
|
||||
openModal,
|
||||
@@ -105,15 +103,9 @@ function WalletSwap(props: Props) {
|
||||
setSwap(null);
|
||||
}
|
||||
|
||||
function handleRemoveSwap(chargeCode) {
|
||||
openModal(MODALS.CONFIRM, {
|
||||
title: __('Remove Swap'),
|
||||
subtitle: <I18nMessage tokens={{ address: <em>{`${chargeCode}`}</em> }}>Remove %address%?</I18nMessage>,
|
||||
body: <p className="help--warning">{__('This process cannot be reversed.')}</p>,
|
||||
onConfirm: (closeModal) => {
|
||||
removeCoinSwap(chargeCode);
|
||||
closeModal();
|
||||
},
|
||||
function removeCoinSwap(chargeCode) {
|
||||
openModal(MODALS.CONFIRM_REMOVE_BTC_SWAP_ADDRESS, {
|
||||
chargeCode: chargeCode,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -665,7 +657,7 @@ function WalletSwap(props: Props) {
|
||||
button="link"
|
||||
icon={ICONS.REMOVE}
|
||||
title={__('Remove swap')}
|
||||
onClick={() => handleRemoveSwap(x.chargeCode)}
|
||||
onClick={() => removeCoinSwap(x.chargeCode)}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -120,6 +120,13 @@ export const PLAY_VIDEO_STARTED = 'PLAY_VIDEO_STARTED';
|
||||
export const FETCH_AVAILABILITY_STARTED = 'FETCH_AVAILABILITY_STARTED';
|
||||
export const FETCH_AVAILABILITY_COMPLETED = 'FETCH_AVAILABILITY_COMPLETED';
|
||||
export const FILE_DELETE = 'FILE_DELETE';
|
||||
export const FETCH_FILE_INFO_FAILED = 'FETCH_FILE_INFO_FAILED';
|
||||
export const DOWNLOADING_CANCELED = 'DOWNLOADING_CANCELED';
|
||||
export const SET_FILE_LIST_SORT = 'SET_FILE_LIST_SORT';
|
||||
export const PURCHASE_URI_STARTED = 'PURCHASE_URI_STARTED';
|
||||
export const PURCHASE_URI_COMPLETED = 'PURCHASE_URI_COMPLETED';
|
||||
export const PURCHASE_URI_FAILED = 'PURCHASE_URI_FAILED';
|
||||
export const CLEAR_PURCHASED_URI_SUCCESS = 'CLEAR_PURCHASED_URI_SUCCESS';
|
||||
|
||||
// Search
|
||||
export const SEARCH_START = 'SEARCH_START';
|
||||
@@ -301,13 +308,6 @@ export const COMMENT_RECEIVED = 'COMMENT_RECEIVED';
|
||||
export const COMMENT_SUPER_CHAT_LIST_STARTED = 'COMMENT_SUPER_CHAT_LIST_STARTED';
|
||||
export const COMMENT_SUPER_CHAT_LIST_COMPLETED = 'COMMENT_SUPER_CHAT_LIST_COMPLETED';
|
||||
export const COMMENT_SUPER_CHAT_LIST_FAILED = 'COMMENT_SUPER_CHAT_LIST_FAILED';
|
||||
export const COMMENT_SBL_FETCH_STARTED = 'COMMENT_SBL_FETCH_STARTED';
|
||||
export const COMMENT_SBL_FETCH_FAILED = 'COMMENT_SBL_FETCH_FAILED';
|
||||
export const COMMENT_SBL_FETCH_COMPLETED = 'COMMENT_SBL_FETCH_COMPLETED';
|
||||
export const COMMENT_SBL_FETCH_INVITES_STARTED = 'COMMENT_SBL_FETCH_INVITES_STARTED';
|
||||
export const COMMENT_SBL_FETCH_INVITES_FAILED = 'COMMENT_SBL_FETCH_INVITES_FAILED';
|
||||
export const COMMENT_SBL_FETCH_INVITES_COMPLETED = 'COMMENT_SBL_FETCH_INVITES_COMPLETED';
|
||||
export const COMMENT_SBL_DELETED = 'COMMENT_SBL_DELETED';
|
||||
|
||||
// Blocked channels
|
||||
export const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL';
|
||||
|
||||
+1
-12
@@ -9,6 +9,7 @@ export const SORT_BY = {
|
||||
OLDEST: 1,
|
||||
CONTROVERSY: 2,
|
||||
POPULARITY: 3,
|
||||
NEWEST_NO_PINS: 4,
|
||||
};
|
||||
|
||||
export const BLOCK_LEVEL = {
|
||||
@@ -19,15 +20,3 @@ export const BLOCK_LEVEL = {
|
||||
|
||||
export const COMMENT_PAGE_SIZE_TOP_LEVEL = 10;
|
||||
export const COMMENT_PAGE_SIZE_REPLIES = 10;
|
||||
|
||||
// ***************************************************************************
|
||||
// SBL: Shared Blocked List
|
||||
// ***************************************************************************
|
||||
|
||||
export const SBL_INVITE_STATUS = {
|
||||
ALL: 0,
|
||||
PENDING: 1,
|
||||
ACCEPTED: 2,
|
||||
REJECTED: 3,
|
||||
NONE: 4,
|
||||
};
|
||||
@@ -171,11 +171,10 @@ export const STAR = 'star';
|
||||
export const MUSIC = 'MusicCategory';
|
||||
export const BADGE_MOD = 'BadgeMod';
|
||||
export const BADGE_STREAMER = 'BadgeStreamer';
|
||||
export const APPEAL = 'JudgeHammer';
|
||||
export const REPLAY = 'Replay';
|
||||
export const REPEAT = 'Repeat';
|
||||
export const SHUFFLE = 'Shuffle';
|
||||
export const HOLD_PHONE = 'HOLD_PHONE';
|
||||
export const HOLD_PHONE = 'HoldPhone';
|
||||
export const LIFE = 'Life';
|
||||
export const ARTISTS = 'Artists';
|
||||
export const MYSTERIES = 'Mysteries';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export const CONFIRM = 'confirm';
|
||||
export const CONFIRM_FILE_REMOVE = 'confirm_file_remove';
|
||||
export const CONFIRM_EXTERNAL_RESOURCE = 'confirm_external_resource';
|
||||
export const COMMENT_ACKNOWEDGEMENT = 'comment_acknowlegement';
|
||||
@@ -43,6 +42,7 @@ export const SYNC_ENABLE = 'SYNC_ENABLE';
|
||||
export const IMAGE_UPLOAD = 'image_upload';
|
||||
export const MOBILE_SEARCH = 'mobile_search';
|
||||
export const VIEW_IMAGE = 'view_image';
|
||||
export const CONFIRM_REMOVE_BTC_SWAP_ADDRESS = 'confirm_remove_btc_swap_address';
|
||||
export const BLOCK_CHANNEL = 'block_channel';
|
||||
export const COLLECTION_ADD = 'collection_add';
|
||||
export const COLLECTION_DELETE = 'collection_delete';
|
||||
|
||||
@@ -52,6 +52,7 @@ export const PAGE_TITLE = {
|
||||
[PAGES.SETTINGS_STRIPE_ACCOUNT]: 'Bank Accounts',
|
||||
[PAGES.SETTINGS_STRIPE_CARD]: 'Payment Methods',
|
||||
[PAGES.SETTINGS_UPDATE_PWD]: 'Update password',
|
||||
[PAGES.SETTINGS_OWN_COMMENTS]: 'Your comments',
|
||||
[PAGES.SWAP]: 'Swap Credits',
|
||||
[PAGES.TAGS_FOLLOWING]: 'Tags',
|
||||
[PAGES.TAGS_FOLLOWING_MANAGE]: 'Manage tags',
|
||||
|
||||
@@ -46,6 +46,7 @@ exports.SETTINGS_NOTIFICATIONS = 'settings/notifications';
|
||||
exports.SETTINGS_BLOCKED_MUTED = 'settings/block_and_mute';
|
||||
exports.SETTINGS_CREATOR = 'settings/creator';
|
||||
exports.SETTINGS_UPDATE_PWD = 'settings/update_password';
|
||||
exports.SETTINGS_OWN_COMMENTS = 'settings/ownComments';
|
||||
exports.SHOW = 'show';
|
||||
exports.ACCOUNT = 'account';
|
||||
exports.SEARCH = 'search';
|
||||
@@ -74,11 +75,5 @@ exports.NOTIFICATIONS = 'notifications';
|
||||
exports.YOUTUBE_SYNC = 'youtube';
|
||||
exports.LIVESTREAM = 'livestream';
|
||||
exports.LIVESTREAM_CURRENT = 'live';
|
||||
exports.SHARED_BLOCKLIST_EDIT = 'sharedblocklist/edit';
|
||||
exports.SHARED_BLOCKLIST_INVITE = 'sharedblocklist/invite';
|
||||
exports.APPEAL_LIST_OFFENCES = 'appeal/offences';
|
||||
exports.APPEAL_FILE = 'appeal/file';
|
||||
exports.APPEAL_FILED = 'appeal/filed';
|
||||
exports.APPEAL_CREATOR_REVIEW = 'appeal/review';
|
||||
exports.GENERAL = 'general';
|
||||
exports.LIST = 'list';
|
||||
@@ -1,12 +1,14 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import parseDuration from 'parse-duration';
|
||||
import Button from 'component/button';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
import Card from 'component/common/card';
|
||||
import { FormField } from 'component/common/form';
|
||||
import FormFieldDuration from 'component/formFieldDuration';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import { Modal } from 'modal/modal';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
@@ -65,6 +67,7 @@ export default function ModalBlockChannel(props: Props) {
|
||||
const [tab, setTab] = usePersistedState('ModalBlockChannel:tab', TAB.PERSONAL);
|
||||
const [blockType, setBlockType] = usePersistedState('ModalBlockChannel:blockType', BLOCK.PERMANENT);
|
||||
const [timeoutInput, setTimeoutInput] = usePersistedState('ModalBlockChannel:timeoutInput', '10m');
|
||||
const [timeoutInputErr, setTimeoutInputErr] = React.useState('');
|
||||
const [timeoutSec, setTimeoutSec] = React.useState(-1);
|
||||
|
||||
const isPersonalTheOnlyTab = !activeChannelIsModerator && !activeChannelIsAdmin;
|
||||
@@ -89,6 +92,45 @@ export default function ModalBlockChannel(props: Props) {
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// 'timeoutInput' to 'timeoutSec' conversion.
|
||||
React.useEffect(() => {
|
||||
const handleInvalidInput = (errMsg: string) => {
|
||||
if (timeoutSec !== -1) {
|
||||
setTimeoutSec(-1);
|
||||
}
|
||||
if (timeoutInputErr !== errMsg) {
|
||||
setTimeoutInputErr(errMsg);
|
||||
}
|
||||
};
|
||||
|
||||
const handleValidInput = (seconds) => {
|
||||
if (seconds !== timeoutSec) {
|
||||
setTimeoutSec(seconds);
|
||||
}
|
||||
if (timeoutInputErr) {
|
||||
setTimeoutInputErr('');
|
||||
}
|
||||
};
|
||||
|
||||
if (!timeoutInput) {
|
||||
handleValidInput(-1); // Reset
|
||||
return;
|
||||
}
|
||||
|
||||
const ONE_HUNDRED_YEARS_IN_SECONDS = 3154000000;
|
||||
const seconds = parseDuration(timeoutInput, 's');
|
||||
|
||||
if (Number.isInteger(seconds) && seconds > 0) {
|
||||
if (seconds > ONE_HUNDRED_YEARS_IN_SECONDS) {
|
||||
handleInvalidInput(__('Wow, banned for more than 100 years?'));
|
||||
} else {
|
||||
handleValidInput(seconds);
|
||||
}
|
||||
} else {
|
||||
handleInvalidInput(__('Invalid duration.'));
|
||||
}
|
||||
}, [timeoutInput, timeoutInputErr, timeoutSec]);
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
@@ -136,12 +178,27 @@ export default function ModalBlockChannel(props: Props) {
|
||||
}
|
||||
|
||||
function getTimeoutDurationElem() {
|
||||
const examples = '\n- 30s\n- 10m\n- 1h\n- 2d\n- 3mo\n- 1y';
|
||||
return (
|
||||
<FormFieldDuration
|
||||
<FormField
|
||||
name="time_out"
|
||||
label={
|
||||
<>
|
||||
{__('Duration')}
|
||||
<Icon
|
||||
customTooltipText={__('Enter the timeout duration. Examples: %examples%', { examples })}
|
||||
className="icon--help"
|
||||
icon={ICONS.HELP}
|
||||
tooltip
|
||||
size={16}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
type="text"
|
||||
placeholder="30s, 10m, 1h, 2d, 3mo, 1y"
|
||||
value={timeoutInput}
|
||||
onChange={(e) => setTimeoutInput(e.target.value)}
|
||||
onResolve={(valueInSeconds) => setTimeoutSec(valueInSeconds)}
|
||||
error={timeoutInputErr}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doHideModal } from 'redux/actions/app';
|
||||
|
||||
import ModalConfirm from './view';
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doHideModal: () => dispatch(doHideModal()),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(ModalConfirm);
|
||||
@@ -1,55 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import type { Node } from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import Spinner from 'component/spinner';
|
||||
import { Modal } from 'modal/modal';
|
||||
|
||||
type Props = {
|
||||
title: string,
|
||||
subtitle?: string | Node,
|
||||
body?: string | Node,
|
||||
labelOk?: string,
|
||||
labelCancel?: string,
|
||||
onConfirm: (closeModal: () => void, setIsBusy: (boolean) => void) => void,
|
||||
// --- perform ---
|
||||
doHideModal: () => void,
|
||||
};
|
||||
|
||||
export default function ModalConfirm(props: Props) {
|
||||
const { title, subtitle, body, labelOk, labelCancel, onConfirm, doHideModal } = props;
|
||||
const [isBusy, setIsBusy] = React.useState(false);
|
||||
|
||||
function handleOnClick() {
|
||||
if (onConfirm) {
|
||||
onConfirm(doHideModal, setIsBusy);
|
||||
}
|
||||
}
|
||||
|
||||
function getOkLabel() {
|
||||
return isBusy ? <Spinner type="small" /> : labelOk || __('OK');
|
||||
}
|
||||
|
||||
function getCancelLabel() {
|
||||
return labelCancel || __('Cancel');
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal isOpen type="card" onAborted={doHideModal}>
|
||||
<Card
|
||||
title={title}
|
||||
subtitle={subtitle}
|
||||
body={body}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button button="primary" label={getOkLabel()} disabled={isBusy} onClick={handleOnClick} />
|
||||
<Button button="link" label={getCancelLabel()} disabled={isBusy} onClick={doHideModal} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doHideModal } from 'redux/actions/app';
|
||||
import ModalRemoveBtcSwapAddress from './view';
|
||||
import { doRemoveCoinSwap } from 'redux/actions/coinSwap';
|
||||
|
||||
const select = (state, props) => ({});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
removeCoinSwap: (chargeCode) => dispatch(doRemoveCoinSwap(chargeCode)),
|
||||
closeModal: () => dispatch(doHideModal()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalRemoveBtcSwapAddress);
|
||||
@@ -0,0 +1,43 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Modal } from 'modal/modal';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
|
||||
type Props = {
|
||||
chargeCode: string,
|
||||
removeCoinSwap: (string) => void,
|
||||
closeModal: () => void,
|
||||
};
|
||||
|
||||
function ModalRemoveBtcSwapAddress(props: Props) {
|
||||
const { chargeCode, removeCoinSwap, closeModal } = props;
|
||||
|
||||
return (
|
||||
<Modal isOpen contentLabel={__('Confirm Swap Removal')} type="card" onAborted={closeModal}>
|
||||
<Card
|
||||
title={__('Remove Swap')}
|
||||
subtitle={<I18nMessage tokens={{ address: <em>{`${chargeCode}`}</em> }}>Remove %address%?</I18nMessage>}
|
||||
body={<p className="help--warning">{__('This process cannot be reversed.')}</p>}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
label={__('OK')}
|
||||
onClick={() => {
|
||||
removeCoinSwap(chargeCode);
|
||||
closeModal();
|
||||
}}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={closeModal} />
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default ModalRemoveBtcSwapAddress;
|
||||
@@ -23,7 +23,6 @@ const ModalClaimCollectionAdd = lazyImport(() =>
|
||||
const ModalCommentAcknowledgement = lazyImport(() =>
|
||||
import('modal/modalCommentAcknowledgement' /* webpackChunkName: "modalCommentAcknowledgement" */)
|
||||
);
|
||||
const ModalConfirm = lazyImport(() => import('modal/modalConfirm' /* webpackChunkName: "modalConfirm" */));
|
||||
const ModalConfirmAge = lazyImport(() => import('modal/modalConfirmAge' /* webpackChunkName: "modalConfirmAge" */));
|
||||
const ModalConfirmThumbnailUpload = lazyImport(() =>
|
||||
import('modal/modalConfirmThumbnailUpload' /* webpackChunkName: "modalConfirmThumbnailUpload" */)
|
||||
@@ -64,6 +63,9 @@ const ModalPublish = lazyImport(() => import('modal/modalPublish' /* webpackChun
|
||||
const ModalPublishPreview = lazyImport(() =>
|
||||
import('modal/modalPublishPreview' /* webpackChunkName: "modalPublishPreview" */)
|
||||
);
|
||||
const ModalRemoveBtcSwapAddress = lazyImport(() =>
|
||||
import('modal/modalRemoveBtcSwapAddress' /* webpackChunkName: "modalRemoveBtcSwapAddress" */)
|
||||
);
|
||||
const ModalRemoveCard = lazyImport(() => import('modal/modalRemoveCard' /* webpackChunkName: "modalRemoveCard" */));
|
||||
const ModalRemoveComment = lazyImport(() =>
|
||||
import('modal/modalRemoveComment' /* webpackChunkName: "modalRemoveComment" */)
|
||||
@@ -122,8 +124,6 @@ function ModalRouter(props: Props) {
|
||||
|
||||
function getModal(id) {
|
||||
switch (id) {
|
||||
case MODALS.CONFIRM:
|
||||
return ModalConfirm;
|
||||
case MODALS.UPGRADE:
|
||||
return ModalUpgrade;
|
||||
case MODALS.DOWNLOADING:
|
||||
@@ -198,6 +198,8 @@ function ModalRouter(props: Props) {
|
||||
return ModalViewImage;
|
||||
case MODALS.MASS_TIP_UNLOCK:
|
||||
return ModalMassTipsUnlock;
|
||||
case MODALS.CONFIRM_REMOVE_BTC_SWAP_ADDRESS:
|
||||
return ModalRemoveBtcSwapAddress;
|
||||
case MODALS.BLOCK_CHANNEL:
|
||||
return ModalBlockChannel;
|
||||
case MODALS.COLLECTION_ADD:
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
import AppealListOffences from './view';
|
||||
|
||||
const select = (state) => ({});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(AppealListOffences);
|
||||
@@ -1,60 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Page from 'component/page';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
|
||||
type Props = {
|
||||
doOpenModal: (id: string, {}) => void,
|
||||
};
|
||||
|
||||
export default function AppealListOffences(props: Props) {
|
||||
const { doOpenModal } = props;
|
||||
|
||||
const blockerUris = [
|
||||
'lbry://@grumpy#3c98c9fc7988a1de4ac4ccfddab47416d9871c0d',
|
||||
'lbry://@timeout#8237fcdf9c3288d49cff1a3a609d680d486447ff',
|
||||
];
|
||||
|
||||
return (
|
||||
<Page noSideNavigation className="main--half-width" backout={{ backoutLabel: __('Cancel'), title: __('Offences') }}>
|
||||
<div className="help--notice">{HELP.OFFENCES}</div>
|
||||
<div className="section">
|
||||
<ClaimList
|
||||
uris={blockerUris}
|
||||
hideMenu
|
||||
renderProperties={() => null}
|
||||
renderActions={(claim) => {
|
||||
return (
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="secondary"
|
||||
icon={ICONS.APPEAL}
|
||||
label={__('Appeal')}
|
||||
title={__(HELP.MANUAL_APPEAL)}
|
||||
onClick={() => doOpenModal(MODALS.CONFIRM, { title: 'Not implemented yet.' })}
|
||||
/>
|
||||
<Button
|
||||
button="secondary"
|
||||
icon={ICONS.LBC}
|
||||
label={__('Auto Appeal')}
|
||||
title={__(HELP.AUTO_APPEAL)}
|
||||
onClick={() => doOpenModal(MODALS.CONFIRM, { title: 'Not implemented yet.' })}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const HELP = {
|
||||
OFFENCES: 'These are creators that have blocked you. You can choose to appeal to the creator. If the creator has enabled automatic appeal (a.k.a swear jar), you can have your offences automatically pardoned by tipping the creator.',
|
||||
MANUAL_APPEAL: 'Appeal to the creator to remove you from their blocklist.',
|
||||
AUTO_APPEAL: 'The creator has enabled the auto-appeal process, where your offence can be automatically pardoned by tipping the creator.',
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
import AppealReview from './view';
|
||||
|
||||
const select = (state) => ({});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doOpenModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(AppealReview);
|
||||
@@ -1,60 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Page from 'component/page';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
|
||||
type Props = {
|
||||
doOpenModal: (id: string, {}) => void,
|
||||
};
|
||||
|
||||
export default function AppealReview(props: Props) {
|
||||
const { doOpenModal } = props;
|
||||
|
||||
const appellantUris = [
|
||||
'lbry://@grumpy#3c98c9fc7988a1de4ac4ccfddab47416d9871c0d',
|
||||
'lbry://@timeout#8237fcdf9c3288d49cff1a3a609d680d486447ff',
|
||||
];
|
||||
|
||||
return (
|
||||
<Page
|
||||
noSideNavigation
|
||||
className="main--half-width"
|
||||
backout={{ backoutLabel: __('Cancel'), title: __('Review Appeals') }}
|
||||
>
|
||||
<div className="help--notice">{HELP.APPELLANTS}</div>
|
||||
<div className="section">
|
||||
<ClaimList
|
||||
uris={appellantUris}
|
||||
hideMenu
|
||||
renderProperties={() => null}
|
||||
renderActions={(claim) => {
|
||||
return (
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="secondary"
|
||||
icon={ICONS.COMPLETE}
|
||||
label={__('Approve')}
|
||||
onClick={() => doOpenModal(MODALS.CONFIRM, { title: 'Not implemented -- waiting for API' })}
|
||||
/>
|
||||
<Button
|
||||
button="secondary"
|
||||
icon={ICONS.REMOVE}
|
||||
label={__('Reject')}
|
||||
onClick={() => doOpenModal(MODALS.CONFIRM, { title: 'Not implemented -- waiting for API' })}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
const HELP = {
|
||||
APPELLANTS: 'The following users have requested an appeal against blocking their channel.',
|
||||
};
|
||||
@@ -102,7 +102,9 @@ export default function CollectionPage(props: Props) {
|
||||
|
||||
const subTitle = (
|
||||
<div>
|
||||
<span className="collection__subtitle">{collectionCount} items</span>
|
||||
<span className="collection__subtitle">
|
||||
{collectionCount === 1 ? __('1 item') : __('%collectionCount% items', { collectionCount })}
|
||||
</span>
|
||||
{uri && <ClaimAuthor uri={uri} />}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -220,7 +220,7 @@ function FilePage(props: Props) {
|
||||
{!collection && !isMarkdown && !videoTheaterMode && <RecommendedContent uri={uri} />}
|
||||
{isMarkdown && (
|
||||
<div className="file-page__post-comments">
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} />
|
||||
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
||||
</div>
|
||||
)}
|
||||
</Page>
|
||||
|
||||
@@ -6,7 +6,6 @@ import classnames from 'classnames';
|
||||
import moment from 'moment';
|
||||
import humanizeDuration from 'humanize-duration';
|
||||
import BlockList from 'component/blockList';
|
||||
import BlockListShared from 'component/blockListShared';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
import Page from 'component/page';
|
||||
import Spinner from 'component/spinner';
|
||||
@@ -18,7 +17,6 @@ import ChannelMuteButton from 'component/channelMuteButton';
|
||||
const VIEW = {
|
||||
BLOCKED: 'blocked',
|
||||
ADMIN: 'admin',
|
||||
SHARED: 'shared',
|
||||
MODERATOR: 'moderator',
|
||||
MUTED: 'muted',
|
||||
};
|
||||
@@ -268,24 +266,19 @@ function ListBlocked(props: Props) {
|
||||
{isAdmin && getViewElem(VIEW.ADMIN, 'Global', ICONS.BLOCK)}
|
||||
{isModerator && getViewElem(VIEW.MODERATOR, 'Moderator', ICONS.BLOCK)}
|
||||
{getViewElem(VIEW.MUTED, 'Muted', ICONS.MUTE)}
|
||||
{getViewElem(VIEW.SHARED, 'Shared Blocklist', ICONS.SHARE)}
|
||||
</div>
|
||||
<div className="section__actions--inline">{getRefreshElem()}</div>
|
||||
</div>
|
||||
|
||||
{viewMode === VIEW.SHARED && <BlockListShared />}
|
||||
|
||||
{viewMode !== VIEW.SHARED && (
|
||||
<BlockList
|
||||
key={viewMode}
|
||||
uris={getList(viewMode)}
|
||||
help={getHelpText(viewMode)}
|
||||
titleEmptyList={getEmptyListTitle(viewMode)}
|
||||
subtitle={getEmptyListSubtitle(viewMode)}
|
||||
getActionButtons={getActionButtons}
|
||||
className={viewMode === VIEW.MODERATOR ? 'block-list--moderator' : undefined}
|
||||
/>
|
||||
)}
|
||||
<BlockList
|
||||
key={viewMode}
|
||||
uris={getList(viewMode)}
|
||||
help={getHelpText(viewMode)}
|
||||
titleEmptyList={getEmptyListTitle(viewMode)}
|
||||
subtitle={getEmptyListSubtitle(viewMode)}
|
||||
getActionButtons={getActionButtons}
|
||||
className={viewMode === VIEW.MODERATOR ? 'block-list--moderator' : undefined}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Page>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doCommentListOwn, doCommentReset } from 'redux/actions/comments';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
import {
|
||||
selectIsFetchingComments,
|
||||
makeSelectCommentsForUri,
|
||||
makeSelectTotalCommentsCountForUri,
|
||||
makeSelectTopLevelTotalPagesForUri,
|
||||
} from 'redux/selectors/comments';
|
||||
import { selectClaimsById } from 'lbry-redux';
|
||||
|
||||
import OwnComments from './view';
|
||||
|
||||
const select = (state) => {
|
||||
const activeChannelClaim = selectActiveChannelClaim(state);
|
||||
const uri = activeChannelClaim && activeChannelClaim.canonical_url;
|
||||
|
||||
return {
|
||||
activeChannelClaim,
|
||||
allComments: makeSelectCommentsForUri(uri)(state),
|
||||
totalComments: makeSelectTotalCommentsCountForUri(uri)(state),
|
||||
topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(uri)(state),
|
||||
isFetchingComments: selectIsFetchingComments(state),
|
||||
claimsById: selectClaimsById(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doCommentReset: (a) => dispatch(doCommentReset(a)),
|
||||
doCommentListOwn: (a, b, c) => dispatch(doCommentListOwn(a, b, c)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(OwnComments);
|
||||
@@ -0,0 +1,210 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
import ClaimPreview from 'component/claimPreview';
|
||||
import Comment from 'component/comment';
|
||||
import Card from 'component/common/card';
|
||||
import Empty from 'component/common/empty';
|
||||
import Page from 'component/page';
|
||||
import Spinner from 'component/spinner';
|
||||
import { COMMENT_PAGE_SIZE_TOP_LEVEL } from 'constants/comment';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import useFetched from 'effects/use-fetched';
|
||||
import debounce from 'util/debounce';
|
||||
|
||||
function scaleToDevicePixelRatio(value) {
|
||||
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
||||
if (devicePixelRatio < 1.0) {
|
||||
return Math.ceil(value / devicePixelRatio);
|
||||
}
|
||||
return Math.ceil(value * devicePixelRatio);
|
||||
}
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
allComments: Array<Comment>,
|
||||
totalComments: number,
|
||||
topLevelTotalPages: number,
|
||||
isFetchingComments: boolean,
|
||||
claimsById: any,
|
||||
doCommentReset: (claimId: string) => void,
|
||||
doCommentListOwn: (channelId: string, page: number, pageSize: number) => void,
|
||||
};
|
||||
|
||||
export default function OwnComments(props: Props) {
|
||||
const {
|
||||
activeChannelClaim,
|
||||
allComments,
|
||||
totalComments,
|
||||
isFetchingComments,
|
||||
claimsById,
|
||||
doCommentReset,
|
||||
doCommentListOwn,
|
||||
} = props;
|
||||
const spinnerRef = React.useRef();
|
||||
const [page, setPage] = React.useState(0);
|
||||
const [activeChannelId, setActiveChannelId] = React.useState('');
|
||||
|
||||
// Since we are sharing the key for Discussion and MyComments, don't show
|
||||
// the list until we've gone through the initial reset.
|
||||
const wasResetAndReady = useFetched(isFetchingComments);
|
||||
|
||||
const totalPages = Math.ceil(totalComments / COMMENT_PAGE_SIZE_TOP_LEVEL);
|
||||
const moreBelow = page < totalPages;
|
||||
|
||||
function getCommentsElem(comments) {
|
||||
return comments.map((comment) => {
|
||||
const contentClaim = claimsById[comment.claim_id];
|
||||
const isChannel = contentClaim && contentClaim.value_type === 'channel';
|
||||
const isLivestream = Boolean(contentClaim && contentClaim.value_type === 'stream' && !contentClaim.value.source);
|
||||
|
||||
return (
|
||||
<div key={comment.comment_id} className="comments-own card__main-actions">
|
||||
<div className="section__actions">
|
||||
<div className="comments-own--claim">
|
||||
{contentClaim && (
|
||||
<ClaimPreview
|
||||
uri={contentClaim.canonical_url}
|
||||
searchParams={{
|
||||
...(isChannel ? { view: 'discussion' } : {}),
|
||||
...(isLivestream ? {} : { lc: comment.comment_id }),
|
||||
}}
|
||||
hideActions
|
||||
hideMenu
|
||||
properties={() => null}
|
||||
/>
|
||||
)}
|
||||
{!contentClaim && <Empty text={__('Content or channel was deleted.')} />}
|
||||
</div>
|
||||
<Comment
|
||||
isTopLevel
|
||||
hideActions
|
||||
authorUri={comment.channel_url}
|
||||
author={comment.channel_name}
|
||||
commentId={comment.comment_id}
|
||||
message={comment.comment}
|
||||
timePosted={comment.timestamp * 1000}
|
||||
commentIsMine
|
||||
supportAmount={comment.support_amount}
|
||||
numDirectReplies={0} // Don't show replies here
|
||||
isModerator={comment.is_moderator}
|
||||
isGlobalMod={comment.is_global_mod}
|
||||
isFiat={comment.is_fiat}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Active channel changed
|
||||
React.useEffect(() => {
|
||||
if (activeChannelClaim && activeChannelClaim.claim_id !== activeChannelId) {
|
||||
setActiveChannelId(activeChannelClaim.claim_id);
|
||||
setPage(0);
|
||||
}
|
||||
}, [activeChannelClaim, activeChannelId]);
|
||||
|
||||
// Reset comments
|
||||
React.useEffect(() => {
|
||||
if (page === 0 && activeChannelId) {
|
||||
doCommentReset(activeChannelId);
|
||||
setPage(1);
|
||||
}
|
||||
}, [page, activeChannelId]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// Fetch own comments
|
||||
React.useEffect(() => {
|
||||
if (page !== 0 && activeChannelId) {
|
||||
doCommentListOwn(activeChannelId, page, COMMENT_PAGE_SIZE_TOP_LEVEL);
|
||||
}
|
||||
}, [page]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// Infinite scroll
|
||||
React.useEffect(() => {
|
||||
function shouldFetchNextPage(page, topLevelTotalPages, window, document, yPrefetchPx = 1000) {
|
||||
if (!spinnerRef || !spinnerRef.current) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const rect = spinnerRef.current.getBoundingClientRect(); // $FlowFixMe
|
||||
const windowH = window.innerHeight || document.documentElement.clientHeight; // $FlowFixMe
|
||||
const windowW = window.innerWidth || document.documentElement.clientWidth; // $FlowFixMe
|
||||
|
||||
const isApproachingViewport = yPrefetchPx !== 0 && rect.top < windowH + scaleToDevicePixelRatio(yPrefetchPx);
|
||||
|
||||
const isInViewport =
|
||||
rect.width > 0 &&
|
||||
rect.height > 0 &&
|
||||
rect.bottom >= 0 &&
|
||||
rect.right >= 0 &&
|
||||
// $FlowFixMe
|
||||
rect.top <= windowH &&
|
||||
// $FlowFixMe
|
||||
rect.left <= windowW;
|
||||
|
||||
return (isInViewport || isApproachingViewport) && page < topLevelTotalPages;
|
||||
}
|
||||
|
||||
const handleCommentScroll = debounce(() => {
|
||||
if (shouldFetchNextPage(page, totalPages, window, document)) {
|
||||
setPage(page + 1);
|
||||
}
|
||||
}, 200);
|
||||
|
||||
if (!isFetchingComments && moreBelow && spinnerRef && spinnerRef.current) {
|
||||
if (shouldFetchNextPage(page, totalPages, window, document, 0)) {
|
||||
setPage(page + 1);
|
||||
} else {
|
||||
window.addEventListener('scroll', handleCommentScroll);
|
||||
return () => window.removeEventListener('scroll', handleCommentScroll);
|
||||
}
|
||||
}
|
||||
}, [page, spinnerRef, isFetchingComments, moreBelow, totalPages]);
|
||||
|
||||
// **************************************************************************
|
||||
// **************************************************************************
|
||||
|
||||
if (!activeChannelClaim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Page noFooter noSideNavigation settingsPage backout={{ title: __('Your comments'), backLabel: __('Back') }}>
|
||||
<ChannelSelector hideAnon />
|
||||
<Card
|
||||
isBodyList
|
||||
title={
|
||||
totalComments > 0
|
||||
? totalComments === 1
|
||||
? __('1 comment')
|
||||
: __('%total_comments% comments', { total_comments: totalComments })
|
||||
: isFetchingComments
|
||||
? ''
|
||||
: __('No comments')
|
||||
}
|
||||
titleActions={
|
||||
<Button
|
||||
button="alt"
|
||||
icon={ICONS.REFRESH}
|
||||
title={__('Refresh')}
|
||||
onClick={() => {
|
||||
setPage(0);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
body={
|
||||
<>
|
||||
{wasResetAndReady && <ul className="comments">{allComments && getCommentsElem(allComments)}</ul>}
|
||||
{(isFetchingComments || moreBelow) && (
|
||||
<div className="main--empty" ref={spinnerRef}>
|
||||
<Spinner type="small" />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
@@ -32,28 +32,30 @@ export default function NotificationSettingsPage(props: Props) {
|
||||
const lbryIoParams = verificationToken ? { auth_token: verificationToken } : undefined;
|
||||
|
||||
React.useEffect(() => {
|
||||
Lbryio.call('tag', 'list', lbryIoParams)
|
||||
.then(setTags)
|
||||
.catch((e) => {
|
||||
setError(true);
|
||||
});
|
||||
if (isAuthenticated) {
|
||||
Lbryio.call('tag', 'list', lbryIoParams)
|
||||
.then(setTags)
|
||||
.catch((e) => {
|
||||
setError(true);
|
||||
});
|
||||
|
||||
Lbryio.call('user_email', 'status', lbryIoParams)
|
||||
.then((res) => {
|
||||
const enabledEmails =
|
||||
res.emails &&
|
||||
Object.keys(res.emails).reduce((acc, email) => {
|
||||
const isEnabled = res.emails[email];
|
||||
return [...acc, { email, isEnabled }];
|
||||
}, []);
|
||||
Lbryio.call('user_email', 'status', lbryIoParams)
|
||||
.then((res) => {
|
||||
const enabledEmails =
|
||||
res.emails &&
|
||||
Object.keys(res.emails).reduce((acc, email) => {
|
||||
const isEnabled = res.emails[email];
|
||||
return [...acc, { email, isEnabled }];
|
||||
}, []);
|
||||
|
||||
setTagMap(res.tags);
|
||||
setEnabledEmails(enabledEmails);
|
||||
})
|
||||
.catch((e) => {
|
||||
setError(true);
|
||||
});
|
||||
}, []);
|
||||
setTagMap(res.tags);
|
||||
setEnabledEmails(enabledEmails);
|
||||
})
|
||||
.catch((e) => {
|
||||
setError(true);
|
||||
});
|
||||
}
|
||||
}, [isAuthenticated]);
|
||||
|
||||
function handleChangeTag(name, newIsEnabled) {
|
||||
const tagParams = newIsEnabled ? { add: name } : { remove: name };
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSblUpdate } from 'redux/actions/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
|
||||
import SharedBlocklistEdit from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doSblUpdate: (channelClaim, params, onComplete) => dispatch(doSblUpdate(channelClaim, params, onComplete)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SharedBlocklistEdit);
|
||||
@@ -1,206 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router';
|
||||
import Button from 'component/button';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
import Card from 'component/common/card';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import Page from 'component/page';
|
||||
import Spinner from 'component/spinner';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
const DEFAULT_STRIKE_HOURS = 4;
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
doSblUpdate: (channelClaim: ChannelClaim, params: SblUpdate, onComplete: (error: string) => void) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
};
|
||||
|
||||
export default function SharedBlocklistEdit(props: Props) {
|
||||
const { activeChannelClaim, doSblUpdate, doToast } = props;
|
||||
|
||||
const { goBack, location } = useHistory();
|
||||
|
||||
const sbl = location.state;
|
||||
const [name, setName] = React.useState('');
|
||||
const [category, setCategory] = React.useState('');
|
||||
const [description, setDescription] = React.useState('');
|
||||
const [strike1, setStrike1] = React.useState(DEFAULT_STRIKE_HOURS);
|
||||
const [strike2, setStrike2] = React.useState(DEFAULT_STRIKE_HOURS);
|
||||
const [strike3, setStrike3] = React.useState(DEFAULT_STRIKE_HOURS);
|
||||
const [appealAmount, setAppealAmount] = React.useState(0);
|
||||
const [memberInviteEnabled, setMemberInviteEnabled] = usePersistedState('sblEdit:memberInviteEnabled', true);
|
||||
const [inviteExpiration, setInviteExpiration] = usePersistedState('sblEdit:inviteExpiration', 0);
|
||||
const [submitting, setSubmitting] = React.useState(false);
|
||||
const [error, setError] = React.useState('');
|
||||
|
||||
const submitDisabled = !name || !description;
|
||||
|
||||
function submitForm() {
|
||||
const params: SblUpdate = {
|
||||
name,
|
||||
category,
|
||||
description,
|
||||
strike_one: strike1,
|
||||
strike_two: strike2,
|
||||
strike_three: strike3,
|
||||
curse_jar_amount: appealAmount,
|
||||
member_invite_enabled: memberInviteEnabled,
|
||||
invite_expiration: inviteExpiration,
|
||||
};
|
||||
|
||||
if (activeChannelClaim) {
|
||||
setError('');
|
||||
setSubmitting(true);
|
||||
doSblUpdate(activeChannelClaim, params, handleUpdateCompleted);
|
||||
}
|
||||
}
|
||||
|
||||
function handleUpdateCompleted(error: string) {
|
||||
setSubmitting(false);
|
||||
if (error) {
|
||||
setError(error);
|
||||
} else {
|
||||
doToast({ message: __('Shared blocklist updated.') });
|
||||
goBack();
|
||||
}
|
||||
}
|
||||
|
||||
// Reload data from existing sbl
|
||||
React.useEffect(() => {
|
||||
if (sbl) {
|
||||
setName(sbl.name);
|
||||
setCategory(sbl.category);
|
||||
setDescription(sbl.description);
|
||||
setStrike1(sbl.strike_one);
|
||||
setStrike2(sbl.strike_two);
|
||||
setStrike3(sbl.strike_three);
|
||||
setAppealAmount(sbl.curse_jar_amount);
|
||||
setMemberInviteEnabled(sbl.member_invite_enabled);
|
||||
setInviteExpiration(sbl.invite_expiration);
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<Page
|
||||
noSideNavigation
|
||||
className="main--half-width"
|
||||
backout={{
|
||||
backoutLabel: __('Cancel'),
|
||||
title: sbl ? __('Edit shared blocklist') : __('Create shared blocklist'),
|
||||
}}
|
||||
>
|
||||
<Form onSubmit={submitForm}>
|
||||
<Card
|
||||
className={submitting ? 'sbl-edit card--disabled' : 'sbl-edit '}
|
||||
body={
|
||||
<>
|
||||
<ChannelSelector hideAnon />
|
||||
<FormField
|
||||
label={__('Blocklist name')}
|
||||
type="text"
|
||||
name="name"
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
/>
|
||||
<FormField
|
||||
label={__('Category')}
|
||||
type="text"
|
||||
name="category"
|
||||
value={category}
|
||||
onChange={(e) => setCategory(e.target.value)}
|
||||
/>
|
||||
<FormField
|
||||
label={__('Description')}
|
||||
type="textarea"
|
||||
name="description"
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
textAreaMaxLength={1000}
|
||||
noEmojis
|
||||
/>
|
||||
<fieldset-section>
|
||||
<label>{__('Timeout (hours)')}</label>
|
||||
<div className="section section__flex">
|
||||
<FormField
|
||||
label={__('Strike 1')}
|
||||
placeholder={__('Strike 1 timeout in hours')}
|
||||
type="number"
|
||||
name="strike_one"
|
||||
min={0}
|
||||
step={1}
|
||||
value={strike1}
|
||||
onChange={(e) => setStrike1(parseInt(e.target.value))}
|
||||
/>
|
||||
<FormField
|
||||
label={__('Strike 2')}
|
||||
placeholder={__('Strike 2 timeout in hours')}
|
||||
type="number"
|
||||
name="strike_two"
|
||||
min={0}
|
||||
step={1}
|
||||
value={strike2}
|
||||
onChange={(e) => setStrike2(parseInt(e.target.value))}
|
||||
/>
|
||||
<FormField
|
||||
label={__('Strike 3')}
|
||||
placeholder={__('Strike 3 timeout in hours')}
|
||||
type="number"
|
||||
name="strike_three"
|
||||
min={0}
|
||||
step={1}
|
||||
value={strike3}
|
||||
onChange={(e) => setStrike3(parseInt(e.target.value))}
|
||||
/>
|
||||
</div>
|
||||
</fieldset-section>
|
||||
<FormField
|
||||
label={<I18nMessage tokens={{ lbc: <LbcSymbol /> }}>Auto-appeal minimum %lbc%</I18nMessage>}
|
||||
name="curse_jar_amount"
|
||||
className="form-field--price-amount"
|
||||
type="number"
|
||||
placeholder="1"
|
||||
value={appealAmount}
|
||||
onChange={(e) => setAppealAmount(parseFloat(e.target.value))}
|
||||
/>
|
||||
<FormField
|
||||
label={__('Invite expiration (hours)')}
|
||||
placeholder={__('Set to 0 for no expiration.')}
|
||||
type="number"
|
||||
name="invite_expiration"
|
||||
min={0}
|
||||
step={1}
|
||||
value={inviteExpiration}
|
||||
onChange={(e) => setInviteExpiration(parseInt(e.target.value))}
|
||||
/>
|
||||
<FormField
|
||||
label={__('Allow members to invite others')}
|
||||
type="checkbox"
|
||||
name="member_invite_enabled"
|
||||
checked={memberInviteEnabled}
|
||||
onChange={() => setMemberInviteEnabled(!memberInviteEnabled)}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
label={submitting ? <Spinner type="small" /> : __('Done')}
|
||||
button="primary"
|
||||
type="submit"
|
||||
disabled={submitDisabled}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => goBack()} />
|
||||
</div>
|
||||
{error && <div className="help--error">{__(error)}</div>}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Form>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doSblInvite } from 'redux/actions/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
|
||||
import SharedBlocklistInvite from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
doSblInvite: (channelClaim, paramList, onComplete) => dispatch(doSblInvite(channelClaim, paramList, onComplete)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SharedBlocklistInvite);
|
||||
@@ -1,125 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import Page from 'component/page';
|
||||
import SearchChannelField from 'component/searchChannelField';
|
||||
import Spinner from 'component/spinner';
|
||||
|
||||
const PARAM_BLOCKLIST_ID = 'id';
|
||||
|
||||
type Props = {
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
doSblInvite: (channelClaim: ChannelClaim, paramList: Array<SblInvite>, onComplete: (err: string) => void) => void,
|
||||
doToast: ({ message: string }) => void,
|
||||
};
|
||||
|
||||
export default function SharedBlocklistInvite(props: Props) {
|
||||
const { activeChannelClaim, doSblInvite, doToast } = props;
|
||||
|
||||
const { goBack, location } = useHistory();
|
||||
const urlParams = new URLSearchParams(location.search);
|
||||
const id = urlParams.get(PARAM_BLOCKLIST_ID);
|
||||
|
||||
const [invitees, setInvitees] = React.useState([]);
|
||||
const [message, setMessage] = React.useState('');
|
||||
const [submitting, setSubmitting] = React.useState(false);
|
||||
const [error, setError] = React.useState('');
|
||||
|
||||
const isInputValid = activeChannelClaim && invitees && invitees.length !== 0;
|
||||
|
||||
function submitForm() {
|
||||
if (activeChannelClaim && isInputValid) {
|
||||
const paramList = invitees.map((invitee) => {
|
||||
const inviteeInfo = invitee.split('#');
|
||||
const params: SblInvite = {
|
||||
blocked_list_id: id ? parseInt(id) : undefined,
|
||||
invitee_channel_name: inviteeInfo[0],
|
||||
invitee_channel_id: inviteeInfo[1],
|
||||
message,
|
||||
};
|
||||
return params;
|
||||
});
|
||||
|
||||
setError('');
|
||||
setSubmitting(true);
|
||||
doSblInvite(activeChannelClaim, paramList, handleInviteCompleted);
|
||||
}
|
||||
}
|
||||
|
||||
function handleInviteCompleted(error: string) {
|
||||
setSubmitting(false);
|
||||
if (error) {
|
||||
setError(error);
|
||||
} else {
|
||||
const multipleInvitees = invitees && invitees.length > 1;
|
||||
doToast({ message: multipleInvitees ? __('Invites sent.') : __('Invite sent.') });
|
||||
goBack();
|
||||
}
|
||||
}
|
||||
|
||||
function handleInviteeAdded(channelUri: string) {
|
||||
setInvitees([...invitees, channelUri]);
|
||||
}
|
||||
|
||||
function handleInviteeRemoved(channelUri: string) {
|
||||
setInvitees(invitees.filter((x) => x !== channelUri));
|
||||
}
|
||||
|
||||
return (
|
||||
<Page
|
||||
noSideNavigation
|
||||
className="main--half-width"
|
||||
backout={{
|
||||
backoutLabel: __('Cancel'),
|
||||
title: __('Invite'),
|
||||
}}
|
||||
>
|
||||
<Form onSubmit={submitForm}>
|
||||
<Card
|
||||
title={__('Invite others to use and contribute to this blocklist.')}
|
||||
subtitle={' '}
|
||||
className={submitting ? 'card--disabled' : ''}
|
||||
body={
|
||||
<>
|
||||
<SearchChannelField
|
||||
label={__('Invitees')}
|
||||
labelAddNew={__('Add invitee')}
|
||||
labelFoundAction={__('Add')}
|
||||
values={invitees}
|
||||
onAdd={handleInviteeAdded}
|
||||
onRemove={handleInviteeRemoved}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
label={__('Message')}
|
||||
type="textarea"
|
||||
name="message"
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
textAreaMaxLength={1000}
|
||||
noEmojis
|
||||
/>
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
label={submitting ? <Spinner type="small" /> : __('Send')}
|
||||
disabled={!isInputValid}
|
||||
button="primary"
|
||||
type="submit"
|
||||
/>
|
||||
<Button label={__('Cancel')} button="link" onClick={() => goBack()} />
|
||||
</div>
|
||||
{error && <div className="help--error">{__(error)}</div>}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</Form>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
@@ -505,6 +505,7 @@ export function doAnalyticsBuffer(uri, bufferData) {
|
||||
const fileSizeInBits = fileSize * 8;
|
||||
const bitRate = parseInt(fileSizeInBits / fileDurationInSeconds);
|
||||
const userId = user && user.id.toString();
|
||||
// if there's a logged in user, send buffer event data to watchman
|
||||
if (userId) {
|
||||
analytics.videoBufferEvent(claim, {
|
||||
timeAtBuffer,
|
||||
|
||||
+114
-267
@@ -3,7 +3,15 @@ import * as ACTIONS from 'constants/action_types';
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import { SORT_BY, BLOCK_LEVEL } from 'constants/comment';
|
||||
import { Lbry, parseURI, buildURI, selectClaimsByUri, selectMyChannelClaims, isURIEqual } from 'lbry-redux';
|
||||
import {
|
||||
Lbry,
|
||||
parseURI,
|
||||
buildURI,
|
||||
selectClaimsByUri,
|
||||
selectMyChannelClaims,
|
||||
isURIEqual,
|
||||
doClaimSearch,
|
||||
} from 'lbry-redux';
|
||||
import { doToast, doSeeNotifications } from 'redux/actions/notifications';
|
||||
import {
|
||||
makeSelectMyReactionsForComment,
|
||||
@@ -49,8 +57,6 @@ const ERR_MAP: CommentronErrorMap = {
|
||||
BLOCKED_BY_CREATOR: {
|
||||
commentron: 'channel is blocked by publisher',
|
||||
replacement: 'Unable to comment. This channel has blocked you.',
|
||||
linkText: 'Appeal',
|
||||
linkTarget: `/${PAGES.APPEAL_LIST_OFFENCES}`,
|
||||
},
|
||||
BLOCKED_BY_ADMIN: {
|
||||
commentron: 'channel is not allowed to post comments',
|
||||
@@ -64,12 +70,6 @@ const ERR_MAP: CommentronErrorMap = {
|
||||
commentron: 'duplicate comment!',
|
||||
replacement: 'Please do not spam.',
|
||||
},
|
||||
TIMEOUT_BANNED: {
|
||||
commentron: /^publisher (.*) has given you a temporary ban with (.*) remaining.$/,
|
||||
replacement: '%1% has given you a temporary ban with %2% remaining.', // TODO: The duration is not localizable.
|
||||
linkText: 'Appeal',
|
||||
linkTarget: `/${PAGES.APPEAL_LIST_OFFENCES}`,
|
||||
},
|
||||
};
|
||||
|
||||
function devToast(dispatch, msg) {
|
||||
@@ -135,7 +135,6 @@ export function doCommentList(
|
||||
type: ACTIONS.COMMENT_LIST_FAILED,
|
||||
data: 'unable to find claim for uri',
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,7 +146,7 @@ export function doCommentList(
|
||||
});
|
||||
|
||||
// Adding 'channel_id' and 'channel_name' enables "CreatorSettings > commentsEnabled".
|
||||
const authorChannelClaim = claim.value_type === 'channel' ? claim : claim.signing_channel;
|
||||
const creatorChannelClaim = claim.value_type === 'channel' ? claim : claim.signing_channel;
|
||||
|
||||
return Comments.comment_list({
|
||||
page,
|
||||
@@ -155,8 +154,8 @@ export function doCommentList(
|
||||
page_size: pageSize,
|
||||
parent_id: parentId || undefined,
|
||||
top_level: !parentId,
|
||||
channel_id: authorChannelClaim ? authorChannelClaim.claim_id : undefined,
|
||||
channel_name: authorChannelClaim ? authorChannelClaim.name : undefined,
|
||||
channel_id: creatorChannelClaim ? creatorChannelClaim.claim_id : undefined,
|
||||
channel_name: creatorChannelClaim ? creatorChannelClaim.name : undefined,
|
||||
sort_by: sortBy,
|
||||
})
|
||||
.then((result: CommentListResponse) => {
|
||||
@@ -170,7 +169,7 @@ export function doCommentList(
|
||||
totalFilteredItems: total_filtered_items,
|
||||
totalPages: total_pages,
|
||||
claimId: claimId,
|
||||
commenterClaimId: authorChannelClaim ? authorChannelClaim.claim_id : undefined,
|
||||
creatorClaimId: creatorChannelClaim ? creatorChannelClaim.claim_id : undefined,
|
||||
uri: uri,
|
||||
},
|
||||
});
|
||||
@@ -183,7 +182,7 @@ export function doCommentList(
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_LIST_COMPLETED,
|
||||
data: {
|
||||
authorClaimId: authorChannelClaim ? authorChannelClaim.claim_id : undefined,
|
||||
creatorClaimId: creatorChannelClaim ? creatorChannelClaim.claim_id : undefined,
|
||||
disabled: true,
|
||||
},
|
||||
});
|
||||
@@ -209,6 +208,103 @@ export function doCommentList(
|
||||
};
|
||||
}
|
||||
|
||||
export function doCommentListOwn(
|
||||
channelId: string,
|
||||
page: number = 1,
|
||||
pageSize: number = 99999,
|
||||
sortBy: number = SORT_BY.NEWEST_NO_PINS
|
||||
) {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const myChannelClaims = selectMyChannelClaims(state);
|
||||
if (!myChannelClaims) {
|
||||
console.error('Failed to fetch channel list.'); // eslint-disable-line
|
||||
return;
|
||||
}
|
||||
|
||||
const channelClaim = myChannelClaims.find((x) => x.claim_id === channelId);
|
||||
if (!channelClaim) {
|
||||
console.error('You do not own this channel.'); // eslint-disable-line
|
||||
return;
|
||||
}
|
||||
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
console.error('Failed to sign channel name.'); // eslint-disable-line
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_LIST_STARTED,
|
||||
data: {},
|
||||
});
|
||||
|
||||
return Comments.comment_list({
|
||||
page,
|
||||
page_size: pageSize,
|
||||
sort_by: sortBy,
|
||||
author_claim_id: channelId,
|
||||
requestor_channel_name: channelClaim.name,
|
||||
requestor_channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
})
|
||||
.then((result: CommentListResponse) => {
|
||||
const { items: comments, total_items, total_filtered_items, total_pages } = result;
|
||||
|
||||
if (!comments) {
|
||||
dispatch({ type: ACTIONS.COMMENT_LIST_FAILED, data: 'No more comments.' });
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(
|
||||
doClaimSearch({
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
no_totals: true,
|
||||
claim_ids: comments.map((c) => c.claim_id),
|
||||
})
|
||||
)
|
||||
.then((result) => {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_LIST_COMPLETED,
|
||||
data: {
|
||||
comments,
|
||||
totalItems: total_items,
|
||||
totalFilteredItems: total_filtered_items,
|
||||
totalPages: total_pages,
|
||||
uri: channelClaim.canonical_url, // hijack "Discussion Page"
|
||||
claimId: channelClaim.claim_id, // hijack "Discussion Page"
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch({ type: ACTIONS.COMMENT_LIST_FAILED, data: err });
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
switch (error.message) {
|
||||
case FETCH_API_FAILED_TO_FETCH:
|
||||
dispatch(
|
||||
doToast({
|
||||
isError: true,
|
||||
message: Comments.isCustomServer
|
||||
? __('Failed to fetch comments. Verify custom server settings.')
|
||||
: __('Failed to fetch comments.'),
|
||||
})
|
||||
);
|
||||
dispatch(doToast({ isError: true, message: `${error.message}` }));
|
||||
dispatch({ type: ACTIONS.COMMENT_LIST_FAILED, data: error });
|
||||
break;
|
||||
|
||||
default:
|
||||
dispatch(doToast({ isError: true, message: `${error.message}` }));
|
||||
dispatch({ type: ACTIONS.COMMENT_LIST_FAILED, data: error });
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doCommentById(commentId: string, toastIfNotFound: boolean = true) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
dispatch({
|
||||
@@ -247,17 +343,10 @@ export function doCommentById(commentId: string, toastIfNotFound: boolean = true
|
||||
};
|
||||
}
|
||||
|
||||
export function doCommentReset(uri: string) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const claim = selectClaimsByUri(state)[uri];
|
||||
const claimId = claim ? claim.claim_id : null;
|
||||
|
||||
export function doCommentReset(claimId: string) {
|
||||
return (dispatch: Dispatch) => {
|
||||
if (!claimId) {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_LIST_FAILED,
|
||||
data: 'unable to find claim for uri',
|
||||
});
|
||||
console.error(`Failed to reset comments`); //eslint-disable-line
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1632,245 +1721,3 @@ export const doFetchBlockedWords = () => {
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblUpdate = (channelClaim: ChannelClaim, params: SblUpdate, onComplete: (error: string) => void) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doSblUpdate: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
return Comments.sbl_update({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
...params,
|
||||
})
|
||||
.then(() => {
|
||||
if (onComplete) {
|
||||
onComplete('');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
if (onComplete) {
|
||||
onComplete(err.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblDelete = (channelClaim: ChannelClaim) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doSblDelete: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
return Comments.sbl_update({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
remove: true,
|
||||
})
|
||||
.then((resp) => {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_DELETED,
|
||||
});
|
||||
dispatch(doToast({ message: __('Shared blocklist deleted.') }));
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblGet = (channelClaim: ?ChannelClaim, params: SblGet) => {
|
||||
return async (dispatch: Dispatch, getState: GetState) => {
|
||||
let channelSignature;
|
||||
if (channelClaim) {
|
||||
channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doSblGet: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_FETCH_STARTED,
|
||||
});
|
||||
|
||||
const authParams =
|
||||
channelClaim && channelSignature
|
||||
? {
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
}
|
||||
: {};
|
||||
|
||||
return Comments.sbl_get({ ...authParams, ...params })
|
||||
.then((resp) => {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_FETCH_COMPLETED,
|
||||
data: resp,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.message !== 'blocked list not found') {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_FETCH_FAILED,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblInvite = (
|
||||
channelClaim: ChannelClaim,
|
||||
paramList: Array<SblInvite>,
|
||||
onComplete: (error: string) => void
|
||||
) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doSblInvite: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
// $FlowFixMe
|
||||
return Promise.allSettled(
|
||||
paramList.map((params) => {
|
||||
return Comments.sbl_invite({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
...params,
|
||||
});
|
||||
})
|
||||
)
|
||||
.then((results) => {
|
||||
const errors: Array<string> = [];
|
||||
results.forEach((result) => {
|
||||
if (result.status === 'rejected') {
|
||||
errors.push(result.reason.message);
|
||||
}
|
||||
});
|
||||
if (onComplete) {
|
||||
onComplete(errors.join(' • '));
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
if (onComplete) {
|
||||
onComplete(err.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblListInvites = (channelClaim: ChannelClaim) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'SBL Invite: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_FETCH_INVITES_STARTED,
|
||||
});
|
||||
|
||||
return Comments.sbl_list_invites({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
})
|
||||
.then((resp) => {
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_FETCH_INVITES_COMPLETED,
|
||||
data: resp,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
dispatch({
|
||||
type: ACTIONS.COMMENT_SBL_FETCH_INVITES_FAILED,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblAccept = (
|
||||
channelClaim: ChannelClaim,
|
||||
params: SblInviteAccept,
|
||||
onComplete: (error: string) => void
|
||||
) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doSblAccept: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
return Comments.sbl_accept({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
...params,
|
||||
})
|
||||
.then((resp) => {
|
||||
if (onComplete) {
|
||||
onComplete('');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
if (onComplete) {
|
||||
onComplete(err.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const doSblRescind = (channelClaim: ChannelClaim, params: SblRescind, onComplete: (error: string) => void) => {
|
||||
return async (dispatch: Dispatch) => {
|
||||
const channelSignature = await channelSignName(channelClaim.claim_id, channelClaim.name);
|
||||
if (!channelSignature) {
|
||||
devToast(dispatch, 'doSblRescind: failed to sign channel name');
|
||||
return;
|
||||
}
|
||||
|
||||
return Comments.sbl_rescind({
|
||||
channel_name: channelClaim.name,
|
||||
channel_id: channelClaim.claim_id,
|
||||
signature: channelSignature.signature,
|
||||
signing_ts: channelSignature.signing_ts,
|
||||
...params,
|
||||
})
|
||||
.then((resp) => {
|
||||
if (onComplete) {
|
||||
onComplete('');
|
||||
}
|
||||
dispatch(
|
||||
doToast({ message: __('Membership for %member% rescinded.', { member: params.invited_channel_name }) })
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
dispatch(doToast({ message: err.message, isError: true }));
|
||||
if (onComplete) {
|
||||
onComplete(err.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
SETTINGS,
|
||||
makeSelectFileInfoForUri,
|
||||
selectFileInfosByOutpoint,
|
||||
doPurchaseUri,
|
||||
makeSelectUriIsStreamable,
|
||||
selectDownloadingByOutpoint,
|
||||
makeSelectClaimForUri,
|
||||
@@ -19,6 +18,7 @@ import {
|
||||
doToast,
|
||||
makeSelectUrlsForCollectionId,
|
||||
} from 'lbry-redux';
|
||||
import { doPurchaseUri } from 'redux/actions/file';
|
||||
import { makeSelectCostInfoForUri, Lbryio } from 'lbryinc';
|
||||
import { makeSelectClientSetting, selectosNotificationsEnabled, selectDaemonSettings } from 'redux/selectors/settings';
|
||||
|
||||
@@ -117,8 +117,8 @@ export function doSetPlayingUri({
|
||||
uri: ?string,
|
||||
source?: string,
|
||||
commentId?: string,
|
||||
pathname: string,
|
||||
collectionId: string,
|
||||
pathname?: string,
|
||||
collectionId?: string,
|
||||
}) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
@@ -140,7 +140,7 @@ export function doPurchaseUriWrapper(uri: string, cost: number, saveFile: boolea
|
||||
}
|
||||
}
|
||||
|
||||
dispatch(doPurchaseUri(uri, { costInfo: cost }, saveFile, onSuccess));
|
||||
dispatch(doPurchaseUri(uri, { cost }, saveFile, onSuccess));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+137
-7
@@ -1,3 +1,4 @@
|
||||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
// @if TARGET='app'
|
||||
import { shell } from 'electron';
|
||||
@@ -7,22 +8,28 @@ import {
|
||||
batchActions,
|
||||
doAbandonClaim,
|
||||
makeSelectFileInfoForUri,
|
||||
selectDownloadingByOutpoint,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectClaimForUri,
|
||||
selectBalance,
|
||||
ABANDON_STATES,
|
||||
} from 'lbry-redux';
|
||||
import { doHideModal } from 'redux/actions/app';
|
||||
import { goBack } from 'connected-react-router';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectPlayingUri } from 'redux/selectors/content';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
type Dispatch = (action: any) => any;
|
||||
type GetState = () => { file: FileState };
|
||||
|
||||
export function doOpenFileInFolder(path) {
|
||||
export function doOpenFileInFolder(path: string) {
|
||||
return () => {
|
||||
shell.showItemInFolder(path);
|
||||
};
|
||||
}
|
||||
|
||||
export function doOpenFileInShell(path) {
|
||||
return (dispatch) => {
|
||||
export function doOpenFileInShell(path: string) {
|
||||
return (dispatch: Dispatch) => {
|
||||
const success = shell.openPath(path);
|
||||
if (!success) {
|
||||
dispatch(doOpenFileInFolder(path));
|
||||
@@ -30,8 +37,8 @@ export function doOpenFileInShell(path) {
|
||||
};
|
||||
}
|
||||
|
||||
export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim, cb) {
|
||||
return (dispatch) => {
|
||||
export function doDeleteFile(outpoint: string, deleteFromComputer?: boolean, abandonClaim?: boolean, cb: any) {
|
||||
return (dispatch: Dispatch) => {
|
||||
if (abandonClaim) {
|
||||
const [txid, nout] = outpoint.split(':');
|
||||
dispatch(doAbandonClaim(txid, Number(nout), cb));
|
||||
@@ -53,8 +60,13 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim, cb) {
|
||||
};
|
||||
}
|
||||
|
||||
export function doDeleteFileAndMaybeGoBack(uri, deleteFromComputer, abandonClaim, doGoBack) {
|
||||
return (dispatch, getState) => {
|
||||
export function doDeleteFileAndMaybeGoBack(
|
||||
uri: string,
|
||||
deleteFromComputer?: boolean,
|
||||
abandonClaim?: boolean,
|
||||
doGoBack: (any) => void
|
||||
) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const playingUri = selectPlayingUri(state);
|
||||
const { outpoint } = makeSelectFileInfoForUri(uri)(state) || '';
|
||||
@@ -88,3 +100,121 @@ export function doDeleteFileAndMaybeGoBack(uri, deleteFromComputer, abandonClaim
|
||||
dispatch(batchActions(...actions));
|
||||
};
|
||||
}
|
||||
|
||||
export function doFileGet(uri: string, saveFile: boolean = true, onSuccess?: (GetResponse) => any) {
|
||||
return (dispatch: Dispatch, getState: () => any) => {
|
||||
const state = getState();
|
||||
const { nout, txid } = makeSelectClaimForUri(uri)(state);
|
||||
const outpoint = `${txid}:${nout}`;
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FILE_INFO_STARTED,
|
||||
data: {
|
||||
outpoint,
|
||||
},
|
||||
});
|
||||
|
||||
// set save_file argument to True to save the file (old behaviour)
|
||||
Lbry.get({ uri, save_file: saveFile })
|
||||
.then((streamInfo: GetResponse) => {
|
||||
const timeout = streamInfo === null || typeof streamInfo !== 'object' || streamInfo.error === 'Timeout';
|
||||
if (timeout) {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FILE_INFO_FAILED,
|
||||
data: { outpoint },
|
||||
});
|
||||
|
||||
dispatch(doToast({ message: `File timeout for uri ${uri}`, isError: true }));
|
||||
} else {
|
||||
if (streamInfo.purchase_receipt || streamInfo.content_fee) {
|
||||
dispatch({
|
||||
type: ACTIONS.PURCHASE_URI_COMPLETED,
|
||||
data: { uri, purchaseReceipt: streamInfo.purchase_receipt || streamInfo.content_fee },
|
||||
});
|
||||
}
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FILE_INFO_COMPLETED,
|
||||
data: {
|
||||
fileInfo: streamInfo,
|
||||
outpoint: outpoint,
|
||||
},
|
||||
});
|
||||
|
||||
if (onSuccess) {
|
||||
onSuccess(streamInfo);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
dispatch({
|
||||
type: ACTIONS.PURCHASE_URI_FAILED,
|
||||
data: { uri, error },
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_FILE_INFO_FAILED,
|
||||
data: { outpoint },
|
||||
});
|
||||
|
||||
dispatch(
|
||||
doToast({
|
||||
message: `Failed to view ${uri}, please try again. If this problem persists, visit https://lbry.com/faq/support for support.`,
|
||||
isError: true,
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doPurchaseUri(
|
||||
uri: string,
|
||||
costInfo: { cost: number },
|
||||
saveFile: boolean = true,
|
||||
onSuccess?: (GetResponse) => any
|
||||
) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
dispatch({
|
||||
type: ACTIONS.PURCHASE_URI_STARTED,
|
||||
data: { uri },
|
||||
});
|
||||
|
||||
const state = getState();
|
||||
const balance = selectBalance(state);
|
||||
const fileInfo = makeSelectFileInfoForUri(uri)(state);
|
||||
const downloadingByOutpoint = selectDownloadingByOutpoint(state);
|
||||
const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint];
|
||||
const alreadyStreaming = makeSelectStreamingUrlForUri(uri)(state);
|
||||
|
||||
if (!saveFile && (alreadyDownloading || alreadyStreaming)) {
|
||||
dispatch({
|
||||
type: ACTIONS.PURCHASE_URI_FAILED,
|
||||
data: { uri, error: `Already fetching uri: ${uri}` },
|
||||
});
|
||||
|
||||
if (onSuccess) {
|
||||
onSuccess(fileInfo);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const { cost } = costInfo;
|
||||
if (parseFloat(cost) > balance) {
|
||||
dispatch({
|
||||
type: ACTIONS.PURCHASE_URI_FAILED,
|
||||
data: { uri, error: 'Insufficient credits' },
|
||||
});
|
||||
|
||||
Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(doFileGet(uri, saveFile, onSuccess));
|
||||
};
|
||||
}
|
||||
|
||||
export function doClearPurchasedUriSuccess() {
|
||||
return {
|
||||
type: ACTIONS.CLEAR_PURCHASED_URI_SUCCESS,
|
||||
};
|
||||
}
|
||||
@@ -48,10 +48,6 @@ const defaultState: CommentsState = {
|
||||
settingsByChannelId: {}, // ChannelId -> PerChannelSettings
|
||||
fetchingSettings: false,
|
||||
fetchingBlockedWords: false,
|
||||
sblMine: undefined,
|
||||
sblInvited: [],
|
||||
fetchingSblMine: false,
|
||||
fetchingSblInvited: false,
|
||||
};
|
||||
|
||||
function pushToArrayInObject(obj, key, valueToPush) {
|
||||
@@ -250,7 +246,7 @@ export default handleActions(
|
||||
claimId,
|
||||
uri,
|
||||
disabled,
|
||||
commenterClaimId,
|
||||
creatorClaimId,
|
||||
} = action.data;
|
||||
|
||||
const commentById = Object.assign({}, state.commentById);
|
||||
@@ -266,8 +262,8 @@ export default handleActions(
|
||||
const isLoadingByParentId = Object.assign({}, state.isLoadingByParentId);
|
||||
const settingsByChannelId = Object.assign({}, state.settingsByChannelId);
|
||||
|
||||
settingsByChannelId[commenterClaimId] = {
|
||||
...(settingsByChannelId[commenterClaimId] || {}),
|
||||
settingsByChannelId[creatorClaimId] = {
|
||||
...(settingsByChannelId[creatorClaimId] || {}),
|
||||
comments_enabled: !disabled,
|
||||
};
|
||||
|
||||
@@ -1076,45 +1072,6 @@ export default handleActions(
|
||||
fetchingBlockedWords: false,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.COMMENT_SBL_FETCH_STARTED]: (state: CommentsState) => ({
|
||||
...state,
|
||||
fetchingSblMine: true,
|
||||
}),
|
||||
[ACTIONS.COMMENT_SBL_FETCH_FAILED]: (state: CommentsState) => ({
|
||||
...state,
|
||||
sblMine: null,
|
||||
fetchingSblMine: false,
|
||||
}),
|
||||
[ACTIONS.COMMENT_SBL_FETCH_COMPLETED]: (state: CommentsState, action: any) => {
|
||||
return {
|
||||
...state,
|
||||
sblMine: action.data,
|
||||
fetchingSblMine: false,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.COMMENT_SBL_FETCH_INVITES_STARTED]: (state: CommentsState) => ({
|
||||
...state,
|
||||
fetchingSblInvited: true,
|
||||
}),
|
||||
[ACTIONS.COMMENT_SBL_FETCH_INVITES_FAILED]: (state: CommentsState) => ({
|
||||
...state,
|
||||
sblInvited: null,
|
||||
fetchingSblInvited: false,
|
||||
}),
|
||||
[ACTIONS.COMMENT_SBL_FETCH_INVITES_COMPLETED]: (state: CommentsState, action: any) => {
|
||||
return {
|
||||
...state,
|
||||
sblInvited: action.data.invitations,
|
||||
fetchingSblInvited: false,
|
||||
};
|
||||
},
|
||||
|
||||
[ACTIONS.COMMENT_SBL_DELETED]: (state: CommentsState) => ({
|
||||
...state,
|
||||
sblMine: null,
|
||||
}),
|
||||
},
|
||||
defaultState
|
||||
);
|
||||
@@ -406,8 +406,3 @@ export const makeSelectSuperChatTotalAmountForUri = (uri: string) =>
|
||||
|
||||
return superChatData.totalAmount;
|
||||
});
|
||||
|
||||
export const selectFetchingSblMine = createSelector(selectState, (state) => state.fetchingSblMine);
|
||||
export const selectFetchingSblInvited = createSelector(selectState, (state) => state.fetchingSblInvited);
|
||||
export const selectSblMine = createSelector(selectState, (state) => state.sblMine);
|
||||
export const selectSblInvited = createSelector(selectState, (state) => state.sblInvited);
|
||||
@@ -83,55 +83,3 @@
|
||||
white-space: pre-line;
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
|
||||
.sbl-edit {
|
||||
.section__flex {
|
||||
fieldset-section {
|
||||
margin-top: 0;
|
||||
margin-right: var(--spacing-m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sbl {
|
||||
.table {
|
||||
width: 95%;
|
||||
margin-left: var(--spacing-m);
|
||||
}
|
||||
}
|
||||
|
||||
.sbl-info {
|
||||
.button--link {
|
||||
margin-top: var(--spacing-m);
|
||||
width: 100%;
|
||||
|
||||
.button__content {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sbl_invite_expired {
|
||||
align-self: flex-end;
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
.sbl_invite_accepted {
|
||||
align-self: flex-end;
|
||||
color: #2bbb90;
|
||||
}
|
||||
|
||||
.sbl-status--active {
|
||||
font-size: var(--font-small);
|
||||
padding: 2px 8px;
|
||||
border-radius: 5px;
|
||||
font-style: italic;
|
||||
color: white;
|
||||
background: #2bbb90;
|
||||
}
|
||||
|
||||
.sbl-status--inactive {
|
||||
@extend .sbl-status--active;
|
||||
background: var(--color-gray-5);
|
||||
}
|
||||
@@ -20,10 +20,6 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card--disable-interaction {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card--section {
|
||||
position: relative;
|
||||
padding: var(--spacing-m);
|
||||
|
||||
@@ -200,6 +200,9 @@ $thumbnailWidthSmall: 1rem;
|
||||
}
|
||||
|
||||
.comment__body-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
margin-left: var(--spacing-xs);
|
||||
|
||||
@@ -487,3 +490,60 @@ $thumbnailWidthSmall: 1rem;
|
||||
margin-bottom: -3px; // TODO fix few instances of these (find "-2px")
|
||||
}
|
||||
}
|
||||
|
||||
.comments-own {
|
||||
.section__actions {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.comments-own--claim {
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
min-width: 40%;
|
||||
max-width: 40%;
|
||||
}
|
||||
|
||||
.media__thumb {
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
$width: 5rem;
|
||||
@include handleClaimListGifThumbnail($width);
|
||||
width: $width;
|
||||
height: calc(#{$width} * (9 / 16));
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
|
||||
.channel-thumbnail {
|
||||
@include handleChannelGif(calc(5rem * 9 / 16));
|
||||
margin-right: var(--spacing-xs);
|
||||
|
||||
@media (min-width: $breakpoint-small) {
|
||||
@include handleChannelGif(calc(5rem * 9 / 16));
|
||||
margin-right: var(--spacing-s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.claim-preview__wrapper {
|
||||
margin: 0 0;
|
||||
padding: 0;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: 0 var(--spacing-xs);
|
||||
}
|
||||
}
|
||||
|
||||
.comment {
|
||||
margin-top: var(--spacing-s);
|
||||
margin-left: 0;
|
||||
padding-left: var(--spacing-m);
|
||||
border-left: 4px solid var(--color-border);
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin-top: 0;
|
||||
margin-left: var(--spacing-s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -454,10 +454,6 @@ fieldset-group {
|
||||
margin-bottom: var(--spacing-s);
|
||||
}
|
||||
|
||||
.form-field__textarea-info:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.form-field__quick-emojis {
|
||||
> *:not(:last-child) {
|
||||
margin-right: var(--spacing-s);
|
||||
|
||||
@@ -27,8 +27,6 @@ $recent-msg-button__height: 2rem;
|
||||
|
||||
.livestream__discussion {
|
||||
width: 100%;
|
||||
margin-top: var(--spacing-m);
|
||||
margin-bottom: var(--spacing-s);
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: 0;
|
||||
|
||||
@@ -207,17 +207,43 @@
|
||||
}
|
||||
|
||||
.main--livestream {
|
||||
width: calc(100vw - var(--spacing-xs) * 2);
|
||||
margin: var(--spacing-xs);
|
||||
@extend .main--file-page;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
max-width: none;
|
||||
|
||||
@media (min-width: $breakpoint-medium) {
|
||||
margin: var(--spacing-m);
|
||||
margin-right: calc(var(--livestream-comments-width) + var(--spacing-m));
|
||||
width: calc(100vw - var(--livestream-comments-width) - var(--spacing-m) * 2);
|
||||
.card-stack {
|
||||
margin-top: var(--spacing-m);
|
||||
margin-bottom: var(--spacing-m);
|
||||
|
||||
@media (min-width: $breakpoint-large + 300px) {
|
||||
max-width: calc(var(--page-max-width--filepage) / 1.25);
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
@media (min-width: $breakpoint-medium) and (max-width: $breakpoint-large + 300px) {
|
||||
max-width: calc(100vw - var(--livestream-comments-width) - var(--spacing-m) * 3);
|
||||
margin-left: var(--spacing-m);
|
||||
margin-right: var(--spacing-m);
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-medium) {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: $breakpoint-large) {
|
||||
margin-right: calc(10vw + var(--livestream-comments-width) + var(--spacing-m));
|
||||
.main__right-side {
|
||||
width: var(--livestream-comments-width);
|
||||
|
||||
@media (max-width: $breakpoint-medium) {
|
||||
width: 100%;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-medium) {
|
||||
padding: 0 var(--spacing-m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,11 +364,6 @@
|
||||
max-width: 40rem;
|
||||
}
|
||||
|
||||
.main--half-width {
|
||||
@extend .main;
|
||||
max-width: calc(var(--page-max-width) / 2);
|
||||
}
|
||||
|
||||
.main--empty {
|
||||
align-self: center;
|
||||
display: flex;
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
}
|
||||
|
||||
.snack-bar__message {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -64,3 +62,8 @@
|
||||
min-width: 1rem;
|
||||
}
|
||||
}
|
||||
.snack-bar__messageText {
|
||||
min-width: 0;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -275,13 +275,3 @@ td {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table--no-row-lines {
|
||||
tr {
|
||||
&:not(:last-of-type) {
|
||||
td {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
const imageAddr = 'https://upload.wikimedia.org/wikipedia/commons/b/b9/Pizigani_1367_Chart_1MB.jpg';
|
||||
const downloadSize = 1093957; // this must match with the image above
|
||||
|
||||
let startTime, endTime;
|
||||
async function measureConnectionSpeed() {
|
||||
startTime = (new Date()).getTime();
|
||||
const cacheBuster = '?nnn=' + startTime;
|
||||
|
||||
const download = new Image();
|
||||
download.src = imageAddr + cacheBuster;
|
||||
// this returns when the image is finished downloading
|
||||
await download.decode();
|
||||
endTime = (new Date()).getTime();
|
||||
const duration = (endTime - startTime) / 1000;
|
||||
const bitsLoaded = downloadSize * 8;
|
||||
const speedBps = (bitsLoaded / duration).toFixed(2);
|
||||
return Math.round(Number(speedBps));
|
||||
}
|
||||
|
||||
module.exports = measureConnectionSpeed;
|
||||
@@ -3,7 +3,7 @@ import visit from 'unist-util-visit';
|
||||
|
||||
const protocol = 'lbry://';
|
||||
const uriRegex = /(lbry:\/\/)[^\s"]*[^)]/g;
|
||||
const punctuationMarks = [',', '.', '!', '?', ':', ';', '-', ']', ')', '}'];
|
||||
export const punctuationMarks = [',', '.', '!', '?', ':', ';', '-', ']', ')', '}'];
|
||||
|
||||
const mentionToken = '@';
|
||||
// const mentionTokenCode = 64; // @
|
||||
|
||||
@@ -3,11 +3,3 @@
|
||||
export function toCapitalCase(string: string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
export function getHoursStr(hours: number) {
|
||||
return hours <= 0 ? '---' : hours === 1 ? __('1 hour') : __('%value% hours', { value: hours });
|
||||
}
|
||||
|
||||
export function getYesNoStr(state: boolean) {
|
||||
return state ? __('Yes') : __('No');
|
||||
}
|
||||
@@ -8,7 +8,8 @@ const STATIC_ASSET_PATHS = [
|
||||
'/public/font/v1/400i.woff',
|
||||
'/public/font/v1/700.woff',
|
||||
'/public/font/v1/700i.woff',
|
||||
'/public/favicon.png',
|
||||
'/public/favicon.png', // LBRY icon
|
||||
'/public/favicon-spaceman.png',
|
||||
'/public/img/busy.gif',
|
||||
'/public/img/fileRenderPlaceholder.png',
|
||||
'/public/img/gerbil-happy.png',
|
||||
|
||||
@@ -53,6 +53,11 @@ module.exports.CATEGORY_METADATA = {
|
||||
description: 'All the songs, reviews, covers, and how-tos you love on Odysee',
|
||||
image: 'https://spee.ch/category-music:8.jpg?quality=80&height=1200&width=630',
|
||||
},
|
||||
[PAGES.TECH]: {
|
||||
title: 'Tech',
|
||||
description: 'Hardware, software, startups, photography on Odysee',
|
||||
image: '',
|
||||
},
|
||||
[PAGES.TECHNOLOGY]: {
|
||||
title: 'Tech',
|
||||
description: 'Hardware, software, startups, photography on Odysee',
|
||||
|
||||
+4
-3
@@ -74,11 +74,12 @@ function getCategoryMeta(path) {
|
||||
// Normal metadata with option to override certain values
|
||||
//
|
||||
function buildOgMetadata(overrideOptions = {}) {
|
||||
const { title, description, image } = overrideOptions;
|
||||
const { title, description, image, path } = overrideOptions;
|
||||
const cleanDescription = removeMd(description || SITE_DESCRIPTION);
|
||||
const head =
|
||||
`<title>${SITE_TITLE}</title>\n` +
|
||||
`<meta property="og:url" content="${URL}" />\n` +
|
||||
`<meta name="description" content="${cleanDescription}" />\n` +
|
||||
`<meta property="og:url" content="${path ? `${URL}${path}` : URL}" />\n` +
|
||||
`<meta property="og:title" content="${title || OG_HOMEPAGE_TITLE || SITE_TITLE}" />\n` +
|
||||
`<meta property="og:site_name" content="${SITE_NAME || SITE_TITLE}"/>\n` +
|
||||
`<meta property="og:description" content="${cleanDescription}" />\n` +
|
||||
@@ -90,7 +91,6 @@ function buildOgMetadata(overrideOptions = {}) {
|
||||
}" />\n` +
|
||||
`<meta name="twitter:description" content="${cleanDescription}" />\n` +
|
||||
`<meta name="twitter:image" content="${image || OG_IMAGE_URL || `${URL}/public/v2-og.png`}"/>\n` +
|
||||
`<meta name="twitter:url" content="${URL}" />\n` +
|
||||
'<meta property="fb:app_id" content="1673146449633983" />\n' +
|
||||
`<link rel="canonical" content="${SITE_CANONICAL_URL || URL}"/>` +
|
||||
`<link rel="search" type="application/opensearchdescription+xml" title="${
|
||||
@@ -347,6 +347,7 @@ async function getHtml(ctx) {
|
||||
title: categoryMeta.title,
|
||||
description: categoryMeta.description,
|
||||
image: categoryMeta.image,
|
||||
path: requestPath,
|
||||
});
|
||||
return insertToHead(html, categoryPageMetadata);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@ const copyWebpackCommands = [
|
||||
to: `${DIST_ROOT}/public/favicon.png`,
|
||||
force: true,
|
||||
},
|
||||
{
|
||||
from: `${STATIC_ROOT}/img/favicon-spaceman.png`,
|
||||
to: `${DIST_ROOT}/public/favicon-spaceman.png`,
|
||||
force: true,
|
||||
},
|
||||
{
|
||||
from: `${STATIC_ROOT}/img/v2-og.png`,
|
||||
to: `${DIST_ROOT}/public/v2-og.png`,
|
||||
@@ -144,7 +149,7 @@ const webConfig = {
|
||||
test: /\.jsx?$/,
|
||||
options: {
|
||||
presets: ['@babel/env', '@babel/react', '@babel/flow'],
|
||||
plugins: ['@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-class-properties'],
|
||||
plugins: ['@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-proposal-class-properties'],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -329,6 +329,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375"
|
||||
integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==
|
||||
|
||||
"@babel/helper-plugin-utils@^7.14.5":
|
||||
version "7.14.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz#5ac822ce97eec46741ab70a517971e443a70c5a9"
|
||||
integrity sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==
|
||||
|
||||
"@babel/helper-remap-async-to-generator@^7.12.1":
|
||||
version "7.12.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.12.1.tgz#8c4dbbf916314f6047dc05e6a2217074238347fd"
|
||||
@@ -390,6 +395,13 @@
|
||||
dependencies:
|
||||
"@babel/types" "^7.12.1"
|
||||
|
||||
"@babel/helper-skip-transparent-expression-wrappers@^7.14.5":
|
||||
version "7.15.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.15.4.tgz#707dbdba1f4ad0fa34f9114fc8197aec7d5da2eb"
|
||||
integrity sha512-BMRLsdh+D1/aap19TycS4eD1qELGrCBJwzaY9IE8LrpJtJb+H7rQkPIdsfgnMtLBA6DJls7X9z93Z4U8h7xw0A==
|
||||
dependencies:
|
||||
"@babel/types" "^7.15.4"
|
||||
|
||||
"@babel/helper-split-export-declaration@^7.10.1":
|
||||
version "7.10.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.1.tgz#c6f4be1cbc15e3a868e4c64a17d5d31d754da35f"
|
||||
@@ -426,6 +438,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed"
|
||||
integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
|
||||
|
||||
"@babel/helper-validator-identifier@^7.14.9":
|
||||
version "7.15.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389"
|
||||
integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==
|
||||
|
||||
"@babel/helper-validator-option@^7.12.1", "@babel/helper-validator-option@^7.12.11":
|
||||
version "7.12.11"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.11.tgz#d66cb8b7a3e7fe4c6962b32020a131ecf0847f4f"
|
||||
@@ -590,6 +607,15 @@
|
||||
"@babel/helper-skip-transparent-expression-wrappers" "^7.12.1"
|
||||
"@babel/plugin-syntax-optional-chaining" "^7.8.0"
|
||||
|
||||
"@babel/plugin-proposal-optional-chaining@^7.14.5":
|
||||
version "7.14.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.14.5.tgz#fa83651e60a360e3f13797eef00b8d519695b603"
|
||||
integrity sha512-ycz+VOzo2UbWNI1rQXxIuMOzrDdHGrI23fRiz/Si2R4kv2XZQ1BK8ccdHwehMKBlcH/joGW/tzrUmo67gbJHlQ==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.14.5"
|
||||
"@babel/helper-skip-transparent-expression-wrappers" "^7.14.5"
|
||||
"@babel/plugin-syntax-optional-chaining" "^7.8.3"
|
||||
|
||||
"@babel/plugin-proposal-private-methods@^7.12.1":
|
||||
version "7.12.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.1.tgz#86814f6e7a21374c980c10d38b4493e703f4a389"
|
||||
@@ -694,7 +720,7 @@
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.8.0"
|
||||
|
||||
"@babel/plugin-syntax-optional-chaining@^7.8.0":
|
||||
"@babel/plugin-syntax-optional-chaining@^7.8.0", "@babel/plugin-syntax-optional-chaining@^7.8.3":
|
||||
version "7.8.3"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a"
|
||||
integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==
|
||||
@@ -1230,6 +1256,14 @@
|
||||
lodash "^4.17.19"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@babel/types@^7.15.4":
|
||||
version "7.15.6"
|
||||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f"
|
||||
integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig==
|
||||
dependencies:
|
||||
"@babel/helper-validator-identifier" "^7.14.9"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@datapunt/matomo-tracker-js@^0.1.4":
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@datapunt/matomo-tracker-js/-/matomo-tracker-js-0.1.4.tgz#1226f0964d2c062bf9392e9c2fd89838262b10df"
|
||||
@@ -16391,9 +16425,9 @@ url-parse-lax@^3.0.0:
|
||||
prepend-http "^2.0.0"
|
||||
|
||||
url-parse@^1.1.1, url-parse@^1.1.8, url-parse@^1.4.3:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.1.tgz#d5fa9890af8a5e1f274a2c98376510f6425f6e3b"
|
||||
integrity sha512-HOfCOUJt7iSYzEx/UqgtwKRMC6EU91NFhsCHMv9oM03VJcVo2Qrp8T8kI9D7amFf1cu+/3CEhgb3rF9zL7k85Q==
|
||||
version "1.5.3"
|
||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862"
|
||||
integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==
|
||||
dependencies:
|
||||
querystringify "^2.1.1"
|
||||
requires-port "^1.0.0"
|
||||
|
||||
Reference in new issue
Block a user