@oxyhq/services
Version:
84 lines (83 loc) • 2.3 kB
JavaScript
"use strict";
import { View, Text, StyleSheet, ScrollView, Linking } from 'react-native';
import { Header, GroupedSection } from "../components/index.js";
import { useThemeStyles } from "../hooks/useThemeStyles.js";
import { normalizeTheme } from "../utils/themeUtils.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const UserLinksScreen = ({
userId,
links = [],
theme,
goBack,
navigate
}) => {
// Use centralized theme styles hook for consistency
// primaryColor from hook (#007AFF) is already correct for this screen
const normalizedTheme = normalizeTheme(theme);
const themeStyles = useThemeStyles(normalizedTheme);
const handleLinkPress = async url => {
try {
await Linking.openURL(url);
} catch (error) {
if (__DEV__) {
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' : ''}`,
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
})]
})
})]
});
};
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