From 8a4b7e8afb35824b52e602c6aedcc812dc70a309 Mon Sep 17 00:00:00 2001 From: Michael Piazza Date: Fri, 7 Jul 2023 17:27:39 -0400 Subject: [PATCH] [PAY-1569] Update blog post link (#3719) --- packages/common/src/utils/chatUtils.ts | 3 +++ .../InboxUnavailableDrawer.tsx | 10 ++++++---- .../mobile/src/screens/chat-screen/ChatUnavailable.tsx | 10 +++++++--- .../inbox-unavailable-modal/InboxUnavailableModal.tsx | 4 +++- .../audio-rewards-page/components/modals/TopAPI.tsx | 2 +- .../chat-page/components/InboxUnavailableMessage.tsx | 4 ++-- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/common/src/utils/chatUtils.ts b/packages/common/src/utils/chatUtils.ts index 9e0d0f7eaa6..eaa5fd476cc 100644 --- a/packages/common/src/utils/chatUtils.ts +++ b/packages/common/src/utils/chatUtils.ts @@ -5,6 +5,9 @@ import { Status } from 'models/Status' import { MESSAGE_GROUP_THRESHOLD_MINUTES } from './constants' +export const CHAT_BLOG_POST_URL = + 'http://support.audius.co/help/How-to-Send-Messages-on-Audius' + /** * Checks to see if the message was sent within the time threshold for grouping it with the next message */ diff --git a/packages/mobile/src/components/inbox-unavailable-drawer/InboxUnavailableDrawer.tsx b/packages/mobile/src/components/inbox-unavailable-drawer/InboxUnavailableDrawer.tsx index 4dfa8d2e515..7c4f5973dbf 100644 --- a/packages/mobile/src/components/inbox-unavailable-drawer/InboxUnavailableDrawer.tsx +++ b/packages/mobile/src/components/inbox-unavailable-drawer/InboxUnavailableDrawer.tsx @@ -6,14 +6,15 @@ import { chatActions, tippingActions, cacheUsersSelectors, - ChatPermissionAction + ChatPermissionAction, + CHAT_BLOG_POST_URL } from '@audius/common' import { View } from 'react-native' import { useDispatch, useSelector } from 'react-redux' import IconMessageLocked from 'app/assets/images/iconMessageLocked.svg' import IconTip from 'app/assets/images/iconTip.svg' -import { Text, Button } from 'app/components/core' +import { Text, Button, useLink } from 'app/components/core' import { NativeDrawer } from 'app/components/drawer' import { useDrawer } from 'app/hooks/useDrawer' import { useNavigation } from 'app/hooks/useNavigation' @@ -132,10 +133,11 @@ const DrawerContent = ({ data }: DrawerContentProps) => { closeDrawer() }, [dispatch, userId, shouldOpenChat, canCreateChat, closeDrawer]) + const { onPress: onPressLearnMore } = useLink(CHAT_BLOG_POST_URL) const handleLearnMorePress = useCallback(() => { - // TODO: Link to blog + onPressLearnMore() closeDrawer() - }, [closeDrawer]) + }, [closeDrawer, onPressLearnMore]) const handleTipPress = useCallback(() => { dispatch(beginTip({ user, source: 'inboxUnavailableModal' })) diff --git a/packages/mobile/src/screens/chat-screen/ChatUnavailable.tsx b/packages/mobile/src/screens/chat-screen/ChatUnavailable.tsx index 32b2f08d305..a08a80cc22d 100644 --- a/packages/mobile/src/screens/chat-screen/ChatUnavailable.tsx +++ b/packages/mobile/src/screens/chat-screen/ChatUnavailable.tsx @@ -1,9 +1,14 @@ import { useCallback, useMemo } from 'react' -import { ChatPermissionAction, useCanSendMessage } from '@audius/common' +import { + ChatPermissionAction, + useCanSendMessage, + CHAT_BLOG_POST_URL +} from '@audius/common' import { View, Text } from 'react-native' import { useDispatch } from 'react-redux' +import { useLink } from 'app/components/core' import { useNavigation } from 'app/hooks/useNavigation' import { setVisibility } from 'app/store/drawers/slice' import { makeStyles } from 'app/styles' @@ -49,8 +54,7 @@ export const ChatUnavailable = ({ chatId }: ChatUnavailableProps) => { const { firstOtherUser: otherUser, callToAction } = useCanSendMessage(chatId) - // TODO: link to blog - const handleLearnMorePress = useCallback(() => {}, []) + const { onPress: handleLearnMorePress } = useLink(CHAT_BLOG_POST_URL) const handleUnblockPress = useCallback(() => { if (otherUser) { diff --git a/packages/web/src/components/inbox-unavailable-modal/InboxUnavailableModal.tsx b/packages/web/src/components/inbox-unavailable-modal/InboxUnavailableModal.tsx index 081c35f8516..290eff6afe5 100644 --- a/packages/web/src/components/inbox-unavailable-modal/InboxUnavailableModal.tsx +++ b/packages/web/src/components/inbox-unavailable-modal/InboxUnavailableModal.tsx @@ -1,6 +1,7 @@ import { ReactNode, useCallback } from 'react' import { + CHAT_BLOG_POST_URL, ChatPermissionAction, User, chatActions, @@ -110,7 +111,8 @@ export const InboxUnavailableModal = ({ dispatch(createChat({ userIds: [user.user_id] })) onClose() } else { - // TODO: Link to blog post + window.open(CHAT_BLOG_POST_URL, '_blank') + onClose() } }, [dispatch, onClose, user, callToAction]) diff --git a/packages/web/src/pages/audio-rewards-page/components/modals/TopAPI.tsx b/packages/web/src/pages/audio-rewards-page/components/modals/TopAPI.tsx index 701bddb087b..4bb5c08d9dc 100644 --- a/packages/web/src/pages/audio-rewards-page/components/modals/TopAPI.tsx +++ b/packages/web/src/pages/audio-rewards-page/components/modals/TopAPI.tsx @@ -21,7 +21,7 @@ const TopAPIBody = () => { const wm = useWithMobileStyle(styles.mobile) const onClickAudiusAPI = useCallback(() => { - window.open(AUDIUS_API_LINK, '__blank') + window.open(AUDIUS_API_LINK, '_blank') }, []) return ( diff --git a/packages/web/src/pages/chat-page/components/InboxUnavailableMessage.tsx b/packages/web/src/pages/chat-page/components/InboxUnavailableMessage.tsx index 886e0dc1aa1..63e98184e1b 100644 --- a/packages/web/src/pages/chat-page/components/InboxUnavailableMessage.tsx +++ b/packages/web/src/pages/chat-page/components/InboxUnavailableMessage.tsx @@ -1,6 +1,6 @@ import { useState, useCallback, MouseEventHandler } from 'react' -import { User, ChatPermissionAction } from '@audius/common' +import { User, ChatPermissionAction, CHAT_BLOG_POST_URL } from '@audius/common' import { UserNameAndBadges } from 'components/user-name-and-badges/UserNameAndBadges' @@ -69,7 +69,7 @@ export const InboxUnavailableMessage = ({ return (
{messages.default(user)}{' '} - + {messages.learnMore}