- Add a system-level tag for scheduled live streams
- Query for that tag in the upcoming section - Improve special tag organization - Filter out the internal tags in the UI - Add missing types to publish state
This commit is contained in:
parent
0ccf9f2c05
commit
356c5bf30f
6 changed files with 32 additions and 14 deletions
|
@ -8,6 +8,7 @@ import { useIsMediumScreen, useIsLargeScreen } from 'effects/use-screensize';
|
||||||
import ClaimListDiscover from 'component/claimListDiscover';
|
import ClaimListDiscover from 'component/claimListDiscover';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { LIVESTREAM_UPCOMING_BUFFER } from 'constants/livestream';
|
import { LIVESTREAM_UPCOMING_BUFFER } from 'constants/livestream';
|
||||||
|
import { SCHEDULED_LIVESTREAM_TAG } from 'constants/tags';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
channelIds: Array<string>,
|
channelIds: Array<string>,
|
||||||
|
@ -40,6 +41,7 @@ const ScheduledStreams = (props: Props) => {
|
||||||
return (
|
return (
|
||||||
<div className={'mb-xl'} style={{ display: showUpcomingLivestreams ? 'block' : 'none' }}>
|
<div className={'mb-xl'} style={{ display: showUpcomingLivestreams ? 'block' : 'none' }}>
|
||||||
<ClaimListDiscover
|
<ClaimListDiscover
|
||||||
|
tags={[SCHEDULED_LIVESTREAM_TAG]}
|
||||||
useSkeletonScreen={false}
|
useSkeletonScreen={false}
|
||||||
channelIds={channelIds}
|
channelIds={channelIds}
|
||||||
limitClaimsPerChannel={limitClaimsPerChannel}
|
limitClaimsPerChannel={limitClaimsPerChannel}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Tag from 'component/tag';
|
||||||
import { setUnion, setDifference } from 'util/set-operations';
|
import { setUnion, setDifference } from 'util/set-operations';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import analytics from 'analytics';
|
import analytics from 'analytics';
|
||||||
import { UTILITY_TAGS } from 'constants/tags';
|
import { CONTROL_TAGS, INTERNAL_TAGS } from 'constants/tags';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tagsPassedIn: Array<Tag>,
|
tagsPassedIn: Array<Tag>,
|
||||||
|
@ -79,7 +79,7 @@ export default function TagsSearch(props: Props) {
|
||||||
const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet);
|
const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet);
|
||||||
const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet);
|
const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet);
|
||||||
|
|
||||||
const SPECIAL_TAGS = [...UTILITY_TAGS, 'lbry-first', 'mature'];
|
const SPECIAL_TAGS = [...INTERNAL_TAGS, 'mature'];
|
||||||
let countWithoutSpecialTags = selectedTagsSet.size;
|
let countWithoutSpecialTags = selectedTagsSet.size;
|
||||||
|
|
||||||
SPECIAL_TAGS.forEach((t) => {
|
SPECIAL_TAGS.forEach((t) => {
|
||||||
|
@ -179,7 +179,7 @@ export default function TagsSearch(props: Props) {
|
||||||
{countWithoutSpecialTags === 0 && <Tag key={`placeholder-tag`} name={'example'} disabled type={'remove'} />}
|
{countWithoutSpecialTags === 0 && <Tag key={`placeholder-tag`} name={'example'} disabled type={'remove'} />}
|
||||||
{Boolean(tagsPassedIn.length) &&
|
{Boolean(tagsPassedIn.length) &&
|
||||||
tagsPassedIn
|
tagsPassedIn
|
||||||
.filter((t) => !UTILITY_TAGS.includes(t.name))
|
.filter((t) => !INTERNAL_TAGS.includes(t.name))
|
||||||
.map((tag) => (
|
.map((tag) => (
|
||||||
<Tag
|
<Tag
|
||||||
key={`passed${tag.name}`}
|
key={`passed${tag.name}`}
|
||||||
|
@ -234,7 +234,7 @@ export default function TagsSearch(props: Props) {
|
||||||
onSelect && ( // onSelect ensures this does not appear on TagFollow
|
onSelect && ( // onSelect ensures this does not appear on TagFollow
|
||||||
<fieldset-section>
|
<fieldset-section>
|
||||||
<label>{__('Control Tags')}</label>
|
<label>{__('Control Tags')}</label>
|
||||||
{UTILITY_TAGS.map((t) => (
|
{CONTROL_TAGS.map((t) => (
|
||||||
<FormField
|
<FormField
|
||||||
key={t}
|
key={t}
|
||||||
name={t}
|
name={t}
|
||||||
|
|
|
@ -16,8 +16,16 @@ export const DEFAULT_FOLLOWED_TAGS = [
|
||||||
export const DISABLE_COMMENTS_TAG = 'disable-comments';
|
export const DISABLE_COMMENTS_TAG = 'disable-comments';
|
||||||
export const DISABLE_SUPPORT_TAG = 'disable-support';
|
export const DISABLE_SUPPORT_TAG = 'disable-support';
|
||||||
export const PREFERENCE_EMBED = 'preference-embed';
|
export const PREFERENCE_EMBED = 'preference-embed';
|
||||||
|
export const SCHEDULED_LIVESTREAM_TAG = 'scheduled-livestream';
|
||||||
|
export const LBRY_FIRST_TAG = 'lbry-first';
|
||||||
|
|
||||||
export const UTILITY_TAGS = [DISABLE_COMMENTS_TAG, DISABLE_SUPPORT_TAG, PREFERENCE_EMBED];
|
// Control tags are special tags that are available to the user in some situations.
|
||||||
|
export const CONTROL_TAGS = [DISABLE_COMMENTS_TAG, DISABLE_SUPPORT_TAG, PREFERENCE_EMBED];
|
||||||
|
|
||||||
|
// System tags are special tags that are not available to the user.
|
||||||
|
export const SYSTEM_TAGS = [SCHEDULED_LIVESTREAM_TAG, LBRY_FIRST_TAG];
|
||||||
|
|
||||||
|
export const INTERNAL_TAGS = [...CONTROL_TAGS, ...SYSTEM_TAGS];
|
||||||
|
|
||||||
export const MATURE_TAGS = [
|
export const MATURE_TAGS = [
|
||||||
'porn',
|
'porn',
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { creditsToString } from 'util/format-credits';
|
||||||
import Lbry from 'lbry';
|
import Lbry from 'lbry';
|
||||||
// import LbryFirst from 'extras/lbry-first/lbry-first';
|
// import LbryFirst from 'extras/lbry-first/lbry-first';
|
||||||
import { isClaimNsfw } from 'util/claim';
|
import { isClaimNsfw } from 'util/claim';
|
||||||
|
import { LBRY_FIRST_TAG, SCHEDULED_LIVESTREAM_TAG } from 'constants/tags';
|
||||||
|
|
||||||
function resolveClaimTypeForAnalytics(claim) {
|
function resolveClaimTypeForAnalytics(claim) {
|
||||||
if (!claim) {
|
if (!claim) {
|
||||||
|
@ -144,10 +145,17 @@ function resolvePublishPayload(publishData, myClaimForUri, myChannels, preview)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useLBRYUploader) {
|
if (useLBRYUploader) {
|
||||||
publishPayload.tags.push('lbry-first');
|
publishPayload.tags.push(LBRY_FIRST_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set release time to curret date. On edits, keep original release/transaction time as release_time
|
const nowTimeStamp = Number(Math.round(Date.now() / 1000));
|
||||||
|
|
||||||
|
// Add internal tag if a livestream is being scheduled.
|
||||||
|
if (isLivestreamPublish && releaseTimeEdited && releaseTimeEdited > nowTimeStamp) {
|
||||||
|
publishPayload.tags.push(SCHEDULED_LIVESTREAM_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set release time to current date. On edits, keep original release/transaction time as release_time
|
||||||
if (releaseTimeEdited) {
|
if (releaseTimeEdited) {
|
||||||
publishPayload.release_time = releaseTimeEdited;
|
publishPayload.release_time = releaseTimeEdited;
|
||||||
} else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
} else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
||||||
|
@ -155,7 +163,7 @@ function resolvePublishPayload(publishData, myClaimForUri, myChannels, preview)
|
||||||
} else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) {
|
} else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) {
|
||||||
publishPayload.release_time = Number(myClaimForUriEditing.timestamp);
|
publishPayload.release_time = Number(myClaimForUriEditing.timestamp);
|
||||||
} else {
|
} else {
|
||||||
publishPayload.release_time = Number(Math.round(Date.now() / 1000));
|
publishPayload.release_time = nowTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channelId) {
|
if (channelId) {
|
||||||
|
|
|
@ -45,6 +45,8 @@ type PublishState = {
|
||||||
optimize: boolean,
|
optimize: boolean,
|
||||||
useLBRYUploader: boolean,
|
useLBRYUploader: boolean,
|
||||||
currentUploads: { [key: string]: FileUploadItem },
|
currentUploads: { [key: string]: FileUploadItem },
|
||||||
|
isMarkdownPost: boolean,
|
||||||
|
isLivestreamPublish: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultState: PublishState = {
|
const defaultState: PublishState = {
|
||||||
|
@ -86,6 +88,8 @@ const defaultState: PublishState = {
|
||||||
optimize: false,
|
optimize: false,
|
||||||
useLBRYUploader: false,
|
useLBRYUploader: false,
|
||||||
currentUploads: {},
|
currentUploads: {},
|
||||||
|
isMarkdownPost: false,
|
||||||
|
isLivestreamPublish: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const publishReducer = handleActions(
|
export const publishReducer = handleActions(
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { createSelector } from 'reselect';
|
||||||
import { createCachedSelector } from 're-reselect';
|
import { createCachedSelector } from 're-reselect';
|
||||||
import { isClaimNsfw, filterClaims, getChannelIdFromClaim } from 'util/claim';
|
import { isClaimNsfw, filterClaims, getChannelIdFromClaim } from 'util/claim';
|
||||||
import * as CLAIM from 'constants/claim';
|
import * as CLAIM from 'constants/claim';
|
||||||
|
import { INTERNAL_TAGS } from 'constants/tags';
|
||||||
|
|
||||||
type State = { claims: any };
|
type State = { claims: any };
|
||||||
|
|
||||||
|
@ -608,14 +609,9 @@ export const makeSelectMyChannelPermUrlForName = (name: string) =>
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectTagsForUri = createCachedSelector(selectMetadataForUri, (metadata: ?GenericMetadata) => {
|
export const selectTagsForUri = createCachedSelector(selectMetadataForUri, (metadata: ?GenericMetadata) => {
|
||||||
return (metadata && metadata.tags) || [];
|
return metadata && metadata.tags ? metadata.tags.filter((tag) => !INTERNAL_TAGS.includes(tag)) : [];
|
||||||
})((state, uri) => String(uri));
|
})((state, uri) => String(uri));
|
||||||
|
|
||||||
export const makeSelectTagsForUri = (uri: string) =>
|
|
||||||
createSelector(makeSelectMetadataForUri(uri), (metadata: ?GenericMetadata) => {
|
|
||||||
return (metadata && metadata.tags) || [];
|
|
||||||
});
|
|
||||||
|
|
||||||
export const selectFetchingClaimSearchByQuery = (state: State) => selectState(state).fetchingClaimSearchByQuery || {};
|
export const selectFetchingClaimSearchByQuery = (state: State) => selectState(state).fetchingClaimSearchByQuery || {};
|
||||||
|
|
||||||
export const selectFetchingClaimSearch = createSelector(
|
export const selectFetchingClaimSearch = createSelector(
|
||||||
|
|
Loading…
Reference in a new issue