From 76c763bfa7bb8e1d16eb711e8de9eafcb05b11c5 Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Mon, 8 Apr 2024 11:27:09 +0300 Subject: [PATCH] feature: Show character class in the header (#1146) --- native/app/screens/MainDrawer.tsx | 25 +++++++++++++++++++++++-- native/app/store/AccountLogic.ts | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/native/app/screens/MainDrawer.tsx b/native/app/screens/MainDrawer.tsx index 443cb2d51..6bca1bb10 100644 --- a/native/app/screens/MainDrawer.tsx +++ b/native/app/screens/MainDrawer.tsx @@ -1,7 +1,8 @@ import { getFullProfile } from "@/app/bungie/BungieApi.ts"; +import type { GuardianClassType } from "@/app/bungie/Hashes.ts"; import { LOGO_DARK } from "@/app/inventory/Common.ts"; import InventoryHeader from "@/app/screens/InventoryHeader.tsx"; -import HomeScreen from "@/app/screens/InventoryPages"; +import InventoryPages from "@/app/screens/InventoryPages"; import { useGGStore } from "@/app/store/GGStore.ts"; import { type DrawerContentComponentProps, createDrawerNavigator } from "@react-navigation/drawer"; import { Image, StyleSheet, Text, View } from "react-native"; @@ -72,7 +73,26 @@ const CustomDrawerContent = (props: DrawerContentComponentProps) => { ); }; +function getGuardianClassType(classType: GuardianClassType | undefined) { + switch (classType) { + case 0: + return "Titan"; + case 1: + return "Hunter"; + case 2: + return "Warlock"; + case 100: + return "Vault"; + default: + return ""; + } +} + export default function MainDrawer() { + const ggGuardians = useGGStore((state) => state.ggCharacters); + const currentListIndex = useGGStore((state) => state.currentListIndex); + const guardianClassType = getGuardianClassType(ggGuardians[currentListIndex]?.guardianClassType); + return ( } @@ -82,8 +102,9 @@ export default function MainDrawer() { > ): GGCh const vaultData: GGCharacterUiData = { characterId: VAULT_CHARACTER_ID, - guardianClassType: GuardianClassType.Unknown, + guardianClassType: GuardianClassType.Vault, genderType: 0, raceType: 0, emblemPath: "",