diff --git a/app/components/common_post_options/base_option/index.tsx b/app/components/common_post_options/base_option/index.tsx
index c5d06f4266..df85900dba 100644
--- a/app/components/common_post_options/base_option/index.tsx
+++ b/app/components/common_post_options/base_option/index.tsx
@@ -1,64 +1,38 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
-import React, {useMemo} from 'react';
+import React from 'react';
+import {useIntl} from 'react-intl';
-import FormattedText from '@components/formatted_text';
-import MenuItem from '@components/menu_item';
-import {useTheme} from '@context/theme';
-import {makeStyleSheetFromTheme} from '@utils/theme';
-import {typography} from '@utils/typography';
-
-const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
- destructive: {
- color: theme.dndIndicator,
- },
- label: {
- color: theme.centerChannelColor,
- ...typography('Body', 200),
- },
- iconContainerStyle: {
- marginLeft: 0,
- },
-}));
+import OptionItem from '@components/option_item';
type BaseOptionType = {
- i18nId: string;
defaultMessage: string;
+ i18nId: string;
iconName: string;
+ isDestructive?: boolean;
onPress: () => void;
testID: string;
- isDestructive?: boolean;
}
const BaseOption = ({
- i18nId,
defaultMessage,
+ i18nId,
iconName,
+ isDestructive = false,
onPress,
testID,
- isDestructive = false,
}: BaseOptionType) => {
- const theme = useTheme();
- const styles = getStyleSheet(theme);
-
- const label = useMemo(() => (
-
- ), [i18nId, defaultMessage, theme]);
+ const intl = useIntl();
return (
-
);
};
diff --git a/app/components/menu_item/__snapshots__/index.test.tsx.snap b/app/components/menu_item/__snapshots__/index.test.tsx.snap
deleted file mode 100644
index 6fde1aafa6..0000000000
--- a/app/components/menu_item/__snapshots__/index.test.tsx.snap
+++ /dev/null
@@ -1,235 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`DrawerItem should match snapshot 1`] = `
-
-
-
-
-
-
-
-
-
- default message
-
-
-
-
-
-
-
-`;
-
-exports[`DrawerItem should match snapshot without separator and centered false 1`] = `
-
-
-
-
-
-
-
-
-
- default message
-
-
-
-
-
-
-`;
diff --git a/app/components/menu_item/index.test.tsx b/app/components/menu_item/index.test.tsx
deleted file mode 100644
index 7795dd1a18..0000000000
--- a/app/components/menu_item/index.test.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
-// See LICENSE.txt for license information.
-
-import React from 'react';
-
-import {Preferences} from '@constants';
-import {renderWithIntl} from '@test/intl-test-helper';
-
-import MenuItem from '.';
-
-describe('DrawerItem', () => {
- const baseProps = {
- onPress: () => null,
- testID: 'test-id',
- centered: true,
- defaultMessage: 'default message',
- i18nId: 'i18-id',
- iconName: 'icon-name',
- isDestructor: true,
- separator: true,
- theme: Preferences.THEMES.denim,
- };
-
- test('should match snapshot', () => {
- const wrapper = renderWithIntl();
-
- expect(wrapper.toJSON()).toMatchSnapshot();
- });
-
- test('should match snapshot without separator and centered false', () => {
- const props = {
- ...baseProps,
- centered: false,
- separator: false,
- };
- const wrapper = renderWithIntl(
- ,
- );
-
- expect(wrapper.toJSON()).toMatchSnapshot();
- });
-});
diff --git a/app/components/menu_item/index.tsx b/app/components/menu_item/index.tsx
deleted file mode 100644
index 345ba9ba7a..0000000000
--- a/app/components/menu_item/index.tsx
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
-// See LICENSE.txt for license information.
-
-import React, {ReactNode} from 'react';
-import {Platform, StyleProp, TextStyle, View, ViewStyle} from 'react-native';
-
-import CompassIcon from '@components/compass_icon';
-import FormattedText from '@components/formatted_text';
-import TouchableWithFeedback from '@components/touchable_with_feedback';
-import {useTheme} from '@context/theme';
-import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
-
-export const ITEM_HEIGHT = 50;
-const getStyleSheet = makeStyleSheetFromTheme((theme) => {
- return {
- container: {
- flexDirection: 'row',
- minHeight: ITEM_HEIGHT,
- },
- iconContainer: {
- width: 45,
- height: ITEM_HEIGHT,
- alignItems: 'center',
- justifyContent: 'center',
- marginLeft: 5,
- },
- icon: {
- color: changeOpacity(theme.centerChannelColor, 0.64),
- fontSize: 24,
- },
- labelContainer: {
- flex: 1,
- justifyContent: 'center',
- paddingVertical: 14,
- },
- centerLabel: {
- textAlign: 'center',
- textAlignVertical: 'center',
- },
- label: {
- color: changeOpacity(theme.centerChannelColor, 0.5),
- fontSize: 17,
- textAlignVertical: 'center',
- includeFontPadding: false,
- },
- divider: {
- backgroundColor: changeOpacity(theme.centerChannelColor, 0.12),
- height: 1,
- },
- chevron: {
- alignSelf: 'center',
- color: changeOpacity(theme.centerChannelColor, 0.64),
- fontSize: 24,
- marginRight: 8,
- },
- linkContainer: {
- marginHorizontal: 15,
- color: theme.linkColor,
- },
- mainContainer: {
- flexDirection: 'column',
- },
- };
-});
-
-export type MenuItemProps = {
- centered?: boolean;
- chevronStyle?: StyleProp;
- containerStyle?: StyleProp;
- defaultMessage?: string;
- i18nId?: string;
- iconContainerStyle?: StyleProp;
- iconName?: string;
- isDestructor?: boolean;
- isLink?: boolean;
- labelComponent?: ReactNode;
- labelStyle?: StyleProp;
- leftComponent?: ReactNode;
- messageValues?: Record;
- onPress: () => void;
- rightComponent?: ReactNode;
- separator?: boolean;
- separatorStyle?: StyleProp;
- showArrow?: boolean;
- testID: string;
-};
-const MenuItem = ({
- centered,
- chevronStyle,
- containerStyle,
- defaultMessage = '',
- i18nId,
- iconContainerStyle,
- iconName,
- isDestructor = false,
- isLink = false,
- labelComponent,
- labelStyle,
- leftComponent,
- messageValues,
- onPress,
- rightComponent,
- separator = true,
- separatorStyle,
- showArrow = false,
- testID,
-}: MenuItemProps) => {
- const theme = useTheme();
- const style = getStyleSheet(theme);
-
- let icon;
- if (leftComponent) {
- icon = leftComponent;
- } else if (iconName) {
- icon = (
-
- );
- }
-
- let label;
- if (labelComponent) {
- label = labelComponent;
- } else if (i18nId) {
- label = (
-
- );
- }
-
- return (
-
-
-
- {icon && (
-
- {icon}
-
- )}
-
- {label}
-
- {rightComponent}
- {Boolean(showArrow) && (
-
- )}
-
- {Boolean(separator) && ()}
-
-
- );
-};
-
-export default MenuItem;
diff --git a/app/components/option_item/index.tsx b/app/components/option_item/index.tsx
index 36c0d3095c..3daa260e21 100644
--- a/app/components/option_item/index.tsx
+++ b/app/components/option_item/index.tsx
@@ -98,6 +98,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
export type OptionItemProps = {
action?: (React.Dispatch>)|((value: string | boolean) => void);
+ arrowStyle?: StyleProp;
containerStyle?: StyleProp;
description?: string;
destructive?: boolean;
@@ -117,6 +118,7 @@ export type OptionItemProps = {
const OptionItem = ({
action,
+ arrowStyle,
containerStyle,
description,
destructive,
@@ -197,6 +199,7 @@ const OptionItem = ({
color={changeOpacity(theme.centerChannelColor, 0.32)}
name='chevron-right'
size={24}
+ style={arrowStyle}
/>
);
} else if (type === OptionType.REMOVE) {
@@ -239,14 +242,14 @@ const OptionItem = ({
{type === OptionType.RADIO && radioComponent}
{label}
{Boolean(description) &&
{description}
diff --git a/app/components/status_label/index.tsx b/app/components/status_label/index.tsx
index 8cc7e0c300..9d8015b131 100644
--- a/app/components/status_label/index.tsx
+++ b/app/components/status_label/index.tsx
@@ -2,24 +2,25 @@
// See LICENSE.txt for license information.
import React from 'react';
-import {TextStyle} from 'react-native';
+import {StyleProp, TextStyle} from 'react-native';
import FormattedText from '@components/formatted_text';
import {General} from '@constants';
import {useTheme} from '@context/theme';
import {t} from '@i18n';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
+import {typography} from '@utils/typography';
type StatusLabelProps = {
status?: string;
- labelStyle?: TextStyle;
+ labelStyle?: StyleProp;
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
label: {
color: changeOpacity(theme.centerChannelColor, 0.5),
- fontSize: 17,
+ ...typography('Body', 200),
textAlignVertical: 'center',
includeFontPadding: false,
},
diff --git a/app/database/operator/base_data_operator/index.ts b/app/database/operator/base_data_operator/index.ts
index f9a59d2c58..631cf60e6d 100644
--- a/app/database/operator/base_data_operator/index.ts
+++ b/app/database/operator/base_data_operator/index.ts
@@ -93,8 +93,6 @@ export default class BaseDataOperator {
// We found a record in the database that matches this element; hence, we'll proceed for an UPDATE operation
if (existingRecord) {
- // const existingRecord = createOrUpdateRaws[findIndex];
-
// Some raw value has an update_at field. We'll proceed to update only if the update_at value is different from the record's value in database
const updateRecords = getValidRecordsForUpdate({
tableName,
@@ -125,8 +123,7 @@ export default class BaseDataOperator {
* @param {RawValue[]} prepareRecord.createRaws
* @param {RawValue[]} prepareRecord.updateRaws
* @param {Model[]} prepareRecord.deleteRaws
- * @param {(TransformerArgs) => Promise;} prepareRecord.composer
- * @throws {DataOperatorException}
+ * @param {(TransformerArgs) => Promise;} transformer
* @returns {Promise}
*/
prepareRecords = async ({tableName, createRaws, deleteRaws, updateRaws, transformer}: OperationArgs): Promise => {
@@ -184,7 +181,6 @@ export default class BaseDataOperator {
* batchRecords: Accepts an instance of Database (either Default or Server) and an array of
* prepareCreate/prepareUpdate 'models' and executes the actions on the database.
* @param {Array} models
- * @throws {DataOperatorException}
* @returns {Promise}
*/
async batchRecords(models: Model[]): Promise {
diff --git a/app/database/operator/server_data_operator/handlers/group.ts b/app/database/operator/server_data_operator/handlers/group.ts
index 6ceab3d804..0a64dd2e7f 100644
--- a/app/database/operator/server_data_operator/handlers/group.ts
+++ b/app/database/operator/server_data_operator/handlers/group.ts
@@ -28,7 +28,6 @@ const GroupHandler = (superclass: any) => class extends superclass implements Gr
* handleGroups: Handler responsible for the Create/Update operations occurring on the Group table from the 'Server' schema
*
* @param {HandleGroupArgs}
- * @throws DataOperatorException
* @returns {Promise}
*/
handleGroups = async ({groups, prepareRecordsOnly = true}: HandleGroupArgs): Promise => {
@@ -111,7 +110,6 @@ const GroupHandler = (superclass: any) => class extends superclass implements Gr
* handleGroupMembershipsForMember: Handler responsible for the Create/Update operations occurring on the GroupMembership table from the 'Server' schema
*
* @param {HandleGroupMembershipForMemberArgs}
- * @throws DataOperatorException
* @returns {Promise}
*/
handleGroupMembershipsForMember = async ({userId, groups, prepareRecordsOnly = true}: HandleGroupMembershipForMemberArgs): Promise => {
@@ -169,7 +167,6 @@ const GroupHandler = (superclass: any) => class extends superclass implements Gr
* handleGroupTeamsForTeam: Handler responsible for the Create/Update operations occurring on the GroupTeam table from the 'Server' schema
*
* @param {HandleGroupTeamsForTeamArgs}
- * @throws DataOperatorException
* @returns {Promise}
*/
handleGroupTeamsForTeam = async ({teamId, groups, prepareRecordsOnly = true}: HandleGroupTeamsForTeamArgs): Promise => {
diff --git a/app/screens/about/server_version.tsx b/app/screens/about/server_version.tsx
deleted file mode 100644
index faf0e67290..0000000000
--- a/app/screens/about/server_version.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
-// See LICENSE.txt for license information.
-
-import React from 'react';
-
-import FormattedText from '@components/formatted_text';
-import {useTheme} from '@context/theme';
-import {t} from '@i18n';
-import {makeStyleSheetFromTheme} from '@utils/theme';
-
-type ServerVersionProps = {
- config: ClientConfig;
-}
-
-const ServerVersion = ({config}: ServerVersionProps) => {
- const buildNumber = config.BuildNumber;
- const version = config.Version;
- const theme = useTheme();
- const style = getStyleSheet(theme);
-
- let id = t('mobile.about.serverVersion');
- let defaultMessage = 'Server Version: {version} (Build {number})';
- let values: {version: string; number?: string} = {
- version,
- number: buildNumber,
- };
-
- if (buildNumber === version) {
- id = t('mobile.about.serverVersionNoBuild');
- defaultMessage = 'Server Version: {version}';
- values = {
- version,
- number: undefined,
- };
- }
- return (
-
- );
-};
-
-const getStyleSheet = makeStyleSheetFromTheme((theme) => {
- return {
- info: {
- color: theme.centerChannelColor,
- fontSize: 16,
- lineHeight: 19,
- },
- };
-});
-
-export default ServerVersion;
diff --git a/app/screens/home/account/components/options/custom_status/custom_label.tsx b/app/screens/home/account/components/options/custom_status/custom_label.tsx
index a430c85e4a..4ea11bc4e8 100644
--- a/app/screens/home/account/components/options/custom_status/custom_label.tsx
+++ b/app/screens/home/account/components/options/custom_status/custom_label.tsx
@@ -8,6 +8,7 @@ import {View} from 'react-native';
import ClearButton from '@components/custom_status/clear_button';
import CustomStatusExpiry from '@components/custom_status/custom_status_expiry';
import FormattedText from '@components/formatted_text';
+import {useTheme} from '@context/theme';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
import CustomStatusText from './custom_status_text';
@@ -16,9 +17,8 @@ type CustomLabelProps = {
customStatus: UserCustomStatus;
isCustomStatusExpirySupported: boolean;
isStatusSet: boolean;
- showRetryMessage: boolean;
- theme: Theme;
onClearCustomStatus: () => void;
+ showRetryMessage: boolean;
};
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
@@ -30,6 +30,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
},
customStatusTextContainer: {
width: '70%',
+ marginLeft: 16,
},
customStatusExpiryText: {
paddingTop: 3,
@@ -43,14 +44,14 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
};
});
-const CustomLabel = ({customStatus, isCustomStatusExpirySupported, isStatusSet, onClearCustomStatus, showRetryMessage, theme}: CustomLabelProps) => {
- const style = getStyleSheet(theme);
+const CustomLabel = ({customStatus, isCustomStatusExpirySupported, isStatusSet, onClearCustomStatus, showRetryMessage}: CustomLabelProps) => {
+ const theme = useTheme();
+ const styles = getStyleSheet(theme);
return (
<>
-
+
@@ -58,7 +59,7 @@ const CustomLabel = ({customStatus, isCustomStatusExpirySupported, isStatusSet,
)}
{isStatusSet && (
-
+
{
@@ -22,7 +22,8 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
};
});
-const CustomStatusEmoji = ({emoji, isStatusSet, theme}: CustomStatusEmojiProps) => {
+const CustomStatusEmoji = ({emoji, isStatusSet}: CustomStatusEmojiProps) => {
+ const theme = useTheme();
const styles = getStyleSheet(theme);
return (
diff --git a/app/screens/home/account/components/options/custom_status/custom_status_text.tsx b/app/screens/home/account/components/options/custom_status/custom_status_text.tsx
index 35de980244..8ffddffe0f 100644
--- a/app/screens/home/account/components/options/custom_status/custom_status_text.tsx
+++ b/app/screens/home/account/components/options/custom_status/custom_status_text.tsx
@@ -5,27 +5,33 @@ import React from 'react';
import CustomText from '@components/custom_status/custom_status_text';
import FormattedText from '@components/formatted_text';
+import {useTheme} from '@context/theme';
import {makeStyleSheetFromTheme} from '@utils/theme';
+import {typography} from '@utils/typography';
type CustomStatusTextProps = {
customStatus?: UserCustomStatus;
isStatusSet: boolean;
- theme: Theme;
};
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
text: {
color: theme.centerChannelColor,
+ ...typography('Body', 200),
},
}));
-const CustomStatusText = ({isStatusSet, customStatus, theme}: CustomStatusTextProps) => {
+const CustomStatusText = ({isStatusSet, customStatus}: CustomStatusTextProps) => {
+ const theme = useTheme();
+ const styles = getStyleSheet(theme);
+
let text: React.ReactNode | string;
text = (
);
@@ -33,7 +39,6 @@ const CustomStatusText = ({isStatusSet, customStatus, theme}: CustomStatusTextPr
text = customStatus.text;
}
- const styles = getStyleSheet(theme);
return (
{
+ return {
+ label: {
+ color: theme.centerChannelColor,
+ ...typography('Body', 200),
+ textAlignVertical: 'center',
+ includeFontPadding: false,
+ },
+ body: {
+ flexDirection: 'row',
+ marginVertical: 18,
+ },
+ };
+});
+
type CustomStatusProps = {
isCustomStatusExpirySupported: boolean;
isTablet: boolean;
@@ -35,6 +51,7 @@ const CustomStatus = ({isCustomStatusExpirySupported, isTablet, currentUser}: Cu
const customStatus = getUserCustomStatus(currentUser);
const isCustomStatusExpired = checkCustomStatusIsExpired(currentUser);
const isStatusSet = !isCustomStatusExpired && (customStatus?.text || customStatus?.emoji);
+ const styles = getStyleSheet(theme);
useEffect(() => {
const onSetCustomStatusError = () => {
@@ -68,27 +85,23 @@ const CustomStatus = ({isCustomStatusExpirySupported, isTablet, currentUser}: Cu
}), [isTablet]);
return (
-