Skip to content

Commit

Permalink
update icon font
Browse files Browse the repository at this point in the history
Former-commit-id: 11e8a6c
  • Loading branch information
rdonnelly committed Aug 5, 2019
1 parent 18f63b8 commit d6419f6
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 49 deletions.
Binary file added android/app/src/main/assets/fonts/swdsets.ttf
Binary file not shown.
Binary file not shown.
Binary file added assets/fonts/swdsets.ttf
Binary file not shown.
Binary file added assets/fonts/swdtypes.ttf
Binary file not shown.
13 changes: 8 additions & 5 deletions ios/SWDTeamBuilder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
Expand Down Expand Up @@ -43,7 +42,6 @@
4A113DF591BB4015A1BF5766 /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 4940F582768D4D17BF6BF6E9 /* Feather.ttf */; };
502CA8C4D50C4D04824E306B /* FontAwesome5_Solid.ttf in Resources */ = {isa = PBXBuildFile; fileRef = BDD1DE93C76D4BEE9F9B4838 /* FontAwesome5_Solid.ttf */; };
5995DC31CFCC45DEA7BCD404 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B990605657204DCEAD554E75 /* MaterialCommunityIcons.ttf */; };
61167BA0CAD94F59860FA040 /* swdestiny.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B495006B2CD64C3D8FAB2582 /* swdestiny.ttf */; };
73D317DF009D4021A8F3FEEE /* libSQLite.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 56924528E6C44F13BED5F41F /* libSQLite.a */; };
7ED82649792B4618B09FDB91 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6AC17F32CE2440389632E981 /* FontAwesome.ttf */; };
825460D9190542D488A50A3B /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B5EF6FF5588A4A1AAC23B829 /* MaterialIcons.ttf */; };
Expand All @@ -67,6 +65,8 @@
ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; };
EEDCABF530544260B8E861B1 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9ACC5CCB25924D0C83364CEB /* EvilIcons.ttf */; };
EF1A3691F14D4A469328CDF3 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B0C92F752AF64E70BFCBF7DC /* libz.tbd */; };
95EFC41F79654AD68877D0D4 /* swdsets.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FB5001421EE34C1D90201E87 /* swdsets.ttf */; };
62F72A5550BB4C73A650B8C3 /* swdtypes.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 76BD201DE7FE486F90048B86 /* swdtypes.ttf */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -473,7 +473,6 @@
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
B0C92F752AF64E70BFCBF7DC /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
B38EA7BC7EB64A509ADBB3CB /* RNGestureHandler.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNGestureHandler.xcodeproj; path = "../node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj"; sourceTree = "<group>"; };
B495006B2CD64C3D8FAB2582 /* swdestiny.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = swdestiny.ttf; path = ../assets/fonts/swdestiny.ttf; sourceTree = "<group>"; };
B5EF6FF5588A4A1AAC23B829 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
B990605657204DCEAD554E75 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = "<group>"; };
BDD1DE93C76D4BEE9F9B4838 /* FontAwesome5_Solid.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Solid.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf"; sourceTree = "<group>"; };
Expand All @@ -488,6 +487,8 @@
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
FC6637A73EE34F4AA7ADB4B3 /* RNCSlider.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNCSlider.xcodeproj; path = "../node_modules/@react-native-community/slider/ios/RNCSlider.xcodeproj"; sourceTree = "<group>"; };
FFEF90D920D547649BB2E618 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
FB5001421EE34C1D90201E87 /* swdsets.ttf */ = {isa = PBXFileReference; name = "swdsets.ttf"; path = "../assets/fonts/swdsets.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
76BD201DE7FE486F90048B86 /* swdtypes.ttf */ = {isa = PBXFileReference; name = "swdtypes.ttf"; path = "../assets/fonts/swdtypes.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -687,12 +688,13 @@
FFEF90D920D547649BB2E618 /* Octicons.ttf */,
40F5955432794195ACDFC328 /* SimpleLineIcons.ttf */,
7B41E8F1E602438F8CD5C0D8 /* Zocial.ttf */,
B495006B2CD64C3D8FAB2582 /* swdestiny.ttf */,
4940F582768D4D17BF6BF6E9 /* Feather.ttf */,
C2A8A2199B4D49DBBA4AFF07 /* AntDesign.ttf */,
575A8C98B4B5436387672CAE /* FontAwesome5_Brands.ttf */,
9884002FA4C549A1876F2EF6 /* FontAwesome5_Regular.ttf */,
BDD1DE93C76D4BEE9F9B4838 /* FontAwesome5_Solid.ttf */,
FB5001421EE34C1D90201E87 /* swdsets.ttf */,
76BD201DE7FE486F90048B86 /* swdtypes.ttf */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -1453,13 +1455,14 @@
863E0B3024C944649FC2CAF4 /* Octicons.ttf in Resources */,
C128ED34F9D543E8AD171F5B /* SimpleLineIcons.ttf in Resources */,
2E6B8CF290604F6DA77785E3 /* Zocial.ttf in Resources */,
61167BA0CAD94F59860FA040 /* swdestiny.ttf in Resources */,
4A113DF591BB4015A1BF5766 /* Feather.ttf in Resources */,
EC2B6ECCCB9D4EC29CA288F3 /* AntDesign.ttf in Resources */,
2AF66EF771894329AB46AB4A /* FontAwesome5_Brands.ttf in Resources */,
B7333971368A48F48F6205FB /* FontAwesome5_Regular.ttf in Resources */,
502CA8C4D50C4D04824E306B /* FontAwesome5_Solid.ttf in Resources */,
954876662237594A006C3DDE /* www in Resources */,
95EFC41F79654AD68877D0D4 /* swdsets.ttf in Resources */,
62F72A5550BB4C73A650B8C3 /* swdtypes.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 2 additions & 0 deletions ios/SWDTeamBuilder/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>swdsets.ttf</string>
<string>swdtypes.ttf</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
Expand Down
Binary file added ios/SWDTeamBuilder/www/swd-teams.db
Binary file not shown.
1 change: 0 additions & 1 deletion ios/SWDTeamBuilder/www/swd-teams.db.REMOVED.git-id

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/CharacterListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Swipeable from 'react-native-swipeable';
import { withNavigation } from 'react-navigation';

import CharacterAvatar from './CharacterAvatar';
import { validateCode } from '../lib/SWDIconCodes';
import { validateSetCode } from '../lib/SWDIconCodes';
import SWDIcon from './SWDIcon';

import { base as baseStyles, colors } from '../styles';
Expand Down Expand Up @@ -161,7 +161,7 @@ class CharacterListItem extends Component {
rowStyles.push(styles.excludedRow);
}

const setIcon = validateCode(card.set) ? (
const setIcon = validateSetCode(card.set) ? (
<SWDIcon type={ card.set } style={ cardInfoLogoStyle } />
) : null;

Expand Down
23 changes: 20 additions & 3 deletions src/components/SWDIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { StyleSheet, Text } from 'react-native';
import PropTypes from 'prop-types';
import _get from 'lodash/get';

import { iconCodes as swdIconCodes } from '../lib/SWDIconCodes';
import {
setCodes as setIconCodes,
typeCodes as typeIconCodes,
validateSetCode,
validateTypeCode,
} from '../lib/SWDIconCodes';

const styles = StyleSheet.create({
text: {
Expand All @@ -17,15 +22,27 @@ class SWDIcon extends PureComponent {
type, style, addSpace,
} = this.props;

const code = _get(swdIconCodes, type.toUpperCase());
const fontStyle = {};

const testType = type.toUpperCase();
let code = null;
if (validateSetCode(testType)) {
code = _get(setIconCodes, type.toUpperCase());
fontStyle.fontFamily = 'swdsets';
}
if (validateTypeCode(testType)) {
code = _get(typeIconCodes, type.toUpperCase());
fontStyle.fontFamily = 'swdtypes';
}

if (!code) {
return null;
}

const codeString = String.fromCharCode(parseInt(code, 16));

return (
<Text style={[style, styles.text]}>
<Text style={[style, styles.text, fontStyle]}>
{ codeString }
{ addSpace ? ' ' : '' }
</Text>
Expand Down
80 changes: 45 additions & 35 deletions src/lib/SWDIconCodes.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,49 @@
import _has from 'lodash/has';

export const iconCodes = {
RESOURCE: 'e900',
SPECIAL: 'e901',
BLANK: 'e902',
DISCARD: 'e903',
DISRUPT: 'e904',
FOCUS: 'e905',
INDIRECT: 'e911',
MELEE: 'e906',
RANGED: 'e907',
SHIELD: 'e908',
export const setCodes = {
BLANK: '004A',
DISCARD: '0047',
DISRUPT: '0046',
FOCUS: '0048',
INDIRECT: '0043',
MELEE: '0041',
RANGED: '0042',
RESOURCE: '0045',
SHIELD: '0044',
SPECIAL: '0049',
UNIQUE: '000C',

AW: '004B',
AWAKENINGS: '004B',
SoR: '004C',
SOR: '004C',
SPIRIT_OF_REBELLION: '004C',
TPG: '004E',
TWO_PLAYER_GAME: '004E',
EaW: '004D',
EAW: '004D',
EMPIRE_AT_WAR: '004D',
LEG: '004F',
LEGACIES: '004F',
RIV: '0050',
RIVALS: '0050',
WotF: '0051',
WOTF: '0051',
WAY_OF_THE_FORCE: '0051',
AtG: '0052',
ATG: '0052',
ACROSS_THE_GALAXY: '0052',
CONV: '0053',
CONVERGENCE: '0053',
AoN: '0054',
AON: '0054',
ALLIES_OF_NECESSITY: '0054',
SoH: '006B',
SOH: '006B',
SPARK_OF_HOPE: '006B',
};

export const typeCodes = {
BATTLEFIELD: 'e947',
CARDS: 'e90b',
CHARACTER: 'e971',
Expand All @@ -23,29 +55,7 @@ export const iconCodes = {
SUPPORT: 'e9b4',
UNIQUE: 'e909',
UPGRADE: 'e916',

AW: 'e90d',
AWAKENINGS: 'e90d',
SoR: 'e90e',
SOR: 'e90e',
SPIRIT_OF_REBELLION: 'e90e',
TPG: 'e910',
TWO_PLAYER_GAME: 'e910',
EaW: 'e90f',
EAW: 'e90f',
EMPIRE_AT_WAR: 'e90f',
LEG: 'e913',
LEGACIES: 'e913',
RIV: 'e914',
RIVALS: 'e914',
WotF: 'e915',
WOTF: 'e915',
WAY_OF_THE_FORCE: 'e915',
AtG: 'e917',
ATG: 'e917',
ACROSS_THE_GALAXY: 'e917',
CONV: 'e918',
CONVERGENCE: 'e918',
};

export const validateCode = code => _has(iconCodes, code);
export const validateSetCode = (code) => _has(setCodes, code);
export const validateTypeCode = (code) => _has(typeCodes, code);
4 changes: 2 additions & 2 deletions src/screens/Characters/CharacterDetailScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from 'react-native';
import { connect } from 'react-redux';

import { validateCode } from '../../lib/SWDIconCodes';
import { validateSetCode } from '../../lib/SWDIconCodes';
import SWDIcon from '../../components/SWDIcon';

import {
Expand Down Expand Up @@ -141,7 +141,7 @@ class CharacterDetailScreen extends Component {
const characterIsIncompatible = characterObject !== undefined && characterObject.isIncompatible;
const characterIsExcluded = characterObject !== undefined && characterObject.isExcluded;

const setIcon = validateCode(card.set) ? (
const setIcon = validateSetCode(card.set) ? (
<SWDIcon type={ card.set } style={ styles.buttonTextIcon } />
) : null;

Expand Down
Binary file added swd-teams.db
Binary file not shown.
1 change: 0 additions & 1 deletion swd-teams.db.REMOVED.git-id

This file was deleted.

0 comments on commit d6419f6

Please sign in to comment.