import { h, render } from 'preact' import { useState } from 'preact/hooks' import ButtonRadio, { SelectionOption } from '../common/components/ButtonRadio' import { loginAndSetNickname } from '../common/crypto' import { getTargetPlatfromSettingsEntiries, getYtUrlResolversSettingsEntiries, TargetPlatformName, YTUrlResolverName } from '../common/settings' import { setSetting, useLbrySettings } from '../common/useSettings' import { LbryPathnameCache } from '../common/yt/urlCache' import './popup.sass' /** Gets all the options for redirect destinations as selection options */ const platformOptions: SelectionOption[] = getTargetPlatfromSettingsEntiries() .map(([value, { displayName: display }]) => ({ value, display })) const ytUrlResolverOptions: SelectionOption[] = getYtUrlResolversSettingsEntiries() .map(([value, { name: display }]) => ({ value, display })) function WatchOnLbryPopup() { const { redirect, targetPlatform, urlResolver, privateKey, publicKey } = useLbrySettings() let [clearingCache, updateClearingCache] = useState(() => false) return
setSetting('redirect', redirect.toLowerCase() === 'yes')} />
setSetting('targetPlatform', platform)} />
setSetting('urlResolver', urlResolver)} />
{ await LbryPathnameCache.clearAll() alert('Cleared Cache.') }}>
{(!privateKey || !publicKey) ? loginAndSetNickname()} target='_blank'> loginAndSetNickname()} target='_blank'> : loginAndSetNickname()} target='_blank'> loginAndSetNickname()} target='_blank'> loginAndSetNickname()} target='_blank'> loginAndSetNickname()} target='_blank'> }
} render(, document.getElementById('root')!)