Skip to content

Commit 2008dbe

Browse files
committed
'Select/Deselect all suggestions' checkbox
1 parent d8dcad7 commit 2008dbe

File tree

1 file changed

+32
-0
lines changed
  • src/components/CognateAnalysisModal

1 file changed

+32
-0
lines changed

src/components/CognateAnalysisModal/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,38 @@ class SuggestionSelection extends React.Component {
12381238
</span>
12391239

12401240
<div>
1241+
<div
1242+
key={`sg${index}all`}
1243+
className="lingvo-cognate-checkbox lingvo-cognate-checkbox_result"
1244+
>
1245+
<Checkbox
1246+
className="lingvo-checkbox lingvo-checkbox_labeled"
1247+
label={<label style={{ color: "green", fontStyle: "oblique" }}>{this.context("All")}</label>}
1248+
disabled={disabled_flag}
1249+
checked={
1250+
single_list.every(([perspective_index, [transcription_str, translation_str], entry_id]) => {
1251+
if (sg_entry_map[id2str(entry_id)][index] &&
1252+
!sg_select_list[index].hasOwnProperty(id2str(entry_id))) {
1253+
return false;
1254+
}
1255+
return true;
1256+
})
1257+
}
1258+
onChange={(e, { checked }) => {
1259+
map(single_list,
1260+
([perspective_index, [transcription_str, translation_str], entry_id]) => {
1261+
if (sg_entry_map[id2str(entry_id)][index] && checked) {
1262+
sg_select_list[index][id2str(entry_id)] = null;
1263+
} else {
1264+
delete sg_select_list[index][id2str(entry_id)];
1265+
}
1266+
}
1267+
);
1268+
this.setState({ sg_select_list });
1269+
}}
1270+
/>
1271+
</div>
1272+
12411273
{map(
12421274
single_list,
12431275

0 commit comments

Comments
 (0)