import React from 'react'
import {SafeAreaView, StyleSheet, TouchableOpacity, View} from 'react-native'
import {observer} from 'mobx-react-lite'
import {SuggestedFollows} from '../discover/SuggestedFollows'
import {Text} from '../util/text/Text'
import {useStores} from 'state/index'
import {s} from 'lib/styles'

export const Follows = observer(() => {
  const store = useStores()

  const onNoSuggestions = () => {
    // no suggestions, bounce from this view
    store.onboard.next()
  }
  const onPressNext = () => store.onboard.next()

  return (
    <SafeAreaView style={styles.container}>
      <Text style={styles.title}>Suggested follows</Text>
      <View style={s.flex1}>
        <SuggestedFollows onNoSuggestions={onNoSuggestions} />
      </View>
      <View style={styles.footer}>
        <TouchableOpacity onPress={onPressNext} testID="onboardFollowsSkipBtn">
          <Text style={[s.blue3, s.f18]}>Skip</Text>
        </TouchableOpacity>
        <View style={s.flex1} />
        <TouchableOpacity onPress={onPressNext} testID="onboardFollowsNextBtn">
          <Text style={[s.blue3, s.f18]}>Next</Text>
        </TouchableOpacity>
      </View>
    </SafeAreaView>
  )
})

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },

  title: {
    fontSize: 24,
    fontWeight: 'bold',
    paddingHorizontal: 16,
    paddingBottom: 12,
  },

  footer: {
    flexDirection: 'row',
    paddingHorizontal: 32,
    paddingBottom: 24,
    paddingTop: 16,
  },
})
