[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:
parent
6ff41ea199
commit
5537c39793
6 changed files with 11 additions and 5 deletions
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ describe('components/channel_list/categories/body', () => {
|
|||
unreadChannels={[]}
|
||||
onChannelSwitch={() => undefined}
|
||||
onlyUnreads={false}
|
||||
unreadThreads={{unreads: 0, mentions: 0}}
|
||||
/>,
|
||||
{database},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)",
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue