add SIMPLE_SITE config value to disable complex UIs

This commit is contained in:
Sean Yesmunt 2020-07-24 10:13:42 -04:00
parent 4b6c772adc
commit 312ff91994
5 changed files with 23 additions and 15 deletions

View file

@ -18,6 +18,7 @@ SITE_TITLE=lbry.tv
SITE_NAME=LBRY
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
LOGO_TITLE=lbry.tv
SIMPLE_SITE=false
# OG
OG_TITLE_SUFFIX=| lbry.tv

View file

@ -22,7 +22,7 @@ const config = {
SITE_CANONICAL_URL: process.env.SITE_CANONICAL_URL,
DEFAULT_LANGUAGE: process.env.DEFAULT_LANGUAGE,
AUTO_FOLLOW_CHANNELS: process.env.AUTO_FOLLOW_CHANNELS,
SIMPLE_SITE: process.env.SIMPLE_SITE === 'false',
PINNED_URI_1: process.env.PINNED_URI_1,
PINNED_LABEL_1: process.env.PINNED_LABEL_1,
PINNED_URI_2: process.env.PINNED_URI_2,

View file

@ -1,4 +1,7 @@
// @flow
import * as ICONS from 'constants/icons';
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
import { SIMPLE_SITE } from 'config';
import React, { useEffect, useState } from 'react';
import { isEmpty } from 'util/object';
import DateTime from 'component/dateTime';
@ -8,12 +11,10 @@ import MarkdownPreview from 'component/common/markdown-preview';
import ChannelThumbnail from 'component/channelThumbnail';
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
import Icon from 'component/common/icon';
import * as ICONS from 'constants/icons';
import { FormField, Form } from 'component/common/form';
import CommentCreate from 'component/commentCreate';
import classnames from 'classnames';
import usePersistedState from 'effects/use-persisted-state';
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
type Props = {
uri: string,
@ -101,7 +102,7 @@ function Comment(props: Props) {
}, [isResolvingUri, shouldFetch, author, authorUri, resolveUri, editedMessage, isEditing, setEditing]);
function handleEditMessageChanged(event) {
setCommentValue(advancedEditor ? event : event.target.value);
setCommentValue(!SIMPLE_SITE && advancedEditor ? event : event.target.value);
}
function handleSubmit() {
@ -168,12 +169,12 @@ function Comment(props: Props) {
{isEditing ? (
<Form onSubmit={handleSubmit}>
<FormField
type={advancedEditor ? 'markdown' : 'textarea'}
type={!SIMPLE_SITE && advancedEditor ? 'markdown' : 'textarea'}
name="editing_comment"
value={editedMessage}
charCount={charCount}
onChange={handleEditMessageChanged}
quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
quickActionLabel={!SIMPLE_SITE && (advancedEditor ? __('Simple Editor') : __('Advanced Editor'))}
quickActionHandler={() => setAdvancedEditor(!advancedEditor)}
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
/>
@ -200,7 +201,7 @@ function Comment(props: Props) {
</div>
)}
</div>
{!parentId && (
{!parentId && !isEditing && (
<Button
button="link"
requiresAuth={IS_WEB}

View file

@ -1,5 +1,6 @@
// @flow
import { CHANNEL_NEW } from 'constants/claim';
import { SIMPLE_SITE } from 'config';
import React, { useEffect, useState } from 'react';
import classnames from 'classnames';
import { FormField, Form } from 'component/common/form';
@ -61,7 +62,7 @@ export function CommentCreate(props: Props) {
if (isReply) {
commentValue = event.target.value;
} else {
commentValue = advancedEditor ? event : event.target.value;
commentValue = !SIMPLE_SITE && advancedEditor ? event : event.target.value;
}
setCommentValue(commentValue);
@ -110,11 +111,13 @@ export function CommentCreate(props: Props) {
{!isReply && <ChannelSelection channel={channel} hideAnon onChannelChange={handleChannelChange} />}
<FormField
disabled={channel === CHANNEL_NEW}
type={advancedEditor && !isReply ? 'markdown' : 'textarea'}
type={SIMPLE_SITE ? 'textarea' : advancedEditor && !isReply ? 'markdown' : 'textarea'}
name={isReply ? 'content_reply' : 'content_description'}
label={isReply ? __('Replying as %reply_channel%', { reply_channel: channel }) : __('Comment')}
quickActionLabel={isReply ? undefined : advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
quickActionHandler={isReply ? undefined : toggleEditorMode}
quickActionLabel={
!SIMPLE_SITE && (isReply ? undefined : advancedEditor ? __('Simple Editor') : __('Advanced Editor'))
}
quickActionHandler={!SIMPLE_SITE && (isReply ? undefined : toggleEditorMode)}
onFocus={onTextareaFocus}
placeholder={__('Say something about this...')}
value={commentValue}

View file

@ -1,9 +1,10 @@
// @flow
import { SIMPLE_SITE } from 'config';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
import React from 'react';
import { FormField } from 'component/common/form';
import usePersistedState from 'effects/use-persisted-state';
import Card from 'component/common/card';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
type Props = {
title: ?string,
@ -34,7 +35,7 @@ function PublishText(props: Props) {
/>
<FormField
type={advancedEditor ? 'markdown' : 'textarea'}
type={!SIMPLE_SITE && advancedEditor ? 'markdown' : 'textarea'}
name="content_description"
label={__('Description')}
placeholder={__(
@ -42,8 +43,10 @@ function PublishText(props: Props) {
)}
value={description}
disabled={disabled}
onChange={value => updatePublishForm({ description: advancedEditor ? value : value.target.value })}
quickActionLabel={advancedEditor ? __('Simple Editor') : __('Advanced Editor')}
onChange={value =>
updatePublishForm({ description: !SIMPLE_SITE && advancedEditor ? value : value.target.value })
}
quickActionLabel={!SIMPLE_SITE && (advancedEditor ? __('Simple Editor') : __('Advanced Editor'))}
quickActionHandler={toggleMarkdown}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/>