"use strict";

import { View, Text, StyleSheet, ScrollView, Linking } from 'react-native';
import { Header, GroupedSection } from '../components';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const UserLinksScreen = ({
  userId,
  links,
  theme,
  goBack,
  navigate
}) => {
  const isDarkTheme = theme === 'dark';
  const themeStyles = {
    backgroundColor: isDarkTheme ? '#000' : '#f2f2f2',
    textColor: isDarkTheme ? '#fff' : '#333',
    primaryColor: '#007AFF'
  };
  const handleLinkPress = async url => {
    try {
      await Linking.openURL(url);
    } catch (error) {
      console.error('Error opening link:', error);
    }
  };
  const groupedItems = links.map(link => ({
    id: link.id,
    icon: link.image ? undefined : 'link',
    iconColor: '#32D74B',
    image: link.image || undefined,
    imageSize: 40,
    title: link.title || link.url,
    subtitle: link.description || link.url,
    onPress: () => handleLinkPress(link.url),
    multiRow: true
  }));
  return /*#__PURE__*/_jsxs(View, {
    style: [styles.container, {
      backgroundColor: themeStyles.backgroundColor
    }],
    children: [/*#__PURE__*/_jsx(Header, {
      title: "Links",
      subtitle: `${links.length} link${links.length !== 1 ? 's' : ''}`,
      theme: theme,
      onBack: goBack,
      elevation: "subtle"
    }), /*#__PURE__*/_jsx(ScrollView, {
      style: styles.content,
      children: /*#__PURE__*/_jsxs(View, {
        style: styles.section,
        children: [/*#__PURE__*/_jsx(Text, {
          style: [styles.sectionTitle, {
            color: themeStyles.textColor
          }],
          children: "Links"
        }), /*#__PURE__*/_jsx(GroupedSection, {
          items: groupedItems,
          theme: theme
        })]
      })
    })]
  });
};
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f2f2f2'
  },
  content: {
    flex: 1,
    padding: 16
  },
  section: {
    marginBottom: 24
  },
  sectionTitle: {
    fontSize: 16,
    fontWeight: '600',
    color: '#333',
    marginBottom: 12
  }
});
export default UserLinksScreen;
//# sourceMappingURL=UserLinksScreen.js.map