diff --git a/app/soapbox/features/chats/components/chat-page/chat-page.tsx b/app/soapbox/features/chats/components/chat-page/chat-page.tsx index b9e26a230..007de0528 100644 --- a/app/soapbox/features/chats/components/chat-page/chat-page.tsx +++ b/app/soapbox/features/chats/components/chat-page/chat-page.tsx @@ -1,10 +1,9 @@ import classNames from 'clsx'; import React, { useEffect, useRef, useState } from 'react'; -import { Route, Switch } from 'react-router-dom'; +import { matchPath, Route, Switch, useHistory } from 'react-router-dom'; import { Stack } from 'soapbox/components/ui'; import { useOwnAccount } from 'soapbox/hooks'; -import { useChat } from 'soapbox/queries/chats'; import ChatPageMain from './components/chat-page-main'; import ChatPageNew from './components/chat-page-new'; @@ -18,9 +17,15 @@ interface IChatPage { const ChatPage: React.FC = ({ chatId }) => { const account = useOwnAccount(); + const history = useHistory(); + const isOnboarded = account?.chats_onboarded; - const { data: chat } = useChat(chatId); + const path = history.location.pathname; + const isSidebarHidden = matchPath(path, { + path: ['/chats/settings', '/chats/new', '/chats/:chatId'], + exact: true, + }); const containerRef = useRef(null); const [height, setHeight] = useState('100%'); @@ -61,7 +66,7 @@ const ChatPage: React.FC = ({ chatId }) => {
@@ -69,7 +74,7 @@ const ChatPage: React.FC = ({ chatId }) => { diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx index c44b44acd..e29f2b3c8 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-new.tsx @@ -3,7 +3,7 @@ import { FormattedMessage } from 'react-intl'; import { useHistory } from 'react-router-dom'; import AccountSearch from 'soapbox/components/account_search'; -import { CardTitle, HStack, Stack, Text } from 'soapbox/components/ui'; +import { CardTitle, HStack, IconButton, Stack, Text } from 'soapbox/components/ui'; import { ChatKeys, useChats } from 'soapbox/queries/chats'; import { queryClient } from 'soapbox/queries/client'; @@ -23,8 +23,16 @@ const ChatPageNew: React.FC = () => { return ( - - + + + history.push('/chats')} + /> + + + diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-settings.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-settings.tsx index fa6ad1e2f..57e3f89e4 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-settings.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-settings.tsx @@ -1,8 +1,9 @@ import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; +import { useHistory } from 'react-router-dom'; import List, { ListItem } from 'soapbox/components/list'; -import { Button, CardBody, CardTitle, Form, Stack, Toggle } from 'soapbox/components/ui'; +import { Button, CardBody, CardTitle, Form, HStack, IconButton, Stack, Toggle } from 'soapbox/components/ui'; import { useOwnAccount } from 'soapbox/hooks'; import { useUpdateCredentials } from 'soapbox/queries/accounts'; @@ -21,6 +22,7 @@ const messages = defineMessages({ const ChatPageSettings = () => { const account = useOwnAccount(); const intl = useIntl(); + const history = useHistory(); const updateCredentials = useUpdateCredentials(); const [data, setData] = useState({ @@ -35,8 +37,16 @@ const ChatPageSettings = () => { }; return ( - - + + + history.push('/chats')} + /> + + +