Skip to content

Commit

Permalink
Settings: Help, Support ZEUS, and Social Media views
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Oct 22, 2023
1 parent cac0f51 commit 17e80eb
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 23 deletions.
10 changes: 7 additions & 3 deletions Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ import SelectCurrency from './views/Settings/SelectCurrency';
import Display from './views/Settings/Display';
import CertInstallInstructions from './views/Settings/CertInstallInstructions';
import SignVerifyMessage from './views/Settings/SignVerifyMessage';
import About from './views/Settings/About';
import Support from './views/Settings/Support';
import Help from './views/Settings/Help';
import SocialMedia from './views/Settings/SocialMedia';
import Sponsors from './views/Settings/Sponsors';
import Olympians from './views/Settings/Olympians';
import Gods from './views/Settings/Gods';
Expand Down Expand Up @@ -175,8 +176,8 @@ const AppScenes = {
Display: {
screen: Display
},
About: {
screen: About
Support: {
screen: Support
},
Help: {
screen: Help
Expand Down Expand Up @@ -387,6 +388,9 @@ const AppScenes = {
},
ChangeAddress: {
screen: ChangeAddress
},
SocialMedia: {
screen: SocialMedia
}
};

Expand Down
10 changes: 8 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
"general.content": "Content",
"general.lightningInvoice": "Lightning invoice",
"general.or": "or",
"views.Settings.Support.title": "Support ZEUS",
"views.Settings.Support.titleAlt": "Merch and Support",
"views.Settings.SocialMedia.title": "Social media",
"views.Settings.SocialMedia.twitter": "X / Twitter",
"views.Settings.Support.store": "ZEUS merch store",
"nostr.nostr": "Nostr",
"nostr.keys": "Nostr keys",
"nostr.pubkey": "Nostr pubkey",
"nostr.privkey": "Nostr private key",
Expand Down Expand Up @@ -676,8 +682,8 @@
"views.Settings.connectNode": "Connect a node",
"views.Settings.Help.docs": "Zeus Documentation",
"views.Settings.Help.github": "GitHub Issues",
"views.Settings.Help.telegram": "Telegram Group",
"views.Settings.Help.twitter": "Twitter (DMs open)",
"views.Settings.Help.telegram": "Telegram (we will not DM you)",
"views.Settings.Help.email": "Email support",
"views.Settings.POS.enableSquare": "Enable Square POS integration",
"views.Settings.POS.squareAccessToken": "Square Access token",
"views.Settings.POS.squareLocationId": "Square Location ID",
Expand Down
24 changes: 16 additions & 8 deletions views/Settings/Help.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { FlatList, View } from 'react-native';
import { FlatList, Linking, View } from 'react-native';
import { Icon, ListItem } from 'react-native-elements';

import Header from '../../components/Header';
Expand Down Expand Up @@ -35,12 +35,8 @@ function Help(props: HelpProps) {
url: 'https://github.com/ZeusLN/zeus/issues'
},
{
label: localeString('views.Settings.Help.telegram'),
url: 'https://t.me/ZeusLN'
},
{
label: localeString('views.Settings.Help.twitter'),
url: 'https://twitter.com/ZeusLN'
label: localeString('views.Settings.Help.email'),
email: 'support@zeusln.com'
}
];

Expand All @@ -65,7 +61,19 @@ function Help(props: HelpProps) {
borderBottomWidth: 0,
backgroundColor: 'transparent'
}}
onPress={() => UrlUtils.goToUrl(item.url)}
onPress={() => {
if (item.email) {
const url = `to:${item.email}`;
Linking.canOpenURL(url).then(
(supported: boolean) => {
if (supported) {
Linking.openURL(url);
}
}
);
}
if (item.url) UrlUtils.goToUrl(item.url);
}}
>
<ListItem.Content>
<ListItem.Title
Expand Down
52 changes: 48 additions & 4 deletions views/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
TouchableOpacity,
TouchableWithoutFeedback
} from 'react-native';
import { Icon } from 'react-native-elements';
import { inject, observer } from 'mobx-react';

import BlockIcon from '../../assets/images/SVG/Block.svg';
Expand All @@ -18,7 +19,6 @@ import SignIcon from '../../assets/images/SVG/Pen.svg';
import CurrencyIcon from '../../assets/images/SVG/Currency.svg';
import BrushIcon from '../../assets/images/SVG/Brush.svg';
import LanguageIcon from '../../assets/images/SVG/Globe.svg';
import HelpIcon from '../../assets/images/SVG/Help Icon.svg';
import NodeOn from '../../assets/images/SVG/Node On.svg';
import Olympus from '../../assets/images/SVG/Olympus.svg';
import POS from '../../assets/images/SVG/POS.svg';
Expand Down Expand Up @@ -988,6 +988,45 @@ export default class Settings extends React.Component<
</TouchableOpacity>
</View>
)}

<View
style={{
backgroundColor: themeColor('secondary'),
width: '90%',
borderRadius: 10,
alignSelf: 'center',
marginTop: 5,
marginBottom: 5
}}
>
<TouchableOpacity
style={styles.columnField}
onPress={() => navigation.navigate('Support')}
>
<View style={{ paddingLeft: 5, paddingTop: 4 }}>
<Icon
name="favorite"
color={themeColor('text')}
underlayColor="transparent"
size={25}
/>
</View>
<Text
style={{
...styles.columnText,
color: themeColor('text')
}}
>
{localeString(
'views.Settings.Support.titleAlt'
)}
</Text>
<View style={styles.ForwardArrow}>
<ForwardIcon />
</View>
</TouchableOpacity>
</View>

<View
style={{
backgroundColor: themeColor('secondary'),
Expand All @@ -1000,18 +1039,23 @@ export default class Settings extends React.Component<
>
<TouchableOpacity
style={styles.columnField}
onPress={() => navigation.navigate('About')}
onPress={() => navigation.navigate('Help')}
>
<View style={{ paddingLeft: 5, paddingTop: 4 }}>
<HelpIcon />
<Icon
name="support"
color={themeColor('text')}
underlayColor="transparent"
size={25}
/>
</View>
<Text
style={{
...styles.columnText,
color: themeColor('text')
}}
>
{localeString('general.about')}
{localeString('general.help')}
</Text>
<View style={styles.ForwardArrow}>
<ForwardIcon />
Expand Down
89 changes: 89 additions & 0 deletions views/Settings/SocialMedia.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import * as React from 'react';
import { FlatList, View } from 'react-native';
import { Icon, ListItem } from 'react-native-elements';

import Header from '../../components/Header';
import Screen from '../../components/Screen';

import { localeString } from '../../utils/LocaleUtils';
import { themeColor } from '../../utils/ThemeUtils';
import UrlUtils from '../../utils/UrlUtils';

interface HelpProps {
navigation: any;
}

function Help(props: HelpProps) {
const { navigation } = props;

const renderSeparator = () => (
<View
style={{
height: 1,
backgroundColor: themeColor('separator')
}}
/>
);

const SOCIAL_ITEMS = [
{
label: localeString('nostr.nostr'),
url: 'https://nostr.band/npub1xnf02f60r9v0e5kty33a404dm79zr7z2eepyrk5gsq3m7pwvsz2sazlpr5'
},
{
label: localeString('views.Settings.Help.telegram'),
url: 'https://t.me/ZeusLN'
},
{
label: localeString('views.Settings.SocialMedia.twitter'),
url: 'https://twitter.com/ZeusLN'
}
];

return (
<Screen>
<Header
leftComponent="Back"
centerComponent={{
text: localeString('views.Settings.SocialMedia.title'),
style: {
color: themeColor('text'),
fontFamily: 'Lato-Regular'
}
}}
navigation={navigation}
/>
<FlatList
data={SOCIAL_ITEMS}
renderItem={({ item }) => (
<ListItem
containerStyle={{
borderBottomWidth: 0,
backgroundColor: 'transparent'
}}
onPress={() => UrlUtils.goToUrl(item.url)}
>
<ListItem.Content>
<ListItem.Title
style={{
color: themeColor('text'),
fontFamily: 'Lato-Regular'
}}
>
{item.label}
</ListItem.Title>
</ListItem.Content>
<Icon
name="keyboard-arrow-right"
color={themeColor('secondaryText')}
/>
</ListItem>
)}
keyExtractor={(item, index) => `${item.label}-${index}`}
ItemSeparatorComponent={renderSeparator}
/>
</Screen>
);
}

export default Help;
23 changes: 17 additions & 6 deletions views/Settings/About.tsx → views/Settings/Support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import Screen from '../../components/Screen';

import { localeString } from '../../utils/LocaleUtils';
import { themeColor } from '../../utils/ThemeUtils';
import UrlUtils from '../../utils/UrlUtils';

interface AboutProps {
interface SupportProps {
navigation: any;
}

function About(props: AboutProps) {
function Support(props: SupportProps) {
const { navigation } = props;

const renderSeparator = () => (
Expand All @@ -26,15 +27,22 @@ function About(props: AboutProps) {

const ABOUT_ITEMS = [
{ label: localeString('views.Sponsors.title'), path: 'Sponsors' },
{ label: localeString('general.help'), path: 'Help' }
{
label: localeString('views.Settings.Support.store'),
url: 'https://store.zeusln.app'
},
{
label: localeString('views.Settings.SocialMedia.title'),
path: 'SocialMedia'
}
];

return (
<Screen>
<Header
leftComponent="Back"
centerComponent={{
text: localeString('general.about'),
text: localeString('views.Settings.Support.title'),
style: {
color: themeColor('text'),
fontFamily: 'Lato-Regular'
Expand All @@ -50,7 +58,10 @@ function About(props: AboutProps) {
borderBottomWidth: 0,
backgroundColor: 'transparent'
}}
onPress={() => navigation.navigate(item.path)}
onPress={() => {
if (item.path) navigation.navigate(item.path);
if (item.url) UrlUtils.goToUrl(item.url);
}}
>
<ListItem.Content>
<ListItem.Title
Expand All @@ -75,4 +86,4 @@ function About(props: AboutProps) {
);
}

export default About;
export default Support;

0 comments on commit 17e80eb

Please sign in to comment.