weechatRN

Weechat relay client for iOS using websockets https://github.com/mhoran/weechatRN
git clone http://git.hanabi.in/repos/weechatRN.git
Log | Files | Refs | README | LICENSE

commit bc47d0bdabc393e85fe5e9b7b8c21d5cc603449d
parent e39867096ca95e30b667541a88c301477717b947
Author: Matthew Horan <matt@matthoran.com>
Date:   Sat, 10 Nov 2018 20:23:01 -0500

Highlight only the nick in highlighted lines

This brings our behavior in line with weechat and weechat-android.

Diffstat:
Msrc/lib/weechat/color-formatter.tsx | 20--------------------
Msrc/usecase/buffers/ui/themes/Default.tsx | 23+++++++++++++++--------
2 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/src/lib/weechat/color-formatter.tsx b/src/lib/weechat/color-formatter.tsx @@ -48,23 +48,3 @@ export const renderWeechatFormat = (input: string): TextProperties[] => { style: [getBgColor(node.bgColor), getFgColor(node.fgColor)] })); }; - -export const getHighlightedViewStyles = line => { - if (line.highlight) { - return { - backgroundColor: "#ffcf7f" - }; - } else { - return null; - } -}; - -export const getHighlightedTextStyles = line => { - if (line.highlight) { - return { - color: "#000" - }; - } else { - return null; - } -}; diff --git a/src/usecase/buffers/ui/themes/Default.tsx b/src/usecase/buffers/ui/themes/Default.tsx @@ -10,8 +10,6 @@ import { import ParsedText from "react-native-parsed-text"; import { renderWeechatFormat, - getHighlightedViewStyles, - getHighlightedTextStyles } from "../../../../lib/weechat/color-formatter"; import { formatDate } from "../../../../lib/helpers/date-formatter"; @@ -26,23 +24,28 @@ export default class BufferLine extends React.Component<Props> { const { line, onLongPress, parseArgs } = this.props; return ( <TouchableHighlight onLongPress={() => onLongPress(line)}> - <View style={[styles.container, getHighlightedViewStyles(line)]}> + <View style={[styles.container]}> <View style={styles.metaContainer}> <View style={styles.userContainer}> <Text style={[styles.text, styles.meta]}> - {renderWeechatFormat(line.prefix).map((props, index) => ( - <Text {...props} key={index} /> - ))} + {renderWeechatFormat(line.prefix).map((props, index) => { + const { style, ...rest } = props; + return ( + <Text {...rest} key={index} + style={ line.highlight ? styles.highlight : style } + /> + ) + })} </Text> </View> <Text - style={[styles.text, styles.meta, getHighlightedTextStyles(line)]} + style={[styles.text, styles.meta]} > {formatDate(line.date_printed)} </Text> </View> <View - style={[styles.messageContainer, getHighlightedViewStyles(line)]} + style={[styles.messageContainer]} > <Text style={styles.text}> {renderWeechatFormat(line.message).map((props, index) => ( @@ -81,5 +84,9 @@ const styles = StyleSheet.create({ }, meta: { fontSize: 10 + }, + highlight: { + backgroundColor: "magenta", + color: "yellow" } });