A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/markerikson/project-minimek/commit/cf8e19c699fa80f3f9c7fca57e812f6bb165f240 below:

Show current unit detail values in the Unit TOE tree · markerikson/project-minimek@cf8e19c · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+26

-4

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+26

-4

lines changed Original file line number Diff line number Diff line change

@@ -13,26 +13,48 @@ const mapState = (state) => {

13 13

const session = getEntitiesSession(state);

14 14

const {Unit} = session;

15 15 16 -

let lances;

16 +

let unit, faction, lances;

17 17 18 18

const unitModel = Unit.all().first();

19 19 20 20

if(unitModel) {

21 +

unit = unitModel.ref;

22 +

faction = unitModel.affiliation.ref;

21 23

lances = unitModel.lances.toRefArray().map(lance => lance.id);

22 24

}

23 25 24 -

return {lances};

26 +

return {unit, faction, lances};

25 27

}

26 28 27 -

const UnitOrganizationTree = ({lances = []}) => {

29 +

const UNKNOWN_UNIT = {name : "Unknown"};

30 + 31 + 32 + 33 +

const UnitOrganizationTree = ({unit = UNKNOWN_UNIT, faction = {}, lances = []}) => {

34 +

const {name, color} = unit;

35 +

const {name : factionName} = faction;

36 + 37 +

const colorBlock = <div

38 +

style={{

39 +

marginLeft : 10,

40 +

backgroundColor : color,

41 +

border : "1px solid black",

42 +

height : 20,

43 +

width : 40,

44 +

}}

45 +

/>;

46 + 47 +

const displayText = factionName ? `${name} / ${factionName}` : name;

48 + 49 + 28 50

const lanceEntries = lances.map(lanceID => <Lance key={lanceID} lanceID={lanceID} />);

29 51 30 52

return (

31 53

<List size="large">

32 54

<List.Item>

33 55

<List.Icon name="cubes" />

34 56

<List.Content>

35 -

<List.Header>Black Widow Company</List.Header>

57 +

<List.Header style={{display : "flex"}}>{displayText} {colorBlock}</List.Header>

36 58

<List.List>

37 59

{lanceEntries}

38 60

</List.List>

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4