// @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 { 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, persistWatchTime: boolean, myChannelUrls: ?Array, instantPurchaseEnabled: boolean, instantPurchaseMax: Price, enablePublishPreview: boolean, // --- perform --- setClientSetting: (string, boolean | string | number) => void, clearPlayingUri: () => void, // clearContentCache: () => void, }; export default function SettingContent(props: Props) { const { isAuthenticated, floatingPlayer, autoplayMedia, autoplayNext, hideReposts, persistWatchTime, showNsfw, myChannelUrls, instantPurchaseEnabled, instantPurchaseMax, enablePublishPreview, setClientSetting, clearPlayingUri, // clearContentCache, } = props; // feature disabled until styling is ironed out // const [contentCacheCleared, setContentCacheCleared] = React.useState(false); // const [clearingContentCache, setClearingContentCache] = React.useState(false); // const onClearContentCache = React.useCallback(() => { // setClearingContentCache(true); // clearContentCache(); // // Just a small timer to give the user a visual effect // // that the content is being cleared. // setTimeout(() => { // setClearingContentCache(false); // setContentCacheCleared(true); // }, 2000); // }, [setClearingContentCache, clearContentCache, setContentCacheCleared]); 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); }} checked={hideReposts} /> {/*
*/} setClientSetting(SETTINGS.PERSIST_WATCH_TIME, !persistWatchTime)} checked={persistWatchTime} /> {/*
Disabled until styling is better
*/}
setClientSetting(SETTINGS.SHOW_MATURE, !showNsfw)} />