Updates comment-related redux code to support sdk version 0.53.0 #259

Merged
osilkin98 merged 18 commits from sdk-update into master 2020-01-23 21:50:02 +01:00
4 changed files with 154 additions and 133 deletions
Showing only changes of commit 1e1fcb8b18 - Show all commits

233
dist/bundle.es.js vendored

File diff suppressed because one or more lines are too long

View file

@ -510,4 +510,5 @@ export const DEFAULT_KNOWN_TAGS = [
'portugal', 'portugal',
'dantdm', 'dantdm',
'teaser', 'teaser',
'lbry',
]; ];

View file

@ -43,7 +43,7 @@ const defaultState: PublishState = {
thumbnailPath: '', thumbnailPath: '',
uploadThumbnailStatus: THUMBNAIL_STATUSES.API_DOWN, uploadThumbnailStatus: THUMBNAIL_STATUSES.API_DOWN,
description: '', description: '',
language: 'en', language: '',
nsfw: false, nsfw: false,
channel: CHANNEL_ANONYMOUS, channel: CHANNEL_ANONYMOUS,
channelId: '', channelId: '',

View file

@ -9,23 +9,9 @@ import {
const selectState = state => state.publish || {}; const selectState = state => state.publish || {};
export const selectPublishFormValues = createSelector(
selectState,
state => {
const { pendingPublish, ...formValues } = state;
return formValues;
}
);
export const makeSelectPublishFormValue = item =>
createSelector(
selectState,
state => state[item]
);
// Is the current uri the same as the uri they clicked "edit" on // Is the current uri the same as the uri they clicked "edit" on
export const selectIsStillEditing = createSelector( export const selectIsStillEditing = createSelector(
selectPublishFormValues, selectState,
publishState => { publishState => {
const { editingURI, uri } = publishState; const { editingURI, uri } = publishState;
@ -52,6 +38,29 @@ export const selectIsStillEditing = createSelector(
} }
); );
export const selectPublishFormValues = createSelector(
selectState,
selectIsStillEditing,
(state, isStillEditing) => {
const { pendingPublish, language, languages, ...formValues } = state;
let actualLanguage;
// Sets default if editing a claim with a set language
if (!language && isStillEditing && languages[0]) {
actualLanguage = languages[0];
} else {
actualLanguage = language || 'en';
}
return { ...formValues, language: actualLanguage };
}
);
export const makeSelectPublishFormValue = item =>
createSelector(
selectState,
state => state[item]
);
export const selectMyClaimForUri = createSelector( export const selectMyClaimForUri = createSelector(
selectPublishFormValues, selectPublishFormValues,
selectIsStillEditing, selectIsStillEditing,