// @flow import * as ICONS from 'constants/icons'; import * as PAGES from 'constants/pages'; import React from 'react'; import { SETTINGS } from 'lbry-redux'; 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, autoplay: boolean, hideReposts: ?boolean, showNsfw: 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, autoplay, hideReposts, showNsfw, myChannelUrls, instantPurchaseEnabled, instantPurchaseMax, enablePublishPreview, setClientSetting, clearPlayingUri, openModal, } = props; return ( { setClientSetting(SETTINGS.FLOATING_PLAYER, !floatingPlayer); clearPlayingUri(); }} checked={floatingPlayer} /> setClientSetting(SETTINGS.AUTOPLAY, !autoplay)} checked={autoplay} /> {!SIMPLE_SITE && ( <> { if (isAuthenticated) { let param = e.target.checked ? { add: 'noreposts' } : { remove: 'noreposts' }; Lbryio.call('user_tag', 'edit', param); } setClientSetting(SETTINGS.HIDE_REPOSTS, !hideReposts); }} /> {/* setClientSetting(SETTINGS.SHOW_ANONYMOUS, !showAnonymous)} checked={showAnonymous} /> */} !IS_WEB || showNsfw ? setClientSetting(SETTINGS.SHOW_MATURE, !showNsfw) : openModal(MODALS.CONFIRM_AGE) } /> )} {(isAuthenticated || !IS_WEB) && ( <>