Skip to content

Commit 5f73f75

Browse files
committed
Handle unknown translation, better account screen.
1 parent d92338a commit 5f73f75

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/minecraft/chatToJsx.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,13 @@ const parseChatToJsx = (
178178
if (typeof chat !== 'string' && (chat as TranslatedChat).translate) {
179179
const translatedChat = chat as TranslatedChat
180180
const translation = translations[translatedChat.translate]
181-
.split('%s')
182-
.map((text, index) => [{ text }, translatedChat.with[index]])
183-
.flat()
184-
.filter(component => !!component)
185-
chat = { extra: translation }
181+
?.split('%s')
182+
?.map((text, index) => [{ text }, translatedChat.with[index]])
183+
?.flat()
184+
?.filter(component => !!component)
185+
chat = {
186+
extra: translation ?? [{ text: '[EnderChat] Unknown translation.' }]
187+
}
186188
}
187189
const flat =
188190
typeof chat === 'string'

src/screens/accounts/AccountScreen.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ const AccountScreen = () => {
102102
/>
103103
<View>
104104
<Text style={styles.username}>{accounts[uuid].username}</Text>
105-
{accounts[uuid].active && (
106-
<Text style={styles.active}>Active Account</Text>
107-
)}
108105
<Text style={darkMode ? styles.authTxtDark : styles.authTxt}>
109106
{accounts[uuid].type === 'mojang'
110107
? 'Mojang: ' + accounts[uuid].email
111108
: accounts[uuid].type === 'microsoft'
112109
? 'Microsoft Account'
113-
: 'No Authentication'}
110+
: 'Offline Mode'}
114111
</Text>
112+
{accounts[uuid].active && (
113+
<Text style={styles.active}>Active Account</Text>
114+
)}
115115
</View>
116116
</Pressable>
117117
</ElevatedView>
@@ -131,7 +131,7 @@ const styles = StyleSheet.create({
131131
resizeMode: 'contain',
132132
marginRight: 16
133133
},
134-
active: { fontSize: 16 },
134+
active: { fontSize: 14, fontWeight: 'bold' },
135135
username: { fontSize: 20, fontWeight: 'bold' },
136136
authTxt: { fontSize: 12, color: '#666', fontWeight: '400' },
137137
authTxtDark: { fontSize: 12, color: '#aaa', fontWeight: '400' },

0 commit comments

Comments
 (0)