[Gekidou] Show unread empty state if there are not unread threads (#6389)

* Show unread empty state if there are not unread threads

* Update loading unreads style
This commit is contained in:
Elias Nahum 2022-06-16 18:01:47 -04:00 committed by GitHub
parent 6ff41ea199
commit 5537c39793
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 5 deletions

View file

@ -190,7 +190,7 @@ exports[`components/categories_list should render channels error 1`] = `
style={
Object {
"borderBottomColor": "rgba(255,255,255,0.16)",
"borderLeftColor": "#1c58d9",
"borderLeftColor": "#ffffff",
"borderRadius": 7,
"borderRightColor": "rgba(255,255,255,0.16)",
"borderTopColor": "rgba(255,255,255,0.16)",

View file

@ -12,6 +12,7 @@ import {filterAndSortMyChannels, makeChannelsMap} from '@helpers/database';
import {getChannelById, observeChannelsByLastPostAt, observeCurrentChannel, observeNotifyPropsByChannels, queryMyChannelUnreads} from '@queries/servers/channel';
import {queryPreferencesByCategoryAndName} from '@queries/servers/preference';
import {observeLastUnreadChannelId} from '@queries/servers/system';
import {observeUnreadsAndMentionsInTeam} from '@queries/servers/thread';
import UnreadCategories from './unreads';
@ -63,8 +64,11 @@ const enhanced = withObservables(['currentTeamId', 'isTablet', 'onlyUnreads'], (
}
return of$([]);
}));
const unreadThreads = observeUnreadsAndMentionsInTeam(database, currentTeamId, true);
return {
unreadChannels,
unreadThreads,
};
});

View file

@ -23,6 +23,7 @@ describe('components/channel_list/categories/body', () => {
unreadChannels={[]}
onChannelSwitch={() => undefined}
onlyUnreads={false}
unreadThreads={{unreads: 0, mentions: 0}}
/>,
{database},
);

View file

@ -35,11 +35,12 @@ type UnreadCategoriesProps = {
onChannelSwitch: (channelId: string) => void;
onlyUnreads: boolean;
unreadChannels: ChannelModel[];
unreadThreads: {unreads: number; mentions: number};
}
const extractKey = (item: ChannelModel) => item.id;
const UnreadCategories = ({onChannelSwitch, onlyUnreads, unreadChannels}: UnreadCategoriesProps) => {
const UnreadCategories = ({onChannelSwitch, onlyUnreads, unreadChannels, unreadThreads}: UnreadCategoriesProps) => {
const intl = useIntl();
const theme = useTheme();
const isTablet = useIsTablet();
@ -60,7 +61,7 @@ const UnreadCategories = ({onChannelSwitch, onlyUnreads, unreadChannels}: Unread
<Empty onlyUnreads={onlyUnreads}/>
) : undefined;
if (!unreadChannels.length && !onlyUnreads) {
if (!unreadChannels.length && !unreadThreads.mentions && !unreadThreads.mentions && !onlyUnreads) {
return null;
}

View file

@ -170,7 +170,7 @@ exports[`components/channel_list/header Channel List Header Component should mat
style={
Object {
"borderBottomColor": "rgba(255,255,255,0.16)",
"borderLeftColor": "#1c58d9",
"borderLeftColor": "#ffffff",
"borderRadius": 7,
"borderRightColor": "rgba(255,255,255,0.16)",
"borderTopColor": "rgba(255,255,255,0.16)",

View file

@ -14,7 +14,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
height: 14,
borderRadius: 7,
borderBottomColor: changeOpacity(theme.sidebarText, 0.16),
borderLeftColor: theme.buttonBg,
borderLeftColor: theme.sidebarText,
borderRightColor: changeOpacity(theme.sidebarText, 0.16),
borderTopColor: changeOpacity(theme.sidebarText, 0.16),
borderWidth: 2,