feedback review
This commit is contained in:
parent
54218d8f3d
commit
7f9cd287fe
5 changed files with 6 additions and 22 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import DatabaseManager from '@database/manager';
|
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> {
|
export async function handleAddCustomEmoji(serverUrl: string, msg: WebSocketMessage): Promise<void> {
|
||||||
const operator = DatabaseManager.serverDatabases[serverUrl]?.operator;
|
const operator = DatabaseManager.serverDatabases[serverUrl]?.operator;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ type ReactionProps = {
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MIN_WIDTH = 50;
|
||||||
|
const DIGIT_WIDTH = 5;
|
||||||
|
|
||||||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
||||||
return {
|
return {
|
||||||
count: {
|
count: {
|
||||||
|
|
@ -44,7 +47,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
marginBottom: 12,
|
marginBottom: 12,
|
||||||
marginRight: 8,
|
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 styles = getStyleSheet(theme);
|
||||||
const digits = String(count).length;
|
const digits = String(count).length;
|
||||||
const containerStyle = useMemo(() => {
|
const containerStyle = useMemo(() => {
|
||||||
const minWidth = 50 + (digits * 5);
|
const minWidth = MIN_WIDTH + (digits * DIGIT_WIDTH);
|
||||||
return [styles.reaction, (highlight && styles.highlight), {minWidth}];
|
return [styles.reaction, (highlight && styles.highlight), {minWidth}];
|
||||||
}, [styles.reaction, highlight, digits]);
|
}, [styles.reaction, highlight, digits]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
@ -14,9 +14,6 @@ type Props = {
|
||||||
|
|
||||||
const style = StyleSheet.create({
|
const style = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
paddingVertical: 0,
|
|
||||||
paddingHorizontal: 0,
|
|
||||||
paddingTop: 0,
|
|
||||||
marginBottom: 8,
|
marginBottom: 8,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
1
types/api/users.d.ts
vendored
1
types/api/users.d.ts
vendored
|
|
@ -43,7 +43,6 @@ type UserProfile = {
|
||||||
last_picture_update: number;
|
last_picture_update: number;
|
||||||
remote_id?: string;
|
remote_id?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
remote_id?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type UsersState = {
|
type UsersState = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue