Browse Source

Small fixes

pull/78/head
Zhiyuan Zheng 2 years ago
parent
commit
544af1936c
No known key found for this signature in database GPG Key ID: 78A93AB607D85E0
  1. 176
      demo/statuses.json
  2. 185
      demo/statuses.ts
  3. 17
      src/components/Timeline/Shared/Poll.tsx
  4. 2
      src/i18n/en/components/instance.ts
  5. 3
      src/i18n/en/components/relativeTime.ts
  6. 2
      src/i18n/en/components/timeline.ts
  7. 2
      src/i18n/en/screens/meSettingsFontsize.ts
  8. 2
      src/i18n/en/screens/meSwitch.ts
  9. 2
      src/screens/Compose/Root/Footer/Poll.tsx

176
demo/statuses.json

@ -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

@ -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

17
src/components/Timeline/Shared/Poll.tsx

@ -37,7 +37,7 @@ const TimelinePoll: React.FC<Props> = ({
sameAccount
}) => {
const { mode, theme } = useTheme()
const { t } = useTranslation('componentTimeline')
const { t, i18n } = useTranslation('componentTimeline')
const [allOptions, setAllOptions] = useState(
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(() => {
if (poll.expired) {
@ -155,7 +162,7 @@ const TimelinePoll: React.FC<Props> = ({
</Text>
)
}
}, [mode, poll.expired, poll.expires_at])
}, [mode, i18n.language, poll.expired, poll.expires_at])
const isSelected = useCallback(
(index: number): string =>
@ -186,7 +193,9 @@ const TimelinePoll: React.FC<Props> = ({
<Text style={styles.optionText}>
<ParseEmojis content={option.title} emojis={poll.emojis} />
</Text>
<Text style={[styles.optionPercentage, { color: theme.primaryDefault }]}>
<Text
style={[styles.optionPercentage, { color: theme.primaryDefault }]}
>
{poll.votes_count
? Math.round(
(option.votes_count /

2
src/i18n/en/components/instance.ts

@ -13,7 +13,7 @@ export default {
},
disclaimer: {
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'
}
},

3
src/i18n/en/components/relativeTime.ts

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

2
src/i18n/en/components/timeline.ts

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

2
src/i18n/en/screens/meSettingsFontsize.ts

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

2
src/i18n/en/screens/meSwitch.ts

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

2
src/screens/Compose/Root/Footer/Poll.tsx

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

Loading…
Cancel
Save