mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-19 07:09:28 +00:00
More styling impr. and less UI contributions
This commit is contained in:
committed by
Christian Weichel
parent
20db72fec7
commit
97135bd08e
@@ -7,7 +7,7 @@ export class ComponentList extends React.Component<ComponentList.Props> {
|
||||
|
||||
render(): React.ReactNode {
|
||||
return <div>
|
||||
{this.props.items.map((item, idx) => <ComponentListItem key={idx} item={item} windowService={this.props.windowService} install={this.props.install} />)}
|
||||
{this.props.items.map(item => <ComponentListItem key={item.name} item={item} windowService={this.props.windowService} install={this.props.install} />)}
|
||||
</div>;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,26 +39,30 @@ export class FilterableListContainer extends React.Component<FilterableListConta
|
||||
const { items } = result;
|
||||
this.setState({
|
||||
filterText,
|
||||
items: items.sort((a, b) => {
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
} else if (a.name === b.name) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
})
|
||||
items: this.sort(items)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected sort(items: ArduinoComponent[]): ArduinoComponent[] {
|
||||
return items.sort((a, b) => {
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
} else if (a.name === b.name) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected async install(comp: ArduinoComponent): Promise<void> {
|
||||
const dialog = new InstallationProgressDialog(comp.name);
|
||||
dialog.open();
|
||||
try {
|
||||
await this.props.service.install(comp);
|
||||
const { items } = await this.props.service.search({ query: this.state.filterText });
|
||||
this.setState({ items });
|
||||
this.setState({ items: this.sort(items) });
|
||||
} finally {
|
||||
dialog.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user