* Add autotranslations * Develop latest changes and missing features * i18n-extract * Fix tests and update api behavior * Fix minor bugs * adjustments to shimmer animation, showtranslation modal style * Update post.tsx * Update show_translation.tsx * adjust sizing and opacity of translate icon * Add channel header translated icon * Disable auto translation item if it is not a supported language * Move channel info to the top * Update edit channel to channel info * Fix align of option items * Fix i18n * Add detox related changes for channel settings changes * Add tests * Address changes around the my channel column change * Address feedback * Fix test * Fix bad import * Fix set my channel autotranslation * Fix test * Address feedback * Add missing files from last commit * Remove unneeded change --------- Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {withDatabase, withObservables} from '@nozbe/watermelondb/react';
|
|
import {of as of$} from 'rxjs';
|
|
import {switchMap} from 'rxjs/operators';
|
|
|
|
import {queryAllCustomEmojis} from '@queries/servers/custom_emoji';
|
|
import {observePost} from '@queries/servers/post';
|
|
import {observeConfigBooleanValue} from '@queries/servers/system';
|
|
import {observeIsCRTEnabled} from '@queries/servers/thread';
|
|
import {mapCustomEmojiNames} from '@utils/emoji/helpers';
|
|
|
|
import ShowTranslation from './show_translation';
|
|
|
|
import type {WithDatabaseArgs} from '@typings/database/database';
|
|
|
|
type Props = WithDatabaseArgs & {
|
|
postId: string;
|
|
}
|
|
|
|
const enhance = withObservables(['postId'], ({postId, database}: Props) => {
|
|
const post = observePost(database, postId);
|
|
const appsEnabled = observeConfigBooleanValue(database, 'FeatureFlagAppsEnabled');
|
|
const customEmojiNames = queryAllCustomEmojis(database).observe().pipe(
|
|
switchMap((customEmojis) => of$(mapCustomEmojiNames(customEmojis))),
|
|
);
|
|
const isCRTEnabled = observeIsCRTEnabled(database);
|
|
return {
|
|
post,
|
|
appsEnabled,
|
|
customEmojiNames,
|
|
isCRTEnabled,
|
|
};
|
|
});
|
|
|
|
export default withDatabase(enhance(ShowTranslation));
|
|
|