@oxyhq/services
Version:
Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀
197 lines (196 loc) • 5.82 kB
JavaScript
"use strict";
import React, { useState } from 'react';
import { View, Text, StyleSheet, ScrollView, Platform, TouchableOpacity, TextInput, LayoutAnimation, UIManager } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
const FAQS = [{
q: 'What is karma?',
a: 'Karma is a recognition of your positive actions in the Oxy Ecosystem. It cannot be sent or received directly.'
}, {
q: 'How do I earn karma?',
a: 'By helping others, reporting bugs, contributing content, and participating in community events.'
}, {
q: 'Can I lose karma?',
a: 'Karma may be reduced for negative actions or breaking community rules.'
}, {
q: 'What can I do with karma?',
a: 'Unlock rewards, badges, and special features as you earn more karma.'
}, {
q: 'Can I transfer karma to others?',
a: 'No, karma cannot be sent or received. It is only earned by your actions.'
}, {
q: 'How do I get support?',
a: 'Contact Oxy support via the app or website for any karma-related questions.'
}];
const KarmaFAQScreen = ({
goBack,
theme
}) => {
const isDarkTheme = theme === 'dark';
const backgroundColor = isDarkTheme ? '#121212' : '#FFFFFF';
const textColor = isDarkTheme ? '#FFFFFF' : '#000000';
const cardColor = isDarkTheme ? '#23232b' : '#f7f7fa';
const primaryColor = '#d169e5';
const inputBg = isDarkTheme ? '#23232b' : '#f2f2f7';
const inputBorder = isDarkTheme ? '#444' : '#e0e0e0';
const [expanded, setExpanded] = useState(0);
const [search, setSearch] = useState('');
const filteredFaqs = FAQS.filter(faq => faq.q.toLowerCase().includes(search.toLowerCase()) || faq.a.toLowerCase().includes(search.toLowerCase()));
const handleToggle = idx => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setExpanded(expanded === idx ? null : idx);
};
return /*#__PURE__*/_jsxs(View, {
style: [styles.container, {
backgroundColor
}],
children: [/*#__PURE__*/_jsx(Text, {
style: [styles.title, {
color: textColor
}],
children: "Karma FAQ"
}), /*#__PURE__*/_jsxs(View, {
style: [styles.searchBar, {
backgroundColor: inputBg,
borderColor: inputBorder
}],
children: [/*#__PURE__*/_jsx(Ionicons, {
name: "search-outline",
size: 20,
color: primaryColor,
style: {
marginRight: 8
}
}), /*#__PURE__*/_jsx(TextInput, {
style: [styles.searchInput, {
color: textColor
}],
placeholder: "Search FAQ...",
placeholderTextColor: isDarkTheme ? '#aaa' : '#888',
value: search,
onChangeText: setSearch,
returnKeyType: "search"
})]
}), /*#__PURE__*/_jsxs(ScrollView, {
contentContainerStyle: styles.contentContainer,
keyboardShouldPersistTaps: "handled",
children: [filteredFaqs.length === 0 ? /*#__PURE__*/_jsx(Text, {
style: [styles.noResults, {
color: textColor
}],
children: "No results found."
}) : filteredFaqs.map((item, idx) => {
const isOpen = expanded === idx;
return /*#__PURE__*/_jsxs(TouchableOpacity, {
style: [styles.card, {
backgroundColor: cardColor,
shadowColor: isDarkTheme ? '#000' : '#d169e5'
}],
activeOpacity: 0.95,
onPress: () => handleToggle(idx),
children: [/*#__PURE__*/_jsxs(View, {
style: styles.questionRow,
children: [/*#__PURE__*/_jsx(Ionicons, {
name: isOpen ? 'chevron-down' : 'chevron-forward',
size: 22,
color: primaryColor,
style: {
marginRight: 8
}
}), /*#__PURE__*/_jsx(Text, {
style: [styles.question, {
color: primaryColor
}],
children: item.q
})]
}), isOpen && /*#__PURE__*/_jsx(Text, {
style: [styles.answer, {
color: textColor
}],
children: item.a
})]
}, idx);
}), /*#__PURE__*/_jsx(Text, {
style: [styles.paragraph, {
color: textColor,
marginTop: 32,
textAlign: 'center'
}],
children: "Still have questions? Contact support!"
})]
})]
});
};
const styles = StyleSheet.create({
container: {
flex: 1
},
title: {
fontFamily: Platform.OS === 'web' ? 'Phudu' : 'Phudu-Bold',
fontWeight: Platform.OS === 'web' ? 'bold' : undefined,
fontSize: 38,
margin: 24,
marginBottom: 12,
textAlign: 'center'
},
searchBar: {
flexDirection: 'row',
alignItems: 'center',
borderRadius: 16,
borderWidth: 1,
marginHorizontal: 24,
marginBottom: 12,
paddingHorizontal: 12,
height: 44
},
searchInput: {
flex: 1,
fontSize: 16,
height: 44
},
contentContainer: {
padding: 24,
paddingBottom: 40
},
card: {
borderRadius: 18,
padding: 20,
marginBottom: 18,
shadowOpacity: 0.08,
shadowOffset: {
width: 0,
height: 2
},
shadowRadius: 8,
elevation: 2
},
questionRow: {
flexDirection: 'row',
alignItems: 'center',
marginBottom: 8
},
question: {
fontSize: 17,
fontWeight: 'bold'
},
answer: {
fontSize: 16,
lineHeight: 22,
marginTop: 8
},
paragraph: {
fontSize: 16,
marginBottom: 12
},
noResults: {
fontSize: 16,
marginTop: 32,
textAlign: 'center',
opacity: 0.7
}
});
export default KarmaFAQScreen;
//# sourceMappingURL=KarmaFAQScreen.js.map