Hide chats from UI
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
a530d3dfb2
commit
0a2b07bea0
5 changed files with 31 additions and 38 deletions
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Helmet as ReactHelmet } from 'react-helmet';
|
||||
|
||||
import { useStatContext } from 'soapbox/contexts/stat-context';
|
||||
import { useAppSelector, useInstance, useSettings } from 'soapbox/hooks';
|
||||
import { RootState } from 'soapbox/store';
|
||||
import FaviconService from 'soapbox/utils/favicon-service';
|
||||
|
@ -21,8 +20,7 @@ interface IHelmet {
|
|||
|
||||
const Helmet: React.FC<IHelmet> = ({ children }) => {
|
||||
const instance = useInstance();
|
||||
const { unreadChatsCount } = useStatContext();
|
||||
const unreadCount = useAppSelector((state) => getNotifTotals(state) + unreadChatsCount);
|
||||
const unreadCount = useAppSelector((state) => getNotifTotals(state));
|
||||
const demetricator = useSettings().get('demetricator');
|
||||
|
||||
const hasUnreadNotifications = React.useMemo(() => !(unreadCount < 1 || demetricator), [unreadCount, demetricator]);
|
||||
|
|
|
@ -3,7 +3,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
|||
|
||||
import Account from 'soapbox/components/account';
|
||||
import { HStack, Icon, Stack } from 'soapbox/components/ui';
|
||||
import { useStatContext } from 'soapbox/contexts/stat-context';
|
||||
import ComposeButton from 'soapbox/features/ui/components/compose-button';
|
||||
import ProfileDropdown from 'soapbox/features/ui/components/profile-dropdown';
|
||||
import { useAppSelector, useGroupsPath, useFeatures, useOwnAccount, useSettings } from 'soapbox/hooks';
|
||||
|
@ -23,7 +22,6 @@ const messages = defineMessages({
|
|||
/** Desktop sidebar with links to different views in the app. */
|
||||
const SidebarNavigation = () => {
|
||||
const intl = useIntl();
|
||||
const { unreadChatsCount } = useStatContext();
|
||||
|
||||
const features = useFeatures();
|
||||
const settings = useSettings();
|
||||
|
@ -95,17 +93,17 @@ const SidebarNavigation = () => {
|
|||
|
||||
/** Conditionally render the supported messages link */
|
||||
const renderMessagesLink = (): React.ReactNode => {
|
||||
if (features.chats) {
|
||||
return (
|
||||
<SidebarNavigationLink
|
||||
to='/chats'
|
||||
icon={require('@tabler/icons/messages.svg')}
|
||||
count={unreadChatsCount}
|
||||
countMax={9}
|
||||
text={<FormattedMessage id='navigation.chats' defaultMessage='Chats' />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
// if (features.chats) {
|
||||
// return (
|
||||
// <SidebarNavigationLink
|
||||
// to='/chats'
|
||||
// icon={require('@tabler/icons/messages.svg')}
|
||||
// count={unreadChatsCount}
|
||||
// countMax={9}
|
||||
// text={<FormattedMessage id='navigation.chats' defaultMessage='Chats' />}
|
||||
// />
|
||||
// );
|
||||
// }
|
||||
|
||||
if (features.directTimeline || features.conversations) {
|
||||
return (
|
||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
|||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import ThumbNavigationLink from 'soapbox/components/thumb-navigation-link';
|
||||
import { useStatContext } from 'soapbox/contexts/stat-context';
|
||||
import { useAppSelector, useFeatures, useGroupsPath, useOwnAccount } from 'soapbox/hooks';
|
||||
|
||||
const ThumbNavigation: React.FC = (): JSX.Element => {
|
||||
|
@ -10,25 +9,23 @@ const ThumbNavigation: React.FC = (): JSX.Element => {
|
|||
const features = useFeatures();
|
||||
const groupsPath = useGroupsPath();
|
||||
|
||||
const { unreadChatsCount } = useStatContext();
|
||||
|
||||
const notificationCount = useAppSelector((state) => state.notifications.unread);
|
||||
const dashboardCount = useAppSelector((state) => state.admin.openReports.count() + state.admin.awaitingApproval.count());
|
||||
|
||||
/** Conditionally render the supported messages link */
|
||||
const renderMessagesLink = (): React.ReactNode => {
|
||||
if (features.chats) {
|
||||
return (
|
||||
<ThumbNavigationLink
|
||||
src={require('@tabler/icons/messages.svg')}
|
||||
text={<FormattedMessage id='navigation.chats' defaultMessage='Chats' />}
|
||||
to='/chats'
|
||||
exact
|
||||
count={unreadChatsCount}
|
||||
countMax={9}
|
||||
/>
|
||||
);
|
||||
}
|
||||
// if (features.chats) {
|
||||
// return (
|
||||
// <ThumbNavigationLink
|
||||
// src={require('@tabler/icons/messages.svg')}
|
||||
// text={<FormattedMessage id='navigation.chats' defaultMessage='Chats' />}
|
||||
// to='/chats'
|
||||
// exact
|
||||
// count={unreadChatsCount}
|
||||
// countMax={9}
|
||||
// />
|
||||
// );
|
||||
// }
|
||||
|
||||
if (features.directTimeline || features.conversations) {
|
||||
return (
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
import { fetchMfa } from 'soapbox/actions/mfa';
|
||||
|
@ -9,7 +9,7 @@ import { useAppDispatch, useAppSelector, useFeatures, useOwnAccount } from 'soap
|
|||
|
||||
import Preferences from '../preferences';
|
||||
|
||||
import MessagesSettings from './components/messages-settings';
|
||||
// import MessagesSettings from './components/messages-settings';
|
||||
|
||||
const messages = defineMessages({
|
||||
accountAliases: { id: 'navigation_bar.account_aliases', defaultMessage: 'Account aliases' },
|
||||
|
@ -130,7 +130,7 @@ const Settings = () => {
|
|||
</>
|
||||
)}
|
||||
|
||||
{features.chats ? (
|
||||
{/* {features.chats ? (
|
||||
<>
|
||||
<CardHeader>
|
||||
<CardTitle title={<FormattedMessage id='column.chats' defaultMessage='Chats' />} />
|
||||
|
@ -140,7 +140,7 @@ const Settings = () => {
|
|||
<MessagesSettings />
|
||||
</CardBody>
|
||||
</>
|
||||
) : null}
|
||||
) : null} */}
|
||||
|
||||
<CardHeader>
|
||||
<CardTitle title={intl.formatMessage(messages.preferences)} />
|
||||
|
|
|
@ -86,7 +86,7 @@ import {
|
|||
Backups,
|
||||
MfaForm,
|
||||
ChatIndex,
|
||||
ChatWidget,
|
||||
// ChatWidget,
|
||||
ServerInfo,
|
||||
Dashboard,
|
||||
ModerationLog,
|
||||
|
@ -547,7 +547,7 @@ const UI: React.FC<IUI> = ({ children }) => {
|
|||
</BundleContainer>
|
||||
)}
|
||||
|
||||
{me && features.chats && (
|
||||
{/* {me && features.chats && (
|
||||
<BundleContainer fetchComponent={ChatWidget}>
|
||||
{Component => (
|
||||
<div className='hidden xl:block'>
|
||||
|
@ -555,7 +555,7 @@ const UI: React.FC<IUI> = ({ children }) => {
|
|||
</div>
|
||||
)}
|
||||
</BundleContainer>
|
||||
)}
|
||||
)} */}
|
||||
<ThumbNavigation />
|
||||
|
||||
<BundleContainer fetchComponent={ProfileHoverCard}>
|
||||
|
|
Loading…
Reference in a new issue