Skip to content

Commit

Permalink
Handle unknown translation, better account screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Apr 3, 2022
1 parent d92338a commit 5f73f75
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 7 additions & 5 deletions src/minecraft/chatToJsx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ const parseChatToJsx = (
if (typeof chat !== 'string' && (chat as TranslatedChat).translate) {
const translatedChat = chat as TranslatedChat
const translation = translations[translatedChat.translate]
.split('%s')
.map((text, index) => [{ text }, translatedChat.with[index]])
.flat()
.filter(component => !!component)
chat = { extra: translation }
?.split('%s')
?.map((text, index) => [{ text }, translatedChat.with[index]])
?.flat()
?.filter(component => !!component)
chat = {
extra: translation ?? [{ text: '[EnderChat] Unknown translation.' }]
}
}
const flat =
typeof chat === 'string'
Expand Down
10 changes: 5 additions & 5 deletions src/screens/accounts/AccountScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ const AccountScreen = () => {
/>
<View>
<Text style={styles.username}>{accounts[uuid].username}</Text>
{accounts[uuid].active && (
<Text style={styles.active}>Active Account</Text>
)}
<Text style={darkMode ? styles.authTxtDark : styles.authTxt}>
{accounts[uuid].type === 'mojang'
? 'Mojang: ' + accounts[uuid].email
: accounts[uuid].type === 'microsoft'
? 'Microsoft Account'
: 'No Authentication'}
: 'Offline Mode'}
</Text>
{accounts[uuid].active && (
<Text style={styles.active}>Active Account</Text>
)}
</View>
</Pressable>
</ElevatedView>
Expand All @@ -131,7 +131,7 @@ const styles = StyleSheet.create({
resizeMode: 'contain',
marginRight: 16
},
active: { fontSize: 16 },
active: { fontSize: 14, fontWeight: 'bold' },
username: { fontSize: 20, fontWeight: 'bold' },
authTxt: { fontSize: 12, color: '#666', fontWeight: '400' },
authTxtDark: { fontSize: 12, color: '#aaa', fontWeight: '400' },
Expand Down

0 comments on commit 5f73f75

Please sign in to comment.