<commit_before>// @flow
import * as React from 'react';
import { View, StyleSheet, Text } from 'react-native';
import idx from 'idx';
import { NetworkImage } from '@kiwicom/react-native-app-common';
import ReadMore from 'react-native-read-more-text';

import type { RoomRowContainer_availableRoom } from './__generated__/RoomRowContainer_availableRoom.graphql';

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'white',
    padding: 15,
    flexDirection: 'row',
    marginBottom: 10,
  },
  thumbnail: {
    width: 60,
    height: 80,
    borderRadius: 2,
  },
  details: {
    flex: 1,
    paddingHorizontal: 15,
    alignSelf: 'center',
  },
  title: {
    fontSize: 14,
    fontWeight: '800',
    color: '#30363d',
  },
  delimiter: {
    height: 1,
    backgroundColor: '#edeff2',
    marginVertical: 6,
  },
  description: {
    fontSize: 12,
    color: '#30363d',
  },
});

type Props = {|
  availableRoom: RoomRowContainer_availableRoom,
|};

export default class RoomRow extends React.Component<Props> {
  render() {
    const availableRoom = this.props.availableRoom;
    const title = idx(availableRoom, _ => _.room.description.title) || 'Room';
    const description = idx(availableRoom, _ => _.room.description.text) || '';
    const thumbnailUrl = idx(
      availableRoom,
      _ => _.room.photos.edges[0].node.thumbnailUrl,
    );
    return (
      <View style={styles.container}>
        <NetworkImage source={{ uri: thumbnailUrl }} style={styles.thumbnail} />
        <View style={styles.details}>
          <Text style={styles.title}>{title}</Text>
          {description && (
            <View>
              <View style={styles.delimiter} />
              <ReadMore numberOfLines={2}>
                <Text style={styles.description}>{description}</Text>
              </ReadMore>
            </View>
          )}
        </View>
      </View>
    );
  }
}<commit_msg>Add the select button (without function atm)<commit_after>// @flow
import * as React from 'react';
import { View, StyleSheet, Text } from 'react-native';
import idx from 'idx';
import { NetworkImage } from '@kiwicom/react-native-app-common';
import ReadMore from 'react-native-read-more-text';

import type { RoomRowContainer_availableRoom } from './__generated__/RoomRowContainer_availableRoom.graphql';
import RoomPicker from '../roomPicker/RoomPicker';

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'white',
    padding: 15,
    marginBottom: 10,
  },
  row: {
    flexDirection: 'row',
  },
  thumbnail: {
    width: 60,
    height: 80,
    borderRadius: 2,
  },
  details: {
    flex: 1,
    paddingHorizontal: 15,
    alignSelf: 'center',
  },
  title: {
    fontSize: 14,
    fontWeight: '800',
    color: '#30363d',
  },
  delimiter: {
    height: 1,
    backgroundColor: '#edeff2',
    marginVertical: 6,
  },
  description: {
    fontSize: 12,
    color: '#30363d',
  },
});

type Props = {|
  availableRoom: RoomRowContainer_availableRoom,
|};

export default class RoomRow extends React.Component<Props> {
  doNothing() {}

  render() {
    const availableRoom = this.props.availableRoom;
    const title = idx(availableRoom, _ => _.room.description.title) || 'Room';
    const description = idx(availableRoom, _ => _.room.description.text) || '';
    const thumbnailUrl = idx(
      availableRoom,
      _ => _.room.photos.edges[0].node.thumbnailUrl,
    );
    const price = idx(availableRoom, _ => _.minimalPrice.amount);
    const currency = idx(availableRoom, _ => _.minimalPrice.currency);
    const selectableCount =
      idx(availableRoom, _ => _.incrementalPrice.length) || 0;
    return (
      <View style={styles.container}>
        <View style={styles.row}>
          <NetworkImage
            source={{ uri: thumbnailUrl }}
            style={styles.thumbnail}
          />
          <View style={styles.details}>
            <Text style={styles.title}>{title}</Text>
            {description && (
              <View>
                <View style={styles.delimiter} />
                <ReadMore numberOfLines={2}>
                  <Text style={styles.description}>{description}</Text>
                </ReadMore>
              </View>
            )}
          </View>
        </View>
        {price &&
          currency && (
            <RoomPicker
              price={price}
              currency={currency}
              selectedCount={0}
              selectableCount={selectableCount}
              increment={this.doNothing}
              decrement={this.doNothing}
            />
          )}
      </View>
    );
  }
}
{'fraction_non_alphanumeric': 0.1392515230635335, 'fraction_numerical': 0.015230635335073977, 'mean_word_length': 2.4460269865067468, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5554928', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1344, 'n_words': 291}