From 3b6882412a7594d1d1410f9cb012f4e21832a924 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 16 Nov 2020 14:09:00 -0500 Subject: [PATCH] enable 'discover' page for everyone --- .flowconfig | 1 + ui/analytics.js | 4 +-- ui/component/sideNavigation/view.jsx | 47 ++++++++++++++-------------- ui/redux/actions/comments.js | 18 +++++------ ui/redux/actions/notifications.js | 10 +++--- ui/redux/actions/publish.js | 5 +-- yarn.lock | 4 +-- 7 files changed, 44 insertions(+), 45 deletions(-) diff --git a/.flowconfig b/.flowconfig index 4870244e1..768762cdc 100644 --- a/.flowconfig +++ b/.flowconfig @@ -2,6 +2,7 @@ .*\.typeface\.json .*/node_modules/findup/.* + [include] [libs] diff --git a/ui/analytics.js b/ui/analytics.js index 93837b7f7..d36b05b63 100644 --- a/ui/analytics.js +++ b/ui/analytics.js @@ -28,7 +28,7 @@ if (isProduction) { type Analytics = { error: string => Promise, sentryError: ({} | string, {}) => Promise, - pageView: string => void, + pageView: (string, ?string) => void, setUser: Object => void, toggleInternal: (boolean, ?boolean) => void, apiLogView: (string, string, string, ?number, ?() => void) => Promise, @@ -97,7 +97,7 @@ const analytics: Analytics = { }, pageView: (path, search) => { if (internalAnalyticsEnabled) { - const params = { href: `${path}` }; + const params: { href: string, customDimensions?: Array<{ id: number, value: ?string }> } = { href: `${path}` }; const dimensions = []; const searchParams = search && new URLSearchParams(search); diff --git a/ui/component/sideNavigation/view.jsx b/ui/component/sideNavigation/view.jsx index 660680a5a..20bd66667 100644 --- a/ui/component/sideNavigation/view.jsx +++ b/ui/component/sideNavigation/view.jsx @@ -28,6 +28,12 @@ const RECENT_FROM_FOLLOWING = { icon: ICONS.SUBSCRIBE, }; +const DISCOVER = { + title: 'Discover', + link: `/$/${PAGES.DISCOVER}`, + icon: ICONS.DISCOVER, +}; + type Props = { subscriptions: Array, followedTags: Array, @@ -73,25 +79,23 @@ function SideNavigation(props: Props) { const { EXTRA_SIDEBAR_LINKS } = homepageData; - const FULL_LINKS: Array = [ - { - title: 'Your Tags', - link: `/$/${PAGES.TAGS_FOLLOWING}`, - icon: ICONS.TAG, - hideForUnauth: true, - }, - { - title: 'Discover', - link: `/$/${PAGES.DISCOVER}`, - icon: ICONS.DISCOVER, - }, - { - title: IS_WEB ? 'Purchased' : 'Library', - link: `/$/${PAGES.LIBRARY}`, - icon: ICONS.PURCHASED, - hideForUnauth: true, - }, - ]; + const FULL_LINKS: Array = SIMPLE_SITE + ? [DISCOVER] + : [ + { + title: 'Your Tags', + link: `/$/${PAGES.TAGS_FOLLOWING}`, + icon: ICONS.TAG, + hideForUnauth: true, + }, + DISCOVER, + { + title: IS_WEB ? 'Purchased' : 'Library', + link: `/$/${PAGES.LIBRARY}`, + icon: ICONS.PURCHASED, + hideForUnauth: true, + }, + ]; const MOBILE_LINKS: Array = [ { @@ -226,11 +230,8 @@ function SideNavigation(props: Props) { SIDE_LINKS.push(HOME); SIDE_LINKS.push(RECENT_FROM_FOLLOWING); + SIDE_LINKS.push(...FULL_LINKS); - if (!SIMPLE_SITE) { - SIDE_LINKS.push(...FULL_LINKS); - } - // $FlowFixMe if (EXTRA_SIDEBAR_LINKS) { SIDE_LINKS.push(...EXTRA_SIDEBAR_LINKS); } diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index 781ff2f2a..3a2639892 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -13,7 +13,7 @@ import { import { makeSelectNotificationForCommentId } from 'redux/selectors/notifications'; export function doCommentList(uri: string, page: number = 1, pageSize: number = 99999) { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); const claim = selectClaimsByUri(state)[uri]; const claimId = claim ? claim.claim_id : null; @@ -50,7 +50,7 @@ export function doCommentList(uri: string, page: number = 1, pageSize: number = } export function doSetCommentChannel(channelName: string) { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { dispatch({ type: ACTIONS.COMMENT_SET_CHANNEL, data: channelName, @@ -59,7 +59,7 @@ export function doSetCommentChannel(channelName: string) { } export function doCommentReactList(uri: string | null, commentId?: string) { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); const channel = selectCommentChannel(state); const commentIds = uri ? makeSelectCommentIdsForUri(uri)(state) : [commentId]; @@ -100,7 +100,7 @@ export function doCommentReactList(uri: string | null, commentId?: string) { } export function doCommentReact(commentId: string, type: string) { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); const channel = selectCommentChannel(state); const pendingReacts = selectPendingCommentReacts(state); @@ -204,7 +204,7 @@ export function doCommentCreate( parent_id?: string, uri: string ) { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); dispatch({ type: ACTIONS.COMMENT_CREATE_STARTED, @@ -268,7 +268,7 @@ export function doCommentCreate( } export function doCommentHide(comment_id: string) { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { dispatch({ type: ACTIONS.COMMENT_HIDE_STARTED, }); @@ -297,7 +297,7 @@ export function doCommentHide(comment_id: string) { } export function doCommentPin(commentId: string, remove: boolean) { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); // const channel = localStorage.getItem('comment-channel'); const channel = selectCommentChannel(state); @@ -347,7 +347,7 @@ export function doCommentPin(commentId: string, remove: boolean) { } export function doCommentAbandon(comment_id: string) { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { dispatch({ type: ACTIONS.COMMENT_ABANDON_STARTED, }); @@ -396,7 +396,7 @@ export function doCommentUpdate(comment_id: string, comment: string) { if (comment === '') { return doCommentAbandon(comment_id); } else { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { dispatch({ type: ACTIONS.COMMENT_UPDATE_STARTED, }); diff --git a/ui/redux/actions/notifications.js b/ui/redux/actions/notifications.js index bee5ea5ae..27d74bf0f 100644 --- a/ui/redux/actions/notifications.js +++ b/ui/redux/actions/notifications.js @@ -42,7 +42,7 @@ export function doDismissError() { } export function doNotificationList() { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { dispatch({ type: ACTIONS.NOTIFICATION_LIST_STARTED }); return Lbryio.call('notification', 'list', { is_app_readable: true }) .then(response => { @@ -77,7 +77,7 @@ export function doNotificationList() { } export function doReadNotifications() { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); const notifications = selectNotifications(state); const unreadNotifications = @@ -99,7 +99,7 @@ export function doReadNotifications() { } export function doSeeNotifications(notificationIds: Array) { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { dispatch({ type: ACTIONS.NOTIFICATION_SEEN_STARTED }); return Lbryio.call('notification', 'edit', { notification_ids: notificationIds.join(','), is_seen: true }) .then(() => { @@ -117,7 +117,7 @@ export function doSeeNotifications(notificationIds: Array) { } export function doSeeAllNotifications() { - return (dispatch: Dispatch<*>, getState: GetState) => { + return (dispatch: Dispatch, getState: GetState) => { const state = getState(); const notifications = selectNotifications(state); const unSeenNotifications = @@ -128,7 +128,7 @@ export function doSeeAllNotifications() { } export function doDeleteNotification(notificationId: number) { - return (dispatch: Dispatch<*>) => { + return (dispatch: Dispatch) => { Lbryio.call('notification', 'delete', { notification_ids: notificationId }) .then(() => { dispatch({ type: ACTIONS.NOTIFICATION_DELETE_COMPLETED, data: { notificationId } }); diff --git a/ui/redux/actions/publish.js b/ui/redux/actions/publish.js index e93437ce5..3688db3b3 100644 --- a/ui/redux/actions/publish.js +++ b/ui/redux/actions/publish.js @@ -15,10 +15,7 @@ import { push } from 'connected-react-router'; import analytics from 'analytics'; import { doOpenModal } from 'redux/actions/app'; -export const doPublishDesktop = (filePath: string, preview?: boolean) => ( - dispatch: Dispatch<*>, - getState: () => {} -) => { +export const doPublishDesktop = (filePath: string, preview?: boolean) => (dispatch: Dispatch, getState: () => {}) => { const publishPreview = previewResponse => { dispatch( doOpenModal(MODALS.PUBLISH_PREVIEW, { diff --git a/yarn.lock b/yarn.lock index b1ffddfe7..501087c12 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7421,9 +7421,9 @@ lbry-redux@lbryio/lbry-redux#70c52e42e8b918e60b8f12b36748e1aef8908c39: reselect "^3.0.0" uuid "^8.3.1" -lbryinc@lbryio/lbryinc#57b8625454caf6ff295633819fbcfd213aa83e01: +lbryinc@lbryio/lbryinc#eee2cb730ecec95a1344a755035755b0d4dad5cf: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/57b8625454caf6ff295633819fbcfd213aa83e01" + resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/eee2cb730ecec95a1344a755035755b0d4dad5cf" dependencies: reselect "^3.0.0"