Skip to content

Commit

Permalink
Merge pull request #2 from zulip/master
Browse files Browse the repository at this point in the history
Fork updated
  • Loading branch information
AB261 committed Feb 20, 2019
2 parents 5913e6a + 7295f1e commit a61494e
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/common/FloatingActionButton.js
Expand Up @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
import { StyleSheet, View } from 'react-native';

import type { Style } from '../types';
import type { Icon as IconType } from './Icons';
import type { IconType } from './Icons';
import { BRAND_COLOR } from '../styles';
import Touchable from './Touchable';

Expand Down
64 changes: 32 additions & 32 deletions src/common/Icons.js
Expand Up @@ -16,37 +16,37 @@ type IconProps = {|
color?: string,
|};

export type Icon = ComponentType<IconProps>;
export const Icon: ComponentType<{| ...IconProps, name: string |}> = Feather;

export const IconHome: Icon = props => <Feather name="home" {...props} />;
export const IconStar: Icon = props => <Feather name="star" {...props} />;
export const IconMention: Icon = props => <Feather name="at-sign" {...props} />;
export const IconSearch: Icon = props => <Feather name="search" {...props} />;
export const IconDone: Icon = props => <Feather name="check" {...props} />;
export const IconCancel: Icon = props => <Feather name="slash" {...props} />;
export const IconTrash: Icon = props => <Feather name="trash-2" {...props} />;
export const IconWarning: Icon = props => <Feather name="alert-triangle" {...props} />;
export const IconSend: Icon = props => <MaterialIcon name="send" {...props} />;
export const IconMute: Icon = props => <MaterialIcon name="volume-off" {...props} />;
export const IconStream: Icon = props => <Feather name="hash" {...props} />;
export const IconPrivate: Icon = props => <Feather name="lock" {...props} />;
export const IconPrivateChat: Icon = props => <Feather name="mail" {...props} />;
export const IconDownArrow: Icon = props => <Feather name="chevron-down" {...props} />;
export const IconGoogle: Icon = props => <IoniconsIcon name="logo-google" {...props} />;
export const IconGitHub: Icon = props => <Feather name="github" {...props} />;
export const IconCross: Icon = props => <Feather name="x" {...props} />;
export const IconDiagnostics: Icon = props => <Feather name="activity" {...props} />;
export const IconNotifications: Icon = props => <Feather name="bell" {...props} />;
export const IconLanguage: Icon = props => <Feather name="globe" {...props} />;
export const IconNight: Icon = props => <Feather name="moon" {...props} />;
export const IconSettings: Icon = props => <Feather name="settings" {...props} />;
export const IconRight: Icon = props => <Feather name="chevron-right" {...props} />;
export const IconPlus: Icon = props => <Feather name="plus-circle" {...props} />;
export const IconLeft: Icon = props => <Feather name="chevron-left" {...props} />;
export const IconPeople: Icon = props => <Feather name="users" {...props} />;
export const IconImage: Icon = props => <Feather name="image" {...props} />;
export const IconCamera: Icon = props => <Feather name="camera" {...props} />;
export const IconTerminal: Icon = props => <Feather name="terminal" {...props} />;
export const IconMoreHorizontal: Icon = props => <Feather name="more-horizontal" {...props} />;
export type IconType = ComponentType<IconProps>;

export default Feather;
export const IconHome: IconType = props => <Feather name="home" {...props} />;
export const IconStar: IconType = props => <Feather name="star" {...props} />;
export const IconMention: IconType = props => <Feather name="at-sign" {...props} />;
export const IconSearch: IconType = props => <Feather name="search" {...props} />;
export const IconDone: IconType = props => <Feather name="check" {...props} />;
export const IconCancel: IconType = props => <Feather name="slash" {...props} />;
export const IconTrash: IconType = props => <Feather name="trash-2" {...props} />;
export const IconWarning: IconType = props => <Feather name="alert-triangle" {...props} />;
export const IconSend: IconType = props => <MaterialIcon name="send" {...props} />;
export const IconMute: IconType = props => <MaterialIcon name="volume-off" {...props} />;
export const IconStream: IconType = props => <Feather name="hash" {...props} />;
export const IconPrivate: IconType = props => <Feather name="lock" {...props} />;
export const IconPrivateChat: IconType = props => <Feather name="mail" {...props} />;
export const IconDownArrow: IconType = props => <Feather name="chevron-down" {...props} />;
export const IconGoogle: IconType = props => <IoniconsIcon name="logo-google" {...props} />;
export const IconGitHub: IconType = props => <Feather name="github" {...props} />;
export const IconCross: IconType = props => <Feather name="x" {...props} />;
export const IconDiagnostics: IconType = props => <Feather name="activity" {...props} />;
export const IconNotifications: IconType = props => <Feather name="bell" {...props} />;
export const IconLanguage: IconType = props => <Feather name="globe" {...props} />;
export const IconNight: IconType = props => <Feather name="moon" {...props} />;
export const IconSettings: IconType = props => <Feather name="settings" {...props} />;
export const IconRight: IconType = props => <Feather name="chevron-right" {...props} />;
export const IconPlus: IconType = props => <Feather name="plus-circle" {...props} />;
export const IconLeft: IconType = props => <Feather name="chevron-left" {...props} />;
export const IconPeople: IconType = props => <Feather name="users" {...props} />;
export const IconImage: IconType = props => <Feather name="image" {...props} />;
export const IconCamera: IconType = props => <Feather name="camera" {...props} />;
export const IconTerminal: IconType = props => <Feather name="terminal" {...props} />;
export const IconMoreHorizontal: IconType = props => <Feather name="more-horizontal" {...props} />;
2 changes: 1 addition & 1 deletion src/common/InputWithClearButton.js
Expand Up @@ -5,7 +5,7 @@ import { View, TextInput, StyleSheet } from 'react-native';
import Input from './Input';
import type { Props as InputProps } from './Input';
import styles, { BRAND_COLOR } from '../styles';
import Icon from './Icons';
import { Icon } from './Icons';

const componentStyles = StyleSheet.create({
clearButtonIcon: {
Expand Down
2 changes: 1 addition & 1 deletion src/common/OptionButton.js
Expand Up @@ -5,7 +5,7 @@ import { View } from 'react-native';
import Label from './Label';
import Touchable from './Touchable';
import { IconRight } from './Icons';
import type { Icon as IconType } from './Icons';
import type { IconType } from './Icons';
import type { ThemeColors } from '../styles';
import styles, { ThemeContext } from '../styles';

Expand Down
2 changes: 1 addition & 1 deletion src/common/OptionRow.js
Expand Up @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
import { View } from 'react-native';

import type { Style } from '../types';
import type { Icon as IconType } from './Icons';
import type { IconType } from './Icons';
import Label from './Label';
import ZulipSwitch from './ZulipSwitch';
import type { ThemeColors } from '../styles';
Expand Down
2 changes: 1 addition & 1 deletion src/common/ZulipButton.js
Expand Up @@ -4,7 +4,7 @@ import { StyleSheet, Text, View, ActivityIndicator } from 'react-native';
import TranslatedText from './TranslatedText';

import type { Style } from '../types';
import type { Icon as IconType } from './Icons';
import type { IconType } from './Icons';
import { BRAND_COLOR } from '../styles';
import Touchable from './Touchable';

Expand Down
2 changes: 1 addition & 1 deletion src/lightbox/LightboxFooter.js
Expand Up @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
import { Text, StyleSheet, View } from 'react-native';

import type { Style } from '../types';
import Icon from '../common/Icons';
import { Icon } from '../common/Icons';

const styles = StyleSheet.create({
wrapper: {
Expand Down
2 changes: 1 addition & 1 deletion src/lightbox/LightboxHeader.js
Expand Up @@ -4,7 +4,7 @@ import { View, Text, StyleSheet } from 'react-native';

import { shortTime, humanDate } from '../utils/date';
import { Avatar, Touchable } from '../common';
import Icon from '../common/Icons';
import { Icon } from '../common/Icons';

const componentStyles = StyleSheet.create({
text: {
Expand Down
4 changes: 2 additions & 2 deletions src/nav/NavButton.js
Expand Up @@ -5,12 +5,12 @@ import type { Style } from '../types';
import styles, { BRAND_COLOR } from '../styles';
import ComponentWithOverlay from '../common/ComponentWithOverlay';
import UnreadCount from '../common/UnreadCount';
import Icon from '../common/Icons';
import { Icon } from '../common/Icons';

type Props = {|
color: string,
style?: Style,
name?: string,
name: string,
unreadCount: number,
onPress: () => void,
|};
Expand Down
2 changes: 1 addition & 1 deletion src/start/AuthButton.js
Expand Up @@ -2,7 +2,7 @@
import React, { PureComponent } from 'react';

import { ZulipButton } from '../common';
import type { Icon as IconType } from '../common/Icons';
import type { IconType } from '../common/Icons';
import styles from '../styles';

type Props = {|
Expand Down
4 changes: 2 additions & 2 deletions src/start/authentications.js
@@ -1,12 +1,12 @@
/* @flow strict-local */
import type { AuthenticationMethods } from '../types';
import { IconPrivate, IconGoogle, IconGitHub, IconTerminal } from '../common/Icons';
import type { Icon } from '../common/Icons';
import type { IconType } from '../common/Icons';

type AuthenticationMethodDetails = {|
method: string,
name: string,
Icon: Icon,
Icon: IconType,
handler: string,
|};

Expand Down
2 changes: 1 addition & 1 deletion src/title/TitleSpecial.js
Expand Up @@ -4,7 +4,7 @@ import { View } from 'react-native';

import type { Narrow } from '../types';
import { Label } from '../common';
import Icon from '../common/Icons';
import { Icon } from '../common/Icons';
import styles from '../styles';

const specials = {
Expand Down
19 changes: 11 additions & 8 deletions src/unread/unreadSelectors.js
Expand Up @@ -46,8 +46,9 @@ export const getUnreadByStream = createSelector(
}, ({}: { [number]: number })),
);

export const getUnreadStreamTotal = createSelector(getUnreadByStream, unreadByStream =>
Object.values(unreadByStream).reduce((total, x) => +x + total, 0),
export const getUnreadStreamTotal: Selector<number> = createSelector(
getUnreadByStream,
unreadByStream => Object.values(unreadByStream).reduce((total, x) => +x + total, 0),
);

export const getUnreadByPms = createSelector(getUnreadPms, unreadPms =>
Expand All @@ -57,7 +58,7 @@ export const getUnreadByPms = createSelector(getUnreadPms, unreadPms =>
}, ({}: { [number]: number })),
);

export const getUnreadPmsTotal = createSelector(getUnreadPms, unreadPms =>
export const getUnreadPmsTotal: Selector<number> = createSelector(getUnreadPms, unreadPms =>
unreadPms.reduce((total, pm) => total + pm.unread_message_ids.length, 0),
);

Expand All @@ -69,16 +70,18 @@ export const getUnreadByHuddles = createSelector(getUnreadHuddles, unreadHuddles
}, ({}: { [string]: number })),
);

export const getUnreadHuddlesTotal = createSelector(getUnreadHuddles, unreadHuddles =>
unreadHuddles.reduce((total, huddle) => total + huddle.unread_message_ids.length, 0),
export const getUnreadHuddlesTotal: Selector<number> = createSelector(
getUnreadHuddles,
unreadHuddles =>
unreadHuddles.reduce((total, huddle) => total + huddle.unread_message_ids.length, 0),
);

export const getUnreadMentionsTotal = createSelector(
export const getUnreadMentionsTotal: Selector<number> = createSelector(
getUnreadMentions,
unreadMentions => unreadMentions.length,
);

export const getUnreadTotal = createSelector(
export const getUnreadTotal: Selector<number> = createSelector(
getUnreadStreamTotal,
getUnreadPmsTotal,
getUnreadHuddlesTotal,
Expand Down Expand Up @@ -149,7 +152,7 @@ export const getUnreadStreamsAndTopicsSansMuted = createSelector(
.filter(stream => !stream.isMuted && stream.data.length > 0),
);

export const getUnreadPrivateMessagesCount = createSelector(
export const getUnreadPrivateMessagesCount: Selector<number> = createSelector(
getPrivateMessages,
getReadFlags,
(privateMessages, readFlags) => countUnread(privateMessages.map(msg => msg.id), readFlags),
Expand Down

0 comments on commit a61494e

Please sign in to comment.