Merge pull request #78 from tooot-app/main

Small fixes
This commit is contained in:
xmflsct 2021-03-22 01:18:08 +01:00 committed by GitHub
commit 7eb5cdd523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 239 additions and 199 deletions

View File

@ -1,176 +0,0 @@
{
"pageParams": [],
"pages": [
[
{
"id": "999",
"created_at": "2021-01-24T11:50:00.901Z",
"sensitive": false,
"visibility": "public",
"replies_count": 9,
"reblogs_count": 15,
"favourites_count": 8,
"favourited": false,
"reblogged": true,
"muted": false,
"bookmarked": false,
"content": "<p>Would you like to try out this simple and open-source mobile app for Mastodon? 😊</p>",
"reblog": null,
"application": {
"name": "tooot",
"website": "https://tooot.app"
},
"account": {
"id": "999",
"username": "tooot📱",
"acct": "tooot@xmflsct.com",
"display_name": "tooot📱",
"avatar_static": "https://avatars.githubusercontent.com/u/77554750?s=200&v=4"
},
"media_attachments": [],
"poll": {
"id": "1",
"expires_at": "2021-01-31T11:50:00.901Z",
"expired": false,
"multiple": false,
"votes_count": 10,
"voters_count": null,
"voted": false,
"own_votes": null,
"options": [
{
"title": "I would love to!",
"votes_count": 6
},
{
"title": "Why not give it a go?",
"votes_count": 4
}
],
"emojis": []
},
"mentions": []
},
{
"id": "1000",
"created_at": "2021-01-24T10:50:00.901Z",
"sensitive": false,
"spoiler_text": "",
"visibility": "public",
"replies_count": 5,
"reblogs_count": 6,
"favourites_count": 11,
"favourited": true,
"reblogged": false,
"muted": false,
"bookmarked": false,
"content": "<p>Mastodon is a free and open-source self-hosted social networking service. It allows anyone to host their own server node in the network, and its various separately operated user bases are federated across many different servers. These nodes are referred to as \"instances\" by Mastodon users.</p>",
"reblog": null,
"application": {
"name": "Web",
"website": null
},
"account": {
"id": "1000",
"username": "Mastodon",
"acct": "mastodon",
"display_name": "Mastodon",
"avatar_static": "https://cdn.dnaindia.com/sites/default/files/styles/full/public/2017/04/06/563120-123.jpg"
},
"media_attachments": [],
"card": {
"url": "https://joinmastodon.org/",
"title": "Giving social networking back to you - Mastodon",
"description": "Mastodon is an open source decentralized social network - by the people for the people. Join the federation and take back control of your social media!",
"type": "link",
"image": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Mastodon_Logotype_%28Simple%29.svg/1200px-Mastodon_Logotype_%28Simple%29.svg.png"
},
"mentions": []
},
{
"id": "1001",
"created_at": "2021-01-24T09:50:00.901Z",
"spoiler_text": "",
"visibility": "public",
"replies_count": 2,
"reblogs_count": null,
"favourites_count": 3,
"favourited": false,
"reblogged": false,
"muted": false,
"bookmarked": true,
"content": "<p>These servers are connected as a federated social network, allowing users from different servers to interact with each other seamlessly. Once a Mastodon server knows another Mastodon server, it \"federates\" with the other Mastodon server. Mastodon is a part of the wider Fediverse, allowing its users to also interact with users on different open platforms that support the same protocol, such as PeerTube and Friendica.</p>",
"reblog": null,
"application": {
"name": "Web",
"website": null
},
"account": {
"id": "1001",
"username": "Fediverse",
"acct": "fediverse",
"display_name": "Fediverse",
"avatar_static": "https://e7.pngegg.com/pngimages/667/514/png-clipart-mastodon-fediverse-social-media-free-software-logo-social-media-blue-text.png"
},
"media_attachments": [],
"mentions": []
},
{
"id": "1002",
"created_at": "2021-01-24T08:50:00.901Z",
"sensitive": false,
"visibility": "public",
"replies_count": 0,
"reblogs_count": 0,
"favourites_count": 0,
"favourited": true,
"reblogged": false,
"muted": false,
"bookmarked": false,
"content": "<p>tooot is an open source, simple mobile client for Mastodon. Focusing on your connections while being able to explore the Fediverse.</p>",
"reblog": null,
"application": {
"name": "tooot",
"website": "https://tooot.app"
},
"account": {
"id": "1002",
"username": "tooot📱",
"acct": "tooot@xmflsct.com",
"display_name": "tooot📱",
"avatar_static": "https://avatars.githubusercontent.com/u/77554750?s=200&v=4"
},
"media_attachments": [],
"mentions": []
},
{
"id": "1003",
"created_at": "2021-01-24T07:50:00.901Z",
"sensitive": false,
"visibility": "public",
"replies_count": 0,
"reblogs_count": 0,
"favourites_count": 0,
"favourited": true,
"reblogged": false,
"muted": false,
"bookmarked": false,
"content": "<p>- tooot supports multiple accounts<br />- tooot supports browsing external instance<br />- tooot aims to support multiple languages</p>",
"reblog": null,
"application": {
"name": "tooot",
"website": "https://tooot.app"
},
"account": {
"id": "1003",
"username": "tooot📱",
"acct": "tooot@xmflsct.com",
"display_name": "tooot📱",
"avatar_static": "https://avatars.githubusercontent.com/u/77554750?s=200&v=4"
},
"media_attachments": [],
"mentions": []
}
]
]
}

185
demo/statuses.ts Normal file
View File

@ -0,0 +1,185 @@
const demoStatuses = [
{
id: '1',
created_at: new Date().toISOString(),
sensitive: false,
visibility: 'public',
replies_count: 9,
reblogs_count: 15,
favourites_count: 8,
favourited: true,
reblogged: false,
muted: false,
bookmarked: false,
content:
'<p>Would you like to try out this simple, beautiful and open-source mobile app for Mastodon? 😊</p>',
reblog: null,
application: {
name: 'tooot',
website: 'https://tooot.app'
},
account: {
id: '999',
username: 'tooot📱',
acct: 'tooot@xmflsct.com',
display_name: 'tooot📱',
avatar_static:
'https://avatars.githubusercontent.com/u/77554750?s=200&v=4'
},
media_attachments: [],
poll: {
id: '1',
expires_at: new Date().setDate(new Date().getDate() + 5),
expired: false,
multiple: false,
votes_count: 10,
voters_count: null,
voted: false,
own_votes: null,
options: [
{
title: 'I would love to!',
votes_count: 6
},
{
title: 'Why not give it a go?',
votes_count: 4
}
],
emojis: []
},
mentions: []
},
{
id: '2',
created_at: new Date().setMinutes(new Date().getMinutes() - 2),
sensitive: false,
spoiler_text: '',
visibility: 'public',
replies_count: 5,
reblogs_count: 6,
favourites_count: 11,
favourited: true,
reblogged: false,
muted: false,
bookmarked: false,
content:
'<p>Mastodon is a free and open-source self-hosted social networking service. It allows anyone to host their own server node in the network, and its various separately operated user bases are federated across many different servers. These nodes are referred to as "instances" by Mastodon users.</p>',
reblog: null,
application: {
name: 'Web',
website: null
},
account: {
id: '1000',
username: 'Mastodon',
acct: 'mastodon',
display_name: 'Mastodon',
avatar_static:
'https://mastodon.social/apple-touch-icon.png'
},
media_attachments: [],
card: {
url: 'https://joinmastodon.org/',
title: 'Giving social networking back to you - Mastodon',
description:
'Mastodon is an open source decentralized social network - by the people for the people. Join the federation and take back control of your social media!',
type: 'link',
image:
'https://mastodon.social/apple-touch-icon.png'
},
mentions: []
},
{
id: '3',
created_at: '2021-01-24T09:50:00.901Z',
spoiler_text: '',
visibility: 'public',
replies_count: 2,
reblogs_count: null,
favourites_count: 3,
favourited: false,
reblogged: false,
muted: false,
bookmarked: true,
content:
'<p>These servers are connected as a federated social network, allowing users from different servers to interact with each other seamlessly. Once a Mastodon server knows another Mastodon server, it "federates" with the other Mastodon server. Mastodon is a part of the wider Fediverse, allowing its users to also interact with users on different open platforms that support the same protocol, such as PeerTube and Friendica.</p>',
reblog: null,
application: {
name: 'Web',
website: null
},
account: {
id: '1001',
username: 'Fediverse',
acct: 'fediverse',
display_name: 'Fediverse',
avatar_static:
'https://e7.pngegg.com/pngimages/667/514/png-clipart-mastodon-fediverse-social-media-free-software-logo-social-media-blue-text.png'
},
media_attachments: [],
mentions: []
},
{
id: '4',
created_at: '2021-01-24T08:50:00.901Z',
sensitive: false,
visibility: 'public',
replies_count: 0,
reblogs_count: 0,
favourites_count: 0,
favourited: true,
reblogged: false,
muted: false,
bookmarked: false,
content:
'<p>tooot is an open source, simple mobile client for Mastodon. Focusing on your connections while being able to explore the Fediverse.</p>',
reblog: null,
application: {
name: 'tooot',
website: 'https://tooot.app'
},
account: {
id: '1002',
username: 'tooot📱',
acct: 'tooot@xmflsct.com',
display_name: 'tooot📱',
avatar_static:
'https://avatars.githubusercontent.com/u/77554750?s=200&v=4'
},
media_attachments: [],
mentions: []
},
{
id: '5',
created_at: '2021-01-24T07:50:00.901Z',
sensitive: false,
visibility: 'public',
replies_count: 0,
reblogs_count: 0,
favourites_count: 0,
favourited: true,
reblogged: false,
muted: false,
bookmarked: false,
content:
'<p>- tooot supports multiple accounts<br />- tooot supports browsing external instance<br />- tooot aims to support multiple languages</p>',
reblog: null,
application: {
name: 'tooot',
website: 'https://tooot.app'
},
account: {
id: '1003',
username: 'tooot📱',
acct: 'tooot@xmflsct.com',
display_name: 'tooot📱',
avatar_static:
'https://avatars.githubusercontent.com/u/77554750?s=200&v=4'
},
media_attachments: [],
mentions: []
}
]
export default demoStatuses

View File

@ -8,6 +8,7 @@ export interface Props {
type?: 'icon' | 'text' type?: 'icon' | 'text'
content?: string content?: string
native?: boolean native?: boolean
background?: boolean
onPress: () => void onPress: () => void
} }
@ -16,6 +17,7 @@ const HeaderLeft: React.FC<Props> = ({
type = 'icon', type = 'icon',
content, content,
native = true, native = true,
background = false,
onPress onPress
}) => { }) => {
const { theme } = useTheme() const { theme } = useTheme()
@ -47,11 +49,19 @@ const HeaderLeft: React.FC<Props> = ({
style={[ style={[
styles.base, styles.base,
{ {
backgroundColor: theme.backgroundOverlayDefault, backgroundColor: background
? theme.backgroundOverlayDefault
: undefined,
minHeight: 44,
minWidth: 44,
marginLeft: native
? -StyleConstants.Spacing.S
: StyleConstants.Spacing.S,
...(type === 'icon' && { ...(type === 'icon' && {
height: 44, borderRadius: 100
width: 44, }),
marginLeft: native ? -9 : 9 ...(type === 'text' && {
paddingHorizontal: StyleConstants.Spacing.S
}) })
} }
]} ]}
@ -63,8 +73,7 @@ const styles = StyleSheet.create({
base: { base: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center'
borderRadius: 100
}, },
text: { text: {
...StyleConstants.FontStyle.M ...StyleConstants.FontStyle.M

View File

@ -9,6 +9,7 @@ export interface Props {
type?: 'icon' | 'text' type?: 'icon' | 'text'
content: string content: string
native?: boolean native?: boolean
background?: boolean
loading?: boolean loading?: boolean
disabled?: boolean disabled?: boolean
@ -20,6 +21,7 @@ const HeaderRight: React.FC<Props> = ({
type = 'icon', type = 'icon',
content, content,
native = true, native = true,
background = false,
loading, loading,
disabled, disabled,
onPress onPress
@ -79,11 +81,19 @@ const HeaderRight: React.FC<Props> = ({
style={[ style={[
styles.base, styles.base,
{ {
backgroundColor: theme.backgroundOverlayDefault, backgroundColor: background
? theme.backgroundOverlayDefault
: undefined,
minHeight: 44,
minWidth: 44,
marginLeft: native
? -StyleConstants.Spacing.S
: StyleConstants.Spacing.S,
...(type === 'icon' && { ...(type === 'icon' && {
height: 44, borderRadius: 100
width: 44, }),
marginRight: native ? -9 : 9 ...(type === 'text' && {
paddingHorizontal: StyleConstants.Spacing.S
}) })
} }
]} ]}
@ -95,8 +105,7 @@ const styles = StyleSheet.create({
base: { base: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center'
borderRadius: 100
}, },
text: { text: {
...StyleConstants.FontStyle.M ...StyleConstants.FontStyle.M

View File

@ -37,7 +37,7 @@ const TimelinePoll: React.FC<Props> = ({
sameAccount sameAccount
}) => { }) => {
const { mode, theme } = useTheme() const { mode, theme } = useTheme()
const { t } = useTranslation('componentTimeline') const { t, i18n } = useTranslation('componentTimeline')
const [allOptions, setAllOptions] = useState( const [allOptions, setAllOptions] = useState(
new Array(poll.options.length).fill(false) new Array(poll.options.length).fill(false)
@ -136,7 +136,14 @@ const TimelinePoll: React.FC<Props> = ({
) )
} }
} }
}, [mode, poll.expired, poll.voted, allOptions, mutation.isLoading]) }, [
mode,
i18n.language,
poll.expired,
poll.voted,
allOptions,
mutation.isLoading
])
const pollExpiration = useMemo(() => { const pollExpiration = useMemo(() => {
if (poll.expired) { if (poll.expired) {
@ -155,7 +162,7 @@ const TimelinePoll: React.FC<Props> = ({
</Text> </Text>
) )
} }
}, [mode, poll.expired, poll.expires_at]) }, [mode, i18n.language, poll.expired, poll.expires_at])
const isSelected = useCallback( const isSelected = useCallback(
(index: number): string => (index: number): string =>
@ -186,7 +193,9 @@ const TimelinePoll: React.FC<Props> = ({
<Text style={styles.optionText}> <Text style={styles.optionText}>
<ParseEmojis content={option.title} emojis={poll.emojis} /> <ParseEmojis content={option.title} emojis={poll.emojis} />
</Text> </Text>
<Text style={[styles.optionPercentage, { color: theme.primaryDefault }]}> <Text
style={[styles.optionPercentage, { color: theme.primaryDefault }]}
>
{poll.votes_count {poll.votes_count
? Math.round( ? Math.round(
(option.votes_count / (option.votes_count /

View File

@ -13,7 +13,7 @@ export default {
}, },
disclaimer: { disclaimer: {
base: base:
"Logging in process uses system broswer that, your account informationo won't be visible to tooot app. Read more ", "Logging in process uses system broswer that, your account information won't be visible to tooot app. Read more ",
privacy: 'privacy policy' privacy: 'privacy policy'
} }
}, },

View File

@ -3,7 +3,8 @@ export default {
prefixAgo: null, prefixAgo: null,
prefixFromNow: null, prefixFromNow: null,
suffixAgo: 'ago', suffixAgo: 'ago',
suffixFromNow: 'from now', // suffixFromNow: 'from now',
suffixFromNow: null,
seconds: '%d seconds', seconds: '%d seconds',
minute: 'about a minute', minute: 'about a minute',
minutes: '%d minutes', minutes: '%d minutes',

View File

@ -152,7 +152,7 @@ export default {
}, },
expiration: { expiration: {
expired: 'Vote expired', expired: 'Vote expired',
until: 'Open until <0 />' until: 'Expires in <0 />'
} }
} }
} }

View File

@ -1,5 +1,5 @@
export default { export default {
heading: 'Toot font size', heading: 'Toot Font Size',
content: { content: {
showcase: 'Example toot', showcase: 'Example toot',
demo: demo:

View File

@ -1,5 +1,5 @@
export default { export default {
heading: 'Switch account', heading: 'Switch Account',
content: { content: {
existing: 'Choose from logged in', existing: 'Choose from logged in',
new: 'Log in to instance' new: 'Log in to instance'

View File

@ -62,7 +62,7 @@ const ComposePoll: React.FC = () => {
? t('content.root.footer.poll.option.placeholder.multiple') ? t('content.root.footer.poll.option.placeholder.multiple')
: t('content.root.footer.poll.option.placeholder.single') : t('content.root.footer.poll.option.placeholder.single')
} }
placeholderTextColor={theme.secondary} placeholderTextColor={theme.disabled}
maxLength={50} maxLength={50}
// @ts-ignore // @ts-ignore
value={options[i]} value={options[i]}

View File

@ -49,6 +49,7 @@ const TabSharedAccount: React.FC<SharedAccountProp> = ({
account account
}) })
}} }}
background
/> />
) )
}) })

View File

@ -74,7 +74,9 @@ const sharedScreens = (
backgroundColor: `rgba(255, 255, 255, 0)` backgroundColor: `rgba(255, 255, 255, 0)`
}, },
headerCenter: () => null, headerCenter: () => null,
headerLeft: () => <HeaderLeft onPress={() => navigation.goBack()} /> headerLeft: () => (
<HeaderLeft onPress={() => navigation.goBack()} background />
)
} }
}} }}
/>, />,