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/762a8205224e2ff4760e5cb87f6428e704f6c539 below:

Hook up editing of pilot name field · markerikson/project-minimek@762a820 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+39

-26

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+39

-26

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

@@ -11,6 +11,10 @@ import {

11 11

stopEditingPilot,

12 12

} from "../pilotsActions";

13 13 14 +

import {updateEntity} from "features/entities/entityActions";

15 + 16 +

import {getValueFromEvent} from "common/utils/clientUtils";

17 + 14 18 15 19

const RANKS = [

16 20

{value: "Private", text : "Private"},

@@ -61,10 +65,18 @@ const mapState = (state) => {

61 65

const actions = {

62 66

startEditingPilot,

63 67

stopEditingPilot,

68 +

updateEntity,

64 69

}

65 70 66 71 67 72

export class PilotDetails extends Component {

73 +

onNameChanged = (e) => {

74 +

const newValues = getValueFromEvent(e);

75 +

const {id} = this.props.pilot;

76 + 77 +

this.props.updateEntity("Pilot", id, newValues);

78 +

}

79 + 68 80 69 81

render() {

70 82

const {pilot={}, pilotIsSelected = false, isEditingPilot = false, ...actions } = this.props;

@@ -87,31 +99,32 @@ export class PilotDetails extends Component {

87 99

name="name"

88 100

label="Name"

89 101

width={16}

90 -

placeholder="Name"

91 -

value={name}

92 -

disabled={!canStopEditing}

102 +

placeholder="Name"

103 +

value={name}

104 +

disabled={!canStopEditing}

105 +

onChange={this.onNameChanged}

93 106

control="input"

94 -

/>

107 +

/>

95 108

<Form.Field

96 109

name="rank"

97 110

label="Rank"

98 111

width={16}

99 112

control={Dropdown}

100 -

fluid

101 -

selection

102 -

options={RANKS}

103 -

value={rank}

104 -

disabled={!canStopEditing}

105 -

/>

113 +

fluid

114 +

selection

115 +

options={RANKS}

116 +

value={rank}

117 +

disabled={!canStopEditing}

118 +

/>

106 119

<Form.Field

107 120

name="age"

108 121

width={6}

109 122

label="Age"

110 -

placeholder="Age"

123 +

placeholder="Age"

111 124

control="input"

112 -

value={age}

113 -

disabled={!canStopEditing}

114 -

/>

125 +

value={age}

126 +

disabled={!canStopEditing}

127 +

/>

115 128

<Form.Field

116 129

name="gunnery"

117 130

label="Gunnery"

@@ -120,9 +133,9 @@ export class PilotDetails extends Component {

120 133

fluid

121 134

selection

122 135

options={SKILL_VALUES}

123 -

value={gunnery}

124 -

disabled={!canStopEditing}

125 -

/>

136 +

value={gunnery}

137 +

disabled={!canStopEditing}

138 +

/>

126 139

<Form.Field

127 140

name="piloting"

128 141

label="Piloting"

@@ -131,20 +144,20 @@ export class PilotDetails extends Component {

131 144

fluid

132 145

selection

133 146

options={SKILL_VALUES}

134 -

value={piloting}

135 -

disabled={!canStopEditing}

136 -

/>

147 +

value={piloting}

148 +

disabled={!canStopEditing}

149 +

/>

137 150

<Form.Field

138 151

name="mech"

139 152

label="Mech"

140 153

width={16}

141 154

control={Dropdown}

142 -

fluid

143 -

selection

144 -

options={MECHS}

145 -

value={mechType}

146 -

disabled={true}

147 -

/>

155 +

fluid

156 +

selection

157 +

options={MECHS}

158 +

value={mechType}

159 +

disabled={true}

160 +

/>

148 161

<Grid.Row width={16}>

149 162

<Button

150 163

primary

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