Chore/Retire hyperlink library
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { StyleSheet, Text, Linking } from 'react-native'
|
||||
|
||||
import { Colors, Typography } from '../../styles'
|
||||
|
||||
const AppLink = ({ children, url, ...props }) => {
|
||||
return (
|
||||
<Text style={styles.link} {...props} onPress={() => Linking.openURL(url)}>
|
||||
{children}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
|
||||
AppLink.propTypes = {
|
||||
children: PropTypes.node,
|
||||
url: PropTypes.string,
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
link: {
|
||||
...Typography.mainText,
|
||||
color: Colors.purple,
|
||||
textDecorationLine: 'underline',
|
||||
},
|
||||
})
|
||||
|
||||
export default AppLink
|
||||
@@ -2,24 +2,18 @@ import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { StyleSheet, Text } from 'react-native'
|
||||
|
||||
import Link from './link'
|
||||
|
||||
import { Colors, Typography } from '../../styles'
|
||||
|
||||
const AppText = ({ children, linkStyle, style, ...props }) => {
|
||||
// we parse for links in case the text contains any
|
||||
const AppText = ({ children, style, ...props }) => {
|
||||
return (
|
||||
<Link style={linkStyle}>
|
||||
<Text style={[styles.text, style]} {...props}>
|
||||
{children}
|
||||
</Text>
|
||||
</Link>
|
||||
<Text style={[styles.text, style]} {...props}>
|
||||
{children}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
|
||||
AppText.propTypes = {
|
||||
children: PropTypes.node,
|
||||
linkStyle: PropTypes.object,
|
||||
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import Hyperlink from 'react-native-hyperlink'
|
||||
import { StyleSheet } from 'react-native'
|
||||
|
||||
import { Colors, Typography } from '../../styles'
|
||||
|
||||
import links from '../../i18n/en/links'
|
||||
|
||||
const Link = ({ children, style }) => {
|
||||
return (
|
||||
<Hyperlink
|
||||
linkStyle={[styles.link, style]}
|
||||
linkText={replaceUrlWithText}
|
||||
linkDefault
|
||||
>
|
||||
{children}
|
||||
</Hyperlink>
|
||||
)
|
||||
}
|
||||
|
||||
Link.propTypes = {
|
||||
children: PropTypes.node,
|
||||
style: PropTypes.object,
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
link: {
|
||||
color: Colors.purple,
|
||||
textDecorationLine: 'underline',
|
||||
...Typography.mainText,
|
||||
},
|
||||
})
|
||||
|
||||
function replaceUrlWithText(url) {
|
||||
const link = Object.values(links).find((l) => l.url === url)
|
||||
return (link && link.text) || url
|
||||
}
|
||||
|
||||
export default Link
|
||||
@@ -3,6 +3,7 @@ import { Platform, Linking } from 'react-native'
|
||||
|
||||
import AppPage from '../common/app-page'
|
||||
import AppText from '../common/app-text'
|
||||
import AppLink from '../common/AppLink'
|
||||
import Segment from '../common/segment'
|
||||
import Button from '../common/button'
|
||||
import ButtonRow from '../common/button-row'
|
||||
@@ -35,13 +36,15 @@ const AboutSection = () => {
|
||||
</Segment>
|
||||
<Segment title={t('credits.title')}>
|
||||
<AppText>
|
||||
{t('credits.text', {
|
||||
smashicons: links.smashicons.url,
|
||||
pause08: links.pause08.url,
|
||||
kazachek: links.kazachek.url,
|
||||
freepik: links.freepik.url,
|
||||
flaticon: links.flaticon.url,
|
||||
})}
|
||||
{t('credits.text')}{' '}
|
||||
<AppLink url={links.flaticon.url}>flaticon</AppLink>.{' '}
|
||||
</AppText>
|
||||
<AppText>
|
||||
{t('credits.madeBy')}{' '}
|
||||
<AppLink url={links.smashicons.url}>smashicons</AppLink>,{' '}
|
||||
<AppLink url={links.pause08.url}>pause08</AppLink>,{' '}
|
||||
<AppLink url={links.kazachek.url}>kazachek</AppLink>,{' '}
|
||||
<AppLink url={links.freepik.url}>freepik</AppLink>.
|
||||
</AppText>
|
||||
</Segment>
|
||||
<Segment title={t('donate.title')}>
|
||||
@@ -4,16 +4,18 @@ import { useTranslation } from 'react-i18next'
|
||||
|
||||
import AppPage from '../common/app-page'
|
||||
import AppText from '../common/app-text'
|
||||
import AppLink from '../common/AppLink'
|
||||
import Segment from '../common/segment'
|
||||
|
||||
const License = ({ children }) => {
|
||||
const { t } = useTranslation()
|
||||
const { t } = useTranslation(null, { keyPrefix: 'settings.license' })
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
const link = 'https://www.gnu.org/licenses/gpl-3.0.html'
|
||||
return (
|
||||
<AppPage title={t('settings.license.title')}>
|
||||
<AppPage title={t('title')}>
|
||||
<Segment last>
|
||||
<AppText>{t('settings.license.text', { currentYear })}</AppText>
|
||||
<AppText>{t('text', { currentYear })}</AppText>
|
||||
<AppLink url={link}>{link}</AppLink>
|
||||
{children}
|
||||
</Segment>
|
||||
</AppPage>
|
||||
|
||||
@@ -2,7 +2,7 @@ import Reminders from './reminders/reminders'
|
||||
import NfpSettings from './nfp-settings'
|
||||
import DataManagement from './data-management'
|
||||
import Password from './password'
|
||||
import About from './about'
|
||||
import About from './About'
|
||||
import License from './License'
|
||||
import PrivacyPolicy from './privacy-policy'
|
||||
|
||||
|
||||
+3
-2
@@ -17,7 +17,8 @@
|
||||
"about": {
|
||||
"credits": {
|
||||
"title": "Credits",
|
||||
"text": "We love the drip. team. Thanks and lots of <3 to all of our condriputors. Thanks to Paula Härtel for the symptom tracking icons. All the other icons are made by {{smashicons}}, {{pause08}}, {{kazachek}} & {{freepik}} from {{flaticon}}."
|
||||
"text": "We love the drip. team. Thanks and lots of <3 to all of our condriputors. Thanks to Paula Härtel for the symptom tracking icons. All the other icons from:",
|
||||
"madeBy": "Made by:"
|
||||
},
|
||||
"donate": {
|
||||
"button": "Donate here",
|
||||
@@ -38,7 +39,7 @@
|
||||
},
|
||||
"license": {
|
||||
"title": "drip. an open-source cycle tracking app",
|
||||
"text": "Copyright (C) {{currentYear}} Heart of Code e.V.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: https://www.gnu.org/licenses/gpl-3.0.html."
|
||||
"text": "Copyright (C) {{currentYear}} Heart of Code e.V.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:"
|
||||
},
|
||||
"privacyPolicy": {
|
||||
"title": "Privacy Policy",
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
"react-native-calendars": "^1.1287.0",
|
||||
"react-native-document-picker": "^8.1.1",
|
||||
"react-native-fs": "^2.20.0",
|
||||
"react-native-hyperlink": "0.0.19",
|
||||
"react-native-modal-datetime-picker": "14.0.0",
|
||||
"react-native-push-notification": "3.2.1",
|
||||
"react-native-share": "^7.9.0",
|
||||
|
||||
@@ -5429,13 +5429,6 @@ lines-and-columns@^1.1.6:
|
||||
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
|
||||
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
||||
|
||||
linkify-it@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf"
|
||||
integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==
|
||||
dependencies:
|
||||
uc.micro "^1.0.1"
|
||||
|
||||
locate-path@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
|
||||
@@ -5580,11 +5573,6 @@ mdast-util-compact@^1.0.0:
|
||||
dependencies:
|
||||
unist-util-visit "^1.1.0"
|
||||
|
||||
mdurl@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
|
||||
integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==
|
||||
|
||||
memoize-one@^5.2.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.2.1.tgz#8337aa3c4335581839ec01c3d594090cebe8f00e"
|
||||
@@ -6903,14 +6891,6 @@ react-native-fs@^2.20.0:
|
||||
base-64 "^0.1.0"
|
||||
utf8 "^3.0.0"
|
||||
|
||||
react-native-hyperlink@0.0.19:
|
||||
version "0.0.19"
|
||||
resolved "https://registry.yarnpkg.com/react-native-hyperlink/-/react-native-hyperlink-0.0.19.tgz#ca375cde1d244bb94c551736852ee0d688c8bb1f"
|
||||
integrity sha512-x4wuRGDMnnpWcRr5MCK1D2UcEuzD9IHK8lfjEhO/+QqXNaX31HdeD3ss3BXXZgHxpRYtLbTB0TuFcl1HHANp3w==
|
||||
dependencies:
|
||||
linkify-it "^2.2.0"
|
||||
mdurl "^1.0.0"
|
||||
|
||||
react-native-modal-datetime-picker@14.0.0:
|
||||
version "14.0.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-modal-datetime-picker/-/react-native-modal-datetime-picker-14.0.0.tgz#ca2c81a275ee3a23d9ad02113e76ed243c90781e"
|
||||
@@ -8280,11 +8260,6 @@ ua-parser-js@^0.7.30:
|
||||
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6"
|
||||
integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==
|
||||
|
||||
uc.micro@^1.0.1:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac"
|
||||
integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==
|
||||
|
||||
uglify-es@^3.1.9:
|
||||
version "3.3.9"
|
||||
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"
|
||||
|
||||
Reference in New Issue
Block a user