<commit_before>// @flow
/**
 * All About Olaf
 * Building Hours list element
 */

import React from 'react'
import {
 View,
 Text,
 Image,
 Dimensions,
 StyleSheet,
} from 'react-native'

import * as c from '../components/colors'
import type {BuildingInfoType} from './types'
import {isBuildingOpen} from './is-building-open'
import {formatBuildingHours} from './format-building-hours'
import CollapsibleBlock from '../components/collapsibleBlock'
import {allBuildingHours} from './all-building-hours.js'



type PropsType = {
  info: BuildingInfoType,
  image: number,
  name: string,
};

let styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    borderLeftWidth: 5,
    borderRightWidth: 5,
    marginTop: 10,
    height: 100,
  },
  name: {
    color: c.white,
    fontSize: 24,
    textAlign: 'center',
    backgroundColor: 'rgba(0, 0, 0, 0.65)',
  },
  inner: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'space-between',
  },
  status: {
    color: c.white,
    fontSize: 14,
    paddingTop: 2,
    paddingBottom: 2,
    textAlign: 'center',
    backgroundColor: 'rgba(0, 0, 0, 0.45)',
  },
  hoursText: {
    textAlign: 'center',
    fontSize: 13,
  },
  contents: {
    paddingBottom: 10,
    paddingTop: 5,
  },
})


export default function BuildingView({info, image, name}: PropsType) {

  let borderColors = {
    'Open': '#CEFFCE',
    'Almost Closed': '#FFFC96',
    'Closed': '#F7C8C8',
  }

  let openStatus = isBuildingOpen(info)
  let hours = formatBuildingHours(info)
  let allHours = allBuildingHours(info, styles.hoursText)

  return (
    <CollapsibleBlock style={styles} collapsedStyle={{backgroundColor: borderColors[openStatus]}}>
      <View style={[styles.container, {borderColor: borderColors[openStatus]}]}>
        <Image
          source={image}
          style={{width: undefined, height: 100}}
          resizeMode='cover'>
          <View style={styles.inner}>
            <Text style={styles.name}>{name}</Text>
            <Text style={styles.status}>{hours}</Text>
          </View>
        </Image>
      </View>

      <View style={[styles.contents, {width: Dimensions.get('window').width}]}>
        <Text style={styles.hoursText}>Daily Hours</Text>
        {allHours}
      </View>
    </CollapsibleBlock>
    )
}

BuildingView.propTypes = {
  image: React.PropTypes.number.isRequired,<commit_msg>Update building.js to pass linting rules<commit_after>// @flow
/**
 * All About Olaf
 * Building Hours list element
 */

import React from 'react'
import {
 View,
 Text,
 Image,
 Dimensions,
 StyleSheet,
} from 'react-native'

import * as c from '../components/colors'
import type {BuildingInfoType} from './types'
import {isBuildingOpen} from './is-building-open'
import {formatBuildingHours} from './format-building-hours'
import CollapsibleBlock from '../components/collapsibleBlock'
import {allBuildingHours} from './all-building-hours.js'



type PropsType = {
  info: BuildingInfoType,
  image: number,
  name: string,
};

let styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    borderLeftWidth: 5,
    borderRightWidth: 5,
    marginTop: 10,
    height: 100,
  },
  name: {
    color: c.white,
    fontSize: 24,
    textAlign: 'center',
    backgroundColor: 'rgba(0, 0, 0, 0.65)',
  },
  inner: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'space-between',
  },
  status: {
    color: c.white,
    fontSize: 14,
    paddingTop: 2,
    paddingBottom: 2,
    textAlign: 'center',
    backgroundColor: 'rgba(0, 0, 0, 0.45)',
  },
  hoursText: {
    textAlign: 'center',
    fontSize: 13,
  },
  contents: {
    paddingBottom: 10,
    paddingTop: 5,
  },
})


export default function BuildingView({info, image, name}: PropsType) {

  let borderColors = {
    'Open': '#CEFFCE',
    'Almost Closed': '#FFFC96',
    'Closed': '#F7C8C8',
  }

  let openStatus = isBuildingOpen(info)
  let hours = formatBuildingHours(info)
  let allHours = allBuildingHours(info, styles.hoursText)

  return (
    <CollapsibleBlock style={styles} collapsedStyle={{backgroundColor: borderColors[openStatus]}}>
      <View style={[styles.container, {borderColor: borderColors[openStatus]}]}>
        <Image
          source={image}
          style={{width: undefined, height: 100}}
          resizeMode='cover'>
          <View style={styles.inner}>
            <Text style={styles.name}>{name}</Text>
            <Text style={styles.status}>{hours}</Text>
          </View>
        </Image>
      </View>

      <View style={[styles.contents, {width: Dimensions.get('window').width}]}>
        <Text style={styles.hoursText}>Daily Hours</Text>
        {allHours}
      </View>
    </CollapsibleBlock>
  )
}

BuildingView.propTypes = {
  image: React.PropTypes.number.isRequired,
{'fraction_non_alphanumeric': 0.14778632300976927, 'fraction_numerical': 0.016628559551028894, 'mean_word_length': 3.1233933161953726, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '5878869', 'n_tokens_mistral': 1660, 'n_tokens_neox': 1557, 'n_words': 364}