From 6718f153a97d6093c3c8c0b5aa7497d747a58139 Mon Sep 17 00:00:00 2001 From: seanyesmunt Date: Wed, 7 Apr 2021 01:40:34 -0400 Subject: [PATCH] style pass --- ui/analytics.js | 35 ++++++++----------- ui/component/claimList/view.jsx | 32 +++++++++-------- ui/component/searchOptions/view.jsx | 9 ++--- ui/page/search/index.js | 20 ----------- ui/page/search/view.jsx | 25 ------------- ui/scss/component/_search.scss | 54 +++++++++++++++++------------ 6 files changed, 68 insertions(+), 107 deletions(-) diff --git a/ui/analytics.js b/ui/analytics.js index 32d6bdd94..6b7b40e5f 100644 --- a/ui/analytics.js +++ b/ui/analytics.js @@ -26,10 +26,10 @@ if (isProduction) { // @endif type Analytics = { - error: string => Promise, + error: (string) => Promise, sentryError: ({} | string, {}) => Promise, pageView: (string, ?string) => void, - setUser: Object => void, + setUser: (Object) => void, toggleInternal: (boolean, ?boolean) => void, apiLogView: (string, string, string, ?number, ?() => void) => Promise, apiLogPublish: (ChannelClaim | StreamClaim) => void, @@ -55,9 +55,9 @@ type Analytics = { emailVerifiedEvent: () => void, rewardEligibleEvent: () => void, startupEvent: () => void, - purchaseEvent: number => void, - readyEvent: number => void, - openUrlEvent: string => void, + purchaseEvent: (number) => void, + readyEvent: (number) => void, + openUrlEvent: (string) => void, }; type LogPublishParams = { @@ -75,8 +75,8 @@ if (window.localStorage.getItem(SHARE_INTERNAL) === 'true') internalAnalyticsEna // @endif const analytics: Analytics = { - error: message => { - return new Promise(resolve => { + error: (message) => { + return new Promise((resolve) => { if (internalAnalyticsEnabled && isProduction) { return Lbryio.call('event', 'desktop_error', { error_message: message }).then(() => { resolve(true); @@ -87,9 +87,9 @@ const analytics: Analytics = { }); }, sentryError: (error, errorInfo) => { - return new Promise(resolve => { + return new Promise((resolve) => { if (internalAnalyticsEnabled && isProduction) { - Sentry.withScope(scope => { + Sentry.withScope((scope) => { scope.setExtras(errorInfo); const eventId = Sentry.captureException(error); resolve(eventId); @@ -114,7 +114,7 @@ const analytics: Analytics = { MatomoInstance.trackPageView(params); } }, - setUser: userId => { + setUser: (userId) => { if (internalAnalyticsEnabled && userId) { window._paq.push(['setUserId', String(userId)]); // @if TARGET='app' @@ -188,19 +188,12 @@ const analytics: Analytics = { } }, - apiSyncTags: params => { + apiSyncTags: (params) => { if (internalAnalyticsEnabled && isProduction) { Lbryio.call('content_tags', 'sync', params); } }, - apiSearchFeedback: (query, vote) => { - if (isProduction) { - // We don't need to worry about analytics enabled here because users manually click on the button to provide feedback - Lbryio.call('feedback', 'search', { query, vote }); - } - }, - videoFetchDuration: (source, duration) => { sendPromMetric('time_to_fetch', duration); sendMatomoEvent('Media', 'TimeToFetch', source, duration); @@ -238,10 +231,10 @@ const analytics: Analytics = { }); } }, - playerLoadedEvent: embedded => { + playerLoadedEvent: (embedded) => { sendMatomoEvent('Player', 'Loaded', embedded ? 'embedded' : 'onsite'); }, - playerStartedEvent: embedded => { + playerStartedEvent: (embedded) => { sendMatomoEvent('Player', 'Started', embedded ? 'embedded' : 'onsite'); }, tagFollowEvent: (tag, following) => { @@ -316,7 +309,7 @@ analytics.pageView( // Listen for url changes and report // This will include search queries -history.listen(location => { +history.listen((location) => { const { pathname, search } = location; const page = `${pathname}${search}`; diff --git a/ui/component/claimList/view.jsx b/ui/component/claimList/view.jsx index 9bd614953..8bcf73844 100644 --- a/ui/component/claimList/view.jsx +++ b/ui/component/claimList/view.jsx @@ -117,21 +117,23 @@ export default function ClaimList(props: Props) {
{header} {loading && } -
- {headerAltControls} - {defaultSort && ( - - - - - )} -
+ {(headerAltControls || defaultSort) && ( +
+ {headerAltControls} + {defaultSort && ( + + + + + )} +
+ )}
)} diff --git a/ui/component/searchOptions/view.jsx b/ui/component/searchOptions/view.jsx index 7dddd874a..7717ac372 100644 --- a/ui/component/searchOptions/view.jsx +++ b/ui/component/searchOptions/view.jsx @@ -127,9 +127,9 @@ const SearchOptions = (props: Props) => { onClick={() => updateSearchOptions(SEARCH_OPTIONS.CLAIM_TYPE, SEARCH_OPTIONS.INCLUDE_FILES_AND_CHANNELS)} /> -
- {options[SEARCH_OPTIONS.CLAIM_TYPE] === SEARCH_OPTIONS.INCLUDE_FILES && - Object.entries(TYPES_ADVANCED).map((t) => { + {options[SEARCH_OPTIONS.CLAIM_TYPE] === SEARCH_OPTIONS.INCLUDE_FILES && ( +
+ {Object.entries(TYPES_ADVANCED).map((t) => { const option = t[0]; return ( { /> ); })} -
+
+ )} ); diff --git a/ui/page/search/index.js b/ui/page/search/index.js index 395088561..c441ac2e0 100644 --- a/ui/page/search/index.js +++ b/ui/page/search/index.js @@ -1,5 +1,4 @@ import { connect } from 'react-redux'; -import { doToast } from 'lbry-redux'; import { withRouter } from 'react-router'; import { doSearch } from 'redux/actions/search'; import { @@ -11,7 +10,6 @@ import { } from 'redux/selectors/search'; import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; -import analytics from 'analytics'; import SearchPage from './view'; const select = (state, props) => { @@ -41,24 +39,6 @@ const select = (state, props) => { const perform = (dispatch) => ({ search: (query, options) => dispatch(doSearch(query, options)), - onFeedbackPositive: (query) => { - analytics.apiSearchFeedback(query, 1); - dispatch( - doToast({ - message: __('Thanks for the feedback! You help make the app better for everyone.'), - }) - ); - }, - onFeedbackNegative: (query) => { - analytics.apiSearchFeedback(query, 0); - dispatch( - doToast({ - message: __( - 'Thanks for the feedback. Mark has been notified and is currently walking over to his computer to work on this.' - ), - }) - ); - }, }); export default withRouter(connect(select, perform)(SearchPage)); diff --git a/ui/page/search/view.jsx b/ui/page/search/view.jsx index d4086f08a..cf72b2aed 100644 --- a/ui/page/search/view.jsx +++ b/ui/page/search/view.jsx @@ -1,17 +1,14 @@ // @flow import { SIMPLE_SITE, SHOW_ADS } from 'config'; -import * as ICONS from 'constants/icons'; import React, { useEffect } from 'react'; import { Lbry, parseURI, isNameValid } from 'lbry-redux'; import ClaimList from 'component/claimList'; import Page from 'component/page'; import SearchOptions from 'component/searchOptions'; -import Button from 'component/button'; import Ads from 'web/component/ads'; import SearchTopClaim from 'component/searchTopClaim'; import { formatLbryUrlForWeb } from 'util/url'; import { useHistory } from 'react-router'; -import ClaimPreview from 'component/claimPreview'; import { SEARCH_PAGE_SIZE } from 'constants/search'; type AdditionalOptions = { @@ -26,8 +23,6 @@ type Props = { isSearching: boolean, location: UrlLocation, uris: Array, - onFeedbackNegative: (string) => void, - onFeedbackPositive: (string) => void, showNsfw: boolean, isAuthenticated: boolean, hasReachedMaxResultsLength: boolean, @@ -37,8 +32,6 @@ export default function SearchPage(props: Props) { const { search, uris, - onFeedbackPositive, - onFeedbackNegative, location, isSearching, showNsfw, @@ -128,25 +121,7 @@ export default function SearchPage(props: Props) { injectedItem={ SHOW_ADS && IS_WEB ? (SIMPLE_SITE ? false : !isAuthenticated && ) : false } - headerAltControls={ - <> - {__('Find what you were looking for?')} -