@oxyhq/services
Version:
88 lines (87 loc) • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _reactNative = require("react-native");
var _index = require("../components/index.js");
var _useThemeStyles = require("../hooks/useThemeStyles.js");
var _themeUtils = require("../utils/themeUtils.js");
var _jsxRuntime = require("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 = (0, _themeUtils.normalizeTheme)(theme);
const themeStyles = (0, _useThemeStyles.useThemeStyles)(normalizedTheme);
const handleLinkPress = async url => {
try {
await _reactNative.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__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
style: [styles.container, {
backgroundColor: themeStyles.backgroundColor
}],
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Header, {
title: "Links",
subtitle: `${links.length} link${links.length !== 1 ? 's' : ''}`,
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)(_index.GroupedSection, {
items: groupedItems
})]
})
})]
});
};
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