mattermost-mobile/app/screens/settings/notification_push/push_thread.tsx
Avinash Lingaloo bb02b1178a
MM-39711 - Gekidou - Theme functionality (#6327)
* added chevron to menu item component

* starting with the skeleton

* starting with the skeleton

* starting with the skeleton

* starting with the skeleton

* remove extra line

* tested on tablets

* some corrections

* corrections as per review

* starting with notification skeleton

* attached notification settings to navigation

* added auto responder

* update translation

* update snapshot

* updated snapshot

* correction after review

* removed unnecessary screen

* refactored

* updated the testIDs

* Update Package.resolved

* refactor

* removed Mattermost as default server name

* fix ts

* refactored settings constant

* display settings skeleton

- pending: query for allowed themes

* added 'allowedThemes' query

* added section item

* mention screen skeleton in place

* added section and sectionItem component

* added reply section to the mention screen

* update i18n

* rename screens properly

* update i18n

* Refactored to MentionSettings component

* Refactored to ReplySettings component

* style clean up

* textTransform uppercase

* rename Section/SectionItem to Block/BlockItem

* added mobile push notif screen - push status section

* adding text to those two components

* correction following review

* added mobile push notification section

* added mobile push notification thread section

* style fix

* code fix

* code fix

* added skeleton for auto responder

* code clean up

* display theme skeleton

* display theme skeleton

* now using selected theme

* clean up code

* showing custom theme

* setTheme implemented

* code clean up

* some corrections

* Gekidou - Replace BlockItem with OptionItem (#6352)

* Replaced BlockItem component with OptionItem

* ui fix

* corrections from PR review

* code clean up

* correction from PR review

* fix - SettingsDisplay was wrongly removed from @screen/index

* fix dependencies

* corrections from peer review
2022-06-10 14:28:35 +04:00

73 lines
2.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {useIntl} from 'react-intl';
import {View} from 'react-native';
import Block from '@components/block';
import OptionItem from '@components/option_item';
import {useTheme} from '@context/theme';
import {t} from '@i18n';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
import {typography} from '@utils/typography';
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
upperCase: {
textTransform: 'uppercase',
},
separator: {
backgroundColor: changeOpacity(theme.centerChannelColor, 0.1),
flex: 1,
height: 1,
marginLeft: 15,
},
area: {
paddingHorizontal: 16,
},
label: {
color: theme.centerChannelColor,
...typography('Body', 100, 'Regular'),
},
};
});
const headerText = {
id: t('notification_settings.push_threads'),
defaultMessage: 'Thread reply notifications',
};
const footerText = {
id: t('notification_settings.push_threads.info'),
defaultMessage: 'When enabled, any reply to a thread you\'re following will send a mobile push notification',
};
type MobilePushThreadProps = {
onMobilePushThreadChanged: (status: string) => void;
pushThread: PushStatus;
}
const MobilePushThread = ({pushThread, onMobilePushThreadChanged}: MobilePushThreadProps) => {
const theme = useTheme();
const intl = useIntl();
const styles = getStyleSheet(theme);
return (
<Block
headerText={headerText}
footerText={footerText}
headerStyles={styles.upperCase}
containerStyles={styles.area}
>
<OptionItem
action={onMobilePushThreadChanged}
label={intl.formatMessage({id: 'notification_settings.push_threads.description', defaultMessage: 'Notify me about all replies to threads I\'m following'})}
selected={pushThread === 'all'}
type='toggle'
/>
<View style={styles.separator}/>
</Block>
);
};
export default MobilePushThread;