Skip to content

Commit

Permalink
aoe4 civ navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
denniske committed May 25, 2024
1 parent 3fba4d9 commit 38d15cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/components/match/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IMatchNew, IPlayerNew } from '@app/api/helper/api.types';
import { getCivIcon } from '@app/helper/civs';
import { openLink } from '@app/helper/url';
import { BottomSheetProps } from '@app/view/bottom-sheet';
import { isVerifiedPlayer } from '@nex/data';
import { getLocalCivEnum, isVerifiedPlayer } from '@nex/data';
import { appConfig } from '@nex/dataset';
import { Image } from 'expo-image';
import { Link } from 'expo-router';
Expand Down Expand Up @@ -77,7 +77,7 @@ export const MatchPlayer: React.FC<MatchPlayerProps> = ({ match, player, highlig
</Pressable>
)}

<Link href={`/explore/civilizations/${player.civName}`} asChild>
<Link href={`/explore/civilizations/${getLocalCivEnum(player.civ)}`} asChild>
<TouchableOpacity className="flex-row flex-1 gap-1" onPress={onClose}>
<Image className={appConfig.game === 'aoe2de' ? 'w-5 h-5' : 'w-8 h-5'} source={getCivIcon(player)} contentFit="contain" />
<Text numberOfLines={1} variant={highlight ? 'label' : 'body'} className="flex-1">
Expand Down
15 changes: 11 additions & 4 deletions data/src/helper/civs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,17 @@ const aoe4CivNameDict = {
2: "Delhi Sultanate",
3: "English",
4: "French",
5: "Holy Roman",
5: "Holy Roman Empire",
6: "Mongols",
7: "Rus",
8: "Malians",
9: "Ottomans",
10: 'Byzantines',
11: 'Japanese',
12: 'JeanneDArc',
12: 'Jeanne d\'Arc',
13: 'Ayyubids',
14: 'ZhuXiSLegacy',
15: 'OrderOfTheDragon',
14: 'Zhu Xi\'s Legacy',
15: 'Order of the Dragon',
}

export function getCivNameById(civ: Civ) {
Expand All @@ -312,6 +312,13 @@ export function getCivIdByEnum(civEnum: string): Civ {
return civEnumList[civEnum];
}

export function getLocalCivEnum(serverCivEnum: string): string {
// jeanne_d_arc -> JeanneDArc
return serverCivEnum
.replace(/_(.)/g, (match, group1) => group1.toUpperCase())
.replace(/^(.)/, (match, group1) => group1.toUpperCase());
}

export function getCivDescription(civ: Civ) {
const civStringKey = aoeData.civ_helptexts[civ];
return sanitizeGameDescription(getAoeString(civStringKey));
Expand Down
1 change: 1 addition & 0 deletions notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Screenshots:
- app/_layout.tsx -> comment out LogBox.ignoreLogs for screenshots
- tester.tsx -> comment out "const testHookStore = new TestHookStore();"
- can use iPhone 15 Pro and iPhone 8
https://developer.apple.com/help/app-store-connect/reference/screenshot-specifications

aoe OTA update
cc1271b48e4a0690511d54b41a63ceb9.Jsh1IP-avYMq5AsEcFQVNn_yrB2P9jP6wEZaWnw79fY.bundle
Expand Down

0 comments on commit 38d15cf

Please sign in to comment.