import { memo, useCallback } from 'react';
import { Text, FlatList, View, Pressable } from 'react-native';
import { RecommendedCommunityItem } from './RecommenedCommunityItems/RecommenedCommunityItems';
import { useStyles } from './styles';
import { ComponentID, ElementID, PageID } from '../../../../enums';
import { useAmityElement } from '../../../../hooks';
import { useExplore } from '../../../../providers/ExploreProvider';
import { useNavigation } from '@react-navigation/native';
const AmityRecommendedCommunityComponent = ({
  pageId = PageID.WildCardPage,
  componentId = ComponentID.WildCardComponent
}) => {
  const elementId = ElementID.explore_recommended_title;
  const navigation = useNavigation();
  const {
    config,
    accessibilityId
  } = useAmityElement({
    pageId,
    componentId,
    elementId
  });
  const styles = useStyles();
  const {
    recommendedCommunities
  } = useExplore();
  const onPressCommunity = useCallback(({
    communityId
  }) => {
    navigation.navigate('CommunityProfilePage', {
      communityId
    });
  }, [navigation]);
  return /*#__PURE__*/React.createElement(View, {
    testID: accessibilityId
  }, /*#__PURE__*/React.createElement(Text, {
    style: styles.headerText
  }, (config === null || config === void 0 ? void 0 : config.text) || 'Recommended for you'), /*#__PURE__*/React.createElement(FlatList, {
    horizontal: true,
    data: recommendedCommunities,
    renderItem: ({
      item
    }) => /*#__PURE__*/React.createElement(Pressable, {
      onPress: () => onPressCommunity({
        communityId: item.communityId
      })
    }, /*#__PURE__*/React.createElement(RecommendedCommunityItem, {
      pageId: pageId,
      community: item
    })),
    keyExtractor: item => item.communityId,
    contentContainerStyle: styles.listContainer
  }));
};
export default /*#__PURE__*/memo(AmityRecommendedCommunityComponent);
//# sourceMappingURL=RecommendedCommunities.js.map