- 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 Button from 'component/button';
|
||||
import { LIVESTREAM_UPCOMING_BUFFER } from 'constants/livestream';
|
||||
import { SCHEDULED_LIVESTREAM_TAG } from 'constants/tags';
|
||||
|
||||
type Props = {
|
||||
channelIds: Array<string>,
|
||||
|
@ -40,6 +41,7 @@ const ScheduledStreams = (props: Props) => {
|
|||
return (
|
||||
<div className={'mb-xl'} style={{ display: showUpcomingLivestreams ? 'block' : 'none' }}>
|
||||
<ClaimListDiscover
|
||||
tags={[SCHEDULED_LIVESTREAM_TAG]}
|
||||
useSkeletonScreen={false}
|
||||
channelIds={channelIds}
|
||||
limitClaimsPerChannel={limitClaimsPerChannel}
|
||||
|
|
|
@ -5,7 +5,7 @@ import Tag from 'component/tag';
|
|||
import { setUnion, setDifference } from 'util/set-operations';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import analytics from 'analytics';
|
||||
import { UTILITY_TAGS } from 'constants/tags';
|
||||
import { CONTROL_TAGS, INTERNAL_TAGS } from 'constants/tags';
|
||||
|
||||
type Props = {
|
||||
tagsPassedIn: Array<Tag>,
|
||||
|
@ -79,7 +79,7 @@ export default function TagsSearch(props: Props) {
|
|||
const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet);
|
||||
const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet);
|
||||
|
||||
const SPECIAL_TAGS = [...UTILITY_TAGS, 'lbry-first', 'mature'];
|
||||
const SPECIAL_TAGS = [...INTERNAL_TAGS, 'mature'];
|
||||
let countWithoutSpecialTags = selectedTagsSet.size;
|
||||
|
||||
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'} />}
|
||||
{Boolean(tagsPassedIn.length) &&
|
||||
tagsPassedIn
|
||||
.filter((t) => !UTILITY_TAGS.includes(t.name))
|
||||
.filter((t) => !INTERNAL_TAGS.includes(t.name))
|
||||
.map((tag) => (
|
||||
<Tag
|
||||
key={`passed${tag.name}`}
|
||||
|
@ -234,7 +234,7 @@ export default function TagsSearch(props: Props) {
|
|||
onSelect && ( // onSelect ensures this does not appear on TagFollow
|
||||
<fieldset-section>
|
||||
<label>{__('Control Tags')}</label>
|
||||
{UTILITY_TAGS.map((t) => (
|
||||
{CONTROL_TAGS.map((t) => (
|
||||
<FormField
|
||||
key={t}
|
||||
name={t}
|
||||
|
|
|
@ -16,8 +16,16 @@ export const DEFAULT_FOLLOWED_TAGS = [
|
|||
export const DISABLE_COMMENTS_TAG = 'disable-comments';
|
||||
export const DISABLE_SUPPORT_TAG = 'disable-support';
|
||||
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 = [
|
||||
'porn',
|
||||
|
|
|
@ -24,6 +24,7 @@ import { creditsToString } from 'util/format-credits';
|
|||
import Lbry from 'lbry';
|
||||
// import LbryFirst from 'extras/lbry-first/lbry-first';
|
||||
import { isClaimNsfw } from 'util/claim';
|
||||
import { LBRY_FIRST_TAG, SCHEDULED_LIVESTREAM_TAG } from 'constants/tags';
|
||||
|
||||
function resolveClaimTypeForAnalytics(claim) {
|
||||
if (!claim) {
|
||||
|
@ -144,10 +145,17 @@ function resolvePublishPayload(publishData, myClaimForUri, myChannels, preview)
|
|||
}
|
||||
|
||||
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) {
|
||||
publishPayload.release_time = releaseTimeEdited;
|
||||
} else if (myClaimForUriEditing && myClaimForUriEditing.value.release_time) {
|
||||
|
@ -155,7 +163,7 @@ function resolvePublishPayload(publishData, myClaimForUri, myChannels, preview)
|
|||
} else if (myClaimForUriEditing && myClaimForUriEditing.timestamp) {
|
||||
publishPayload.release_time = Number(myClaimForUriEditing.timestamp);
|
||||
} else {
|
||||
publishPayload.release_time = Number(Math.round(Date.now() / 1000));
|
||||
publishPayload.release_time = nowTimeStamp;
|
||||
}
|
||||
|
||||
if (channelId) {
|
||||
|
|
|
@ -45,6 +45,8 @@ type PublishState = {
|
|||
optimize: boolean,
|
||||
useLBRYUploader: boolean,
|
||||
currentUploads: { [key: string]: FileUploadItem },
|
||||
isMarkdownPost: boolean,
|
||||
isLivestreamPublish: boolean,
|
||||
};
|
||||
|
||||
const defaultState: PublishState = {
|
||||
|
@ -86,6 +88,8 @@ const defaultState: PublishState = {
|
|||
optimize: false,
|
||||
useLBRYUploader: false,
|
||||
currentUploads: {},
|
||||
isMarkdownPost: false,
|
||||
isLivestreamPublish: false,
|
||||
};
|
||||
|
||||
export const publishReducer = handleActions(
|
||||
|
|
|
@ -5,6 +5,7 @@ import { createSelector } from 'reselect';
|
|||
import { createCachedSelector } from 're-reselect';
|
||||
import { isClaimNsfw, filterClaims, getChannelIdFromClaim } from 'util/claim';
|
||||
import * as CLAIM from 'constants/claim';
|
||||
import { INTERNAL_TAGS } from 'constants/tags';
|
||||
|
||||
type State = { claims: any };
|
||||
|
||||
|
@ -608,14 +609,9 @@ export const makeSelectMyChannelPermUrlForName = (name: string) =>
|
|||
});
|
||||
|
||||
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));
|
||||
|
||||
export const makeSelectTagsForUri = (uri: string) =>
|
||||
createSelector(makeSelectMetadataForUri(uri), (metadata: ?GenericMetadata) => {
|
||||
return (metadata && metadata.tags) || [];
|
||||
});
|
||||
|
||||
export const selectFetchingClaimSearchByQuery = (state: State) => selectState(state).fetchingClaimSearchByQuery || {};
|
||||
|
||||
export const selectFetchingClaimSearch = createSelector(
|
||||
|
|
Loading…
Reference in a new issue