1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
Zhiyuan Zheng
2021-03-06 21:01:38 +01:00
parent 17f15a199c
commit 83048450e8
15 changed files with 476 additions and 520 deletions

View File

@ -1,62 +0,0 @@
import analytics from '@components/analytics'
import Icon from '@components/Icon'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import * as WebBrowser from 'expo-web-browser'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Pressable, StyleSheet, Text } from 'react-native'
export interface Props {
agreed: boolean
setAgreed: React.Dispatch<React.SetStateAction<boolean>>
}
const EULA = React.memo(
({ agreed, setAgreed }: Props) => {
const { t } = useTranslation('componentInstance')
const { theme } = useTheme()
return (
<Pressable style={styles.base} onPress={() => setAgreed(!agreed)}>
<Icon
style={styles.icon}
name={agreed ? 'CheckCircle' : 'Circle'}
size={StyleConstants.Font.Size.M}
color={theme.primary}
/>
<Text style={[styles.text, { color: theme.primary }]}>
{t('server.EULA.base')}
<Text
style={{ color: theme.blue }}
children={t('server.EULA.EULA')}
onPress={() => {
analytics('view_EULA')
WebBrowser.openBrowserAsync(
'https://tooot.app/end-user-license-agreement'
)
}}
/>
</Text>
</Pressable>
)
},
(prev, next) => prev.agreed === next.agreed
)
const styles = StyleSheet.create({
base: {
flexDirection: 'row',
marginTop: StyleConstants.Spacing.M,
paddingHorizontal: StyleConstants.Spacing.Global.PagePadding,
alignItems: 'center'
},
icon: {
marginRight: StyleConstants.Spacing.XS
},
text: {
...StyleConstants.FontStyle.S
}
})
export default EULA

View File

@ -8,15 +8,13 @@ import { PlaceholderLine } from 'rn-placeholder'
export interface Props {
style?: ViewStyle
visible: boolean
header: string
content?: string
potentialWidth?: number
potentialLines?: number
}
const InstanceInfo = React.memo(
({ style, header, content, potentialWidth, potentialLines = 1 }: Props) => {
({ style, header, content, potentialWidth }: Props) => {
const { t } = useTranslation('componentInstance')
const { theme } = useTheme()
@ -31,24 +29,22 @@ const InstanceInfo = React.memo(
expandHint={t('server.information.description.expandHint')}
/>
) : (
Array.from(Array(potentialLines)).map((_, i) => (
<PlaceholderLine
key={i}
width={
potentialWidth
? potentialWidth * StyleConstants.Font.Size.M
: undefined
}
height={StyleConstants.Font.LineHeight.M}
color={theme.shimmerDefault}
noMargin
style={{ borderRadius: 0 }}
/>
))
<PlaceholderLine
width={
potentialWidth
? potentialWidth * StyleConstants.Font.Size.M
: undefined
}
height={StyleConstants.Font.LineHeight.M}
color={theme.shimmerDefault}
noMargin
style={{ borderRadius: 0 }}
/>
)}
</View>
)
}
},
(prev, next) => prev.content === next.content
)
const styles = StyleSheet.create({