* MM-39710: saved posts screen and DB - Adds ids of saved posts to the systems table, as we do with recent mentions. - Adds a new remote action to fetch saved posts (getFlaggedPosts). - Adds a new screen to display those in a mobile. - Displays saved posts in the tablet view next to profile card. * Uses Preferences instead of System table Renames to saved posts wherever possible * Adds text to localization file * Fixes fetching/saving saved posts * Refactor mini post to components folder * Fixes hooks dependencies according to review * Removes unnecessary 'withObservables' * Small refactor * Satisfies linter * Adds empty state And fixes empty state icon to be theme sensitive. Both recent_mentions and saved_posts. * Fixes empty screen's alignment * Add missing preference * add missing translation strings * remove unused database type definition * Fetch newly saved post * Fix return type for client.getSavedPosts * Remove usage of lodash compose * Rename get remote actions to fetch * Include close button for savedPost modal * fix tablet view for SavePosts and use lottie loading indicator * Render post with content for save posts and recent mentions * post list viewable items type definition * Add layout width to post content for saved post screen * Use PostWithChannel and viewableItems for saved posts and recent mentions * Layout margin of 20 * openGraphImage margin * Fix openGraphImage display Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
import React from 'react';
|
|
import {View} from 'react-native';
|
|
|
|
import FormattedText from '@components/formatted_text';
|
|
import {useTheme} from '@context/theme';
|
|
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
|
import {typography} from '@utils/typography';
|
|
|
|
import SavedPostsIcon from './saved_posts_icon';
|
|
|
|
const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
|
|
container: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
paddingHorizontal: 40,
|
|
},
|
|
title: {
|
|
color: theme.centerChannelColor,
|
|
...typography('Heading', 400),
|
|
},
|
|
paragraph: {
|
|
marginTop: 8,
|
|
textAlign: 'center',
|
|
color: changeOpacity(theme.centerChannelColor, 0.72),
|
|
...typography('Body', 200),
|
|
},
|
|
icon: {
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
}));
|
|
|
|
function EmptySavedPosts() {
|
|
const theme = useTheme();
|
|
const styles = getStyleSheet(theme);
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<SavedPostsIcon style={styles.icon}/>
|
|
<FormattedText
|
|
defaultMessage='No saved messages yet'
|
|
id='saved_posts.empty.title'
|
|
style={styles.title}
|
|
testID='saved_posts.empty.title'
|
|
/>
|
|
<FormattedText
|
|
defaultMessage={'To save something for later, long-press on a message and choose Save from the menu. Saved messages are only visible to you.'}
|
|
id='saved_posts.empty.paragraph'
|
|
style={styles.paragraph}
|
|
testID='saved_posts.empty.paragraph'
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
export default EmptySavedPosts;
|