From 5f73f75fdc28098aa341d5b88fa44d2be539d390 Mon Sep 17 00:00:00 2001 From: Ibrahim Ansari Date: Sun, 3 Apr 2022 20:04:46 +0530 Subject: [PATCH] Handle unknown translation, better account screen. --- src/minecraft/chatToJsx.tsx | 12 +++++++----- src/screens/accounts/AccountScreen.tsx | 10 +++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/minecraft/chatToJsx.tsx b/src/minecraft/chatToJsx.tsx index 3bc88e2..de88c7f 100644 --- a/src/minecraft/chatToJsx.tsx +++ b/src/minecraft/chatToJsx.tsx @@ -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' diff --git a/src/screens/accounts/AccountScreen.tsx b/src/screens/accounts/AccountScreen.tsx index 1ff8906..3e87d34 100644 --- a/src/screens/accounts/AccountScreen.tsx +++ b/src/screens/accounts/AccountScreen.tsx @@ -102,16 +102,16 @@ const AccountScreen = () => { /> {accounts[uuid].username} - {accounts[uuid].active && ( - Active Account - )} {accounts[uuid].type === 'mojang' ? 'Mojang: ' + accounts[uuid].email : accounts[uuid].type === 'microsoft' ? 'Microsoft Account' - : 'No Authentication'} + : 'Offline Mode'} + {accounts[uuid].active && ( + Active Account + )} @@ -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' },