import React, { Component } from 'react';
import { View, Text, StyleSheet, Image, Linking } from 'react-native';
import Button from '../../components/Button';
import app from '../../../app.json';

export default class Contact extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }

  callPhone() {
    Linking.openURL("tel:" + app.modules.support.phone)
  }

  callWhatapp() {
    Linking.openURL(app.modules.support.whatsapp)
  }

  render() {
    return (
      <View style={styles.container}>
        <View style={ui.center}>
          <Image
            style={styles.logo}
            resizeMode='contain'
            source={require('../../images/about-logo.png')}/>
        </View>
        <Text style={styles.labelText}>{$t("support.labelOpenTime")}</Text>
        <Text style={styles.contentText}>{$t("support.timeAllDay")}</Text>
        <View style={ui.flex1}></View>
        <Button
          text={$t("support.btnCallSupport")}
          style={styles.buttonPrimary}
          onClick={() => this.callPhone()}
          disabled={!app.modules.support.phone}
        />
        <Button
          text={$t("support.btnWhatsapp")}
          disabled={!app.modules.support.whatsapp}
          onClick={() => this.callWhatapp()}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 16,
    backgroundColor: colorLight
  },
  logo: {
    width: 215,
    height: 70,
    marginTop: 16,
    marginBottom: 12
  },
  labelText: {
    color: textPrimary,
    fontSize: 18,
    fontWeight: 'bold',
    paddingTop: 16,
    paddingBottom: 8
  },
  contentText: {
    color: textSecondary,
    fontSize: 16
  },
  buttonPrimary: {
    marginBottom: 16,
    backgroundColor: colorPrimary
  }
})