// @flow import * as ICONS from 'constants/icons'; import * as PAGES from 'constants/pages'; import React from 'react'; import * as SETTINGS from 'constants/settings'; import { Lbryio } from 'lbryinc'; import { SIMPLE_SITE } from 'config'; import * as MODALS from 'constants/modal_types'; import { SETTINGS_GRP } from 'constants/settings'; import Button from 'component/button'; import Card from 'component/common/card'; import { FormField, FormFieldPrice } from 'component/common/form'; import MaxPurchasePrice from 'component/maxPurchasePrice'; import SettingsRow from 'component/settingsRow'; type Price = { currency: string, amount: number, }; type Props = { // --- select --- isAuthenticated: boolean, floatingPlayer: boolean, autoplayMedia: boolean, autoplayNext: boolean, hideReposts: ?boolean, showNsfw: boolean, hideScheduledLivestreams: boolean, myChannelUrls: ?Array, instantPurchaseEnabled: boolean, instantPurchaseMax: Price, enablePublishPreview: boolean, // --- perform --- setClientSetting: (string, boolean | string | number) => void, clearPlayingUri: () => void, openModal: (string) => void, }; export default function SettingContent(props: Props) { const { isAuthenticated, floatingPlayer, autoplayMedia, autoplayNext, hideReposts, showNsfw, hideScheduledLivestreams, myChannelUrls, instantPurchaseEnabled, instantPurchaseMax, enablePublishPreview, setClientSetting, clearPlayingUri, openModal, } = props; return ( <>

{__('Content settings')}

{ setClientSetting(SETTINGS.FLOATING_PLAYER, !floatingPlayer); clearPlayingUri(); }} checked={floatingPlayer} /> setClientSetting(SETTINGS.AUTOPLAY_MEDIA, !autoplayMedia)} checked={autoplayMedia} /> setClientSetting(SETTINGS.AUTOPLAY_NEXT, !autoplayNext)} checked={autoplayNext} /> { if (isAuthenticated) { let param = e.target.checked ? { add: 'noreposts' } : { remove: 'noreposts' }; Lbryio.call('user_tag', 'edit', param); } setClientSetting(SETTINGS.HIDE_REPOSTS, !hideReposts); }} /> setClientSetting(SETTINGS.HIDE_SCHEDULED_LIVESTREAMS, !hideScheduledLivestreams)} checked={hideScheduledLivestreams} /> {!SIMPLE_SITE && ( <> {/* setClientSetting(SETTINGS.SHOW_ANONYMOUS, !showAnonymous)} checked={showAnonymous} /> */} !IS_WEB || showNsfw ? setClientSetting(SETTINGS.SHOW_MATURE, !showNsfw) : openModal(MODALS.CONFIRM_AGE) } /> )} {(isAuthenticated || !IS_WEB) && ( <>