"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _components = require("../components");
var _jsxRuntime = require("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 _reactNative.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__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
    style: [styles.container, {
      backgroundColor: themeStyles.backgroundColor
    }],
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Header, {
      title: "Links",
      subtitle: `${links.length} link${links.length !== 1 ? 's' : ''}`,
      theme: theme,
      onBack: goBack,
      elevation: "subtle"
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
      style: styles.content,
      children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
        style: styles.section,
        children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
          style: [styles.sectionTitle, {
            color: themeStyles.textColor
          }],
          children: "Links"
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GroupedSection, {
          items: groupedItems,
          theme: theme
        })]
      })
    })]
  });
};
const styles = _reactNative.StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f2f2f2'
  },
  content: {
    flex: 1,
    padding: 16
  },
  section: {
    marginBottom: 24
  },
  sectionTitle: {
    fontSize: 16,
    fontWeight: '600',
    color: '#333',
    marginBottom: 12
  }
});
var _default = exports.default = UserLinksScreen;
//# sourceMappingURL=UserLinksScreen.js.map