feedback review

This commit is contained in:
Elias Nahum
2022-03-23 11:35:37 -03:00
parent 54218d8f3d
commit 7f9cd287fe
5 changed files with 6 additions and 22 deletions

View File

@@ -2,7 +2,7 @@
// See LICENSE.txt for license information.
import DatabaseManager from '@database/manager';
import {queryReaction} from '@queries/servers/reactions';
import {queryReaction} from '@queries/servers/reaction';
export async function handleAddCustomEmoji(serverUrl: string, msg: WebSocketMessage): Promise<void> {
const operator = DatabaseManager.serverDatabases[serverUrl]?.operator;

View File

@@ -18,6 +18,9 @@ type ReactionProps = {
theme: Theme;
}
const MIN_WIDTH = 50;
const DIGIT_WIDTH = 5;
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
return {
count: {
@@ -44,7 +47,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
justifyContent: 'center',
marginBottom: 12,
marginRight: 8,
minWidth: 50,
minWidth: MIN_WIDTH,
},
};
});
@@ -53,7 +56,7 @@ const Reaction = ({count, emojiName, highlight, onPress, onLongPress, theme}: Re
const styles = getStyleSheet(theme);
const digits = String(count).length;
const containerStyle = useMemo(() => {
const minWidth = 50 + (digits * 5);
const minWidth = MIN_WIDTH + (digits * DIGIT_WIDTH);
return [styles.reaction, (highlight && styles.highlight), {minWidth}];
}, [styles.reaction, highlight, digits]);

View File

@@ -1,15 +0,0 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Database, Q} from '@nozbe/watermelondb';
import {MM_TABLES} from '@constants/database';
const {SERVER: {REACTION}} = MM_TABLES;
export const queryReaction = (database: Database, emojiName: string, postId: string, userId: string) => {
return database.get(REACTION).query(
Q.where('emoji_name', emojiName),
Q.where('post_id', postId),
Q.where('user_id', userId),
);
};

View File

@@ -14,9 +14,6 @@ type Props = {
const style = StyleSheet.create({
container: {
paddingVertical: 0,
paddingHorizontal: 0,
paddingTop: 0,
marginBottom: 8,
},
});

View File

@@ -43,7 +43,6 @@ type UserProfile = {
last_picture_update: number;
remote_id?: string;
status?: string;
remote_id?: string;
};
type UsersState = {