-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Unreads on top * Feedback addressed * update sorted channels if locale changes * Extract localized strings Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
- Loading branch information
Showing
9 changed files
with
168 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {Database} from '@nozbe/watermelondb'; | ||
import React from 'react'; | ||
|
||
import {renderWithEverything} from '@test/intl-test-helper'; | ||
import TestHelper from '@test/test_helper'; | ||
|
||
import UnreadsCategory from './unreads'; | ||
|
||
describe('components/channel_list/categories/body', () => { | ||
let database: Database; | ||
|
||
beforeAll(async () => { | ||
const server = await TestHelper.setupServerDatabase(); | ||
database = server.database; | ||
}); | ||
|
||
it('render without error', () => { | ||
const wrapper = renderWithEverything( | ||
<UnreadsCategory unreadChannels={[]}/>, | ||
{database}, | ||
); | ||
|
||
expect(wrapper.toJSON()).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import React from 'react'; | ||
import {useIntl} from 'react-intl'; | ||
import {FlatList, Text} from 'react-native'; | ||
|
||
import {changeOpacity, makeStyleSheetFromTheme} from '@app/utils/theme'; | ||
import {useTheme} from '@context/theme'; | ||
import {typography} from '@utils/typography'; | ||
|
||
import ChannelListItem from './body/channel'; | ||
|
||
import type ChannelModel from '@typings/database/models/servers/channel'; | ||
|
||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ | ||
heading: { | ||
color: changeOpacity(theme.sidebarText, 0.64), | ||
...typography('Heading', 75), | ||
paddingLeft: 5, | ||
paddingTop: 10, | ||
}, | ||
})); | ||
|
||
const renderItem = ({item}: {item: ChannelModel}) => { | ||
return ( | ||
<ChannelListItem | ||
channel={item} | ||
isActive={true} | ||
collapsed={false} | ||
/> | ||
); | ||
}; | ||
|
||
const UnreadCategories = ({unreadChannels}: {unreadChannels: ChannelModel[]}) => { | ||
const theme = useTheme(); | ||
const styles = getStyleSheet(theme); | ||
const intl = useIntl(); | ||
|
||
return ( | ||
<> | ||
<Text | ||
style={styles.heading} | ||
> | ||
{intl.formatMessage({id: 'mobile.channel_list.unreads', defaultMessage: 'UNREADS'})} | ||
</Text> | ||
<FlatList | ||
data={unreadChannels} | ||
renderItem={renderItem} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default UnreadCategories; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters