Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit cf1ac62

Browse files
[Board/Library manager] User should be able to see the total count of search result (#164)
1 parent 56c0d64 commit cf1ac62

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

html/app/components/BoardManager.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ class BoardManager extends React.Component<IBoardManagerProps, IBoardManagerStat
9595
return filterType(element, this.state.category) && filterSearch(element);
9696
});
9797

98+
let totalCountTips = "";
99+
if (this.state.category === "All" && !this.state.searchTerm) {
100+
totalCountTips = `Total ${filteredPlatforms.length} Boards`;
101+
} else {
102+
totalCountTips = `${filteredPlatforms.length} Boards matched`;
103+
}
98104
const boardProps = {
99105
installingBoardName: this.props.installingBoardName,
100106
installErrorMessage: this.props.installErrorMessage,
@@ -128,7 +134,9 @@ class BoardManager extends React.Component<IBoardManagerProps, IBoardManagerStat
128134
})
129135
}
130136
</div>
131-
<div className="arduinomanager-footer"></div>
137+
<div className="arduinomanager-footer theme-bgcolor">
138+
<span>{totalCountTips}</span>
139+
</div>
132140
</div>);
133141
}
134142

html/app/components/LibraryManager.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,21 @@ class LibraryManager extends React.Component<ILibraryManagerProps, ILibraryManag
112112

113113
const SEARCH_KEYS = ["name", "sentence", "paragraph"];
114114
const filterSearch = createFilter(this.state.searchTerm, SEARCH_KEYS);
115+
let totalCount = 0;
115116
this.props.libraries.forEach((element) => {
116117
if (filterType(element, this.state.type) && filterTopic(element, this.state.topic) && filterSearch(element)) {
117118
element.shouldBeDisplayed = true;
119+
totalCount++;
118120
} else {
119121
element.shouldBeDisplayed = false;
120122
}
121123
});
124+
let totalCountTips = "";
125+
if (this.state.type === "All" && this.state.topic === "All" && !this.state.searchTerm) {
126+
totalCountTips = `Total ${totalCount} Libraries`;
127+
} else {
128+
totalCountTips = `${totalCount} Libraries matched`;
129+
}
122130

123131
const libraryItemProps = {
124132
installLibrary: this.props.installLibrary,
@@ -156,7 +164,9 @@ class LibraryManager extends React.Component<ILibraryManagerProps, ILibraryManag
156164
})
157165
}
158166
</div>
159-
<div className="arduinomanager-footer"></div>
167+
<div className="arduinomanager-footer theme-bgcolor">
168+
<span>{ totalCountTips }</span>
169+
</div>
160170
</div>);
161171
}
162172

html/app/styles/board.scss

+10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@
5656

5757
.arduinomanager-container {
5858
padding-top: 60px;
59+
padding-bottom: 40px;
60+
}
61+
62+
.arduinomanager-footer {
63+
height: 40px;
64+
line-height: 40px;
65+
width: 100%;
66+
position: fixed;
67+
bottom: 0;
68+
padding: 0px 10px;
5969
}
6070

6171
a {

0 commit comments

Comments
 (0)