|
83 | 83 | .filter(value => value > 0)
|
84 | 84 | .reduce((a, c) => a + Number(c), 0);
|
85 | 85 |
|
86 |
| - const bonus = Math.floor(totalPrizePool * 0.05); |
| 86 | + const CL_PERCENT = 5.0; |
| 87 | + |
| 88 | + const percentLink = () => ( |
| 89 | + <a |
| 90 | + href="#" |
| 91 | + > |
| 92 | + {CL_PERCENT.toFixed(1)}% |
| 93 | + </a> |
| 94 | + ); |
| 95 | + |
| 96 | + const bonus = Math.floor(totalPrizePool * ( CL_PERCENT / 100 ) ); |
87 | 97 |
|
88 | 98 | const remaining = totalPrizePool - bonus;
|
89 | 99 |
|
|
92 | 102 | const chopValue = count ? Math.floor(remaining / count) : NaN;
|
93 | 103 |
|
94 | 104 | const chopTotal = count ? (chopValue * count) : NaN;
|
95 |
| - |
| 105 | + |
96 | 106 | return (
|
97 | 107 | <div>
|
98 | 108 |
|
99 | 109 | <button
|
100 |
| - className="btn btn-info mb-2" |
| 110 | + className="btn btn-info mb-3" |
101 | 111 | style={{ width: '10em' }}
|
102 | 112 | onClick={() => insertNewPlace()}
|
103 | 113 | role="button"
|
|
113 | 123 | return ( <div key={index}
|
114 | 124 | className="d-flex align-items-center mb-2"
|
115 | 125 | >
|
116 |
| - |
117 |
| - <input |
118 |
| - type="number" step="10" |
119 |
| - className="form-control mr-2" |
120 |
| - style={{ width: '8.9em' }} |
121 |
| - value={place || ''} |
122 |
| - onChange={({ target: { value } }) => updatePlace(index, value)} |
123 |
| - ref={el => inputRefs.current[index] = el} |
124 |
| - aria-label={LABEL_INPUT(index)} |
125 |
| - title={LABEL_INPUT(index)} |
126 |
| - /> |
127 |
| - |
128 |
| - <button |
129 |
| - // style={{ height: '20px', marginLeft: '10px' }} |
130 |
| - className="btn btn-danger btn-sm" |
131 |
| - onClick={() => removePlace(index)} |
132 |
| - role="button" |
133 |
| - aria-label={LABEL_REMOVE(index)} |
134 |
| - title={LABEL_REMOVE(index)} |
135 |
| - >X</button> |
136 |
| - |
| 126 | + |
| 127 | + <label |
| 128 | + style={{ display: 'flex', alignItems: 'center' }} |
| 129 | + > |
| 130 | + <span |
| 131 | + style={{ minWidth: '2em', textAlign: 'right' }} |
| 132 | + className="mr-1" |
| 133 | + > |
| 134 | + {ordinal(index+1)} |
| 135 | + </span> |
| 136 | + |
| 137 | + <input |
| 138 | + type="number" step="10" |
| 139 | + className="form-control ml-1 mr-2" |
| 140 | + style={{ width: '7.5em' }} |
| 141 | + value={place || ''} |
| 142 | + onChange={({ target: { value } }) => updatePlace(index, value)} |
| 143 | + ref={el => inputRefs.current[index] = el} |
| 144 | + aria-label={LABEL_INPUT(index)} |
| 145 | + title={LABEL_INPUT(index)} |
| 146 | + /> |
| 147 | + |
| 148 | + <button |
| 149 | + // style={{ height: '20px', marginLeft: '10px' }} |
| 150 | + className="btn btn-danger btn-sm" |
| 151 | + onClick={() => removePlace(index)} |
| 152 | + role="button" |
| 153 | + aria-label={LABEL_REMOVE(index)} |
| 154 | + title={LABEL_REMOVE(index)} |
| 155 | + >X</button> |
| 156 | + </label> |
137 | 157 | </div> );
|
138 | 158 |
|
139 | 159 | } )
|
140 | 160 | : <div className="mb-1 text-muted"><small> ~ {zero[0]}<b>{zero[1]}</b>{zero[2]} ~ </small></div>
|
141 | 161 | }
|
142 | 162 |
|
143 | 163 | <button
|
144 |
| - className="btn btn-primary my-1" |
| 164 | + className="btn btn-primary mb-1" |
145 | 165 | style={{ width: '10em' }}
|
146 | 166 | onClick={() => appendNewPlace()}
|
147 | 167 | role="button"
|
|
165 | 185 | }
|
166 | 186 | </div>
|
167 | 187 |
|
168 |
| - {totalPrizePool > 0 && <div>( after first giving 5% to <strong>Chip Leader{bonus > 0 ? `: $${bonus}` : ''}</strong> )</div>} |
| 188 | + {totalPrizePool > 0 && <div>( after first giving {percentLink()} to <strong>Chip Leader{bonus > 0 ? `: $${bonus}` : ''}</strong> )</div>} |
169 | 189 |
|
170 | 190 | </div>
|
171 | 191 | );
|
|
0 commit comments